- fixed bug with unsigned32 on big endian systems

This commit is contained in:
Michael Zillgith 2015-05-20 16:58:54 +02:00
parent 37913842fd
commit 7c540f77c4
2 changed files with 12 additions and 5 deletions

View file

@ -1486,7 +1486,7 @@ IedConnection_getDataDirectoryFC(IedConnection self, IedClientError* error, cons
* \brief returns the directory of the given data object/data attribute with the given FC
*
* Implementation of the GetDataDirectory ACSI service. This will return the list of
* C strings with all data attributes or sub data objects as elements that have the given FX. The returned
* C strings with all data attributes or sub data objects as elements. The returned
* strings will contain the functional constraint appended in square brackets when appropriate.
*
* \param self the connection object

View file

@ -125,13 +125,20 @@ BerInteger_setUint32(Asn1PrimitiveValue* self, uint32_t value)
uint8_t* valueBuffer = (uint8_t*) &valueCopy;
uint8_t byteBuffer[5];
byteBuffer[4] = 0;
int i;
for (i = 0; i < 4; i++) {
#if (ORDER_LITTLE_ENDIAN == 1)
byteBuffer[4] = 0;
for (i = 0; i < 4; i++)
byteBuffer[i] = valueBuffer[i];
}
#else
bytebuffer[0] = 0;
for (i = 0; i < 4; i++)
byteBuffer[i + 1] = valueBuffer[i];
#endif /* (ORDER_LITTLE_ENDIAN == 1) */
return setIntegerValue(self, byteBuffer, 5);
}