From 0e6d8617ae38ded8bb9c5d030c4e90a5a5838e5f Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Sat, 23 Aug 2014 00:01:11 +0900 Subject: [PATCH] Revert "Removed an ambiguous cast from FileNameHandle to FileName." This reverts commit 9af7601baee66ed8fa7cac01b5dc272dd2544ee5. --- taglib/toolkit/tfilestream.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 0195302a..93078ae9 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -85,14 +85,10 @@ namespace #else // _WIN32 - class FileNameHandle + struct FileNameHandle : public std::string { - private: - std::string name; - - public: - FileNameHandle(FileName n) : name(n) {} - FileName toFileName() const { return name.c_str(); } + FileNameHandle(FileName name) : std::string(name) {} + operator FileName () const { return c_str(); } }; typedef FILE* FileHandle; @@ -126,10 +122,12 @@ namespace class FileStream::FileStreamPrivate { public: - FileStreamPrivate(const FileName &fileName) : - file(InvalidFileHandle), - name(fileName), - readOnly(true) {} + FileStreamPrivate(const FileName &fileName) + : file(InvalidFileHandle) + , name(fileName) + , readOnly(true) + { + } FileHandle file; FileNameHandle name; @@ -140,8 +138,8 @@ public: // public members //////////////////////////////////////////////////////////////////////////////// -FileStream::FileStream(FileName fileName, bool openReadOnly) : - d(new FileStreamPrivate(fileName)) +FileStream::FileStream(FileName fileName, bool openReadOnly) + : d(new FileStreamPrivate(fileName)) { // First try with read / write mode, if that fails, fall back to read only. @@ -158,7 +156,7 @@ FileStream::FileStream(FileName fileName, bool openReadOnly) : # ifdef _WIN32 debug("Could not open file " + fileName.toString()); # else - debug("Could not open file " + String(d->name.toFileName())); + debug("Could not open file " + String(static_cast(d->name))); # endif } } @@ -173,11 +171,7 @@ FileStream::~FileStream() FileName FileStream::name() const { -# ifdef _WIN32 return d->name; -# else - return d->name.toFileName(); -# endif } ByteVector FileStream::readBlock(ulong length) -- 2.40.0