[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:37:15 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=b55a7f9
The following commit has been merged in the master branch:
commit b55a7f9f9c19a7ea2febe2e0a47c093a7c6e96a8
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sun Sep 18 09:36:53 2005 +0000
Cosmetics
---
src/basicio.cpp | 31 ++++++++++++++++++++++++-------
src/basicio.hpp | 5 ++---
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/basicio.cpp b/src/basicio.cpp
index d9e694f..94863c4 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -45,6 +45,7 @@ EXIV2_RCSID("@(#) $Id$");
#include <string>
#include <cassert>
#include <cstdio> // for remove()
+#include <cstdlib> // for alloc(), realloc(), free()
#include <sys/types.h> // for stat()
#include <sys/stat.h> // for stat()
#ifdef EXV_HAVE_PROCESS_H
@@ -183,13 +184,13 @@ namespace Exiv2 {
close();
fileIo->close();
// MSVCRT rename that does not overwrite existing files
- if (remove(path_.c_str()) != 0) {
- throw Error(2, path_, strError(), "::remove");
+ if (std::remove(path_.c_str()) != 0) {
+ throw Error(2, path_, strError(), "std::remove");
}
if (rename(fileIo->path_.c_str(), path_.c_str()) == -1) {
throw Error(17, fileIo->path_, path_, strError());
}
- remove(fileIo->path_.c_str());
+ std::remove(fileIo->path_.c_str());
}
else{
// Generic handling, reopen both to reset to start
@@ -331,6 +332,15 @@ namespace Exiv2 {
return path_;
}
+ MemIo::MemIo()
+ : data_(0),
+ idx_(0),
+ size_(0),
+ sizeAlloced_(0),
+ isMalloced_(false)
+ {
+ }
+
MemIo::MemIo(const byte* data, long size)
: data_(const_cast<byte*>(data)),
idx_(0),
@@ -340,6 +350,13 @@ namespace Exiv2 {
{
}
+ MemIo::~MemIo()
+ {
+ if (isMalloced_) {
+ std::free(data_);
+ }
+ }
+
BasicIo::AutoPtr MemIo::temporary() const
{
return BasicIo::AutoPtr(new MemIo);
@@ -355,16 +372,16 @@ namespace Exiv2 {
if (size_ > 0) {
if (!isMalloced_) {
// "copy-on-expand"
- byte* data = (byte*)malloc(want);
+ byte* data = (byte*)std::malloc(want);
memcpy(data, data_, size_);
data_ = data;
}
else {
- data_ = (byte*)realloc(data_, want);
+ data_ = (byte*)std::realloc(data_, want);
}
}
else {
- data_ = (byte*)malloc(want);
+ data_ = (byte*)std::malloc(want);
}
sizeAlloced_ = want;
isMalloced_ = true;
@@ -387,7 +404,7 @@ namespace Exiv2 {
if (memIo) {
// Optimization if this is another instance of MemIo
if (true == isMalloced_) {
- free(data_);
+ std::free(data_);
}
idx_ = 0;
data_ = memIo->data_;
diff --git a/src/basicio.hpp b/src/basicio.hpp
index 21046fd..02da29d 100644
--- a/src/basicio.hpp
+++ b/src/basicio.hpp
@@ -474,8 +474,7 @@ namespace Exiv2 {
//! @name Creators
//@{
//! Default constructor that results in an empty object
- MemIo() : data_(0), idx_(0), size_(0),
- sizeAlloced_(0), isMalloced_(false) {}
+ MemIo();
/*!
@brief Constructor that accepts a block of memory to be copied.
IO operations are performed on the copied memory.
@@ -485,7 +484,7 @@ namespace Exiv2 {
*/
MemIo(const byte* data, long size);
//! Destructor. Releases all managed memory
- ~MemIo() { if (isMalloced_) free(data_); }
+ ~MemIo();
//@}
//! @name Manipulators
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list