Minor Update:
- DeviceCore: - Initialise params in header file - JSONparseCore: - Increase Read buffer to handle large queries - UtilCore: - Bug fix: handle NULL seperator in Hex conversions
This commit is contained in:
@@ -75,7 +75,7 @@ char * BytesToHexStr( const char * Bytes, const int Len, const char * Separator,
|
||||
|
||||
// Print Hex values of individual bytes
|
||||
for (int i=0; i<Len; i++) {
|
||||
sprintf( BufPos, "%s%02X", ((First)? "" : Separator), (unsigned char)Bytes[i] );
|
||||
sprintf( BufPos, "%s%02X", ((First || !Separator)? "" : Separator), (unsigned char)Bytes[i] );
|
||||
BufPos += (First)? 2 : 2+SepLen;
|
||||
First = false;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ char * BytesToBinStr( const char * Bytes, const int Len, const char * Separator,
|
||||
|
||||
// Print each byte as 8-bit binary
|
||||
for (int i=0; i<Len; i++) {
|
||||
sprintf( BufPos, "%s%c%c%c%c%c%c%c%c", ((First)? "" : Separator),
|
||||
sprintf( BufPos, "%s%c%c%c%c%c%c%c%c", ((First || !Separator)? "" : Separator),
|
||||
(Bytes[i] & 0x80)?'1':'0', (Bytes[i] & 0x40)?'1':'0', (Bytes[i] & 0x20)?'1':'0', (Bytes[i] & 0x10)?'1':'0',
|
||||
(Bytes[i] & 0x08)?'1':'0', (Bytes[i] & 0x04)?'1':'0', (Bytes[i] & 0x02)?'1':'0', (Bytes[i] & 0x01)?'1':'0' );
|
||||
BufPos += (First)? 8 : 8+SepLen;
|
||||
|
||||
Reference in New Issue
Block a user