From c2ee4008756d99bbb0b3e091d04ae732cf08ecb8 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Wed, 6 Jan 2010 16:37:43 +0000 Subject: [PATCH] #672: Fixed issue with C-string pointer of a temporary. --- src/basicio.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/basicio.cpp b/src/basicio.cpp index 44e10ff1..bec9c759 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -442,16 +442,20 @@ namespace Exiv2 { bool statOk = true; mode_t origStMode = 0; - char* pf = 0; + std::string spf; + const char* pf = 0; #ifdef EXV_UNICODE_PATH - wchar_t* wpf = 0; + std::wstring wspf; + const wchar_t* wpf = 0; if (p_->wpMode_ == Impl::wpUnicode) { - wpf = const_cast(wpath().c_str()); + wspf = wpath(); + wpf = wspf.c_str(); } else #endif { - pf = const_cast(path().c_str()); + spf = path(); + pf = spf.c_str(); } // Get the permissions of the file, or linked-to file, on platforms which have lstat