/////////////////////////////////////////////////////////////////////////////
-// Name: common/init.cpp
+// Name: src/common/init.cpp
// Purpose: initialisation for the library
// Author: Vadim Zeitlin
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+ #pragma hdrstop
#endif //__BORLANDC__
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/thread.h"
#include "wx/intl.h"
+ #include "wx/module.h"
#endif
#include "wx/init.h"
#include "wx/ptr_scpd.h"
-#include "wx/module.h"
#include "wx/except.h"
-#if wxUSE_FONTMAP
-#include "wx/fontmap.h"
-#endif
#if defined(__WXMSW__) && defined(__WXDEBUG__)
#include "wx/msw/msvcrt.h"
static void ConvertArgsToUnicode(int argc, char **argv)
{
gs_initData.argv = new wchar_t *[argc + 1];
+ int wargc = 0;
for ( int i = 0; i < argc; i++ )
{
wxWCharBuffer buf(wxConvLocal.cMB2WX(argv[i]));
- gs_initData.argv[i] = buf ? wxStrdup(buf) : NULL;
+ if ( !buf )
+ {
+ wxLogWarning(_("Command line argument %d couldn't be converted to Unicode and will be ignored."),
+ i);
+ }
+ else // converted ok
+ {
+ gs_initData.argv[wargc++] = wxStrdup(buf);
+ }
}
- gs_initData.argc = argc;
- gs_initData.argv[argc] = NULL;
+ gs_initData.argc = wargc;
+ gs_initData.argv[wargc] = NULL;
}
static void FreeConvertedArgs()
{
ConvertArgsToUnicode(argc, argv);
- if ( !wxEntryStart(argc, gs_initData.argv) )
+ if ( !wxEntryStart(gs_initData.argc, gs_initData.argv) )
{
FreeConvertedArgs();
{
ConvertArgsToUnicode(argc, argv);
-#if wxUSE_FONTMAP
- // If we created a font mapper during the above call,
- // it will only be the base class, so delete it to allow
- // app traits to create mapper.
- delete (wxFontMapperBase*) wxFontMapperBase::Set(NULL);
-#endif
-
- return wxEntry(argc, gs_initData.argv);
+ return wxEntry(gs_initData.argc, gs_initData.argv);
}
#endif // wxUSE_UNICODE