mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Revert "Fixed some MSVC specific warnings"
This reverts commit 93f304a91d
.
This commit is contained in:
parent
98d010f460
commit
dce00b96b8
@ -69,73 +69,58 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
class FileName::FileNamePrivate
|
||||
{
|
||||
public:
|
||||
std::wstring wname;
|
||||
std::string name;
|
||||
};
|
||||
// If WinNT, stores a Unicode string into m_wname directly.
|
||||
// If Win9x, converts and stores it into m_name to avoid calling Unicode version functions.
|
||||
|
||||
FileName::FileName(const wchar_t *name)
|
||||
: d(new FileNamePrivate())
|
||||
: m_wname(SystemSupportsUnicode ? name : L"")
|
||||
, m_name (SystemSupportsUnicode ? "" : unicodeToAnsi(name))
|
||||
{
|
||||
// If Windows NT, stores a Unicode string directly.
|
||||
// If Windows 9x, stores it converting into an ANSI string.
|
||||
if(SystemSupportsUnicode)
|
||||
d->wname = name;
|
||||
else
|
||||
d->name = unicodeToAnsi(name);
|
||||
}
|
||||
|
||||
FileName::FileName(const char *name)
|
||||
: d(new FileNamePrivate())
|
||||
: m_name(name)
|
||||
{
|
||||
d->name = name;
|
||||
}
|
||||
|
||||
FileName::FileName(const FileName &name)
|
||||
: d(new FileNamePrivate(*name.d))
|
||||
: m_wname(name.m_wname)
|
||||
, m_name (name.m_name)
|
||||
{
|
||||
}
|
||||
|
||||
FileName &FileName::operator==(const FileName &name)
|
||||
{
|
||||
*d = *name.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FileName::operator const wchar_t *() const
|
||||
{
|
||||
return d->wname.c_str();
|
||||
return m_wname.c_str();
|
||||
}
|
||||
|
||||
FileName::operator const char *() const
|
||||
{
|
||||
return d->name.c_str();
|
||||
return m_name.c_str();
|
||||
}
|
||||
|
||||
const std::wstring &FileName::wstr() const
|
||||
{
|
||||
return d->wname;
|
||||
return m_wname;
|
||||
}
|
||||
|
||||
const std::string &FileName::str() const
|
||||
{
|
||||
return d->name;
|
||||
return m_name;
|
||||
}
|
||||
|
||||
String FileName::toString() const
|
||||
{
|
||||
if(!d->wname.empty()) {
|
||||
return String(d->wname);
|
||||
if(!m_wname.empty()) {
|
||||
return String(m_wname);
|
||||
}
|
||||
else if(!d->name.empty()) {
|
||||
const int len = MultiByteToWideChar(CP_ACP, 0, d->name.c_str(), -1, NULL, 0);
|
||||
else if(!m_name.empty()) {
|
||||
const int len = MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, NULL, 0);
|
||||
if(len == 0)
|
||||
return String::null;
|
||||
|
||||
std::vector<wchar_t> buf(len);
|
||||
MultiByteToWideChar(CP_ACP, 0, d->name.c_str(), -1, &buf[0], len);
|
||||
MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, &buf[0], len);
|
||||
|
||||
return String(&buf[0]);
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ namespace TagLib {
|
||||
FileName(const char *name);
|
||||
|
||||
FileName(const FileName &name);
|
||||
FileName &operator==(const FileName &name);
|
||||
|
||||
operator const wchar_t *() const;
|
||||
operator const char *() const;
|
||||
@ -51,14 +50,11 @@ namespace TagLib {
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
class FileNamePrivate;
|
||||
FileNamePrivate *d;
|
||||
const std::string m_name;
|
||||
const std::wstring m_wname;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
typedef const char *FileName;
|
||||
|
||||
#endif
|
||||
|
||||
//! An abstract class that provides operations on a sequence of bytes
|
||||
|
Loading…
Reference in New Issue
Block a user