Mercurial > hg > orthanc
comparison Core/Compression/ZlibCompressor.cpp @ 3378:596cfabd72c5
Fixed a couple of truncation warnings
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 17 May 2019 08:36:18 +0200 |
parents | 4e43e67f8ecf |
children | 94f4a18a79cc |
comparison
equal
deleted
inserted
replaced
3377:05881bf99c83 | 3378:596cfabd72c5 |
---|---|
51 { | 51 { |
52 compressed.clear(); | 52 compressed.clear(); |
53 return; | 53 return; |
54 } | 54 } |
55 | 55 |
56 uLongf compressedSize = compressBound(uncompressedSize) + 1024 /* security margin */; | 56 uLongf compressedSize = compressBound(static_cast<uLong>(uncompressedSize)) |
57 + 1024 /* security margin */; | |
57 if (compressedSize == 0) | 58 if (compressedSize == 0) |
58 { | 59 { |
59 compressedSize = 1; | 60 compressedSize = 1; |
60 } | 61 } |
61 | 62 |
72 } | 73 } |
73 | 74 |
74 int error = compress2(target, | 75 int error = compress2(target, |
75 &compressedSize, | 76 &compressedSize, |
76 const_cast<Bytef *>(static_cast<const Bytef *>(uncompressed)), | 77 const_cast<Bytef *>(static_cast<const Bytef *>(uncompressed)), |
77 uncompressedSize, | 78 static_cast<uLong>(uncompressedSize), |
78 GetCompressionLevel()); | 79 GetCompressionLevel()); |
79 | 80 |
80 if (error != Z_OK) | 81 if (error != Z_OK) |
81 { | 82 { |
82 compressed.clear(); | 83 compressed.clear(); |
135 uLongf tmp = static_cast<uLongf>(uncompressedSize); | 136 uLongf tmp = static_cast<uLongf>(uncompressedSize); |
136 int error = uncompress | 137 int error = uncompress |
137 (reinterpret_cast<uint8_t*>(&uncompressed[0]), | 138 (reinterpret_cast<uint8_t*>(&uncompressed[0]), |
138 &tmp, | 139 &tmp, |
139 reinterpret_cast<const uint8_t*>(compressed) + sizeof(uint64_t), | 140 reinterpret_cast<const uint8_t*>(compressed) + sizeof(uint64_t), |
140 compressedSize - sizeof(uint64_t)); | 141 static_cast<uLong>(compressedSize - sizeof(uint64_t))); |
141 | 142 |
142 if (error != Z_OK) | 143 if (error != Z_OK) |
143 { | 144 { |
144 uncompressed.clear(); | 145 uncompressed.clear(); |
145 | 146 |