Unicode fixes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6216 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2012-02-28 22:40:43 +00:00
parent 615ce82030
commit 382b2fa282
11 changed files with 150 additions and 49 deletions

View file

@ -57,9 +57,15 @@ void Plugins::FindCommands(const tstring &path, bool displayInfo)
}
}
struct NSISException : public std::runtime_error
// VC6 cannot handle NSISException(const tstring& msg) : std::runtime_error(string(TtoCString(msg))) {}
struct NSISExceptionInner : public std::runtime_error
{
NSISException(const tstring& msg) : std::runtime_error(string(TtoCString(msg))) {}
NSISExceptionInner(const char* msg) : std::runtime_error(string(msg)) {} // Unicode
NSISExceptionInner(const string&msg) : std::runtime_error(msg) {} // Ansi
};
struct NSISException : public NSISExceptionInner
{
NSISException(const tstring& msg) : NSISExceptionInner(TtoCString(msg)) {}
};
namespace {

View file

@ -150,6 +150,9 @@ CEXEBuild::CEXEBuild() :
#ifdef _WIN32
definedlist.add(_T("NSIS_WIN32_MAKENSIS"));
#endif
#ifdef _UNICODE
definedlist.add(_T("NSIS_UNICODE_MAKENSIS")); // This define might go away once makensis.exe is always unicode
#endif
db_opt_save=db_comp_save=db_full_size=db_opt_save_u=db_comp_save_u=db_full_size_u=0;

View file

@ -277,6 +277,9 @@ int _tmain(int argc, TCHAR **argv)
int in_files=0;
#ifdef _UNICODE
#if (defined(_MSC_VER) && (_MSC_VER<=1200))
const int _O_U8TEXT=0x40000; // BUGBUG: This is bogus
#endif
_setmode(_fileno(stdout), _O_U8TEXT); // set stdout to UTF-8
#ifdef _WIN32
g_initialCodepage = GetConsoleOutputCP();

View file

@ -101,7 +101,7 @@ public:
~TtoCString() { free(m_cStr); m_cStr = 0; }
operator const char*() { return m_cStr; }
operator const char*() const { return m_cStr; }
private:
char* m_cStr;