[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:47:28 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=67859f4
The following commit has been merged in the master branch:
commit 67859f4f4ec48301a407410952068333a778fba3
Author: Robin Mills <robin at clanmills.com>
Date: Wed Apr 19 17:03:54 2017 +0000
#1175 I'm going to accept the recommendation to change BasicIo::size() to return size_t. This passes the test suite. The only "ripple" outside of basicio is to iotest.cpp. This change enables several casts to be removed.
---
include/exiv2/basicio.hpp | 8 ++++----
samples/iotest.cpp | 28 ++++++++++++++--------------
src/basicio.cpp | 28 ++++++++++++++--------------
3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp
index beb491c..95713bf 100644
--- a/include/exiv2/basicio.hpp
+++ b/include/exiv2/basicio.hpp
@@ -222,7 +222,7 @@ namespace Exiv2 {
@return Size of the IO source in bytes;<BR>
-1 if failure;
*/
- virtual long size() const = 0;
+ virtual size_t size() const = 0;
//!Returns true if the IO source is open, otherwise false.
virtual bool isopen() const = 0;
//!Returns 0 if the IO source is in a valid state, otherwise nonzero.
@@ -497,7 +497,7 @@ namespace Exiv2 {
@return Size of the file in bytes;<BR>
-1 if failure;
*/
- virtual long size() const;
+ virtual size_t size() const;
//! Returns true if the file is open, otherwise false.
virtual bool isopen() const;
//! Returns 0 if the file is in a valid state, otherwise nonzero.
@@ -696,7 +696,7 @@ namespace Exiv2 {
@return Size of the in memory data in bytes;<BR>
-1 if failure;
*/
- virtual long size() const;
+ virtual size_t size() const;
//!Always returns true
virtual bool isopen() const;
//!Always returns 0
@@ -1034,7 +1034,7 @@ namespace Exiv2 {
@return Size of the in memory data in bytes;<BR>
-1 if failure;
*/
- virtual long size() const;
+ virtual size_t size() const;
//!Returns true if the memory area is allocated.
virtual bool isopen() const;
//!Always returns 0
diff --git a/samples/iotest.cpp b/samples/iotest.cpp
index 4dd6fec..66aa5d4 100644
--- a/samples/iotest.cpp
+++ b/samples/iotest.cpp
@@ -131,28 +131,28 @@ catch (Exiv2::AnyError& e) {
int WriteReadSeek(BasicIo &io)
{
byte buf[4096];
- const char tester1[] = "this is a little test of MemIo";
- const char tester2[] = "Appending this on the end";
- const char expect[] = "this is a little teAppending this on the end";
- const long insert = 19;
- const long len1 = (long)std::strlen(tester1) + 1;
- const long len2 = (long)std::strlen(tester2) + 1;
+ const char tester1[] = "this is a little test of MemIo";
+ const char tester2[] = "Appending this on the end";
+ const char expect[] = "this is a little teAppending this on the end";
+ const size_t insert = 19;
+ const size_t size1 = std::strlen(tester1) + 1;
+ const size_t size2 = std::strlen(tester2) + 1;
if (io.open() != 0) {
throw Error(9, io.path(), strError());
}
IoCloser closer(io);
- if (io.write((byte*)tester1, len1) != len1) {
+ if (io.write((byte*)tester1, size1) != size1) {
std::cerr << ": WRS initial write failed
";
return 2;
}
- if (io.size() != len1) {
- std::cerr << ": WRS size is not " << len1 << "
";
+ if (io.size() != size1) {
+ std::cerr << ": WRS size is not " << size1 << "
";
return 2;
}
- io.seek(-len1, BasicIo::cur);
+ io.seek(-size1, BasicIo::cur);
int c = EOF;
std::memset(buf, -1, sizeof(buf));
@@ -161,7 +161,7 @@ int WriteReadSeek(BasicIo &io)
}
// Make sure we got the null back
- if(buf[len1-1] != 0) {
+ if(buf[size1-1] != 0) {
std::cerr << ": WRS missing null terminator 1
";
return 3;
}
@@ -195,7 +195,7 @@ int WriteReadSeek(BasicIo &io)
}
io.seek(insert, BasicIo::beg);
- if(io.write((byte*)tester2, len2) != len2) {
+ if(io.write((byte*)tester2, size2) != size2) {
std::cerr << ": WRS bad write 1
";
return 9;
}
@@ -205,13 +205,13 @@ int WriteReadSeek(BasicIo &io)
throw Error(9, io.path(), strError());
}
std::memset(buf, -1, sizeof(buf));
- if (io.read(buf, sizeof(buf)) != insert + len2) {
+ if (io.read(buf, sizeof(buf)) != insert + size2) {
std::cerr << ": WRS something went wrong
";
return 10;
}
// Make sure we got the null back
- if(buf[insert + len2 - 1] != 0) {
+ if(buf[insert + size2 - 1] != 0) {
std::cerr << ": WRS missing null terminator 2
";
return 11;
}
diff --git a/src/basicio.cpp b/src/basicio.cpp
index cf2fb20..95589cd 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -929,7 +929,7 @@ namespace Exiv2 {
return std::ftell(p_->fp_);
}
- long FileIo::size() const
+ size_t FileIo::size() const
{
// Flush and commit only if the file is open for writing
if (p_->fp_ != 0 && (p_->openMode_[0] != 'r' || p_->openMode_[1] == '+')) {
@@ -1018,7 +1018,7 @@ namespace Exiv2 {
bool FileIo::eof() const
{
assert(p_->fp_ != 0);
- return feof(p_->fp_) != 0 || tell() >= size() ;
+ return feof(p_->fp_) != 0 || tell() >= (long) size() ;
}
std::string FileIo::path() const
@@ -1244,7 +1244,7 @@ namespace Exiv2 {
return p_->idx_;
}
- long MemIo::size() const
+ size_t MemIo::size() const
{
return p_->size_;
}
@@ -1659,20 +1659,20 @@ namespace Exiv2 {
* + goes from the right, find the first different position -> $right
* The different bytes are [$left-$right] part.
*/
- long left = 0;
- long right = 0;
- long blockIndex = 0;
- long i = 0;
- long readCount = 0;
- long blockSize = 0;
- byte* buf = (byte*) std::malloc(p_->blockSize_);
- long nBlocks = (long)((p_->size_ + p_->blockSize_ - 1) / p_->blockSize_);
+ size_t left = 0;
+ size_t right = 0;
+ size_t blockIndex = 0;
+ size_t i = 0;
+ size_t readCount = 0;
+ size_t blockSize = 0;
+ byte* buf = (byte*) std::malloc(p_->blockSize_);
+ size_t nBlocks = (p_->size_ + p_->blockSize_ - 1) / p_->blockSize_;
// find $left
src.seek(0, BasicIo::beg);
bool findDiff = false;
while (blockIndex < nBlocks && !src.eof() && !findDiff) {
- blockSize = (long)p_->blocksMap_[blockIndex].getSize();
+ blockSize = p_->blocksMap_[blockIndex].getSize();
bool isFakeData = p_->blocksMap_[blockIndex].isKnown(); // fake data
readCount = src.read(buf, blockSize);
byte* blockData = p_->blocksMap_[blockIndex].getData();
@@ -1689,7 +1689,7 @@ namespace Exiv2 {
// find $right
findDiff = false;
blockIndex = nBlocks - 1;
- blockSize = (long)p_->blocksMap_[blockIndex].getSize();
+ blockSize = p_->blocksMap_[blockIndex].getSize();
while ((blockIndex + 1 > 0) && right < src.size() && !findDiff) {
if(src.seek(-1 * (blockSize + right), BasicIo::end)) {
findDiff = true;
@@ -1870,7 +1870,7 @@ namespace Exiv2 {
return p_->idx_;
}
- long RemoteIo::size() const
+ size_t RemoteIo::size() const
{
return (long) p_->size_;
}
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list