mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
The icsneolegacy API finds devices correctly now
This commit is contained in:
@@ -55,13 +55,13 @@ void icsneo_freeUnconnectedDevices() {
|
||||
|
||||
bool icsneo_serialNumToString(uint32_t num, char* str, size_t* count) {
|
||||
auto result = Device::SerialNumToString(num);
|
||||
if(*count <= result.length()) {
|
||||
if(*count < result.length()) {
|
||||
*count = result.length() + 1; // This is how big of a buffer we need
|
||||
return false;
|
||||
}
|
||||
strncpy(str, result.c_str(), *count);
|
||||
str[*count - 1] = '\0';
|
||||
*count = result.length();
|
||||
|
||||
*count = result.copy(str, *count);
|
||||
str[*count] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -208,6 +208,6 @@ bool icsneo_getProductName(const neodevice_t* device, char* str, size_t* maxLeng
|
||||
return false;
|
||||
|
||||
*maxLength = device->device->getType().toString().copy(str, *maxLength);
|
||||
str[*maxLength + 1] = '\0';
|
||||
str[*maxLength] = '\0';
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user