comparison OrthancFramework/Sources/Compression/ZipReader.cpp @ 4360:4301722b3225

fix for msvc2015
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Dec 2020 18:07:12 +0100
parents 074f37013186
children 88be8b67b2d7
comparison
equal deleted inserted replaced
4359:074f37013186 4360:4301722b3225
34 #if ORTHANC_SANDBOXED != 1 34 #if ORTHANC_SANDBOXED != 1
35 # include "../SystemToolbox.h" 35 # include "../SystemToolbox.h"
36 #endif 36 #endif
37 37
38 #if defined(_MSC_VER) 38 #if defined(_MSC_VER)
39 # include <BaseTsd.h> // Definition of ssize_t 39 # include <BaseTsd.h> // Definition of SSIZE_T
40 typedef SSIZE_T ssize_t;
40 #endif 41 #endif
41 42
42 #include <string.h> 43 #include <string.h>
43 44
44 45
89 { 90 {
90 memcpy(target, content_ + pos_, s); 91 memcpy(target, content_ + pos_, s);
91 } 92 }
92 93
93 pos_ += s; 94 pos_ += s;
94 return s; 95 return static_cast<uLong>(s);
95 } 96 }
96 } 97 }
97 98
98 ZPOS64_T Tell() const 99 ZPOS64_T Tell() const
99 { 100 {
316 throw OrthancException(ErrorCode_BadFileFormat); 317 throw OrthancException(ErrorCode_BadFileFormat);
317 } 318 }
318 319
319 filename.resize(info.size_filename); 320 filename.resize(info.size_filename);
320 if (!filename.empty() && 321 if (!filename.empty() &&
321 unzGetCurrentFileInfo64(pimpl_->unzip_, &info, &filename[0], filename.size(), NULL, 0, NULL, 0) != 0) 322 unzGetCurrentFileInfo64(pimpl_->unzip_, &info, &filename[0],
323 static_cast<uLong>(filename.size()), NULL, 0, NULL, 0) != 0)
322 { 324 {
323 throw OrthancException(ErrorCode_BadFileFormat); 325 throw OrthancException(ErrorCode_BadFileFormat);
324 } 326 }
325 327
326 content.resize(info.uncompressed_size); 328 content.resize(info.uncompressed_size);
327 329
328 if (!content.empty()) 330 if (!content.empty())
329 { 331 {
330 if (unzOpenCurrentFile(pimpl_->unzip_) == 0) 332 if (unzOpenCurrentFile(pimpl_->unzip_) == 0)
331 { 333 {
332 bool success = (unzReadCurrentFile(pimpl_->unzip_, &content[0], content.size()) != 0); 334 bool success = (unzReadCurrentFile(pimpl_->unzip_, &content[0],
335 static_cast<uLong>(content.size())) != 0);
333 336
334 if (unzCloseCurrentFile(pimpl_->unzip_) != 0 || 337 if (unzCloseCurrentFile(pimpl_->unzip_) != 0 ||
335 !success) 338 !success)
336 { 339 {
337 throw OrthancException(ErrorCode_BadFileFormat); 340 throw OrthancException(ErrorCode_BadFileFormat);