It now compiles all these files without warnings in Unicode mode.
(at least It Works For Me(tm)) I will respond to any complaints when I wake up for another workday (any complaints will prove whether Vadim was right in that it's bound to break things) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1136,8 +1136,8 @@ void wxPageSetupDialogData::SetPaperSize(wxPaperSize id)
|
||||
void wxPageSetupDialogData::CalculateIdFromPaperSize()
|
||||
{
|
||||
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
|
||||
"wxThePrintPaperDatabase should not be NULL. "
|
||||
"Do not create global print dialog data objects." );
|
||||
_T("wxThePrintPaperDatabase should not be NULL. "
|
||||
"Do not create global print dialog data objects.") );
|
||||
|
||||
wxSize sz = GetPaperSize();
|
||||
|
||||
@@ -1152,8 +1152,8 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize()
|
||||
void wxPageSetupDialogData::CalculatePaperSizeFromId()
|
||||
{
|
||||
wxASSERT_MSG( (wxThePrintPaperDatabase != (wxPrintPaperDatabase*) NULL),
|
||||
"wxThePrintPaperDatabase should not be NULL. "
|
||||
"Do not create global print dialog data objects." );
|
||||
_T("wxThePrintPaperDatabase should not be NULL. "
|
||||
"Do not create global print dialog data objects.") );
|
||||
|
||||
wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId());
|
||||
|
||||
|
@@ -124,7 +124,7 @@ bool wxConfigBase::Read(const wxString& key, double* val) const
|
||||
wxString str;
|
||||
if (Read(key, & str))
|
||||
{
|
||||
*val = atof(str);
|
||||
*val = wxAtof(str);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -187,7 +187,7 @@ bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const
|
||||
bool wxConfigBase::Write(const wxString& key, double val)
|
||||
{
|
||||
wxString str;
|
||||
str.Printf("%f", val);
|
||||
str.Printf(_T("%f"), val);
|
||||
return Write(key, str);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ wxString wxExpandEnvVars(const wxString& str)
|
||||
|
||||
wxString strVarName(str.c_str() + n + 1, m - n - 1);
|
||||
|
||||
const char *pszValue = getenv(strVarName);
|
||||
const wxChar *pszValue = wxGetenv(strVarName);
|
||||
if ( pszValue != NULL ) {
|
||||
strResult += pszValue;
|
||||
}
|
||||
|
@@ -48,13 +48,14 @@
|
||||
|
||||
#define ABBR_LENGTH 3
|
||||
|
||||
static const char *dayname[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
static const wxChar *dayname[] = {
|
||||
_T("Sunday"), _T("Monday"), _T("Tuesday"), _T("Wednesday"),
|
||||
_T("Thursday"), _T("Friday"), _T("Saturday")
|
||||
};
|
||||
|
||||
static const char *mname[] = {
|
||||
"January", "February", "March", "April", "May", "June", "July", "August",
|
||||
"September", "October", "November", "December"
|
||||
static const wxChar *mname[] = {
|
||||
_T("January"), _T("February"), _T("March"), _T("April"), _T("May"), _T("June"),
|
||||
_T("July"), _T("August"), _T("September"), _T("October"), _T("November"), _T("December")
|
||||
};
|
||||
|
||||
static int GauDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
@@ -93,20 +94,20 @@ wxDate::wxDate (const wxString& dat)
|
||||
{
|
||||
DisplayFormat=wxMDY;
|
||||
DisplayOptions='\0';
|
||||
if (strcmp(dat, "TODAY") == 0 || strcmp(dat, "today") == 0)
|
||||
if (wxStrcmp(dat, _T("TODAY")) == 0 || wxStrcmp(dat, _T("today")) == 0)
|
||||
{
|
||||
// Sets the current date
|
||||
Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[100];
|
||||
strcpy(buf, (char *) (const char *)dat);
|
||||
wxChar buf[100];
|
||||
wxStrcpy(buf, WXSTRINGCAST dat);
|
||||
|
||||
char *token = strtok(buf,"/-");
|
||||
month = atoi(token);
|
||||
day = atoi(strtok((char *) NULL,"/-"));
|
||||
year = atoi(strtok((char *) NULL," "));
|
||||
wxChar *save_ptr, *token = wxStrtok(buf,_T("/-"),&save_ptr);
|
||||
month = wxAtoi(token);
|
||||
day = wxAtoi(wxStrtok((wxChar *) NULL,_T("/-"),&save_ptr));
|
||||
year = wxAtoi(wxStrtok((wxChar *) NULL,_T(" "),&save_ptr));
|
||||
}
|
||||
|
||||
mdy_to_julian ();
|
||||
@@ -136,20 +137,20 @@ void wxDate::operator = (const wxString& dat)
|
||||
{
|
||||
DisplayFormat=wxMDY;
|
||||
DisplayOptions='\0';
|
||||
if (strcmp(dat, "TODAY") == 0 || strcmp(dat, "today") == 0)
|
||||
if (wxStrcmp(dat, _T("TODAY")) == 0 || wxStrcmp(dat, _T("today")) == 0)
|
||||
{
|
||||
// Sets the current date
|
||||
Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[100];
|
||||
strcpy(buf, (char *)(const char *)dat);
|
||||
wxChar buf[100];
|
||||
wxStrcpy(buf, WXSTRINGCAST dat);
|
||||
|
||||
char *token = strtok(buf,"/-");
|
||||
month = atoi(token);
|
||||
day = atoi(strtok((char *) NULL,"/-"));
|
||||
year = atoi(strtok((char *) NULL," "));
|
||||
wxChar *save_ptr, *token = wxStrtok(buf,_T("/-"),&save_ptr);
|
||||
month = wxAtoi(token);
|
||||
day = wxAtoi(wxStrtok((wxChar *) NULL,_T("/-"),&save_ptr));
|
||||
year = wxAtoi(wxStrtok((wxChar *) NULL,_T(" "),&save_ptr));
|
||||
}
|
||||
|
||||
mdy_to_julian ();
|
||||
@@ -281,7 +282,7 @@ bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2)
|
||||
|
||||
ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt)
|
||||
{
|
||||
return os << (const char *) dt.FormatDate();
|
||||
return os << (const wxChar *) dt.FormatDate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@@ -345,24 +346,24 @@ wxString wxDate::FormatDate (int type) const
|
||||
if (actualType == -1)
|
||||
actualType = DisplayFormat;
|
||||
|
||||
char buf[40];
|
||||
wxChar buf[40];
|
||||
|
||||
memset( buf, '\0', sizeof(buf) );
|
||||
switch ( actualType )
|
||||
{
|
||||
case wxDAY:
|
||||
if ( (day_of_week < 1) || (day_of_week > 7) )
|
||||
strcpy(buf, _("invalid day"));
|
||||
wxStrcpy(buf, _("invalid day"));
|
||||
else
|
||||
strncpy( buf, _(dayname[day_of_week-1]),
|
||||
wxStrncpy( buf, wxGetTranslation(dayname[day_of_week-1]),
|
||||
(DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
|
||||
return wxString(buf);
|
||||
|
||||
case wxMONTH:
|
||||
if ( (month < 1) || (month > 12) )
|
||||
strcpy(buf, _("invalid month"));
|
||||
wxStrcpy(buf, _("invalid month"));
|
||||
else
|
||||
strncpy( buf, _(mname[month-1]),
|
||||
wxStrncpy( buf, wxGetTranslation(mname[month-1]),
|
||||
(DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
|
||||
return wxString(buf);
|
||||
|
||||
@@ -370,47 +371,47 @@ wxString wxDate::FormatDate (int type) const
|
||||
if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
|
||||
(day_of_week > 7) )
|
||||
{
|
||||
strcpy(buf, _("invalid date"));
|
||||
wxStrcpy(buf, _("invalid date"));
|
||||
return wxString(buf);
|
||||
}
|
||||
strncpy( buf, _(dayname[day_of_week-1]),
|
||||
wxStrncpy( buf, wxGetTranslation(dayname[day_of_week-1]),
|
||||
(DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
|
||||
strcat( buf, ", ");
|
||||
strncat( buf, _(mname[month-1]),
|
||||
wxStrcat( buf, _T(", "));
|
||||
wxStrncat( buf, wxGetTranslation(mname[month-1]),
|
||||
(DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
|
||||
strcat( buf, " ");
|
||||
sprintf( buf+strlen(buf), "%d, %d", day, abs(year) );
|
||||
wxStrcat( buf, _T(" "));
|
||||
wxSprintf( buf+wxStrlen(buf), _T("%d, %d"), day, abs(year) );
|
||||
if (year < 0)
|
||||
strcat(buf,_(" B.C."));
|
||||
wxStrcat(buf,_(" B.C."));
|
||||
return wxString(buf);
|
||||
|
||||
case wxEUROPEAN:
|
||||
if ( (month < 1) || (month > 12) || (day_of_week < 0) ||
|
||||
(day_of_week > 7) )
|
||||
{
|
||||
strcpy(buf, _("invalid date"));
|
||||
wxStrcpy(buf, _("invalid date"));
|
||||
return wxString(buf);
|
||||
}
|
||||
sprintf(buf,"%d ", day);
|
||||
strncat(buf, _(mname[month-1]),
|
||||
wxSprintf(buf,_T("%d "), day);
|
||||
wxStrncat(buf, wxGetTranslation(mname[month-1]),
|
||||
(DisplayOptions & wxDATE_ABBR) ? ABBR_LENGTH : 9);
|
||||
sprintf( buf+strlen(buf), " %d", abs(year) );
|
||||
wxSprintf( buf+wxStrlen(buf), _T(" %d"), abs(year) );
|
||||
if (year < 0)
|
||||
strcat(buf, _(" B.C."));
|
||||
wxStrcat(buf, _(" B.C."));
|
||||
return wxString(buf);
|
||||
|
||||
case wxMDY:
|
||||
default:
|
||||
if (day==0 || month==0 || year==0)
|
||||
strcpy(buf, _("invalid date"));
|
||||
wxStrcpy(buf, _("invalid date"));
|
||||
else
|
||||
sprintf( buf+strlen(buf), "%1d/%1d/%02d", month, day,
|
||||
wxSprintf( buf+wxStrlen(buf), _T("%1d/%1d/%02d"), month, day,
|
||||
(DisplayOptions & wxNO_CENTURY) && (abs(year) > 1899)
|
||||
? (abs(year) - (abs(year) / 100 * 100))
|
||||
: (abs(year)) );
|
||||
return wxString(buf);
|
||||
}
|
||||
return wxString("");
|
||||
return wxString(_T(""));
|
||||
}
|
||||
|
||||
void wxDate::SetFormat( int format )
|
||||
|
@@ -92,7 +92,7 @@
|
||||
// function prototypes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static inline wxString FindExtension(const char *path);
|
||||
static inline wxString FindExtension(const wxChar *path);
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
@@ -102,7 +102,7 @@ static inline wxString FindExtension(const char *path);
|
||||
// local functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static wxString FindExtension(const char *path)
|
||||
static wxString FindExtension(const wxChar *path)
|
||||
{
|
||||
wxString ext;
|
||||
wxSplitPath(path, NULL, NULL, &ext);
|
||||
@@ -279,7 +279,7 @@ bool wxDocument::OnSaveDocument(const wxString& file)
|
||||
else
|
||||
msgTitle = wxString(_("File error"));
|
||||
|
||||
ofstream store(file);
|
||||
ofstream store(file.fn_str());
|
||||
if (store.fail() || store.bad())
|
||||
{
|
||||
(void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION,
|
||||
@@ -310,7 +310,7 @@ bool wxDocument::OnOpenDocument(const wxString& file)
|
||||
else
|
||||
msgTitle = wxString(_("File error"));
|
||||
|
||||
ifstream store(file);
|
||||
ifstream store(file.fn_str());
|
||||
if (store.fail() || store.bad())
|
||||
{
|
||||
(void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION,
|
||||
@@ -402,7 +402,7 @@ bool wxDocument::OnSaveModified()
|
||||
|
||||
wxString prompt;
|
||||
prompt.Printf(_("Do you want to save changes to document %s?"),
|
||||
(const char *)title);
|
||||
(const wxChar *)title);
|
||||
int res = wxMessageBox(prompt, msgTitle,
|
||||
wxYES_NO|wxCANCEL|wxICON_QUESTION,
|
||||
GetDocumentWindow());
|
||||
@@ -1139,7 +1139,7 @@ wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path)
|
||||
for (i = 0; i < m_templates.Number(); i++)
|
||||
{
|
||||
wxDocTemplate *temp = (wxDocTemplate *)m_templates.Nth(i)->Data();
|
||||
if (strcmp(temp->GetDefaultExtension(), theExt) == 0)
|
||||
if (wxStrcmp(temp->GetDefaultExtension(), theExt) == 0)
|
||||
{
|
||||
theTemplate = temp;
|
||||
break;
|
||||
@@ -1170,18 +1170,18 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
||||
{
|
||||
// add a '|' to separate this filter from the previous one
|
||||
if ( !descrBuf.IsEmpty() )
|
||||
descrBuf << '|';
|
||||
descrBuf << _T('|');
|
||||
|
||||
descrBuf << templates[i]->GetDescription()
|
||||
<< " (" << templates[i]->GetFileFilter() << ") |"
|
||||
<< _T(" (") << templates[i]->GetFileFilter() << _T(") |")
|
||||
<< templates[i]->GetFileFilter();
|
||||
}
|
||||
}
|
||||
#else
|
||||
wxString descrBuf = "*.*";
|
||||
wxString descrBuf = _T("*.*");
|
||||
#endif
|
||||
|
||||
wxString pathTmp = wxFileSelector(_("Select a file"), "", "", "",
|
||||
wxString pathTmp = wxFileSelector(_("Select a file"), _T(""), _T(""), _T(""),
|
||||
descrBuf, 0, wxTheApp->GetTopWindow());
|
||||
|
||||
if (!pathTmp.IsEmpty())
|
||||
@@ -1229,8 +1229,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
||||
wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
|
||||
int noTemplates)
|
||||
{
|
||||
char **strings = new char *[noTemplates];
|
||||
char **data = new char *[noTemplates];
|
||||
wxChar **strings = new wxChar *[noTemplates];
|
||||
wxChar **data = new wxChar *[noTemplates];
|
||||
int i;
|
||||
int n = 0;
|
||||
for (i = 0; i < noTemplates; i++)
|
||||
@@ -1238,7 +1238,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
|
||||
if (templates[i]->IsVisible())
|
||||
{
|
||||
strings[n] = WXSTRINGCAST templates[i]->m_description;
|
||||
data[n] = (char *)templates[i];
|
||||
data[n] = (wxChar *)templates[i];
|
||||
n ++;
|
||||
}
|
||||
}
|
||||
@@ -1266,8 +1266,8 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
|
||||
wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
|
||||
int noTemplates)
|
||||
{
|
||||
char **strings = new char *[noTemplates];
|
||||
char **data = new char *[noTemplates];
|
||||
wxChar **strings = new wxChar *[noTemplates];
|
||||
wxChar **data = new wxChar *[noTemplates];
|
||||
int i;
|
||||
int n = 0;
|
||||
for (i = 0; i < noTemplates; i++)
|
||||
@@ -1275,7 +1275,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
|
||||
if (templates[i]->IsVisible() && (templates[i]->GetViewName() != ""))
|
||||
{
|
||||
strings[n] = WXSTRINGCAST templates[i]->m_viewTypeName;
|
||||
data[n] = (char *)templates[i];
|
||||
data[n] = (wxChar *)templates[i];
|
||||
n ++;
|
||||
}
|
||||
}
|
||||
@@ -1763,7 +1763,7 @@ wxFileHistory::wxFileHistory(int maxFiles)
|
||||
{
|
||||
m_fileMaxFiles = maxFiles;
|
||||
m_fileHistoryN = 0;
|
||||
m_fileHistory = new char *[m_fileMaxFiles];
|
||||
m_fileHistory = new wxChar *[m_fileMaxFiles];
|
||||
}
|
||||
|
||||
wxFileHistory::~wxFileHistory()
|
||||
@@ -1792,7 +1792,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
|
||||
if (m_fileHistoryN == m_fileMaxFiles)
|
||||
{
|
||||
delete[] m_fileHistory[m_fileMaxFiles-1];
|
||||
m_fileHistory[m_fileMaxFiles-1] = (char *) NULL;
|
||||
m_fileHistory[m_fileMaxFiles-1] = (wxChar *) NULL;
|
||||
}
|
||||
if (m_fileHistoryN < m_fileMaxFiles)
|
||||
{
|
||||
@@ -1818,7 +1818,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
|
||||
if (m_fileHistory[i])
|
||||
{
|
||||
wxString buf;
|
||||
buf.Printf("&%d %s", i+1, m_fileHistory[i]);
|
||||
buf.Printf(_T("&%d %s"), i+1, m_fileHistory[i]);
|
||||
wxNode* node = m_fileMenus.First();
|
||||
while (node)
|
||||
{
|
||||
@@ -1853,13 +1853,13 @@ void wxFileHistory::Load(wxConfigBase& config)
|
||||
{
|
||||
m_fileHistoryN = 0;
|
||||
wxString buf;
|
||||
buf.Printf("file%d", m_fileHistoryN+1);
|
||||
buf.Printf(_T("file%d"), m_fileHistoryN+1);
|
||||
wxString historyFile;
|
||||
while ((m_fileHistoryN <= m_fileMaxFiles) && config.Read(buf, &historyFile) && (historyFile != ""))
|
||||
{
|
||||
m_fileHistory[m_fileHistoryN] = copystring((const char*) historyFile);
|
||||
m_fileHistory[m_fileHistoryN] = copystring((const wxChar*) historyFile);
|
||||
m_fileHistoryN ++;
|
||||
buf.Printf("file%d", m_fileHistoryN+1);
|
||||
buf.Printf(_T("file%d"), m_fileHistoryN+1);
|
||||
historyFile = "";
|
||||
}
|
||||
AddFilesToMenu();
|
||||
@@ -1871,7 +1871,7 @@ void wxFileHistory::Save(wxConfigBase& config)
|
||||
for (i = 0; i < m_fileHistoryN; i++)
|
||||
{
|
||||
wxString buf;
|
||||
buf.Printf("file%d", i+1);
|
||||
buf.Printf(_T("file%d"), i+1);
|
||||
config.Write(buf, wxString(m_fileHistory[i]));
|
||||
}
|
||||
}
|
||||
@@ -1892,7 +1892,7 @@ void wxFileHistory::AddFilesToMenu()
|
||||
if (m_fileHistory[i])
|
||||
{
|
||||
wxString buf;
|
||||
buf.Printf("&%d %s", i+1, m_fileHistory[i]);
|
||||
buf.Printf(_T("&%d %s"), i+1, m_fileHistory[i]);
|
||||
menu->Append(wxID_FILE1+i, buf);
|
||||
}
|
||||
}
|
||||
@@ -1912,7 +1912,7 @@ void wxFileHistory::AddFilesToMenu(wxMenu* menu)
|
||||
if (m_fileHistory[i])
|
||||
{
|
||||
wxString buf;
|
||||
buf.Printf("&%d %s", i+1, m_fileHistory[i]);
|
||||
buf.Printf(_T("&%d %s"), i+1, m_fileHistory[i]);
|
||||
menu->Append(wxID_FILE1+i, buf);
|
||||
}
|
||||
}
|
||||
@@ -1929,7 +1929,7 @@ bool wxTransferFileToStream(const wxString& filename, ostream& stream)
|
||||
FILE *fd1;
|
||||
int ch;
|
||||
|
||||
if ((fd1 = fopen (WXSTRINGCAST filename, "rb")) == NULL)
|
||||
if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL)
|
||||
return FALSE;
|
||||
|
||||
while ((ch = getc (fd1)) != EOF)
|
||||
@@ -1944,7 +1944,7 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename)
|
||||
FILE *fd1;
|
||||
int ch;
|
||||
|
||||
if ((fd1 = fopen (WXSTRINGCAST filename, "wb")) == NULL)
|
||||
if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -250,7 +250,7 @@ void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
|
||||
// add item at the given position
|
||||
void wxBaseArray::Insert(long lItem, size_t nIndex)
|
||||
{
|
||||
wxCHECK_RET( nIndex <= m_nCount, "bad index in wxArray::Insert" );
|
||||
wxCHECK_RET( nIndex <= m_nCount, _T("bad index in wxArray::Insert") );
|
||||
|
||||
Grow();
|
||||
|
||||
@@ -263,7 +263,7 @@ void wxBaseArray::Insert(long lItem, size_t nIndex)
|
||||
// removes item from array (by index)
|
||||
void wxBaseArray::Remove(size_t nIndex)
|
||||
{
|
||||
wxCHECK_RET( nIndex <= m_nCount, "bad index in wxArray::Remove" );
|
||||
wxCHECK_RET( nIndex <= m_nCount, _T("bad index in wxArray::Remove") );
|
||||
|
||||
memmove(&m_pItems[nIndex], &m_pItems[nIndex + 1],
|
||||
(m_nCount - nIndex - 1)*sizeof(long));
|
||||
@@ -276,7 +276,7 @@ void wxBaseArray::Remove(long lItem)
|
||||
int iIndex = Index(lItem);
|
||||
|
||||
wxCHECK_RET( iIndex != wxNOT_FOUND,
|
||||
"removing inexistent item in wxArray::Remove" );
|
||||
_T("removing inexistent item in wxArray::Remove") );
|
||||
|
||||
Remove((size_t)iIndex);
|
||||
}
|
||||
|
@@ -40,17 +40,17 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(HAVE_DLOPEN)
|
||||
#define wxDllOpen(lib) dlopen(lib, RTLD_LAZY)
|
||||
#define wxDllGetSymbol(handle, name) dlsym(handle, (char *)name)
|
||||
#define wxDllOpen(lib) dlopen(lib.fn_str(), RTLD_LAZY)
|
||||
#define wxDllGetSymbol(handle, name) dlsym(handle, name.mb_str())
|
||||
#define wxDllClose dlclose
|
||||
#elif defined(HAVE_SHL_LOAD)
|
||||
#define wxDllOpen(lib) shl_load(lib, BIND_DEFERRED, 0)
|
||||
#define wxDllOpen(lib) shl_load(lib.fn_str(), BIND_DEFERRED, 0)
|
||||
#define wxDllClose shl_unload
|
||||
|
||||
static inline void *wxDllGetSymbol(shl_t handle, const char *name)
|
||||
static inline void *wxDllGetSymbol(shl_t handle, const wxString& name)
|
||||
{
|
||||
void *sym;
|
||||
if ( shl_findsym(&handle, name, TYPE_UNDEFINED, &sym) == 0 )
|
||||
if ( shl_findsym(&handle, name.mb_str(), TYPE_UNDEFINED, &sym) == 0 )
|
||||
return sym;
|
||||
else
|
||||
return (void *)0;
|
||||
@@ -179,9 +179,7 @@ void *wxLibrary::GetSymbol(const wxString& symbname)
|
||||
symbol = (void *)symAddress ;
|
||||
}
|
||||
#else
|
||||
// VZ: hmm... why is WXSTRINGCAST needed? if it's really modified, we
|
||||
// should make a copy of it
|
||||
symbol = wxDllGetSymbol(m_handle, WXSTRINGCAST symbname);
|
||||
symbol = wxDllGetSymbol(m_handle, symbname);
|
||||
#endif
|
||||
|
||||
if ( !symbol )
|
||||
@@ -234,7 +232,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
const char *envLibPath = getenv("LD_LIBRARY_PATH");
|
||||
if ( envLibPath )
|
||||
libPath << ':' << envLibPath;
|
||||
wxStringTokenizer tokenizer(libPath, ':');
|
||||
wxStringTokenizer tokenizer(libPath, _T(':'));
|
||||
while ( tokenizer.HasMoreToken() )
|
||||
{
|
||||
wxString fullname(tokenizer.NextToken());
|
||||
|
@@ -171,7 +171,7 @@ bool wxMouseEvent::ButtonDClick(int but) const
|
||||
case 3:
|
||||
return RightDClick();
|
||||
default:
|
||||
wxFAIL_MSG("invalid parameter in wxMouseEvent::ButtonDClick");
|
||||
wxFAIL_MSG(_T("invalid parameter in wxMouseEvent::ButtonDClick"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -192,7 +192,7 @@ bool wxMouseEvent::ButtonDown(int but) const
|
||||
case 3:
|
||||
return RightDown();
|
||||
default:
|
||||
wxFAIL_MSG("invalid parameter in wxMouseEvent::ButtonDown");
|
||||
wxFAIL_MSG(_T("invalid parameter in wxMouseEvent::ButtonDown"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -212,7 +212,7 @@ bool wxMouseEvent::ButtonUp(int but) const
|
||||
case 3:
|
||||
return RightUp();
|
||||
default:
|
||||
wxFAIL_MSG("invalid parameter in wxMouseEvent::ButtonUp");
|
||||
wxFAIL_MSG(_T("invalid parameter in wxMouseEvent::ButtonUp"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -231,7 +231,7 @@ bool wxMouseEvent::Button(int but) const
|
||||
case 3:
|
||||
return (RightDown() || RightUp() || RightDClick());
|
||||
default:
|
||||
wxFAIL_MSG("invalid parameter in wxMouseEvent::Button");
|
||||
wxFAIL_MSG(_T("invalid parameter in wxMouseEvent::Button"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -249,7 +249,7 @@ bool wxMouseEvent::ButtonIsDown(int but) const
|
||||
case 3:
|
||||
return RightIsDown();
|
||||
default:
|
||||
wxFAIL_MSG("invalid parameter in wxMouseEvent::ButtonIsDown");
|
||||
wxFAIL_MSG(_T("invalid parameter in wxMouseEvent::ButtonIsDown"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -511,7 +511,7 @@ void wxEvtHandler::Connect( int id, int lastId,
|
||||
bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
|
||||
{
|
||||
wxCHECK_MSG( m_dynamicEvents, FALSE,
|
||||
"caller should check that we have dynamic events" );
|
||||
_T("caller should check that we have dynamic events") );
|
||||
|
||||
int commandId = event.GetId();
|
||||
|
||||
|
@@ -156,16 +156,23 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// static functions
|
||||
// ----------------------------------------------------------------------------
|
||||
bool wxFile::Exists(const char *name)
|
||||
bool wxFile::Exists(const wxChar *name)
|
||||
{
|
||||
struct stat st;
|
||||
#if wxUSE_UNICODE && wxMBFILES
|
||||
wxCharBuffer fname = wxConv_file.cWC2MB(name);
|
||||
|
||||
return !access(name, 0) &&
|
||||
!stat((char*) name, &st) &&
|
||||
return !access(fname, 0) &&
|
||||
!stat(MBSTRINGCAST fname, &st) &&
|
||||
(st.st_mode & S_IFREG);
|
||||
#else
|
||||
return !access(name, 0) &&
|
||||
!stat((wxChar*) name, &st) &&
|
||||
(st.st_mode & S_IFREG);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxFile::Access(const char *name, OpenMode mode)
|
||||
bool wxFile::Access(const wxChar *name, OpenMode mode)
|
||||
{
|
||||
int how = 0;
|
||||
|
||||
@@ -179,10 +186,10 @@ bool wxFile::Access(const char *name, OpenMode mode)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("bad wxFile::Access mode parameter.");
|
||||
wxFAIL_MSG(_T("bad wxFile::Access mode parameter."));
|
||||
}
|
||||
|
||||
return access(name, how) == 0;
|
||||
return access(wxFNCONV(name), how) == 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -190,7 +197,7 @@ bool wxFile::Access(const char *name, OpenMode mode)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ctors
|
||||
wxFile::wxFile(const char *szFileName, OpenMode mode)
|
||||
wxFile::wxFile(const wxChar *szFileName, OpenMode mode)
|
||||
{
|
||||
m_fd = fd_invalid;
|
||||
m_error = FALSE;
|
||||
@@ -205,11 +212,11 @@ wxFile::~wxFile()
|
||||
}
|
||||
|
||||
// create the file, fail if it already exists and bOverwrite
|
||||
bool wxFile::Create(const char *szFileName, bool bOverwrite, int accessMode)
|
||||
bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
|
||||
{
|
||||
// if bOverwrite we create a new file or truncate the existing one,
|
||||
// otherwise we only create the new file and fail if it already exists
|
||||
int fd = open(szFileName,
|
||||
int fd = open(wxFNCONV(szFileName),
|
||||
O_WRONLY | O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL)
|
||||
ACCESS(accessMode));
|
||||
|
||||
@@ -224,7 +231,7 @@ bool wxFile::Create(const char *szFileName, bool bOverwrite, int accessMode)
|
||||
}
|
||||
|
||||
// open the file
|
||||
bool wxFile::Open(const char *szFileName, OpenMode mode, int accessMode)
|
||||
bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
|
||||
{
|
||||
int flags = O_BINARY;
|
||||
|
||||
@@ -246,7 +253,7 @@ bool wxFile::Open(const char *szFileName, OpenMode mode, int accessMode)
|
||||
break;
|
||||
}
|
||||
|
||||
int fd = open(szFileName, flags ACCESS(accessMode));
|
||||
int fd = open(wxFNCONV(szFileName), flags ACCESS(accessMode));
|
||||
|
||||
if ( fd == -1 ) {
|
||||
wxLogSysError(_("can't open file '%s'"), szFileName);
|
||||
@@ -474,21 +481,21 @@ bool wxTempFile::Open(const wxString& strName)
|
||||
// different partitions for example). Unfortunately, the only standard
|
||||
// (POSIX) temp file creation function tmpnam() can't do it.
|
||||
#if defined(__UNIX__) || defined(__WXSTUBS__)|| defined( __WXMAC__ )
|
||||
static const char *szMktempSuffix = "XXXXXX";
|
||||
static const wxChar *szMktempSuffix = _T("XXXXXX");
|
||||
m_strTemp << strName << szMktempSuffix;
|
||||
mktemp((char *)m_strTemp.c_str()); // will do because length doesn't change
|
||||
mktemp(MBSTRINGCAST m_strTemp.mb_str()); // will do because length doesn't change
|
||||
#else // Windows
|
||||
wxString strPath;
|
||||
wxSplitPath(strName, &strPath, NULL, NULL);
|
||||
if ( strPath.IsEmpty() )
|
||||
strPath = '.'; // GetTempFileName will fail if we give it empty string
|
||||
strPath = _T('.'); // GetTempFileName will fail if we give it empty string
|
||||
#ifdef __WIN32__
|
||||
if ( !GetTempFileName(strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
if ( !GetTempFileName(strPath, _T("wx_"),0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
#else
|
||||
// Not sure why MSVC++ 1.5 header defines first param as BYTE - bug?
|
||||
if ( !GetTempFileName((BYTE) (const char*) strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
if ( !GetTempFileName((BYTE) (const wxChar*) strPath, _T("wx_"),0, m_strTemp.GetWriteBuf(MAX_PATH)) )
|
||||
#endif
|
||||
wxLogLastError("GetTempFileName");
|
||||
wxLogLastError(_T("GetTempFileName"));
|
||||
m_strTemp.UngetWriteBuf();
|
||||
#endif // Windows/Unix
|
||||
|
||||
@@ -496,7 +503,7 @@ bool wxTempFile::Open(const wxString& strName)
|
||||
#ifdef __UNIX__
|
||||
// create the file with the same mode as the original one under Unix
|
||||
struct stat st;
|
||||
if ( stat(strName, &st) == 0 )
|
||||
if ( stat(strName.fn_str(), &st) == 0 )
|
||||
{
|
||||
// this assumes that only lower bits of st_mode contain the access
|
||||
// rights, but it's true for at least all Unices which have S_IXXXX()
|
||||
@@ -506,7 +513,7 @@ bool wxTempFile::Open(const wxString& strName)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogLastError("stat");
|
||||
wxLogLastError(_T("stat"));
|
||||
}
|
||||
|
||||
// we want to create the file with exactly the same access rights as the
|
||||
@@ -538,12 +545,12 @@ bool wxTempFile::Commit()
|
||||
{
|
||||
m_file.Close();
|
||||
|
||||
if ( wxFile::Exists(m_strName) && remove(m_strName) != 0 ) {
|
||||
if ( wxFile::Exists(m_strName) && remove(m_strName.fn_str()) != 0 ) {
|
||||
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( rename(m_strTemp, m_strName) != 0 ) {
|
||||
if ( rename(m_strTemp.fn_str(), m_strName.fn_str()) != 0 ) {
|
||||
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
@@ -554,6 +561,6 @@ bool wxTempFile::Commit()
|
||||
void wxTempFile::Discard()
|
||||
{
|
||||
m_file.Close();
|
||||
if ( remove(m_strTemp) != 0 )
|
||||
if ( remove(m_strTemp.fn_str()) != 0 )
|
||||
wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
|
||||
}
|
||||
|
@@ -90,17 +90,17 @@ wxString wxFileConfig::GetGlobalDir()
|
||||
wxString strDir;
|
||||
|
||||
#ifdef __UNIX__
|
||||
strDir = "/etc/";
|
||||
strDir = _T("/etc/");
|
||||
#elif defined(__WXSTUBS__)
|
||||
wxASSERT_MSG( FALSE, "TODO" ) ;
|
||||
wxASSERT_MSG( FALSE, _T("TODO") ) ;
|
||||
#elif defined(__WXMAC__)
|
||||
wxASSERT_MSG( FALSE, "TODO" ) ;
|
||||
wxASSERT_MSG( FALSE, _T("TODO") ) ;
|
||||
#else // Windows
|
||||
char szWinDir[MAX_PATH];
|
||||
wxChar szWinDir[MAX_PATH];
|
||||
::GetWindowsDirectory(szWinDir, MAX_PATH);
|
||||
|
||||
strDir = szWinDir;
|
||||
strDir << '\\';
|
||||
strDir << _T('\\');
|
||||
#endif // Unix/Windows
|
||||
|
||||
return strDir;
|
||||
@@ -113,42 +113,42 @@ wxString wxFileConfig::GetLocalDir()
|
||||
wxGetHomeDir(&strDir);
|
||||
|
||||
#ifdef __UNIX__
|
||||
if (strDir.Last() != '/') strDir << '/';
|
||||
if (strDir.Last() != _T('/')) strDir << _T('/');
|
||||
#else
|
||||
if (strDir.Last() != '\\') strDir << '\\';
|
||||
if (strDir.Last() != _T('\\')) strDir << _T('\\');
|
||||
#endif
|
||||
|
||||
return strDir;
|
||||
}
|
||||
|
||||
wxString wxFileConfig::GetGlobalFileName(const char *szFile)
|
||||
wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile)
|
||||
{
|
||||
wxString str = GetGlobalDir();
|
||||
str << szFile;
|
||||
|
||||
if ( strchr(szFile, '.') == NULL )
|
||||
if ( wxStrchr(szFile, _T('.')) == NULL )
|
||||
#ifdef __UNIX__
|
||||
str << ".conf";
|
||||
str << _T(".conf");
|
||||
#else // Windows
|
||||
str << ".ini";
|
||||
str << _T(".ini");
|
||||
#endif // UNIX/Win
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
wxString wxFileConfig::GetLocalFileName(const char *szFile)
|
||||
wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
|
||||
{
|
||||
wxString str = GetLocalDir();
|
||||
|
||||
#ifdef __UNIX__
|
||||
str << '.';
|
||||
str << _T('.');
|
||||
#endif
|
||||
|
||||
str << szFile;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if ( strchr(szFile, '.') == NULL )
|
||||
str << ".ini";
|
||||
if ( wxStrchr(szFile, _T('.')) == NULL )
|
||||
str << _T(".ini");
|
||||
#endif
|
||||
|
||||
return str;
|
||||
@@ -265,8 +265,8 @@ wxFileConfig::~wxFileConfig()
|
||||
|
||||
void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
{
|
||||
const char *pStart;
|
||||
const char *pEnd;
|
||||
const wxChar *pStart;
|
||||
const wxChar *pEnd;
|
||||
wxString strLine;
|
||||
|
||||
size_t nLineCount = file.GetLineCount();
|
||||
@@ -278,22 +278,22 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
LineListAppend(strLine);
|
||||
|
||||
// skip leading spaces
|
||||
for ( pStart = strLine; isspace(*pStart); pStart++ )
|
||||
for ( pStart = strLine; wxIsspace(*pStart); pStart++ )
|
||||
;
|
||||
|
||||
// skip blank/comment lines
|
||||
if ( *pStart == '\0'|| *pStart == ';' || *pStart == '#' )
|
||||
if ( *pStart == _T('\0')|| *pStart == _T(';') || *pStart == _T('#') )
|
||||
continue;
|
||||
|
||||
if ( *pStart == '[' ) { // a new group
|
||||
if ( *pStart == _T('[') ) { // a new group
|
||||
pEnd = pStart;
|
||||
|
||||
while ( *++pEnd != ']' ) {
|
||||
if ( *pEnd == '\n' || *pEnd == '\0' )
|
||||
while ( *++pEnd != _T(']') ) {
|
||||
if ( *pEnd == _T('\n') || *pEnd == _T('\0') )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( *pEnd != ']' ) {
|
||||
if ( *pEnd != _T(']') ) {
|
||||
wxLogError(_("file '%s': unexpected character %c at line %d."),
|
||||
file.GetName(), *pEnd, n + 1);
|
||||
continue; // skip this line
|
||||
@@ -313,15 +313,15 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
|
||||
// check that there is nothing except comments left on this line
|
||||
bool bCont = TRUE;
|
||||
while ( *++pEnd != '\0' && bCont ) {
|
||||
while ( *++pEnd != _T('\0') && bCont ) {
|
||||
switch ( *pEnd ) {
|
||||
case '#':
|
||||
case ';':
|
||||
case _T('#'):
|
||||
case _T(';'):
|
||||
bCont = FALSE;
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case _T(' '):
|
||||
case _T('\t'):
|
||||
// ignore whitespace ('\n' impossible here)
|
||||
break;
|
||||
|
||||
@@ -334,9 +334,9 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
}
|
||||
}
|
||||
else { // a key
|
||||
const char *pEnd = pStart;
|
||||
while ( !isspace(*pEnd) ) {
|
||||
if ( *pEnd == '\\' ) {
|
||||
const wxChar *pEnd = pStart;
|
||||
while ( !wxIsspace(*pEnd) ) {
|
||||
if ( *pEnd == _T('\\') ) {
|
||||
// next character may be space or not - still take it because it's
|
||||
// quoted
|
||||
pEnd++;
|
||||
@@ -351,7 +351,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
while ( isspace(*pEnd) )
|
||||
pEnd++;
|
||||
|
||||
if ( *pEnd++ != '=' ) {
|
||||
if ( *pEnd++ != _T('=') ) {
|
||||
wxLogError(_("file '%s', line %d: '=' expected."),
|
||||
file.GetName(), n + 1);
|
||||
}
|
||||
@@ -389,7 +389,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
}
|
||||
|
||||
// skip whitespace
|
||||
while ( isspace(*pEnd) )
|
||||
while ( wxIsspace(*pEnd) )
|
||||
pEnd++;
|
||||
|
||||
pEntry->SetValue(FilterInValue(pEnd), FALSE /* read from file */);
|
||||
@@ -574,7 +574,7 @@ bool wxFileConfig::Read(const wxString& key, long *pl) const
|
||||
{
|
||||
wxString str;
|
||||
if ( Read(key, & str) ) {
|
||||
*pl = atol(str);
|
||||
*pl = wxAtol(str);
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -589,7 +589,7 @@ bool wxFileConfig::Write(const wxString& key, const wxString& szValue)
|
||||
wxString strName = path.Name();
|
||||
if ( strName.IsEmpty() ) {
|
||||
// setting the value of a group is an error
|
||||
wxASSERT_MSG( IsEmpty(szValue), "can't set value of a group!" );
|
||||
wxASSERT_MSG( wxIsEmpty(szValue), _T("can't set value of a group!") );
|
||||
|
||||
// ... except if it's empty in which case it's a way to force it's creation
|
||||
m_pCurrentGroup->SetDirty();
|
||||
@@ -623,7 +623,7 @@ bool wxFileConfig::Write(const wxString& key, long lValue)
|
||||
{
|
||||
// ltoa() is not ANSI :-(
|
||||
wxString buf;
|
||||
buf.Printf("%ld", lValue);
|
||||
buf.Printf(_T("%ld"), lValue);
|
||||
return Write(key, buf);
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso)
|
||||
if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) {
|
||||
if ( m_pCurrentGroup != m_pRootGroup ) {
|
||||
ConfigGroup *pGroup = m_pCurrentGroup;
|
||||
SetPath(".."); // changes m_pCurrentGroup!
|
||||
SetPath(_T("..")); // changes m_pCurrentGroup!
|
||||
m_pCurrentGroup->DeleteSubgroupByName(pGroup->Name());
|
||||
}
|
||||
//else: never delete the root group
|
||||
@@ -728,12 +728,10 @@ bool wxFileConfig::DeleteAll()
|
||||
{
|
||||
CleanUp();
|
||||
|
||||
const char *szFile = m_strLocalFile;
|
||||
if ( remove(m_strLocalFile.fn_str()) == -1 )
|
||||
wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str());
|
||||
|
||||
if ( remove(szFile) == -1 )
|
||||
wxLogSysError(_("can't delete user configuration file '%s'"), szFile);
|
||||
|
||||
m_strLocalFile = m_strGlobalFile = "";
|
||||
m_strLocalFile = m_strGlobalFile = _T("");
|
||||
Init();
|
||||
|
||||
return TRUE;
|
||||
@@ -905,7 +903,7 @@ LineList *ConfigGroup::GetGroupLine()
|
||||
// this group wasn't present in local config file, add it now
|
||||
if ( pParent != NULL ) {
|
||||
wxString strFullName;
|
||||
strFullName << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/'
|
||||
strFullName << _T("[") << (GetFullName().c_str() + 1) << _T("]"); // +1: no '/'
|
||||
m_pLine = m_pConfig->LineListInsert(strFullName,
|
||||
pParent->GetLastGroupLine());
|
||||
pParent->SetLastGroup(this); // we're surely after all the others
|
||||
@@ -963,7 +961,7 @@ void ConfigGroup::Rename(const wxString& newName)
|
||||
|
||||
LineList *line = GetGroupLine();
|
||||
wxString strFullName;
|
||||
strFullName << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/'
|
||||
strFullName << _T("[") << (GetFullName().c_str() + 1) << _T("]"); // +1: no '/'
|
||||
line->SetText(strFullName);
|
||||
|
||||
SetDirty();
|
||||
@@ -974,7 +972,7 @@ wxString ConfigGroup::GetFullName() const
|
||||
if ( Parent() )
|
||||
return Parent()->GetFullName() + wxCONFIG_PATH_SEPARATOR + Name();
|
||||
else
|
||||
return "";
|
||||
return _T("");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -983,7 +981,7 @@ wxString ConfigGroup::GetFullName() const
|
||||
|
||||
// use binary search because the array is sorted
|
||||
ConfigEntry *
|
||||
ConfigGroup::FindEntry(const char *szName) const
|
||||
ConfigGroup::FindEntry(const wxChar *szName) const
|
||||
{
|
||||
size_t i,
|
||||
lo = 0,
|
||||
@@ -996,9 +994,9 @@ ConfigGroup::FindEntry(const char *szName) const
|
||||
pEntry = m_aEntries[i];
|
||||
|
||||
#if wxCONFIG_CASE_SENSITIVE
|
||||
res = strcmp(pEntry->Name(), szName);
|
||||
res = wxStrcmp(pEntry->Name(), szName);
|
||||
#else
|
||||
res = Stricmp(pEntry->Name(), szName);
|
||||
res = wxStricmp(pEntry->Name(), szName);
|
||||
#endif
|
||||
|
||||
if ( res > 0 )
|
||||
@@ -1013,7 +1011,7 @@ ConfigGroup::FindEntry(const char *szName) const
|
||||
}
|
||||
|
||||
ConfigGroup *
|
||||
ConfigGroup::FindSubgroup(const char *szName) const
|
||||
ConfigGroup::FindSubgroup(const wxChar *szName) const
|
||||
{
|
||||
size_t i,
|
||||
lo = 0,
|
||||
@@ -1026,9 +1024,9 @@ ConfigGroup::FindSubgroup(const char *szName) const
|
||||
pGroup = m_aSubgroups[i];
|
||||
|
||||
#if wxCONFIG_CASE_SENSITIVE
|
||||
res = strcmp(pGroup->Name(), szName);
|
||||
res = wxStrcmp(pGroup->Name(), szName);
|
||||
#else
|
||||
res = Stricmp(pGroup->Name(), szName);
|
||||
res = wxStricmp(pGroup->Name(), szName);
|
||||
#endif
|
||||
|
||||
if ( res > 0 )
|
||||
@@ -1081,7 +1079,7 @@ ConfigGroup::AddSubgroup(const wxString& strName)
|
||||
delete several of them.
|
||||
*/
|
||||
|
||||
bool ConfigGroup::DeleteSubgroupByName(const char *szName)
|
||||
bool ConfigGroup::DeleteSubgroupByName(const wxChar *szName)
|
||||
{
|
||||
return DeleteSubgroup(FindSubgroup(szName));
|
||||
}
|
||||
@@ -1153,7 +1151,7 @@ bool ConfigGroup::DeleteSubgroup(ConfigGroup *pGroup)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool ConfigGroup::DeleteEntry(const char *szName)
|
||||
bool ConfigGroup::DeleteEntry(const wxChar *szName)
|
||||
{
|
||||
ConfigEntry *pEntry = FindEntry(szName);
|
||||
wxCHECK( pEntry != NULL, FALSE ); // deleting non existing item?
|
||||
@@ -1272,7 +1270,7 @@ void ConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
||||
if ( bUser ) {
|
||||
wxString strVal = FilterOutValue(strValue);
|
||||
wxString strLine;
|
||||
strLine << m_strName << " = " << strVal;
|
||||
strLine << m_strName << _T(" = ") << strVal;
|
||||
|
||||
if ( m_pLine != NULL ) {
|
||||
// entry was read from the local config file, just modify the line
|
||||
@@ -1309,9 +1307,9 @@ int CompareEntries(ConfigEntry *p1,
|
||||
ConfigEntry *p2)
|
||||
{
|
||||
#if wxCONFIG_CASE_SENSITIVE
|
||||
return strcmp(p1->Name(), p2->Name());
|
||||
return wxStrcmp(p1->Name(), p2->Name());
|
||||
#else
|
||||
return Stricmp(p1->Name(), p2->Name());
|
||||
return wxStricmp(p1->Name(), p2->Name());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1319,9 +1317,9 @@ int CompareGroups(ConfigGroup *p1,
|
||||
ConfigGroup *p2)
|
||||
{
|
||||
#if wxCONFIG_CASE_SENSITIVE
|
||||
return strcmp(p1->Name(), p2->Name());
|
||||
return wxStrcmp(p1->Name(), p2->Name());
|
||||
#else
|
||||
return Stricmp(p1->Name(), p2->Name());
|
||||
return wxStricmp(p1->Name(), p2->Name());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1338,31 +1336,31 @@ static wxString FilterInValue(const wxString& str)
|
||||
bool bQuoted = !str.IsEmpty() && str[0] == '"';
|
||||
|
||||
for ( size_t n = bQuoted ? 1 : 0; n < str.Len(); n++ ) {
|
||||
if ( str[n] == '\\' ) {
|
||||
if ( str[n] == _T('\\') ) {
|
||||
switch ( str[++n] ) {
|
||||
case 'n':
|
||||
strResult += '\n';
|
||||
case _T('n'):
|
||||
strResult += _T('\n');
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strResult += '\r';
|
||||
case _T('r'):
|
||||
strResult += _T('\r');
|
||||
break;
|
||||
|
||||
case 't':
|
||||
strResult += '\t';
|
||||
case _T('t'):
|
||||
strResult += _T('\t');
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
strResult += '\\';
|
||||
case _T('\\'):
|
||||
strResult += _T('\\');
|
||||
break;
|
||||
|
||||
case '"':
|
||||
strResult += '"';
|
||||
case _T('"'):
|
||||
strResult += _T('"');
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( str[n] != '"' || !bQuoted )
|
||||
if ( str[n] != _T('"') || !bQuoted )
|
||||
strResult += str[n];
|
||||
else if ( n != str.Len() - 1 ) {
|
||||
wxLogWarning(_("unexpected \" at position %d in '%s'."),
|
||||
@@ -1385,33 +1383,33 @@ static wxString FilterOutValue(const wxString& str)
|
||||
strResult.Alloc(str.Len());
|
||||
|
||||
// quoting is necessary to preserve spaces in the beginning of the string
|
||||
bool bQuote = isspace(str[0]) || str[0] == '"';
|
||||
bool bQuote = wxIsspace(str[0]) || str[0] == _T('"');
|
||||
|
||||
if ( bQuote )
|
||||
strResult += '"';
|
||||
strResult += _T('"');
|
||||
|
||||
char c;
|
||||
wxChar c;
|
||||
for ( size_t n = 0; n < str.Len(); n++ ) {
|
||||
switch ( str[n] ) {
|
||||
case '\n':
|
||||
c = 'n';
|
||||
case _T('\n'):
|
||||
c = _T('n');
|
||||
break;
|
||||
|
||||
case '\r':
|
||||
c = 'r';
|
||||
case _T('\r'):
|
||||
c = _T('r');
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
c = 't';
|
||||
case _T('\t'):
|
||||
c = _T('t');
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
c = '\\';
|
||||
case _T('\\'):
|
||||
c = _T('\\');
|
||||
break;
|
||||
|
||||
case '"':
|
||||
case _T('"'):
|
||||
if ( bQuote ) {
|
||||
c = '"';
|
||||
c = _T('"');
|
||||
break;
|
||||
}
|
||||
//else: fall through
|
||||
@@ -1422,11 +1420,11 @@ static wxString FilterOutValue(const wxString& str)
|
||||
}
|
||||
|
||||
// we get here only for special characters
|
||||
strResult << '\\' << c;
|
||||
strResult << _T('\\') << c;
|
||||
}
|
||||
|
||||
if ( bQuote )
|
||||
strResult += '"';
|
||||
strResult += _T('"');
|
||||
|
||||
return strResult;
|
||||
}
|
||||
@@ -1437,8 +1435,8 @@ static wxString FilterInEntryName(const wxString& str)
|
||||
wxString strResult;
|
||||
strResult.Alloc(str.Len());
|
||||
|
||||
for ( const char *pc = str.c_str(); *pc != '\0'; pc++ ) {
|
||||
if ( *pc == '\\' )
|
||||
for ( const wxChar *pc = str.c_str(); *pc != '\0'; pc++ ) {
|
||||
if ( *pc == _T('\\') )
|
||||
pc++;
|
||||
|
||||
strResult += *pc;
|
||||
@@ -1453,15 +1451,15 @@ static wxString FilterOutEntryName(const wxString& str)
|
||||
wxString strResult;
|
||||
strResult.Alloc(str.Len());
|
||||
|
||||
for ( const char *pc = str.c_str(); *pc != '\0'; pc++ ) {
|
||||
char c = *pc;
|
||||
for ( const wxChar *pc = str.c_str(); *pc != _T('\0'); pc++ ) {
|
||||
wxChar c = *pc;
|
||||
|
||||
// we explicitly allow some of "safe" chars and 8bit ASCII characters
|
||||
// which will probably never have special meaning
|
||||
// NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR
|
||||
// should *not* be quoted
|
||||
if ( !isalnum(c) && !strchr("@_/-!.*%", c) && ((c & 0x80) == 0) )
|
||||
strResult += '\\';
|
||||
if ( !wxIsalnum(c) && !wxStrchr(_T("@_/-!.*%"), c) && ((c & 0x80) == 0) )
|
||||
strResult += _T('\\');
|
||||
|
||||
strResult += c;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -148,91 +148,91 @@ void wxColourDatabase::Initialize ()
|
||||
// Added: Not all
|
||||
|
||||
struct cdef {
|
||||
char *name;
|
||||
wxChar *name;
|
||||
int r,g,b;
|
||||
};
|
||||
cdef cc;
|
||||
static cdef table[]={
|
||||
|
||||
// #ifdef __WXMSW__
|
||||
{"AQUAMARINE",112, 219, 147},
|
||||
{"BLACK",0, 0, 0},
|
||||
{"BLUE", 0, 0, 255},
|
||||
{"BLUE VIOLET", 159, 95, 159},
|
||||
{"BROWN", 165, 42, 42},
|
||||
{"CADET BLUE", 95, 159, 159},
|
||||
{"CORAL", 255, 127, 0},
|
||||
{"CORNFLOWER BLUE", 66, 66, 111},
|
||||
{"CYAN", 0, 255, 255},
|
||||
{"DARK GREY", 47, 47, 47}, // ?
|
||||
{_T("AQUAMARINE"),112, 219, 147},
|
||||
{_T("BLACK"),0, 0, 0},
|
||||
{_T("BLUE"), 0, 0, 255},
|
||||
{_T("BLUE VIOLET"), 159, 95, 159},
|
||||
{_T("BROWN"), 165, 42, 42},
|
||||
{_T("CADET BLUE"), 95, 159, 159},
|
||||
{_T("CORAL"), 255, 127, 0},
|
||||
{_T("CORNFLOWER BLUE"), 66, 66, 111},
|
||||
{_T("CYAN"), 0, 255, 255},
|
||||
{_T("DARK GREY"), 47, 47, 47}, // ?
|
||||
|
||||
{"DARK GREEN", 47, 79, 47},
|
||||
{"DARK OLIVE GREEN", 79, 79, 47},
|
||||
{"DARK ORCHID", 153, 50, 204},
|
||||
{"DARK SLATE BLUE", 107, 35, 142},
|
||||
{"DARK SLATE GREY", 47, 79, 79},
|
||||
{"DARK TURQUOISE", 112, 147, 219},
|
||||
{"DIM GREY", 84, 84, 84},
|
||||
{"FIREBRICK", 142, 35, 35},
|
||||
{"FOREST GREEN", 35, 142, 35},
|
||||
{"GOLD", 204, 127, 50},
|
||||
{"GOLDENROD", 219, 219, 112},
|
||||
{"GREY", 128, 128, 128},
|
||||
{"GREEN", 0, 255, 0},
|
||||
{"GREEN YELLOW", 147, 219, 112},
|
||||
{"INDIAN RED", 79, 47, 47},
|
||||
{"KHAKI", 159, 159, 95},
|
||||
{"LIGHT BLUE", 191, 216, 216},
|
||||
{"LIGHT GREY", 192, 192, 192},
|
||||
{"LIGHT STEEL BLUE", 143, 143, 188},
|
||||
{"LIME GREEN", 50, 204, 50},
|
||||
{"LIGHT MAGENTA", 255, 0, 255},
|
||||
{"MAGENTA", 255, 0, 255},
|
||||
{"MAROON", 142, 35, 107},
|
||||
{"MEDIUM AQUAMARINE", 50, 204, 153},
|
||||
{"MEDIUM GREY", 100, 100, 100},
|
||||
{"MEDIUM BLUE", 50, 50, 204},
|
||||
{"MEDIUM FOREST GREEN", 107, 142, 35},
|
||||
{"MEDIUM GOLDENROD", 234, 234, 173},
|
||||
{"MEDIUM ORCHID", 147, 112, 219},
|
||||
{"MEDIUM SEA GREEN", 66, 111, 66},
|
||||
{"MEDIUM SLATE BLUE", 127, 0, 255},
|
||||
{"MEDIUM SPRING GREEN", 127, 255, 0},
|
||||
{"MEDIUM TURQUOISE", 112, 219, 219},
|
||||
{"MEDIUM VIOLET RED", 219, 112, 147},
|
||||
{"MIDNIGHT BLUE", 47, 47, 79},
|
||||
{"NAVY", 35, 35, 142},
|
||||
{"ORANGE", 204, 50, 50},
|
||||
{"ORANGE RED", 255, 0, 127},
|
||||
{"ORCHID", 219, 112, 219},
|
||||
{"PALE GREEN", 143, 188, 143},
|
||||
{"PINK", 188, 143, 234},
|
||||
{"PLUM", 234, 173, 234},
|
||||
{"PURPLE", 176, 0, 255},
|
||||
{"RED", 255, 0, 0},
|
||||
{"SALMON", 111, 66, 66},
|
||||
{"SEA GREEN", 35, 142, 107},
|
||||
{"SIENNA", 142, 107, 35},
|
||||
{"SKY BLUE", 50, 153, 204},
|
||||
{"SLATE BLUE", 0, 127, 255},
|
||||
{"SPRING GREEN", 0, 255, 127},
|
||||
{"STEEL BLUE", 35, 107, 142},
|
||||
{"TAN", 219, 147, 112},
|
||||
{"THISTLE", 216, 191, 216},
|
||||
{"TURQUOISE", 173, 234, 234},
|
||||
{"VIOLET", 79, 47, 79},
|
||||
{"VIOLET RED", 204, 50, 153},
|
||||
{"WHEAT", 216, 216, 191},
|
||||
{"WHITE", 255, 255, 255},
|
||||
{"YELLOW", 255, 255, 0},
|
||||
{"YELLOW GREEN", 153, 204, 50},
|
||||
{_T("DARK GREEN"), 47, 79, 47},
|
||||
{_T("DARK OLIVE GREEN"), 79, 79, 47},
|
||||
{_T("DARK ORCHID"), 153, 50, 204},
|
||||
{_T("DARK SLATE BLUE"), 107, 35, 142},
|
||||
{_T("DARK SLATE GREY"), 47, 79, 79},
|
||||
{_T("DARK TURQUOISE"), 112, 147, 219},
|
||||
{_T("DIM GREY"), 84, 84, 84},
|
||||
{_T("FIREBRICK"), 142, 35, 35},
|
||||
{_T("FOREST GREEN"), 35, 142, 35},
|
||||
{_T("GOLD"), 204, 127, 50},
|
||||
{_T("GOLDENROD"), 219, 219, 112},
|
||||
{_T("GREY"), 128, 128, 128},
|
||||
{_T("GREEN"), 0, 255, 0},
|
||||
{_T("GREEN YELLOW"), 147, 219, 112},
|
||||
{_T("INDIAN RED"), 79, 47, 47},
|
||||
{_T("KHAKI"), 159, 159, 95},
|
||||
{_T("LIGHT BLUE"), 191, 216, 216},
|
||||
{_T("LIGHT GREY"), 192, 192, 192},
|
||||
{_T("LIGHT STEEL BLUE"), 143, 143, 188},
|
||||
{_T("LIME GREEN"), 50, 204, 50},
|
||||
{_T("LIGHT MAGENTA"), 255, 0, 255},
|
||||
{_T("MAGENTA"), 255, 0, 255},
|
||||
{_T("MAROON"), 142, 35, 107},
|
||||
{_T("MEDIUM AQUAMARINE"), 50, 204, 153},
|
||||
{_T("MEDIUM GREY"), 100, 100, 100},
|
||||
{_T("MEDIUM BLUE"), 50, 50, 204},
|
||||
{_T("MEDIUM FOREST GREEN"), 107, 142, 35},
|
||||
{_T("MEDIUM GOLDENROD"), 234, 234, 173},
|
||||
{_T("MEDIUM ORCHID"), 147, 112, 219},
|
||||
{_T("MEDIUM SEA GREEN"), 66, 111, 66},
|
||||
{_T("MEDIUM SLATE BLUE"), 127, 0, 255},
|
||||
{_T("MEDIUM SPRING GREEN"), 127, 255, 0},
|
||||
{_T("MEDIUM TURQUOISE"), 112, 219, 219},
|
||||
{_T("MEDIUM VIOLET RED"), 219, 112, 147},
|
||||
{_T("MIDNIGHT BLUE"), 47, 47, 79},
|
||||
{_T("NAVY"), 35, 35, 142},
|
||||
{_T("ORANGE"), 204, 50, 50},
|
||||
{_T("ORANGE RED"), 255, 0, 127},
|
||||
{_T("ORCHID"), 219, 112, 219},
|
||||
{_T("PALE GREEN"), 143, 188, 143},
|
||||
{_T("PINK"), 188, 143, 234},
|
||||
{_T("PLUM"), 234, 173, 234},
|
||||
{_T("PURPLE"), 176, 0, 255},
|
||||
{_T("RED"), 255, 0, 0},
|
||||
{_T("SALMON"), 111, 66, 66},
|
||||
{_T("SEA GREEN"), 35, 142, 107},
|
||||
{_T("SIENNA"), 142, 107, 35},
|
||||
{_T("SKY BLUE"), 50, 153, 204},
|
||||
{_T("SLATE BLUE"), 0, 127, 255},
|
||||
{_T("SPRING GREEN"), 0, 255, 127},
|
||||
{_T("STEEL BLUE"), 35, 107, 142},
|
||||
{_T("TAN"), 219, 147, 112},
|
||||
{_T("THISTLE"), 216, 191, 216},
|
||||
{_T("TURQUOISE"), 173, 234, 234},
|
||||
{_T("VIOLET"), 79, 47, 79},
|
||||
{_T("VIOLET RED"), 204, 50, 153},
|
||||
{_T("WHEAT"), 216, 216, 191},
|
||||
{_T("WHITE"), 255, 255, 255},
|
||||
{_T("YELLOW"), 255, 255, 0},
|
||||
{_T("YELLOW GREEN"), 153, 204, 50},
|
||||
// #endif
|
||||
|
||||
#if defined(__WXGTK__) || defined(__X__)
|
||||
{"MEDIUM GOLDENROD", 234, 234, 173},
|
||||
{"MEDIUM FOREST GREEN", 107, 142, 35},
|
||||
{"LIGHT MAGENTA", 255, 0, 255},
|
||||
{"MEDIUM GREY", 100, 100, 100},
|
||||
{_T("MEDIUM GOLDENROD"), 234, 234, 173},
|
||||
{_T("MEDIUM FOREST GREEN"), 107, 142, 35},
|
||||
{_T("LIGHT MAGENTA"), 255, 0, 255},
|
||||
{_T("MEDIUM GREY"), 100, 100, 100},
|
||||
#endif
|
||||
|
||||
{0,0,0,0}
|
||||
@@ -331,7 +331,7 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
|
||||
|
||||
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
|
||||
{
|
||||
const char *found = node->GetKeyString();
|
||||
const wxChar *found = node->GetKeyString();
|
||||
if (found)
|
||||
return wxString(found);
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ void wxHashTable::Put (long key, long value, wxObject * object)
|
||||
hash_table[position]->Append (value, object);
|
||||
}
|
||||
|
||||
void wxHashTable::Put (long key, const char *value, wxObject * object)
|
||||
void wxHashTable::Put (long key, const wxChar *value, wxObject * object)
|
||||
{
|
||||
// Should NEVER be
|
||||
long k = (long) key;
|
||||
@@ -120,7 +120,7 @@ void wxHashTable::Put (long key, wxObject * object)
|
||||
hash_table[position]->Append (k, object);
|
||||
}
|
||||
|
||||
void wxHashTable::Put (const char *key, wxObject * object)
|
||||
void wxHashTable::Put (const wxChar *key, wxObject * object)
|
||||
{
|
||||
int position = (int) (MakeKey (key) % n);
|
||||
|
||||
@@ -150,7 +150,7 @@ wxObject *wxHashTable::Get (long key, long value) const
|
||||
}
|
||||
}
|
||||
|
||||
wxObject *wxHashTable::Get (long key, const char *value) const
|
||||
wxObject *wxHashTable::Get (long key, const wxChar *value) const
|
||||
{
|
||||
// Should NEVER be
|
||||
long k = (long) key;
|
||||
@@ -187,7 +187,7 @@ wxObject *wxHashTable::Get (long key) const
|
||||
}
|
||||
}
|
||||
|
||||
wxObject *wxHashTable::Get (const char *key) const
|
||||
wxObject *wxHashTable::Get (const wxChar *key) const
|
||||
{
|
||||
int position = (int) (MakeKey (key) % n);
|
||||
|
||||
@@ -224,7 +224,7 @@ wxObject *wxHashTable::Delete (long key)
|
||||
}
|
||||
}
|
||||
|
||||
wxObject *wxHashTable::Delete (const char *key)
|
||||
wxObject *wxHashTable::Delete (const wxChar *key)
|
||||
{
|
||||
int position = (int) (MakeKey (key) % n);
|
||||
if (!hash_table[position])
|
||||
@@ -267,7 +267,7 @@ wxObject *wxHashTable::Delete (long key, int value)
|
||||
}
|
||||
}
|
||||
|
||||
wxObject *wxHashTable::Delete (long key, const char *value)
|
||||
wxObject *wxHashTable::Delete (long key, const wxChar *value)
|
||||
{
|
||||
int position = (int) (key % n);
|
||||
if (!hash_table[position])
|
||||
@@ -286,12 +286,12 @@ wxObject *wxHashTable::Delete (long key, const char *value)
|
||||
}
|
||||
}
|
||||
|
||||
long wxHashTable::MakeKey (const char *string) const
|
||||
long wxHashTable::MakeKey (const wxChar *string) const
|
||||
{
|
||||
long int_key = 0;
|
||||
|
||||
while (*string)
|
||||
int_key += (unsigned char) *string++;
|
||||
int_key += (wxUChar) *string++;
|
||||
|
||||
return int_key;
|
||||
}
|
||||
|
@@ -156,15 +156,15 @@ wxImage wxImage::Scale( int width, int height )
|
||||
{
|
||||
wxImage image;
|
||||
|
||||
wxCHECK_MSG( Ok(), image, "invlaid image" );
|
||||
wxCHECK_MSG( Ok(), image, _T("invalid image") );
|
||||
|
||||
wxCHECK_MSG( (width > 0) && (height > 0), image, "invalid image size" );
|
||||
wxCHECK_MSG( (width > 0) && (height > 0), image, _T("invalid image size") );
|
||||
|
||||
image.Create( width, height );
|
||||
|
||||
char unsigned *data = image.GetData();
|
||||
|
||||
wxCHECK_MSG( data, image, "unable to create image" );
|
||||
wxCHECK_MSG( data, image, _T("unable to create image") );
|
||||
|
||||
if (M_IMGDATA->m_hasMask)
|
||||
image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue );
|
||||
@@ -193,12 +193,12 @@ wxImage wxImage::Scale( int width, int height )
|
||||
|
||||
void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b )
|
||||
{
|
||||
wxCHECK_RET( Ok(), "invalid image" );
|
||||
wxCHECK_RET( Ok(), _T("invalid image") );
|
||||
|
||||
int w = M_IMGDATA->m_width;
|
||||
int h = M_IMGDATA->m_height;
|
||||
|
||||
wxCHECK_RET( (x>=0) && (y>=0) && (x<w) && (y<h), "invalid image index" );
|
||||
wxCHECK_RET( (x>=0) && (y>=0) && (x<w) && (y<h), _T("invalid image index") );
|
||||
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
@@ -209,12 +209,12 @@ void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned c
|
||||
|
||||
unsigned char wxImage::GetRed( int x, int y )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
int w = M_IMGDATA->m_width;
|
||||
int h = M_IMGDATA->m_height;
|
||||
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, "invalid image index" );
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, _T("invalid image index") );
|
||||
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
@@ -223,12 +223,12 @@ unsigned char wxImage::GetRed( int x, int y )
|
||||
|
||||
unsigned char wxImage::GetGreen( int x, int y )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
int w = M_IMGDATA->m_width;
|
||||
int h = M_IMGDATA->m_height;
|
||||
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, "invalid image index" );
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, _T("invalid image index") );
|
||||
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
@@ -237,12 +237,12 @@ unsigned char wxImage::GetGreen( int x, int y )
|
||||
|
||||
unsigned char wxImage::GetBlue( int x, int y )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
int w = M_IMGDATA->m_width;
|
||||
int h = M_IMGDATA->m_height;
|
||||
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, "invalid image index" );
|
||||
wxCHECK_MSG( (x>=0) && (y>=0) && (x<w) && (y<h), 0, _T("invalid image index") );
|
||||
|
||||
long pos = (y * w + x) * 3;
|
||||
|
||||
@@ -256,21 +256,21 @@ bool wxImage::Ok() const
|
||||
|
||||
char unsigned *wxImage::GetData() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), (char unsigned *)NULL, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), (char unsigned *)NULL, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_data;
|
||||
}
|
||||
|
||||
void wxImage::SetData( char unsigned *data )
|
||||
{
|
||||
wxCHECK_RET( Ok(), "invalid image" );
|
||||
wxCHECK_RET( Ok(), _T("invalid image") );
|
||||
|
||||
memcpy(M_IMGDATA->m_data, data, M_IMGDATA->m_width * M_IMGDATA->m_height * 3);
|
||||
}
|
||||
|
||||
void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
|
||||
{
|
||||
wxCHECK_RET( Ok(), "invalid image" );
|
||||
wxCHECK_RET( Ok(), _T("invalid image") );
|
||||
|
||||
M_IMGDATA->m_maskRed = r;
|
||||
M_IMGDATA->m_maskGreen = g;
|
||||
@@ -280,49 +280,49 @@ void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
|
||||
|
||||
unsigned char wxImage::GetMaskRed() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_maskRed;
|
||||
}
|
||||
|
||||
unsigned char wxImage::GetMaskGreen() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_maskGreen;
|
||||
}
|
||||
|
||||
unsigned char wxImage::GetMaskBlue() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_maskBlue;
|
||||
}
|
||||
|
||||
void wxImage::SetMask( bool mask )
|
||||
{
|
||||
wxCHECK_RET( Ok(), "invalid image" );
|
||||
wxCHECK_RET( Ok(), _T("invalid image") );
|
||||
|
||||
M_IMGDATA->m_hasMask = mask;
|
||||
}
|
||||
|
||||
bool wxImage::HasMask() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), FALSE, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_hasMask;
|
||||
}
|
||||
|
||||
int wxImage::GetWidth() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_width;
|
||||
}
|
||||
|
||||
int wxImage::GetHeight() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), 0, _T("invalid image") );
|
||||
|
||||
return M_IMGDATA->m_height;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ bool wxImage::LoadFile( const wxString& filename, long type )
|
||||
}
|
||||
|
||||
else {
|
||||
wxLogError( "Can't load image from file '%s': file does not exist.", filename.c_str() );
|
||||
wxLogError( _T("Can't load image from file '%s': file does not exist."), filename.c_str() );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
|
||||
}
|
||||
|
||||
else {
|
||||
wxLogError( "Can't load image from file '%s': file does not exist.", filename.c_str() );
|
||||
wxLogError( _T("Can't load image from file '%s': file does not exist."), filename.c_str() );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type )
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
wxLogWarning( "No image handler for type %d defined.", type );
|
||||
wxLogWarning( _T("No image handler for type %d defined."), type );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype )
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
wxLogWarning( "No image handler for type %s defined.", mimetype.GetData() );
|
||||
wxLogWarning( _T("No image handler for type %s defined."), mimetype.GetData() );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -428,13 +428,13 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype )
|
||||
|
||||
bool wxImage::SaveFile( wxOutputStream& stream, int type )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), FALSE, _T("invalid image") );
|
||||
|
||||
wxImageHandler *handler = FindHandler(type);
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
wxLogWarning( "No image handler for type %d defined.", type );
|
||||
wxLogWarning( _T("No image handler for type %d defined."), type );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -444,13 +444,13 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type )
|
||||
|
||||
bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), FALSE, _T("invalid image") );
|
||||
|
||||
wxImageHandler *handler = FindHandlerMime(mimetype);
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
wxLogWarning( "No image handler for type %s defined.", mimetype.GetData() );
|
||||
wxLogWarning( _T("No image handler for type %s defined."), mimetype.GetData() );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -630,12 +630,12 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
int height = (int)dbuf[1];
|
||||
if (width > 32767)
|
||||
{
|
||||
wxLogError( "Image width > 32767 pixels for file\n" );
|
||||
wxLogError( _T("Image width > 32767 pixels for file\n") );
|
||||
return FALSE;
|
||||
}
|
||||
if (height > 32767)
|
||||
{
|
||||
wxLogError( "Image height > 32767 pixels for file\n" );
|
||||
wxLogError( _T("Image height > 32767 pixels for file\n") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(&word, 2);
|
||||
@@ -644,14 +644,14 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
bpp = (int)word;
|
||||
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
|
||||
{
|
||||
wxLogError( "unknown bitdepth in file\n" );
|
||||
wxLogError( _T("unknown bitdepth in file\n") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(dbuf, 4 * 4);
|
||||
comp = (int)dbuf[0];
|
||||
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
||||
{
|
||||
wxLogError( "unknown encoding in Windows BMP file\n" );
|
||||
wxLogError( _T("unknown encoding in Windows BMP file\n") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(dbuf, 4 * 2);
|
||||
@@ -661,7 +661,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
/* some more sanity checks */
|
||||
if (((comp == BI_RLE4) && (bpp != 4)) || ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
|
||||
{
|
||||
wxLogError( "encoding of BMP doesn't match bitdepth\n" );
|
||||
wxLogError( _T("encoding of BMP doesn't match bitdepth\n") );
|
||||
return FALSE;
|
||||
}
|
||||
if (bpp < 16)
|
||||
@@ -670,7 +670,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
|
||||
if (!cmap)
|
||||
{
|
||||
wxLogError( "Cannot allocate RAM for color map in BMP file\n" );
|
||||
wxLogError( _T("Cannot allocate RAM for color map in BMP file\n") );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -681,7 +681,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
ptr = image->GetData();
|
||||
if (!ptr)
|
||||
{
|
||||
wxLogError( "Cannot allocate RAM for RGB data in file\n" );
|
||||
wxLogError( _T("Cannot allocate RAM for RGB data in file\n") );
|
||||
if (cmap)
|
||||
free(cmap);
|
||||
return FALSE;
|
||||
@@ -795,7 +795,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
{
|
||||
if (comp == BI_RLE4)
|
||||
{
|
||||
wxLogError( "can't deal with 4bit encoded yet.\n");
|
||||
wxLogError( _T("can't deal with 4bit encoded yet.\n") );
|
||||
image->Destroy();
|
||||
free(cmap);
|
||||
return FALSE;
|
||||
@@ -973,7 +973,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
|
||||
// set bitmap parameters
|
||||
wxBitmap bitmap;
|
||||
wxCHECK_MSG( Ok(), bitmap, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), bitmap, _T("invalid image") );
|
||||
bitmap.SetWidth( width );
|
||||
bitmap.SetHeight( bmpHeight );
|
||||
bitmap.SetDepth( wxDisplayDepth() );
|
||||
@@ -981,7 +981,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
// create a DIB header
|
||||
int headersize = sizeof(BITMAPINFOHEADER);
|
||||
LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize );
|
||||
wxCHECK_MSG( lpDIBh, bitmap, "could not allocate memory for DIB header" );
|
||||
wxCHECK_MSG( lpDIBh, bitmap, _T("could not allocate memory for DIB header") );
|
||||
// Fill in the DIB header
|
||||
lpDIBh->bmiHeader.biSize = headersize;
|
||||
lpDIBh->bmiHeader.biWidth = (DWORD)width;
|
||||
@@ -1002,7 +1002,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
lpBits = (unsigned char *)malloc( lpDIBh->bmiHeader.biSizeImage );
|
||||
if( !lpBits )
|
||||
{
|
||||
wxFAIL_MSG( "could not allocate memory for DIB" );
|
||||
wxFAIL_MSG( _T("could not allocate memory for DIB") );
|
||||
free( lpDIBh );
|
||||
return bitmap;
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
// check the bitmap
|
||||
if( !bitmap.Ok() )
|
||||
{
|
||||
wxFAIL_MSG( "invalid bitmap" );
|
||||
wxFAIL_MSG( _T("invalid bitmap") );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1156,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
unsigned char *data = GetData();
|
||||
if( !data )
|
||||
{
|
||||
wxFAIL_MSG( "could not allocate data for image" );
|
||||
wxFAIL_MSG( _T("could not allocate data for image") );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1176,7 +1176,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize );
|
||||
if( !lpDIBh )
|
||||
{
|
||||
wxFAIL_MSG( "could not allocate data for DIB header" );
|
||||
wxFAIL_MSG( _T("could not allocate data for DIB header") );
|
||||
free( data );
|
||||
return;
|
||||
}
|
||||
@@ -1198,7 +1198,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
lpBits = (unsigned char *) malloc( lpDIBh->bmiHeader.biSizeImage );
|
||||
if( !lpBits )
|
||||
{
|
||||
wxFAIL_MSG( "could not allocate data for DIB" );
|
||||
wxFAIL_MSG( _T("could not allocate data for DIB") );
|
||||
free( data );
|
||||
free( lpDIBh );
|
||||
return;
|
||||
@@ -1281,7 +1281,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
{
|
||||
wxBitmap bitmap;
|
||||
|
||||
wxCHECK_MSG( Ok(), bitmap, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), bitmap, _T("invalid image") );
|
||||
|
||||
int width = GetWidth();
|
||||
int height = GetHeight();
|
||||
@@ -1460,13 +1460,13 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
|
||||
wxImage::wxImage( const wxBitmap &bitmap )
|
||||
{
|
||||
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
|
||||
wxCHECK_RET( bitmap.Ok(), _T("invalid bitmap") );
|
||||
|
||||
GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
|
||||
0, 0,
|
||||
bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
|
||||
wxCHECK_RET( gdk_image, "couldn't create image" );
|
||||
wxCHECK_RET( gdk_image, _T("couldn't create image") );
|
||||
|
||||
Create( bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
char unsigned *data = GetData();
|
||||
@@ -1474,7 +1474,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
if (!data)
|
||||
{
|
||||
gdk_image_destroy( gdk_image );
|
||||
wxFAIL_MSG( "couldn't create image" );
|
||||
wxFAIL_MSG( _T("couldn't create image") );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1554,7 +1554,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
{
|
||||
wxBitmap bitmap;
|
||||
|
||||
wxCHECK_MSG( Ok(), bitmap, "invalid image" );
|
||||
wxCHECK_MSG( Ok(), bitmap, _T("invalid image") );
|
||||
|
||||
int width = GetWidth();
|
||||
int height = GetHeight();
|
||||
@@ -1758,7 +1758,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
|
||||
wxImage::wxImage( const wxBitmap &bitmap )
|
||||
{
|
||||
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
|
||||
wxCHECK_RET( bitmap.Ok(), _T("invalid bitmap") );
|
||||
|
||||
Display *dpy = (Display*) wxGetDisplay();
|
||||
Visual* vis = DefaultVisual( dpy, DefaultScreen( dpy ) );
|
||||
@@ -1770,7 +1770,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
bitmap.GetWidth(), bitmap.GetHeight(),
|
||||
AllPlanes, ZPixmap );
|
||||
|
||||
wxCHECK_RET( ximage, "couldn't create image" );
|
||||
wxCHECK_RET( ximage, _T("couldn't create image") );
|
||||
|
||||
Create( bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
char unsigned *data = GetData();
|
||||
@@ -1778,7 +1778,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
if (!data)
|
||||
{
|
||||
XDestroyImage( ximage );
|
||||
wxFAIL_MSG( "couldn't create image" );
|
||||
wxFAIL_MSG( _T("couldn't create image") );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1891,4 +1891,3 @@ public:
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxImageModule, wxModule)
|
||||
|
||||
|
@@ -390,7 +390,7 @@ bool wxGIFHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
decod = new gifDecoder(&stream);
|
||||
|
||||
if (decod -> readgif(&igif) != E_OK) {
|
||||
wxLogDebug("Error reading GIF");
|
||||
wxLogDebug(_T("Error reading GIF"));
|
||||
delete decod;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ bool wxGIFHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
|
||||
bool wxGIFHandler::SaveFile( wxImage *image, wxOutputStream& stream )
|
||||
{
|
||||
wxLogDebug("wxGIFHandler is read-only!!");
|
||||
wxLogDebug(_T("wxGIFHandler is read-only!!"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -59,12 +59,12 @@ bool wxListKey::operator==(wxListKeyValue value) const
|
||||
switch ( m_keyType )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG("bad key type.");
|
||||
wxFAIL_MSG(_T("bad key type."));
|
||||
// let compiler optimize the line above away in release build
|
||||
// by not putting return here...
|
||||
|
||||
case wxKEY_STRING:
|
||||
return strcmp(m_key.string, value.string) == 0;
|
||||
return wxStrcmp(m_key.string, value.string) == 0;
|
||||
|
||||
case wxKEY_INTEGER:
|
||||
return m_key.integer == value.integer;
|
||||
@@ -95,11 +95,11 @@ wxNodeBase::wxNodeBase(wxListBase *list,
|
||||
|
||||
case wxKEY_STRING:
|
||||
// to be free()d later
|
||||
m_key.string = strdup(key.GetString());
|
||||
m_key.string = wxStrdup(key.GetString());
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("invalid key type");
|
||||
wxFAIL_MSG(_T("invalid key type"));
|
||||
}
|
||||
|
||||
if ( previous )
|
||||
@@ -127,7 +127,7 @@ wxNodeBase::~wxNodeBase()
|
||||
|
||||
int wxNodeBase::IndexOf() const
|
||||
{
|
||||
wxCHECK_MSG( m_list, wxNOT_FOUND, "node doesn't belong to a list in IndexOf");
|
||||
wxCHECK_MSG( m_list, wxNOT_FOUND, _T("node doesn't belong to a list in IndexOf"));
|
||||
|
||||
// It would be more efficient to implement IndexOf() completely inside
|
||||
// wxListBase (only traverse the list once), but this is probably a more
|
||||
@@ -170,7 +170,7 @@ wxListBase::wxListBase(size_t count, void *elements[])
|
||||
void wxListBase::DoCopy(const wxListBase& list)
|
||||
{
|
||||
wxASSERT_MSG( !list.m_destroy,
|
||||
"copying list which owns it's elements is a bad idea" );
|
||||
_T("copying list which owns it's elements is a bad idea") );
|
||||
|
||||
m_count = list.m_count;
|
||||
m_destroy = list.m_destroy;
|
||||
@@ -217,7 +217,7 @@ wxNodeBase *wxListBase::Append(void *object)
|
||||
{
|
||||
// all objects in a keyed list should have a key
|
||||
wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL,
|
||||
"need a key for the object to append" );
|
||||
_T("need a key for the object to append") );
|
||||
|
||||
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object);
|
||||
|
||||
@@ -229,18 +229,18 @@ wxNodeBase *wxListBase::Append(long key, void *object)
|
||||
wxCHECK_MSG( (m_keyType == wxKEY_INTEGER) ||
|
||||
(m_keyType == wxKEY_NONE && m_count == 0),
|
||||
(wxNodeBase *)NULL,
|
||||
"can't append object with numeric key to this list" );
|
||||
_T("can't append object with numeric key to this list") );
|
||||
|
||||
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key);
|
||||
return AppendCommon(node);
|
||||
}
|
||||
|
||||
wxNodeBase *wxListBase::Append (const char *key, void *object)
|
||||
wxNodeBase *wxListBase::Append (const wxChar *key, void *object)
|
||||
{
|
||||
wxCHECK_MSG( (m_keyType == wxKEY_STRING) ||
|
||||
(m_keyType == wxKEY_NONE && m_count == 0),
|
||||
(wxNodeBase *)NULL,
|
||||
"can't append object with string key to this list" );
|
||||
_T("can't append object with string key to this list") );
|
||||
|
||||
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key);
|
||||
return AppendCommon(node);
|
||||
@@ -250,10 +250,10 @@ wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object)
|
||||
{
|
||||
// all objects in a keyed list should have a key
|
||||
wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL,
|
||||
"need a key for the object to insert" );
|
||||
_T("need a key for the object to insert") );
|
||||
|
||||
wxCHECK_MSG( !position || position->m_list == this, (wxNodeBase *)NULL,
|
||||
"can't insert before a node from another list" );
|
||||
_T("can't insert before a node from another list") );
|
||||
|
||||
// previous and next node for the node being inserted
|
||||
wxNodeBase *prev, *next;
|
||||
@@ -295,7 +295,7 @@ wxNodeBase *wxListBase::Item(size_t n) const
|
||||
}
|
||||
}
|
||||
|
||||
wxFAIL_MSG( "invalid index in wxListBase::Item" );
|
||||
wxFAIL_MSG( _T("invalid index in wxListBase::Item") );
|
||||
|
||||
return (wxNodeBase *)NULL;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ wxNodeBase *wxListBase::Item(size_t n) const
|
||||
wxNodeBase *wxListBase::Find(const wxListKey& key) const
|
||||
{
|
||||
wxASSERT_MSG( m_keyType == key.GetKeyType(),
|
||||
"this list is not keyed on the type of this key" );
|
||||
_T("this list is not keyed on the type of this key") );
|
||||
|
||||
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||
{
|
||||
@@ -356,9 +356,9 @@ void wxListBase::DoDeleteNode(wxNodeBase *node)
|
||||
|
||||
wxNodeBase *wxListBase::DetachNode(wxNodeBase *node)
|
||||
{
|
||||
wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" );
|
||||
wxCHECK_MSG( node, NULL, _T("detaching NULL wxNodeBase") );
|
||||
wxCHECK_MSG( node->m_list == this, NULL,
|
||||
"detaching node which is not from this list" );
|
||||
_T("detaching node which is not from this list") );
|
||||
|
||||
// update the list
|
||||
wxNodeBase **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next
|
||||
@@ -524,13 +524,13 @@ void wxStringListNode::DeleteData()
|
||||
delete [] (char *)GetData();
|
||||
}
|
||||
|
||||
bool wxStringList::Delete(const char *s)
|
||||
bool wxStringList::Delete(const wxChar *s)
|
||||
{
|
||||
wxStringListNode *current;
|
||||
|
||||
for ( current = GetFirst(); current; current = current->GetNext() )
|
||||
{
|
||||
if ( strcmp(current->GetData(), s) == 0 )
|
||||
if ( wxStrcmp(current->GetData(), s) == 0 )
|
||||
{
|
||||
DeleteNode(current);
|
||||
return TRUE;
|
||||
@@ -554,7 +554,7 @@ void wxStringList::DoCopy(const wxStringList& other)
|
||||
|
||||
// Variable argument list, terminated by a zero
|
||||
// Makes new storage for the strings
|
||||
wxStringList::wxStringList (const char *first, ...)
|
||||
wxStringList::wxStringList (const wxChar *first, ...)
|
||||
{
|
||||
if ( !first )
|
||||
return;
|
||||
@@ -562,12 +562,12 @@ wxStringList::wxStringList (const char *first, ...)
|
||||
va_list ap;
|
||||
va_start(ap, first);
|
||||
|
||||
const char *s = first;
|
||||
const wxChar *s = first;
|
||||
for (;;)
|
||||
{
|
||||
Add(s);
|
||||
|
||||
s = va_arg(ap, const char *);
|
||||
s = va_arg(ap, const wxChar *);
|
||||
// if (s == NULL)
|
||||
#ifdef __WXMSW__
|
||||
if ((int) s == 0)
|
||||
@@ -581,13 +581,13 @@ wxStringList::wxStringList (const char *first, ...)
|
||||
}
|
||||
|
||||
// Only makes new strings if arg is TRUE
|
||||
char **wxStringList::ListToArray(bool new_copies) const
|
||||
wxChar **wxStringList::ListToArray(bool new_copies) const
|
||||
{
|
||||
char **string_array = new char *[GetCount()];
|
||||
wxChar **string_array = new wxChar *[GetCount()];
|
||||
wxStringListNode *node = GetFirst();
|
||||
for (size_t i = 0; i < GetCount(); i++)
|
||||
{
|
||||
char *s = node->GetData();
|
||||
wxChar *s = node->GetData();
|
||||
if ( new_copies )
|
||||
string_array[i] = copystring(s);
|
||||
else
|
||||
@@ -599,12 +599,12 @@ char **wxStringList::ListToArray(bool new_copies) const
|
||||
}
|
||||
|
||||
// Checks whether s is a member of the list
|
||||
bool wxStringList::Member(const char *s) const
|
||||
bool wxStringList::Member(const wxChar *s) const
|
||||
{
|
||||
for ( wxStringListNode *node = GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
const char *s1 = node->GetData();
|
||||
if (s == s1 || strcmp (s, s1) == 0)
|
||||
const wxChar *s1 = node->GetData();
|
||||
if (s == s1 || wxStrcmp (s, s1) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -614,17 +614,17 @@ bool wxStringList::Member(const char *s) const
|
||||
static int
|
||||
wx_comparestrings(const void *arg1, const void *arg2)
|
||||
{
|
||||
char **s1 = (char **) arg1;
|
||||
char **s2 = (char **) arg2;
|
||||
wxChar **s1 = (wxChar **) arg1;
|
||||
wxChar **s2 = (wxChar **) arg2;
|
||||
|
||||
return strcmp (*s1, *s2);
|
||||
return wxStrcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
// Sort a list of strings - deallocates old nodes, allocates new
|
||||
void wxStringList::Sort()
|
||||
{
|
||||
size_t N = GetCount();
|
||||
char **array = new char *[N];
|
||||
wxChar **array = new wxChar *[N];
|
||||
wxStringListNode *node;
|
||||
|
||||
size_t i = 0;
|
||||
@@ -633,7 +633,7 @@ void wxStringList::Sort()
|
||||
array[i++] = node->GetData();
|
||||
}
|
||||
|
||||
qsort (array, N, sizeof (char *), wx_comparestrings);
|
||||
qsort (array, N, sizeof (wxChar *), wx_comparestrings);
|
||||
|
||||
i = 0;
|
||||
for ( node = GetFirst(); node; node = node->GetNext() )
|
||||
|
@@ -93,15 +93,15 @@ static wxFrame *gs_pFrame; // FIXME MT-unsafe
|
||||
#define LOG_BUFFER_SIZE (4096)
|
||||
|
||||
// static buffer for error messages (FIXME MT-unsafe)
|
||||
static char s_szBuf[LOG_BUFFER_SIZE];
|
||||
static wxChar s_szBuf[LOG_BUFFER_SIZE];
|
||||
|
||||
// generic log function
|
||||
void wxLogGeneric(wxLogLevel level, const char *szFormat, ...)
|
||||
void wxLogGeneric(wxLogLevel level, const wxChar *szFormat, ...)
|
||||
{
|
||||
if ( wxLog::GetActiveTarget() != NULL ) {
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLog::OnLog(level, s_szBuf, time(NULL));
|
||||
@@ -109,12 +109,12 @@ void wxLogGeneric(wxLogLevel level, const char *szFormat, ...)
|
||||
}
|
||||
|
||||
#define IMPLEMENT_LOG_FUNCTION(level) \
|
||||
void wxLog##level(const char *szFormat, ...) \
|
||||
void wxLog##level(const wxChar *szFormat, ...) \
|
||||
{ \
|
||||
if ( wxLog::GetActiveTarget() != NULL ) { \
|
||||
va_list argptr; \
|
||||
va_start(argptr, szFormat); \
|
||||
vsprintf(s_szBuf, szFormat, argptr); \
|
||||
wxVsprintf(s_szBuf, szFormat, argptr); \
|
||||
va_end(argptr); \
|
||||
\
|
||||
wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
|
||||
@@ -130,13 +130,13 @@ IMPLEMENT_LOG_FUNCTION(Status)
|
||||
|
||||
// accepts an additional argument which tells to which frame the output should
|
||||
// be directed
|
||||
void wxLogStatus(wxFrame *pFrame, const char *szFormat, ...)
|
||||
void wxLogStatus(wxFrame *pFrame, const wxChar *szFormat, ...)
|
||||
{
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL ) {
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxASSERT( gs_pFrame == NULL ); // should be reset!
|
||||
@@ -147,13 +147,13 @@ void wxLogStatus(wxFrame *pFrame, const char *szFormat, ...)
|
||||
}
|
||||
|
||||
// same as info, but only if 'verbose' mode is on
|
||||
void wxLogVerbose(const char *szFormat, ...)
|
||||
void wxLogVerbose(const wxChar *szFormat, ...)
|
||||
{
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->GetVerbose() ) {
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLog::OnLog(wxLOG_Info, s_szBuf, time(NULL));
|
||||
@@ -163,33 +163,33 @@ void wxLogVerbose(const char *szFormat, ...)
|
||||
// debug functions
|
||||
#ifdef __WXDEBUG__
|
||||
#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
|
||||
void wxLog##level(const char *szFormat, ...) \
|
||||
void wxLog##level(const wxChar *szFormat, ...) \
|
||||
{ \
|
||||
if ( wxLog::GetActiveTarget() != NULL ) { \
|
||||
va_list argptr; \
|
||||
va_start(argptr, szFormat); \
|
||||
vsprintf(s_szBuf, szFormat, argptr); \
|
||||
wxVsprintf(s_szBuf, szFormat, argptr); \
|
||||
va_end(argptr); \
|
||||
\
|
||||
wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
|
||||
} \
|
||||
}
|
||||
|
||||
void wxLogTrace(const char *mask, const char *szFormat, ...)
|
||||
void wxLogTrace(const wxChar *mask, const wxChar *szFormat, ...)
|
||||
{
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
|
||||
if ( pLog != NULL && wxLog::IsAllowedTraceMask(mask) ) {
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
|
||||
}
|
||||
}
|
||||
|
||||
void wxLogTrace(wxTraceMask mask, const char *szFormat, ...)
|
||||
void wxLogTrace(wxTraceMask mask, const wxChar *szFormat, ...)
|
||||
{
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
|
||||
@@ -199,7 +199,7 @@ void wxLogVerbose(const char *szFormat, ...)
|
||||
if ( pLog != NULL && ((pLog->GetTraceMask() & mask) == mask) ) {
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
|
||||
@@ -219,28 +219,28 @@ IMPLEMENT_LOG_DEBUG_FUNCTION(Trace)
|
||||
// common part of both wxLogSysError
|
||||
void wxLogSysErrorHelper(long lErrCode)
|
||||
{
|
||||
char szErrMsg[LOG_BUFFER_SIZE / 2];
|
||||
sprintf(szErrMsg, _(" (error %ld: %s)"), lErrCode, wxSysErrorMsg(lErrCode));
|
||||
strncat(s_szBuf, szErrMsg, WXSIZEOF(s_szBuf) - strlen(s_szBuf));
|
||||
wxChar szErrMsg[LOG_BUFFER_SIZE / 2];
|
||||
wxSprintf(szErrMsg, _(" (error %ld: %s)"), lErrCode, wxSysErrorMsg(lErrCode));
|
||||
wxStrncat(s_szBuf, szErrMsg, WXSIZEOF(s_szBuf) - wxStrlen(s_szBuf));
|
||||
|
||||
wxLog::OnLog(wxLOG_Error, s_szBuf, time(NULL));
|
||||
}
|
||||
|
||||
void WXDLLEXPORT wxLogSysError(const char *szFormat, ...)
|
||||
void WXDLLEXPORT wxLogSysError(const wxChar *szFormat, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLogSysErrorHelper(wxSysErrorCode());
|
||||
}
|
||||
|
||||
void WXDLLEXPORT wxLogSysError(long lErrCode, const char *szFormat, ...)
|
||||
void WXDLLEXPORT wxLogSysError(long lErrCode, const wxChar *szFormat, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
vsprintf(s_szBuf, szFormat, argptr);
|
||||
wxVsprintf(s_szBuf, szFormat, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
wxLogSysErrorHelper(lErrCode);
|
||||
@@ -311,7 +311,7 @@ void wxLog::RemoveTraceMask(const wxString& str)
|
||||
ms_aTraceMasks.Remove((size_t)index);
|
||||
}
|
||||
|
||||
void wxLog::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
||||
{
|
||||
wxString str;
|
||||
|
||||
@@ -354,9 +354,9 @@ void wxLog::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
}
|
||||
}
|
||||
|
||||
void wxLog::DoLogString(const char *WXUNUSED(szString), time_t t)
|
||||
void wxLog::DoLogString(const wxChar *WXUNUSED(szString), time_t t)
|
||||
{
|
||||
wxFAIL_MSG("DoLogString must be overriden if it's called.");
|
||||
wxFAIL_MSG(_T("DoLogString must be overriden if it's called."));
|
||||
}
|
||||
|
||||
void wxLog::Flush()
|
||||
@@ -376,18 +376,18 @@ wxLogStderr::wxLogStderr(FILE *fp)
|
||||
m_fp = fp;
|
||||
}
|
||||
|
||||
void wxLogStderr::DoLogString(const char *szString, time_t t)
|
||||
void wxLogStderr::DoLogString(const wxChar *szString, time_t t)
|
||||
{
|
||||
wxString str(szString);
|
||||
str << '\n';
|
||||
str << _T('\n');
|
||||
|
||||
fputs(str, m_fp);
|
||||
fputs(str.mb_str(), m_fp);
|
||||
fflush(m_fp);
|
||||
|
||||
// under Windows, programs usually don't have stderr at all, so make show the
|
||||
// messages also under debugger
|
||||
#ifdef __WXMSW__
|
||||
OutputDebugString(str + '\r');
|
||||
OutputDebugString(str + _T('\r'));
|
||||
#endif // MSW
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ wxLogStream::wxLogStream(ostream *ostr)
|
||||
m_ostr = ostr;
|
||||
}
|
||||
|
||||
void wxLogStream::DoLogString(const char *szString, time_t t)
|
||||
void wxLogStream::DoLogString(const wxChar *szString, time_t t)
|
||||
{
|
||||
(*m_ostr) << szString << endl << flush;
|
||||
}
|
||||
@@ -469,10 +469,10 @@ void wxLogGui::Flush()
|
||||
if ( nLines > 25 ) // don't put too many lines in message box
|
||||
break;
|
||||
|
||||
str << m_aMessages[n - 1] << "\n";
|
||||
str << m_aMessages[n - 1] << _T("\n");
|
||||
}
|
||||
|
||||
const char *title;
|
||||
const wxChar *title;
|
||||
long style;
|
||||
|
||||
if ( m_bErrors ) {
|
||||
@@ -496,7 +496,7 @@ void wxLogGui::Flush()
|
||||
|
||||
// the default behaviour is to discard all informational messages if there
|
||||
// are any errors/warnings.
|
||||
void wxLogGui::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
||||
{
|
||||
switch ( level ) {
|
||||
case wxLOG_Info:
|
||||
@@ -532,12 +532,12 @@ void wxLogGui::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
#ifdef __WXMSW__
|
||||
// don't prepend debug/trace here: it goes to the
|
||||
// debug window anyhow, but do put a timestamp
|
||||
OutputDebugString(wxString(szString) + "\n\r");
|
||||
OutputDebugString(wxString(szString) + _T("\n\r"));
|
||||
#else
|
||||
// send them to stderr
|
||||
fprintf(stderr, "%s: %s\n",
|
||||
level == wxLOG_Trace ? "Trace" : "Debug",
|
||||
szString);
|
||||
(const char*)wxConv_libc.cWX2MB(szString));
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
@@ -586,7 +586,7 @@ class wxLogFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxLogFrame(wxFrame *pParent, wxLogWindow *log, const char *szTitle);
|
||||
wxLogFrame(wxFrame *pParent, wxLogWindow *log, const wxChar *szTitle);
|
||||
virtual ~wxLogFrame();
|
||||
|
||||
// menu callbacks
|
||||
@@ -626,7 +626,7 @@ BEGIN_EVENT_TABLE(wxLogFrame, wxFrame)
|
||||
EVT_CLOSE(wxLogFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxLogFrame::wxLogFrame(wxFrame *pParent, wxLogWindow *log, const char *szTitle)
|
||||
wxLogFrame::wxLogFrame(wxFrame *pParent, wxLogWindow *log, const wxChar *szTitle)
|
||||
: wxFrame(pParent, -1, szTitle)
|
||||
{
|
||||
m_log = log;
|
||||
@@ -667,7 +667,7 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// get the file name
|
||||
// -----------------
|
||||
const char *szFileName = wxSaveFileSelector("log", "txt", "log.txt");
|
||||
const wxChar *szFileName = wxSaveFileSelector(_T("log"), _T("txt"), _T("log.txt"));
|
||||
if ( szFileName == NULL ) {
|
||||
// cancelled
|
||||
return;
|
||||
@@ -747,7 +747,7 @@ wxLogFrame::~wxLogFrame()
|
||||
// wxLogWindow
|
||||
// -----------
|
||||
wxLogWindow::wxLogWindow(wxFrame *pParent,
|
||||
const char *szTitle,
|
||||
const wxChar *szTitle,
|
||||
bool bShow,
|
||||
bool bDoPass)
|
||||
{
|
||||
@@ -773,7 +773,7 @@ void wxLogWindow::Flush()
|
||||
m_bHasMessages = FALSE;
|
||||
}
|
||||
|
||||
void wxLogWindow::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
void wxLogWindow::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
||||
{
|
||||
// first let the previous logger show it
|
||||
if ( m_pOldLog != NULL && m_bPassMessages ) {
|
||||
@@ -812,7 +812,7 @@ void wxLogWindow::DoLog(wxLogLevel level, const char *szString, time_t t)
|
||||
m_bHasMessages = TRUE;
|
||||
}
|
||||
|
||||
void wxLogWindow::DoLogString(const char *szString, time_t t)
|
||||
void wxLogWindow::DoLogString(const wxChar *szString, time_t t)
|
||||
{
|
||||
// put the text into our window
|
||||
wxTextCtrl *pText = m_pLogFrame->TextCtrl();
|
||||
@@ -824,7 +824,7 @@ void wxLogWindow::DoLogString(const char *szString, time_t t)
|
||||
#endif // Windows
|
||||
|
||||
pText->WriteText(szString);
|
||||
pText->WriteText("\n"); // "\n" ok here (_not_ "\r\n")
|
||||
pText->WriteText(_T("\n")); // "\n" ok here (_not_ "\r\n")
|
||||
|
||||
// TODO ensure that the line can be seen
|
||||
}
|
||||
@@ -924,14 +924,14 @@ unsigned long wxSysErrorCode()
|
||||
}
|
||||
|
||||
// get error message from system
|
||||
const char *wxSysErrorMsg(unsigned long nErrCode)
|
||||
const wxChar *wxSysErrorMsg(unsigned long nErrCode)
|
||||
{
|
||||
if ( nErrCode == 0 )
|
||||
nErrCode = wxSysErrorCode();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#ifdef __WIN32__
|
||||
static char s_szBuf[LOG_BUFFER_SIZE / 2];
|
||||
static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
|
||||
|
||||
// get error message from system
|
||||
LPVOID lpMsgBuf;
|
||||
@@ -942,17 +942,17 @@ const char *wxSysErrorMsg(unsigned long nErrCode)
|
||||
0, NULL);
|
||||
|
||||
// copy it to our buffer and free memory
|
||||
strncpy(s_szBuf, (const char *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
|
||||
s_szBuf[WXSIZEOF(s_szBuf) - 1] = '\0';
|
||||
wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
|
||||
s_szBuf[WXSIZEOF(s_szBuf) - 1] = _T('\0');
|
||||
LocalFree(lpMsgBuf);
|
||||
|
||||
// returned string is capitalized and ended with '\r\n' - bad
|
||||
s_szBuf[0] = (char)tolower(s_szBuf[0]);
|
||||
size_t len = strlen(s_szBuf);
|
||||
s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]);
|
||||
size_t len = wxStrlen(s_szBuf);
|
||||
if ( len > 0 ) {
|
||||
// truncate string
|
||||
if ( s_szBuf[len - 2] == '\r' )
|
||||
s_szBuf[len - 2] = '\0';
|
||||
if ( s_szBuf[len - 2] == _T('\r') )
|
||||
s_szBuf[len - 2] = _T('\0');
|
||||
}
|
||||
|
||||
return s_szBuf;
|
||||
@@ -961,7 +961,13 @@ const char *wxSysErrorMsg(unsigned long nErrCode)
|
||||
return NULL;
|
||||
#endif // Win16/32
|
||||
#else // Unix
|
||||
#if wxUSE_UNICODE
|
||||
static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
|
||||
wxConv_libc.MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1);
|
||||
return s_szBuf;
|
||||
#else
|
||||
return strerror(nErrCode);
|
||||
#endif
|
||||
#endif // Win/Unix
|
||||
}
|
||||
|
||||
@@ -990,7 +996,7 @@ void Trap()
|
||||
}
|
||||
|
||||
// this function is called when an assert fails
|
||||
void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
|
||||
void wxOnAssert(const char *szFile, int nLine, const wxChar *szMsg)
|
||||
{
|
||||
// this variable can be set to true to suppress "assert failure" messages
|
||||
static bool s_bNoAsserts = FALSE;
|
||||
@@ -1007,23 +1013,27 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
|
||||
|
||||
s_bInAssert = TRUE;
|
||||
|
||||
char szBuf[LOG_BUFFER_SIZE];
|
||||
wxChar szBuf[LOG_BUFFER_SIZE];
|
||||
|
||||
// make life easier for people using VC++ IDE: clicking on the message
|
||||
// will take us immediately to the place of the failed assert
|
||||
#ifdef __VISUALC__
|
||||
sprintf(szBuf, "%s(%d): assert failed", szFile, nLine);
|
||||
sprintf(szBuf, _T("%s(%d): assert failed"), szFile, nLine);
|
||||
#else // !VC++
|
||||
// make the error message more clear for all the others
|
||||
sprintf(szBuf, "Assert failed in file %s at line %d", szFile, nLine);
|
||||
#ifdef wxSprintf
|
||||
wxSprintf(szBuf, _T("Assert failed in file %s at line %d"), szFile, nLine);
|
||||
#else
|
||||
wxSprintf(szBuf, _T("Assert failed in file %hs at line %d"), szFile, nLine);
|
||||
#endif
|
||||
#endif // VC/!VC
|
||||
|
||||
if ( szMsg != NULL ) {
|
||||
strcat(szBuf, ": ");
|
||||
strcat(szBuf, szMsg);
|
||||
wxStrcat(szBuf, _T(": "));
|
||||
wxStrcat(szBuf, szMsg);
|
||||
}
|
||||
else {
|
||||
strcat(szBuf, ".");
|
||||
wxStrcat(szBuf, _T("."));
|
||||
}
|
||||
|
||||
if ( !s_bNoAsserts ) {
|
||||
@@ -1035,9 +1045,9 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
|
||||
#else
|
||||
// this message is intentionally not translated - it is for
|
||||
// developpers only
|
||||
strcat(szBuf, "\nDo you want to stop the program?"
|
||||
wxStrcat(szBuf, _T("\nDo you want to stop the program?"
|
||||
"\nYou can also choose [Cancel] to suppress "
|
||||
"further warnings.");
|
||||
"further warnings."));
|
||||
|
||||
switch ( wxMessageBox(szBuf, _("Debug"),
|
||||
wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
|
||||
|
@@ -233,7 +233,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
wxASSERT_MSG( n == pos, "invalid position in MailCapEntry::Insert" );
|
||||
wxASSERT_MSG( n == pos, _T("invalid position in MailCapEntry::Insert") );
|
||||
|
||||
m_next = cur->m_next;
|
||||
cur->m_next = this;
|
||||
@@ -241,7 +241,7 @@ public:
|
||||
// append this element to the list
|
||||
void Append(MailCapEntry *next)
|
||||
{
|
||||
wxCHECK_RET( next != NULL, "Append()ing to what?" );
|
||||
wxCHECK_RET( next != NULL, _T("Append()ing to what?") );
|
||||
|
||||
// FIXME slooow...
|
||||
MailCapEntry *cur;
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
|
||||
cur->m_next = this;
|
||||
|
||||
wxASSERT_MSG( !m_next, "Append()ing element already in the list?" );
|
||||
wxASSERT_MSG( !m_next, _T("Append()ing element already in the list?") );
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -349,57 +349,57 @@ wxString wxFileType::ExpandCommand(const wxString& command,
|
||||
bool hasFilename = FALSE;
|
||||
|
||||
wxString str;
|
||||
for ( const char *pc = command.c_str(); *pc != '\0'; pc++ ) {
|
||||
if ( *pc == '%' ) {
|
||||
for ( const wxChar *pc = command.c_str(); *pc != _T('\0'); pc++ ) {
|
||||
if ( *pc == _T('%') ) {
|
||||
switch ( *++pc ) {
|
||||
case 's':
|
||||
case _T('s'):
|
||||
// '%s' expands into file name (quoted because it might
|
||||
// contain spaces) - except if there are already quotes
|
||||
// there because otherwise some programs may get confused
|
||||
// by double double quotes
|
||||
#if 0
|
||||
if ( *(pc - 2) == '"' )
|
||||
if ( *(pc - 2) == _T('"') )
|
||||
str << params.GetFileName();
|
||||
else
|
||||
str << '"' << params.GetFileName() << '"';
|
||||
str << _T('"') << params.GetFileName() << _T('"');
|
||||
#endif
|
||||
str << params.GetFileName();
|
||||
hasFilename = TRUE;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
case _T('t'):
|
||||
// '%t' expands into MIME type (quote it too just to be
|
||||
// consistent)
|
||||
str << '\'' << params.GetMimeType() << '\'';
|
||||
str << _T('\'') << params.GetMimeType() << _T('\'');
|
||||
break;
|
||||
|
||||
case '{':
|
||||
case _T('{'):
|
||||
{
|
||||
const char *pEnd = strchr(pc, '}');
|
||||
const wxChar *pEnd = wxStrchr(pc, _T('}'));
|
||||
if ( pEnd == NULL ) {
|
||||
wxString mimetype;
|
||||
wxLogWarning(_("Unmatched '{' in an entry for "
|
||||
"mime type %s."),
|
||||
params.GetMimeType().c_str());
|
||||
str << "%{";
|
||||
str << _T("%{");
|
||||
}
|
||||
else {
|
||||
wxString param(pc + 1, pEnd - pc - 1);
|
||||
str << '\'' << params.GetParamValue(param) << '\'';
|
||||
str << _T('\'') << params.GetParamValue(param) << _T('\'');
|
||||
pc = pEnd;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
case 'F':
|
||||
case _T('n'):
|
||||
case _T('F'):
|
||||
// TODO %n is the number of parts, %F is an array containing
|
||||
// the names of temp files these parts were written to
|
||||
// and their mime types.
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogDebug("Unknown field %%%c in command '%s'.",
|
||||
wxLogDebug(_T("Unknown field %%%c in command '%s'."),
|
||||
*pc, command.c_str());
|
||||
str << *pc;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ wxString wxFileType::ExpandCommand(const wxString& command,
|
||||
// metamail(1) man page states that if the mailcap entry doesn't have '%s'
|
||||
// the program will accept the data on stdin: so give it to it!
|
||||
if ( !hasFilename && !str.IsEmpty() ) {
|
||||
str << " < '" << params.GetFileName() << '\'';
|
||||
str << _T(" < '") << params.GetFileName() << _T('\'');
|
||||
}
|
||||
|
||||
return str;
|
||||
@@ -469,16 +469,16 @@ wxFileType::GetPrintCommand(wxString *printCmd,
|
||||
bool wxMimeTypesManager::IsOfType(const wxString& mimeType,
|
||||
const wxString& wildcard)
|
||||
{
|
||||
wxASSERT_MSG( mimeType.Find('*') == wxNOT_FOUND,
|
||||
"first MIME type can't contain wildcards" );
|
||||
wxASSERT_MSG( mimeType.Find(_T('*')) == wxNOT_FOUND,
|
||||
_T("first MIME type can't contain wildcards") );
|
||||
|
||||
// all comparaisons are case insensitive (2nd arg of IsSameAs() is FALSE)
|
||||
if ( wildcard.BeforeFirst('/').IsSameAs(mimeType.BeforeFirst('/'), FALSE) )
|
||||
if ( wildcard.BeforeFirst(_T('/')).IsSameAs(mimeType.BeforeFirst(_T('/')), FALSE) )
|
||||
{
|
||||
wxString strSubtype = wildcard.AfterFirst('/');
|
||||
wxString strSubtype = wildcard.AfterFirst(_T('/'));
|
||||
|
||||
if ( strSubtype == '*' ||
|
||||
strSubtype.IsSameAs(mimeType.AfterFirst('/'), FALSE) )
|
||||
if ( strSubtype == _T('*') ||
|
||||
strSubtype.IsSameAs(mimeType.AfterFirst(_T('/')), FALSE) )
|
||||
{
|
||||
// matches (either exactly or it's a wildcard)
|
||||
return TRUE;
|
||||
@@ -526,27 +526,27 @@ bool wxMimeTypesManager::ReadMimeTypes(const wxString& filename)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
|
||||
bool wxFileTypeImpl::GetCommand(wxString *command, const wxChar *verb) const
|
||||
{
|
||||
// suppress possible error messages
|
||||
wxLogNull nolog;
|
||||
wxString strKey;
|
||||
strKey << m_strFileType << "\\shell\\" << verb << "\\command";
|
||||
strKey << m_strFileType << _T("\\shell\\") << verb << _T("\\command");
|
||||
wxRegKey key(wxRegKey::HKCR, strKey);
|
||||
|
||||
if ( key.Open() ) {
|
||||
// it's the default value of the key
|
||||
if ( key.QueryValue("", *command) ) {
|
||||
if ( key.QueryValue(_T(""), *command) ) {
|
||||
// transform it from '%1' to '%s' style format string
|
||||
// NB: we don't make any attempt to verify that the string is valid,
|
||||
// i.e. doesn't contain %2, or second %1 or .... But we do make
|
||||
// sure that we return a string with _exactly_ one '%s'!
|
||||
size_t len = command->Len();
|
||||
for ( size_t n = 0; n < len; n++ ) {
|
||||
if ( command->GetChar(n) == '%' &&
|
||||
(n + 1 < len) && command->GetChar(n + 1) == '1' ) {
|
||||
if ( command->GetChar(n) == _T('%') &&
|
||||
(n + 1 < len) && command->GetChar(n + 1) == _T('1') ) {
|
||||
// replace it with '%s'
|
||||
command->SetChar(n + 1, 's');
|
||||
command->SetChar(n + 1, _T('s'));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
|
||||
|
||||
// we didn't find any '%1'!
|
||||
// HACK: append the filename at the end, hope that it will do
|
||||
*command << " %s";
|
||||
*command << _T(" %s");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -585,8 +585,8 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
|
||||
{
|
||||
// suppress possible error messages
|
||||
wxLogNull nolog;
|
||||
wxRegKey key(wxRegKey::HKCR, /*m_strFileType*/ "." + m_ext);
|
||||
if ( key.Open() && key.QueryValue("Content Type", *mimeType) ) {
|
||||
wxRegKey key(wxRegKey::HKCR, /*m_strFileType*/ _T(".") + m_ext);
|
||||
if ( key.Open() && key.QueryValue(_T("Content Type"), *mimeType) ) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -597,7 +597,7 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
|
||||
bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
|
||||
{
|
||||
wxString strIconKey;
|
||||
strIconKey << m_strFileType << "\\DefaultIcon";
|
||||
strIconKey << m_strFileType << _T("\\DefaultIcon");
|
||||
|
||||
// suppress possible error messages
|
||||
wxLogNull nolog;
|
||||
@@ -606,18 +606,18 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
|
||||
if ( key.Open() ) {
|
||||
wxString strIcon;
|
||||
// it's the default value of the key
|
||||
if ( key.QueryValue("", strIcon) ) {
|
||||
if ( key.QueryValue(_T(""), strIcon) ) {
|
||||
// the format is the following: <full path to file>, <icon index>
|
||||
// NB: icon index may be negative as well as positive and the full
|
||||
// path may contain the environment variables inside '%'
|
||||
wxString strFullPath = strIcon.BeforeLast(','),
|
||||
strIndex = strIcon.AfterLast(',');
|
||||
wxString strFullPath = strIcon.BeforeLast(_T(',')),
|
||||
strIndex = strIcon.AfterLast(_T(','));
|
||||
|
||||
// index may be omitted, in which case BeforeLast(',') is empty and
|
||||
// AfterLast(',') is the whole string
|
||||
if ( strFullPath.IsEmpty() ) {
|
||||
strFullPath = strIndex;
|
||||
strIndex = "0";
|
||||
strIndex = _T("0");
|
||||
}
|
||||
|
||||
wxString strExpPath = wxExpandEnvVars(strFullPath);
|
||||
@@ -627,7 +627,7 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
|
||||
switch ( (int)hIcon ) {
|
||||
case 0: // means no icons were found
|
||||
case 1: // means no such file or it wasn't a DLL/EXE/OCX/ICO/...
|
||||
wxLogDebug("incorrect registry entry '%s': no such icon.",
|
||||
wxLogDebug(_T("incorrect registry entry '%s': no such icon."),
|
||||
key.GetName().c_str());
|
||||
break;
|
||||
|
||||
@@ -650,7 +650,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
|
||||
|
||||
if ( key.Open() ) {
|
||||
// it's the default value of the key
|
||||
if ( key.QueryValue("", *desc) ) {
|
||||
if ( key.QueryValue(_T(""), *desc) ) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -664,8 +664,8 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
|
||||
{
|
||||
// add the leading point if necessary
|
||||
wxString str;
|
||||
if ( ext[0u] != '.' ) {
|
||||
str = '.';
|
||||
if ( ext[0u] != _T('.') ) {
|
||||
str = _T('.');
|
||||
}
|
||||
str << ext;
|
||||
|
||||
@@ -676,7 +676,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
|
||||
wxRegKey key(wxRegKey::HKCR, str);
|
||||
if ( key.Open() ) {
|
||||
// it's the default value of the key
|
||||
if ( key.QueryValue("", strFileType) ) {
|
||||
if ( key.QueryValue(_T(""), strFileType) ) {
|
||||
// create the new wxFileType object
|
||||
wxFileType *fileType = new wxFileType;
|
||||
fileType->m_impl->SetFileType(strFileType);
|
||||
@@ -696,7 +696,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
|
||||
{
|
||||
// HACK I don't know of any official documentation which mentions this
|
||||
// location, but as a matter of fact IE uses it, so why not we?
|
||||
static const char *szMimeDbase = "MIME\\Database\\Content Type\\";
|
||||
static const wxChar *szMimeDbase = _T("MIME\\Database\\Content Type\\");
|
||||
|
||||
wxString strKey = szMimeDbase;
|
||||
strKey << mimeType;
|
||||
@@ -707,7 +707,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
|
||||
wxString ext;
|
||||
wxRegKey key(wxRegKey::HKCR, strKey);
|
||||
if ( key.Open() ) {
|
||||
if ( key.QueryValue("Extension", ext) ) {
|
||||
if ( key.QueryValue(_T("Extension"), ext) ) {
|
||||
return GetFileTypeFromExtension(ext);
|
||||
}
|
||||
}
|
||||
@@ -727,14 +727,14 @@ wxFileTypeImpl::GetEntry(const wxFileType::MessageParameters& params) const
|
||||
// notice that an empty command would always succeed (it's ok)
|
||||
command = wxFileType::ExpandCommand(entry->GetTestCmd(), params);
|
||||
|
||||
if ( command.IsEmpty() || (system(command) == 0) ) {
|
||||
if ( command.IsEmpty() || (wxSystem(command) == 0) ) {
|
||||
// ok, passed
|
||||
wxLogTrace("Test '%s' for mime type '%s' succeeded.",
|
||||
wxLogTrace(_T("Test '%s' for mime type '%s' succeeded."),
|
||||
command.c_str(), params.GetMimeType().c_str());
|
||||
break;
|
||||
}
|
||||
else {
|
||||
wxLogTrace("Test '%s' for mime type '%s' failed.",
|
||||
wxLogTrace(_T("Test '%s' for mime type '%s' failed."),
|
||||
command.c_str(), params.GetMimeType().c_str());
|
||||
}
|
||||
|
||||
@@ -772,8 +772,8 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
|
||||
|
||||
// one extension in the space or comma delimitid list
|
||||
wxString strExt;
|
||||
for ( const char *p = strExtensions; ; p++ ) {
|
||||
if ( *p == ' ' || *p == ',' || *p == '\0' ) {
|
||||
for ( const wxChar *p = strExtensions; ; p++ ) {
|
||||
if ( *p == _T(' ') || *p == _T(',') || *p == _T('\0') ) {
|
||||
if ( !strExt.IsEmpty() ) {
|
||||
extensions.Add(strExt);
|
||||
strExt.Empty();
|
||||
@@ -781,13 +781,13 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
|
||||
//else: repeated spaces (shouldn't happen, but it's not that
|
||||
// important if it does happen)
|
||||
|
||||
if ( *p == '\0' )
|
||||
if ( *p == _T('\0') )
|
||||
break;
|
||||
}
|
||||
else if ( *p == '.' ) {
|
||||
else if ( *p == _T('.') ) {
|
||||
// remove the dot from extension (but only if it's the first char)
|
||||
if ( !strExt.IsEmpty() ) {
|
||||
strExt += '.';
|
||||
strExt += _T('.');
|
||||
}
|
||||
//else: no, don't append it
|
||||
}
|
||||
@@ -804,40 +804,40 @@ wxMimeTypesManagerImpl::wxMimeTypesManagerImpl()
|
||||
{
|
||||
// directories where we look for mailcap and mime.types by default
|
||||
// (taken from metamail(1) sources)
|
||||
static const char *aStandardLocations[] =
|
||||
static const wxChar *aStandardLocations[] =
|
||||
{
|
||||
"/etc",
|
||||
"/usr/etc",
|
||||
"/usr/local/etc",
|
||||
"/etc/mail",
|
||||
"/usr/public/lib"
|
||||
_T("/etc"),
|
||||
_T("/usr/etc"),
|
||||
_T("/usr/local/etc"),
|
||||
_T("/etc/mail"),
|
||||
_T("/usr/public/lib")
|
||||
};
|
||||
|
||||
// first read the system wide file(s)
|
||||
for ( size_t n = 0; n < WXSIZEOF(aStandardLocations); n++ ) {
|
||||
wxString dir = aStandardLocations[n];
|
||||
|
||||
wxString file = dir + "/mailcap";
|
||||
wxString file = dir + _T("/mailcap");
|
||||
if ( wxFile::Exists(file) ) {
|
||||
ReadMailcap(file);
|
||||
}
|
||||
|
||||
file = dir + "/mime.types";
|
||||
file = dir + _T("/mime.types");
|
||||
if ( wxFile::Exists(file) ) {
|
||||
ReadMimeTypes(file);
|
||||
}
|
||||
}
|
||||
|
||||
wxString strHome = getenv("HOME");
|
||||
wxString strHome = wxGetenv(_T("HOME"));
|
||||
|
||||
// and now the users mailcap
|
||||
wxString strUserMailcap = strHome + "/.mailcap";
|
||||
wxString strUserMailcap = strHome + _T("/.mailcap");
|
||||
if ( wxFile::Exists(strUserMailcap) ) {
|
||||
ReadMailcap(strUserMailcap);
|
||||
}
|
||||
|
||||
// read the users mime.types
|
||||
wxString strUserMimeTypes = strHome + "/.mime.types";
|
||||
wxString strUserMimeTypes = strHome + _T("/.mime.types");
|
||||
if ( wxFile::Exists(strUserMimeTypes) ) {
|
||||
ReadMimeTypes(strUserMimeTypes);
|
||||
}
|
||||
@@ -850,8 +850,8 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
|
||||
for ( size_t n = 0; n < count; n++ ) {
|
||||
wxString extensions = m_aExtensions[n];
|
||||
while ( !extensions.IsEmpty() ) {
|
||||
wxString field = extensions.BeforeFirst(' ');
|
||||
extensions = extensions.AfterFirst(' ');
|
||||
wxString field = extensions.BeforeFirst(_T(' '));
|
||||
extensions = extensions.AfterFirst(_T(' '));
|
||||
|
||||
// consider extensions as not being case-sensitive
|
||||
if ( field.IsSameAs(ext, FALSE /* no case */) ) {
|
||||
@@ -881,12 +881,12 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
|
||||
// then try to find "text/*" as match for "text/plain" (for example)
|
||||
// NB: if mimeType doesn't contain '/' at all, BeforeFirst() will return
|
||||
// the whole string - ok.
|
||||
wxString strCategory = mimetype.BeforeFirst('/');
|
||||
wxString strCategory = mimetype.BeforeFirst(_T('/'));
|
||||
|
||||
size_t nCount = m_aTypes.Count();
|
||||
for ( size_t n = 0; n < nCount; n++ ) {
|
||||
if ( (m_aTypes[n].BeforeFirst('/') == strCategory ) &&
|
||||
m_aTypes[n].AfterFirst('/') == "*" ) {
|
||||
if ( (m_aTypes[n].BeforeFirst(_T('/')) == strCategory ) &&
|
||||
m_aTypes[n].AfterFirst(_T('/')) == _T("*") ) {
|
||||
index = n;
|
||||
break;
|
||||
}
|
||||
@@ -907,7 +907,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
|
||||
|
||||
bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
{
|
||||
wxLogTrace("--- Parsing mime.types file '%s' ---", strFileName.c_str());
|
||||
wxLogTrace(_T("--- Parsing mime.types file '%s' ---"), strFileName.c_str());
|
||||
|
||||
wxTextFile file(strFileName);
|
||||
if ( !file.Open() )
|
||||
@@ -917,7 +917,7 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
wxString strMimeType, strDesc, strExtensions;
|
||||
|
||||
size_t nLineCount = file.GetLineCount();
|
||||
const char *pc = NULL;
|
||||
const wxChar *pc = NULL;
|
||||
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
|
||||
if ( pc == NULL ) {
|
||||
// now we're at the start of the line
|
||||
@@ -929,29 +929,29 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
}
|
||||
|
||||
// skip whitespace
|
||||
while ( isspace(*pc) )
|
||||
while ( wxIsspace(*pc) )
|
||||
pc++;
|
||||
|
||||
// comment?
|
||||
if ( *pc == '#' ) {
|
||||
if ( *pc == _T('#') ) {
|
||||
// skip the whole line
|
||||
pc = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// detect file format
|
||||
const char *pEqualSign = strchr(pc, '=');
|
||||
const wxChar *pEqualSign = wxStrchr(pc, _T('='));
|
||||
if ( pEqualSign == NULL ) {
|
||||
// brief format
|
||||
// ------------
|
||||
|
||||
// first field is mime type
|
||||
for ( strMimeType.Empty(); !isspace(*pc) && *pc != '\0'; pc++ ) {
|
||||
for ( strMimeType.Empty(); !wxIsspace(*pc) && *pc != _T('\0'); pc++ ) {
|
||||
strMimeType += *pc;
|
||||
}
|
||||
|
||||
// skip whitespace
|
||||
while ( isspace(*pc) )
|
||||
while ( wxIsspace(*pc) )
|
||||
pc++;
|
||||
|
||||
// take all the rest of the string
|
||||
@@ -968,13 +968,13 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
wxString strLHS(pc, pEqualSign - pc);
|
||||
|
||||
// eat whitespace
|
||||
for ( pc = pEqualSign + 1; isspace(*pc); pc++ )
|
||||
for ( pc = pEqualSign + 1; wxIsspace(*pc); pc++ )
|
||||
;
|
||||
|
||||
const char *pEnd;
|
||||
if ( *pc == '"' ) {
|
||||
const wxChar *pEnd;
|
||||
if ( *pc == _T('"') ) {
|
||||
// the string is quoted and ends at the matching quote
|
||||
pEnd = strchr(++pc, '"');
|
||||
pEnd = wxStrchr(++pc, _T('"'));
|
||||
if ( pEnd == NULL ) {
|
||||
wxLogWarning(_("Mime.types file %s, line %d: unterminated "
|
||||
"quoted string."),
|
||||
@@ -983,7 +983,7 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
}
|
||||
else {
|
||||
// unquoted string ends at the first space
|
||||
for ( pEnd = pc; !isspace(*pEnd); pEnd++ )
|
||||
for ( pEnd = pc; !wxIsspace(*pEnd); pEnd++ )
|
||||
;
|
||||
}
|
||||
|
||||
@@ -991,30 +991,30 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
wxString strRHS(pc, pEnd - pc);
|
||||
|
||||
// check what follows this entry
|
||||
if ( *pEnd == '"' ) {
|
||||
if ( *pEnd == _T('"') ) {
|
||||
// skip this quote
|
||||
pEnd++;
|
||||
}
|
||||
|
||||
for ( pc = pEnd; isspace(*pc); pc++ )
|
||||
for ( pc = pEnd; wxIsspace(*pc); pc++ )
|
||||
;
|
||||
|
||||
// if there is something left, it may be either a '\\' to continue
|
||||
// the line or the next field of the same entry
|
||||
bool entryEnded = *pc == '\0',
|
||||
bool entryEnded = *pc == _T('\0'),
|
||||
nextFieldOnSameLine = FALSE;
|
||||
if ( !entryEnded ) {
|
||||
nextFieldOnSameLine = ((*pc != '\\') || (pc[1] != '\0'));
|
||||
nextFieldOnSameLine = ((*pc != _T('\\')) || (pc[1] != _T('\0')));
|
||||
}
|
||||
|
||||
// now see what we got
|
||||
if ( strLHS == "type" ) {
|
||||
if ( strLHS == _T("type") ) {
|
||||
strMimeType = strRHS;
|
||||
}
|
||||
else if ( strLHS == "desc" ) {
|
||||
else if ( strLHS == _T("desc") ) {
|
||||
strDesc = strRHS;
|
||||
}
|
||||
else if ( strLHS == "exts" ) {
|
||||
else if ( strLHS == _T("exts") ) {
|
||||
strExtensions = strRHS;
|
||||
}
|
||||
else {
|
||||
@@ -1037,10 +1037,10 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
// although it doesn't seem to be covered by RFCs, some programs
|
||||
// (notably Netscape) create their entries with several comma
|
||||
// separated extensions (RFC mention the spaces only)
|
||||
strExtensions.Replace(",", " ");
|
||||
strExtensions.Replace(_T(","), _T(" "));
|
||||
|
||||
// also deal with the leading dot
|
||||
if ( !strExtensions.IsEmpty() && strExtensions[0] == '.' ) {
|
||||
if ( !strExtensions.IsEmpty() && strExtensions[0] == _T('.') ) {
|
||||
strExtensions.erase(0, 1);
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
bool fallback)
|
||||
{
|
||||
wxLogTrace("--- Parsing mailcap file '%s' ---", strFileName.c_str());
|
||||
wxLogTrace(_T("--- Parsing mailcap file '%s' ---"), strFileName.c_str());
|
||||
|
||||
wxTextFile file(strFileName);
|
||||
if ( !file.Open() )
|
||||
@@ -1092,14 +1092,14 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
size_t nLineCount = file.GetLineCount();
|
||||
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
|
||||
// now we're at the start of the line
|
||||
const char *pc = file[nLine].c_str();
|
||||
const wxChar *pc = file[nLine].c_str();
|
||||
|
||||
// skip whitespace
|
||||
while ( isspace(*pc) )
|
||||
while ( wxIsspace(*pc) )
|
||||
pc++;
|
||||
|
||||
// comment or empty string?
|
||||
if ( *pc == '#' || *pc == '\0' )
|
||||
if ( *pc == _T('#') || *pc == _T('\0') )
|
||||
continue;
|
||||
|
||||
// no, do parse
|
||||
@@ -1125,10 +1125,10 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
curField; // accumulator
|
||||
for ( bool cont = TRUE; cont; pc++ ) {
|
||||
switch ( *pc ) {
|
||||
case '\\':
|
||||
case _T('\\'):
|
||||
// interpret the next character literally (notice that
|
||||
// backslash can be used for line continuation)
|
||||
if ( *++pc == '\0' ) {
|
||||
if ( *++pc == _T('\0') ) {
|
||||
// fetch the next line.
|
||||
|
||||
// pc currently points to nowhere, but after the next
|
||||
@@ -1142,12 +1142,12 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
}
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
case _T('\0'):
|
||||
cont = FALSE; // end of line reached, exit the loop
|
||||
|
||||
// fall through
|
||||
|
||||
case ';':
|
||||
case _T(';'):
|
||||
// store this field and start looking for the next one
|
||||
|
||||
// trim whitespaces from both sides
|
||||
@@ -1156,9 +1156,9 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
switch ( currentToken ) {
|
||||
case Field_Type:
|
||||
strType = curField;
|
||||
if ( strType.Find('/') == wxNOT_FOUND ) {
|
||||
if ( strType.Find(_T('/')) == wxNOT_FOUND ) {
|
||||
// we interpret "type" as "type/*"
|
||||
strType += "/*";
|
||||
strType += _T("/*");
|
||||
}
|
||||
|
||||
currentToken = Field_OpenCmd;
|
||||
@@ -1176,22 +1176,22 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
bool ok = TRUE;
|
||||
|
||||
// is this something of the form foo=bar?
|
||||
const char *pEq = strchr(curField, '=');
|
||||
const wxChar *pEq = wxStrchr(curField, _T('='));
|
||||
if ( pEq != NULL ) {
|
||||
wxString lhs = curField.BeforeFirst('='),
|
||||
rhs = curField.AfterFirst('=');
|
||||
wxString lhs = curField.BeforeFirst(_T('=')),
|
||||
rhs = curField.AfterFirst(_T('='));
|
||||
|
||||
lhs.Trim(TRUE); // from right
|
||||
rhs.Trim(FALSE); // from left
|
||||
|
||||
if ( lhs == "print" )
|
||||
if ( lhs == _T("print") )
|
||||
strPrintCmd = rhs;
|
||||
else if ( lhs == "test" )
|
||||
else if ( lhs == _T("test") )
|
||||
strTest = rhs;
|
||||
else if ( lhs == "description" ) {
|
||||
else if ( lhs == _T("description") ) {
|
||||
// it might be quoted
|
||||
if ( rhs[0u] == '"' &&
|
||||
rhs.Last() == '"' ) {
|
||||
if ( rhs[0u] == _T('"') &&
|
||||
rhs.Last() == _T('"') ) {
|
||||
strDesc = wxString(rhs.c_str() + 1,
|
||||
rhs.Len() - 2);
|
||||
}
|
||||
@@ -1199,10 +1199,10 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
strDesc = rhs;
|
||||
}
|
||||
}
|
||||
else if ( lhs == "compose" ||
|
||||
lhs == "composetyped" ||
|
||||
lhs == "notes" ||
|
||||
lhs == "edit" )
|
||||
else if ( lhs == _T("compose") ||
|
||||
lhs == _T("composetyped") ||
|
||||
lhs == _T("notes") ||
|
||||
lhs == _T("edit") )
|
||||
; // ignore
|
||||
else
|
||||
ok = FALSE;
|
||||
@@ -1213,11 +1213,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
// TODO support the flags:
|
||||
// 1. create an xterm for 'needsterminal'
|
||||
// 2. append "| $PAGER" for 'copiousoutput'
|
||||
if ( curField == "needsterminal" )
|
||||
if ( curField == _T("needsterminal") )
|
||||
needsterminal = TRUE;
|
||||
else if ( curField == "copiousoutput" )
|
||||
else if ( curField == _T("copiousoutput") )
|
||||
copiousoutput = TRUE;
|
||||
else if ( curField == "textualnewlines" )
|
||||
else if ( curField == _T("textualnewlines") )
|
||||
; // ignore
|
||||
else
|
||||
ok = FALSE;
|
||||
@@ -1232,9 +1232,9 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
// programmer
|
||||
wxLogDebug
|
||||
(
|
||||
"Mailcap file %s, line %d: unknown "
|
||||
_T("Mailcap file %s, line %d: unknown "
|
||||
"field '%s' for the MIME type "
|
||||
"'%s' ignored.",
|
||||
"'%s' ignored."),
|
||||
strFileName.c_str(),
|
||||
nLine + 1,
|
||||
curField.c_str(),
|
||||
@@ -1248,7 +1248,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG("unknown field type in mailcap");
|
||||
wxFAIL_MSG(_T("unknown field type in mailcap"));
|
||||
}
|
||||
|
||||
// next token starts immediately after ';'
|
||||
@@ -1278,7 +1278,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
m_aTypes.Add(strType);
|
||||
|
||||
m_aEntries.Add(entry);
|
||||
m_aExtensions.Add("");
|
||||
m_aExtensions.Add(_T(""));
|
||||
m_aDescriptions.Add(strDesc);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user