const correctness fix

This commit is contained in:
Guenter Obiltschnig 2016-04-23 09:20:37 +02:00
parent 1df5f56449
commit c351f65957

View File

@ -78,10 +78,10 @@ public:
const std::string& getFileComment() const; const std::string& getFileComment() const;
void getVersionMadeBy(int& major, int& minor); void getVersionMadeBy(int& major, int& minor) const;
/// The ZIP version used to create the file /// The ZIP version used to create the file
void getRequiredVersion(int& major, int& minor); void getRequiredVersion(int& major, int& minor) const;
/// The minimum version required to extract the data /// The minimum version required to extract the data
ZipCommon::HostSystem getHostSystem() const; ZipCommon::HostSystem getHostSystem() const;
@ -319,14 +319,14 @@ inline Poco::UInt16 ZipFileInfo::getFileCommentLength() const
} }
inline void ZipFileInfo::getVersionMadeBy(int& major, int& minor) inline void ZipFileInfo::getVersionMadeBy(int& major, int& minor) const
{ {
major = (_rawInfo[VERSIONMADEBY_POS]/10); major = (_rawInfo[VERSIONMADEBY_POS]/10);
minor = (_rawInfo[VERSIONMADEBY_POS]%10); minor = (_rawInfo[VERSIONMADEBY_POS]%10);
} }
inline void ZipFileInfo::getRequiredVersion(int& major, int& minor) inline void ZipFileInfo::getRequiredVersion(int& major, int& minor) const
{ {
major = (_rawInfo[VERSION_NEEDED_POS]/10); major = (_rawInfo[VERSION_NEEDED_POS]/10);
minor = (_rawInfo[VERSION_NEEDED_POS]%10); minor = (_rawInfo[VERSION_NEEDED_POS]%10);
@ -423,7 +423,7 @@ inline void ZipFileInfo::setRequiredVersion(int major, int minor)
{ {
poco_assert (minor < 10); poco_assert (minor < 10);
poco_assert (major < 24); poco_assert (major < 24);
Poco::UInt8 val = static_cast<unsigned char>(major)*10+static_cast<unsigned char>(minor); Poco::UInt8 val = static_cast<Poco::UInt8>(major)*10 + static_cast<Poco::UInt8>(minor);
_rawInfo[VERSIONMADEBY_POS] = static_cast<char>(val); _rawInfo[VERSIONMADEBY_POS] = static_cast<char>(val);
_rawInfo[VERSION_NEEDED_POS] = static_cast<char>(val); _rawInfo[VERSION_NEEDED_POS] = static_cast<char>(val);
} }