wxWarning replaced with wxLogWarning (to solve the compilation problems due

to wxWarning's const incorrectness)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-08-08 22:14:17 +00:00
parent b039c367cd
commit e17e4f282f

View File

@@ -54,6 +54,8 @@
#include "wx/validate.h"
#include "wx/log.h"
#if USE_WX_RESOURCES
#include <ctype.h>
@@ -97,7 +99,7 @@ void wxCleanUpResourceSystem(void)
delete wxDefaultResourceTable;
}
void wxWarning(char *msg)
void wxLogWarning(char *msg)
{
wxMessageBox(msg, _("Warning"), wxOK);
}
@@ -287,7 +289,7 @@ bool wxResourceTable::ParseResourceData(char *data)
PrologDatabase db;
if (!db.ReadPrologFromString(data))
{
wxWarning(_("Ill-formed resource file syntax."));
wxLogWarning(_("Ill-formed resource file syntax."));
return FALSE;
}
@@ -793,10 +795,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, PrologExpr *e
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
if (id == 0)
{
char buf[300];
sprintf(buf, _("Could not resolve control class or id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"),
wxLogWarning(_("Could not resolve control class or id '%s'. "
"Use (non-zero) integer instead\n or provide #define "
"(see manual for caveats)"),
(const char*) expr1->StringValue());
wxWarning(buf);
delete controlItem;
return NULL;
}
@@ -1208,10 +1210,10 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, PrologExpr *
id = wxResourceGetIdentifier(WXSTRINGCAST str, &table);
if (id == 0)
{
char buf[300];
sprintf(buf, _("Could not resolve menu id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"),
wxLogWarning(_("Could not resolve menu id '%s'. "
"Use (non-zero) integer instead\n"
"or provide #define (see manual for caveats)"),
(const char*) idExpr->StringValue());
wxWarning(buf);
}
}
else if (idExpr->Type() == PrologInteger)
@@ -1630,9 +1632,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
}
else
{
char buf[300];
sprintf(buf, _("#define %s must be an integer."), name);
wxWarning(buf);
wxLogWarning(_("#define %s must be an integer."), name);
delete[] name;
delete[] value;
return FALSE;
@@ -1654,9 +1654,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
name[len-1] = 0;
if (!wxResourceParseIncludeFile(actualName, table))
{
char buf[400];
sprintf(buf, _("Could not find resource include file %s."), actualName);
wxWarning(buf);
wxLogWarning(_("Could not find resource include file %s."), actualName);
}
delete[] name;
return TRUE;
@@ -1667,35 +1665,35 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
strcpy(buf, _("Found "));
strncat(buf, wxResourceBuffer, 30);
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
wxWarning(buf);
wxLogWarning(buf);
return FALSE;
}
// char
if (!wxGetResourceToken(fd))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (strcmp(wxResourceBuffer, "char") != 0)
{
wxWarning(_("Expected 'char' whilst parsing resource."));
wxLogWarning(_("Expected 'char' whilst parsing resource."));
return FALSE;
}
// *name
if (!wxGetResourceToken(fd))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (wxResourceBuffer[0] != '*')
{
wxWarning(_("Expected '*' whilst parsing resource."));
wxLogWarning(_("Expected '*' whilst parsing resource."));
return FALSE;
}
char nameBuf[100];
@@ -1704,21 +1702,21 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
// =
if (!wxGetResourceToken(fd))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (strcmp(wxResourceBuffer, "=") != 0)
{
wxWarning(_("Expected '=' whilst parsing resource."));
wxLogWarning(_("Expected '=' whilst parsing resource."));
return FALSE;
}
// String
if (!wxGetResourceToken(fd))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
@@ -1726,9 +1724,7 @@ bool wxResourceReadOneResource(FILE *fd, PrologDatabase& db, bool *eof, wxResour
{
if (!db.ReadPrologFromString(wxResourceBuffer))
{
char buf[300];
sprintf(buf, _("%s: ill-formed resource file syntax."), nameBuf);
wxWarning(buf);
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
return FALSE;
}
}
@@ -2059,9 +2055,7 @@ long wxParseWindowStyle(char *bitListString)
}
if (!found)
{
char buf[200];
sprintf(buf, _("Unrecognized style %s whilst parsing resource."), word);
wxWarning(buf);
wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word);
return 0;
}
}
@@ -2083,9 +2077,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
{
if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0)
{
char buf[300];
sprintf(buf, _("%s not a bitmap resource specification."), resource);
wxWarning(buf);
wxLogWarning(_("%s not a bitmap resource specification."), resource);
return NULL;
}
int thisDepth = wxDisplayDepth();
@@ -2185,14 +2177,13 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
wxItemResource *item = table->FindResource(name);
if (!item)
{
char buf[400];
sprintf(buf, _("Failed to find XBM resource %s.\nForgot to use wxResourceLoadBitmapData?"), name);
wxWarning(buf);
wxLogWarning(_("Failed to find XBM resource %s.\n"
"Forgot to use wxResourceLoadBitmapData?"), name);
return NULL;
}
bitmap = new wxBitmap((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else
wxWarning(_("No XBM facility available!"));
wxLogWarning(_("No XBM facility available!"));
#endif
break;
}
@@ -2202,14 +2193,13 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
wxItemResource *item = table->FindResource(name);
if (!item)
{
char buf[400];
sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadBitmapData?"), name);
wxWarning(buf);
wxLogWarning(_("Failed to find XPM resource %s.\n"
"Forgot to use wxResourceLoadBitmapData?"), name);
return NULL;
}
bitmap = new wxBitmap(item->GetValue1());
#else
wxWarning(_("No XPM facility available!"));
wxLogWarning(_("No XPM facility available!"));
#endif
break;
}
@@ -2234,9 +2224,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
}
else
{
char buf[300];
sprintf(buf, _("Bitmap resource specification %s not found."), resource);
wxWarning(buf);
wxLogWarning(_("Bitmap resource specification %s not found."), resource);
return NULL;
}
}
@@ -2256,9 +2244,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
{
if (!item->GetType() || strcmp(item->GetType(), "wxIcon") != 0)
{
char buf[300];
sprintf(buf, _("%s not an icon resource specification."), resource);
wxWarning(buf);
wxLogWarning(_("%s not an icon resource specification."), resource);
return NULL;
}
int thisDepth = wxDisplayDepth();
@@ -2358,14 +2344,13 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
wxItemResource *item = table->FindResource(name);
if (!item)
{
char buf[400];
sprintf(buf, _("Failed to find XBM resource %s.\nForgot to use wxResourceLoadIconData?"), name);
wxWarning(buf);
wxLogWarning(_("Failed to find XBM resource %s.\n"
"Forgot to use wxResourceLoadIconData?"), name);
return NULL;
}
icon = new wxIcon((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else
wxWarning(_("No XBM facility available!"));
wxLogWarning(_("No XBM facility available!"));
#endif
break;
}
@@ -2379,15 +2364,15 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
{
char buf[400];
sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name);
wxWarning(buf);
wxLogWarning(buf);
return NULL;
}
icon = new wxIcon((char **)item->GetValue1());
#else
wxWarning(_("No XPM facility available!"));
wxLogWarning(_("No XPM facility available!"));
#endif
*/
wxWarning(_("No XPM icon facility available!"));
wxLogWarning(_("No XPM icon facility available!"));
break;
}
default:
@@ -2411,9 +2396,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
}
else
{
char buf[300];
sprintf(buf, _("Icon resource specification %s not found."), resource);
wxWarning(buf);
wxLogWarning(_("Icon resource specification %s not found."), resource);
return NULL;
}
}
@@ -2739,9 +2722,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
}
else
{
char buf[300];
sprintf(buf, _("#define %s must be an integer."), name);
wxWarning(buf);
wxLogWarning(_("#define %s must be an integer."), name);
delete[] name;
delete[] value;
return FALSE;
@@ -2766,7 +2747,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
{
char buf[400];
sprintf(buf, _("Could not find resource include file %s."), actualName);
wxWarning(buf);
wxLogWarning(buf);
}
delete[] name;
return TRUE;
@@ -2778,35 +2759,35 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
strcpy(buf, _("Found "));
strncat(buf, wxResourceBuffer, 30);
strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
wxWarning(buf);
wxLogWarning(buf);
return FALSE;
}
// char
if (!wxGetResourceTokenString(s))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (strcmp(wxResourceBuffer, "char") != 0)
{
wxWarning(_("Expected 'char' whilst parsing resource."));
wxLogWarning(_("Expected 'char' whilst parsing resource."));
return FALSE;
}
// *name
if (!wxGetResourceTokenString(s))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (wxResourceBuffer[0] != '*')
{
wxWarning(_("Expected '*' whilst parsing resource."));
wxLogWarning(_("Expected '*' whilst parsing resource."));
return FALSE;
}
char nameBuf[100];
@@ -2815,21 +2796,21 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
// =
if (!wxGetResourceTokenString(s))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
if (strcmp(wxResourceBuffer, "=") != 0)
{
wxWarning(_("Expected '=' whilst parsing resource."));
wxLogWarning(_("Expected '=' whilst parsing resource."));
return FALSE;
}
// String
if (!wxGetResourceTokenString(s))
{
wxWarning(_("Unexpected end of file whilst parsing resource."));
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
*eof = TRUE;
return FALSE;
}
@@ -2837,9 +2818,7 @@ bool wxResourceReadOneResourceString(char *s, PrologDatabase& db, bool *eof, wxR
{
if (!db.ReadPrologFromString(wxResourceBuffer))
{
char buf[300];
sprintf(buf, _("%s: ill-formed resource file syntax."), nameBuf);
wxWarning(buf);
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
return FALSE;
}
}