bug 603592 - Swap endianness on GUIDs when de-stringifying them. r=mwu, a=blocking-fennec

--HG--
extra : rebase_source : fef5970b706e352cf442526f3a419a76696b5413
This commit is contained in:
Ted Mielczarek 2010-10-22 14:38:58 -04:00
parent a71c6c9372
commit 7d484d4837

View File

@ -264,6 +264,13 @@ void FileIDToGUID(const char* file_id, u_int8_t guid[sizeof(MDGUID)])
guid[i] = (u_int8_t)(c & 0xFF);
file_id += 2;
}
// GUIDs are stored in network byte order.
uint32_t* data1 = reinterpret_cast<uint32_t*>(guid);
*data1 = htonl(*data1);
uint16_t* data2 = reinterpret_cast<uint16_t*>(guid + 4);
*data2 = htons(*data2);
uint16_t* data3 = reinterpret_cast<uint16_t*>(guid + 6);
*data3 = htons(*data3);
}
#endif