#1043 #1042 #812. Thank You to Thomas for this "polishing" patch. Thank you to everybody who has worked on this issue. Adding all the comments on the three issues together comes to about 60 items by at least 6 contributors. And it involves platform issues, networking, Linux and Windows APIs. One of the most complex issues to arise in Exiv2. Well done everybody. And we've dealt with this quickly. Only 9 days since Calvin first reported #1042.

I use the term "complex" to mean many threads of technology.  "complex" != "complicated".  "complicated" = "difficult to understand".  We try to avoid "complicated".
v0.27.3
Robin Mills 10 years ago
parent fe48230c64
commit e51425046e

@ -258,7 +258,7 @@ namespace Exiv2 {
@note This method should be only called after the concerned data (metadata)
are all downloaded from the remote file to memory.
*/
virtual void populateFakeData() {}
virtual void populateFakeData() {}
//@}
protected:
@ -684,7 +684,7 @@ namespace Exiv2 {
#else
virtual int seek(long offset, Position pos);
#endif
/*!
/*!
@brief Allow direct access to the underlying data buffer. The buffer
is not protected against write access in any way, the argument
is ignored.
@ -694,7 +694,7 @@ namespace Exiv2 {
*/
virtual byte* mmap(bool /*isWriteable*/ =false);
virtual int munmap();
virtual int msync();
int msync();
//@}
//! @name Accessors
@ -1272,14 +1272,14 @@ namespace Exiv2 {
*/
EXIV2API long writeFile(const DataBuf& buf, const std::wstring& wpath);
#endif
/*!
/*!
@brief replace each substring of the subject that matches the given search string with the given replacement.
@return the subject after replacing.
*/
EXIV2API std::string ReplaceStringInPlace(std::string subject, const std::string& search,
const std::string& replace);
#ifdef EXV_UNICODE_PATH
/*!
/*!
@brief Like ReplaceStringInPlace() but accepts a unicode path in an std::wstring.
@return the subject after replacing.
@note This function is only available on Windows.

@ -125,7 +125,7 @@ namespace Exiv2 {
struct StructStat {
StructStat() : st_mode(0), st_size(0), st_nlink(0) {}
mode_t st_mode; //!< Permissions
off_t st_size; //!< Size
off_t st_size; //!< Size
nlink_t st_nlink; //!< Number of hard links (broken on Windows, see winNumberOfLinks())
};
// #endif
@ -256,7 +256,7 @@ namespace Exiv2 {
if (0 == ret) {
buf.st_size = st.st_size;
buf.st_nlink = st.st_nlink;
buf.st_mode = st.st_mode;
buf.st_mode = st.st_mode;
}
}
return ret;
@ -681,8 +681,8 @@ namespace Exiv2 {
close();
bool statOk = true;
mode_t origStMode = 0;
std::string spf;
mode_t origStMode = 0;
std::string spf;
char* pf = 0;
#ifdef EXV_UNICODE_PATH
std::wstring wspf;
@ -735,7 +735,7 @@ namespace Exiv2 {
if (p_->stat(buf1) == -1) {
statOk = false;
}
origStMode = buf1.st_mode;
origStMode = buf1.st_mode;
#endif // !EXV_HAVE_LSTAT
// MSVCRT rename that does not overwrite existing files
@ -859,7 +859,7 @@ namespace Exiv2 {
EXV_WARNING << Error(2, pf, strError(), "::stat") << "\n";
#endif
}
if (statOk && origStMode != buf2.st_mode) {
if (statOk && origStMode != buf2.st_mode) {
// Set original file permissions
if (::chmod(pf, origStMode) == -1) {
#ifndef SUPPRESS_WARNINGS
@ -867,7 +867,7 @@ namespace Exiv2 {
#endif
}
}
}
}
} // if (fileIo)
else {
// Generic handling, reopen both to reset to start
@ -1199,7 +1199,8 @@ namespace Exiv2 {
MemIo *memIo = dynamic_cast<MemIo*>(&src);
if (memIo) {
// Optimization if src is another instance of MemIo
if (true == p_->isMalloced_) {
if (p_->isMalloced_) {
msync();
std::free(p_->data_);
}
p_->idx_ = 0;
@ -1287,16 +1288,15 @@ namespace Exiv2 {
int MemIo::munmap()
{
msync();
return 0;
return msync();
}
int MemIo::msync()
{
#ifdef MS_SYNC
return ::msync(p_, p_->size_, MS_SYNC);
return ::msync(p_, p_->size_, MS_SYNC);
#else
return 0;
return 0;
#endif
}

Loading…
Cancel
Save