Removing the casts which were regrettably added with SVN: 2525.

This commit is contained in:
Robin Mills
2011-06-29 01:02:04 +00:00
parent b960062f90
commit ebfb513a21
9 changed files with 13 additions and 27 deletions
+1 -1
View File
@@ -506,7 +506,7 @@ namespace Exiv2 {
uint16_t sizeOfSize = 4 | 0x8000;
us2Data(pWrite, sizeOfSize, bigEndian);
pWrite += 2;
ul2Data(pWrite, (uint32_t) dataSize, bigEndian);
ul2Data(pWrite, dataSize, bigEndian);
pWrite += 4;
}
else {
+3 -3
View File
@@ -488,7 +488,7 @@ namespace Exiv2
memcpy(rawExif.pData_ + sizeof(ExifHeader), &blob[0], blob.size());
DataBuf boxData(8 + 16 + rawExif.size_);
ul2Data(boxDataSize, (uint32_t) boxData.size_, Exiv2::bigEndian);
ul2Data(boxDataSize, boxData.size_, Exiv2::bigEndian);
ul2Data(boxUUIDtype, kJp2BoxTypeUuid, Exiv2::bigEndian);
memcpy(boxData.pData_, boxDataSize, 4);
memcpy(boxData.pData_ + 4, boxUUIDtype, 4);
@@ -511,7 +511,7 @@ namespace Exiv2
if (rawIptc.size_ > 0)
{
DataBuf boxData(8 + 16 + rawIptc.size_);
ul2Data(boxDataSize, (uint32_t) boxData.size_, Exiv2::bigEndian);
ul2Data(boxDataSize, boxData.size_, Exiv2::bigEndian);
ul2Data(boxUUIDtype, kJp2BoxTypeUuid, Exiv2::bigEndian);
memcpy(boxData.pData_, boxDataSize, 4);
memcpy(boxData.pData_ + 4, boxUUIDtype, 4);
@@ -541,7 +541,7 @@ namespace Exiv2
DataBuf xmp(reinterpret_cast<const byte*>(xmpPacket_.data()), static_cast<long>(xmpPacket_.size()));
DataBuf boxData(8 + 16 + xmp.size_);
ul2Data(boxDataSize, (uint32_t)boxData.size_, Exiv2::bigEndian);
ul2Data(boxDataSize, boxData.size_, Exiv2::bigEndian);
ul2Data(boxUUIDtype, kJp2BoxTypeUuid, Exiv2::bigEndian);
memcpy(boxData.pData_, boxDataSize, 4);
memcpy(boxData.pData_ + 4, boxUUIDtype, 4);
+1 -1
View File
@@ -230,7 +230,7 @@ namespace Exiv2 {
us2Data(tmpBuf + 4, iptc_, bigEndian);
tmpBuf[6] = 0;
tmpBuf[7] = 0;
ul2Data(tmpBuf + 8, (uint32_t)rawIptc.size_, bigEndian);
ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian);
append(psBlob, tmpBuf, 12);
append(psBlob, rawIptc.pData_, rawIptc.size_);
// Data is padded to be even (but not included in size)
+1 -1
View File
@@ -281,7 +281,7 @@ namespace Exiv2 {
break;
}
us2Data(buf.pData_ + 2, sig_, byteOrder());
ul2Data(buf.pData_ + 4, (uint32_t) 0x00000008, byteOrder());
ul2Data(buf.pData_ + 4, 0x00000008, byteOrder());
return buf;
}
+2 -2
View File
@@ -541,7 +541,7 @@ namespace Exiv2 {
uLong tmp = crc32(0L, Z_NULL, 0);
tmp = crc32(tmp, (const Bytef*)crcData.data(), static_cast<uInt>(crcData.size()));
byte crc[4];
ul2Data(crc, (uint32_t) tmp, bigEndian);
ul2Data(crc, tmp, bigEndian);
// Assemble the chunk
return std::string((const char*)length, 4) + chunkType + chunkData + std::string((const char*)crc, 4);
@@ -578,7 +578,7 @@ namespace Exiv2 {
uLong tmp = crc32(0L, Z_NULL, 0);
tmp = crc32(tmp, (const Bytef*)crcData.data(), static_cast<uInt>(crcData.size()));
byte crc[4];
ul2Data(crc, (uint32_t)tmp, bigEndian);
ul2Data(crc, tmp, bigEndian);
// Assemble the chunk
return std::string((const char*)length, 4) + chunkType + chunkData + std::string((const char*)crc, 4);
+1 -1
View File
@@ -582,7 +582,7 @@ namespace Exiv2 {
if (out.write(buf, 2) != 2) throw Error(21);
us2Data(buf, 0, bigEndian); // NULL resource name
if (out.write(buf, 2) != 2) throw Error(21);
ul2Data(buf, (uint32_t)rawIptc.size_, bigEndian);
ul2Data(buf, rawIptc.size_, bigEndian);
if (out.write(buf, 4) != 4) throw Error(21);
// Write encoded Iptc data
if (out.write(rawIptc.pData_, rawIptc.size_) != rawIptc.size_) throw Error(21);
+1 -1
View File
@@ -1973,7 +1973,7 @@ namespace Exiv2 {
break;
}
us2Data(buf.pData_ + 2, tag_, byteOrder_);
ul2Data(buf.pData_ + 4, (uint32_t)0x00000008, byteOrder_);
ul2Data(buf.pData_ + 4, 0x00000008, byteOrder_);
return buf;
}
+2 -9
View File
@@ -330,8 +330,9 @@ namespace Exiv2 {
return 2;
}
long ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder)
long ul2Data(byte* buf, size_t s, ByteOrder byteOrder)
{
uint32_t l = (uint32_t) s; // downcast for 64 bit architecture
if (byteOrder == littleEndian) {
buf[0] = (byte) (l & 0x000000ff);
buf[1] = (byte)((l & 0x0000ff00) >> 8);
@@ -347,14 +348,6 @@ namespace Exiv2 {
return 4;
}
#ifdef _WIN64
long ul2Data(byte* buf, size_t s, ByteOrder byteOrder)
{
uint32_t l = (uint32_t) s;
return ul2Data(buf,l,byteOrder);
}
#endif
long ur2Data(byte* buf, URational l, ByteOrder byteOrder)
{
long o = ul2Data(buf, l.first, byteOrder);
+1 -8
View File
@@ -293,14 +293,7 @@ namespace Exiv2 {
@brief Convert an unsigned long to data, write the data to the buffer,
return number of bytes written.
*/
EXIV2API long ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder);
#ifdef _WIN64
/*!
@brief Convert an unsigned long to data, write the data to the buffer,
return number of bytes written.
*/
EXIV2API long ul2Data(byte* buf, size_t l, ByteOrder byteOrder);
#endif
EXIV2API long ul2Data(byte* buf, size_t s, ByteOrder byteOrder);
/*!
@brief Convert an unsigned rational to data, write the data to the buffer,
return number of bytes written.