// Verify that the table exists in the database
if (!pDb->TableExists(tableName))
{
- char s[128];
- sprintf(s, "Error opening '%s', table/view does not exist in the database.", tableName);
+ wxString s;
+ s.Printf("Error opening '%s', table/view does not exist in the database.", tableName);
pDb->LogError(s);
return(FALSE);
}
// For varchars, append the size of the string
if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)
{
- char s[10];
// strcat(sqlStmt, "(");
// strcat(sqlStmt, itoa(colDefs[i].SzDataObj, s, 10));
// strcat(sqlStmt, ")");
- sprintf(s, "(%d)", colDefs[i].SzDataObj);
+ wxString s;
+ s.Printf("(%d)", colDefs[i].SzDataObj);
strcat(sqlStmt, s);
}
needComma = TRUE;
void wxTable::GetWhereClause(char *pWhereClause, int typeOfWhere)
{
bool moreThanOneColumn = FALSE;
- char colValue[255];
+ wxString colValue;
// Loop through the columns building a where clause as you go
for (int i = 0; i < noCols; i++)
switch(colDefs[i].SqlCtype)
{
case SQL_C_CHAR:
- sprintf(colValue, "'%s'", (UCHAR FAR *) colDefs[i].PtrDataObj);
+ colValue.Printf("'%s'", (UCHAR FAR *) colDefs[i].PtrDataObj);
break;
case SQL_C_SSHORT:
- sprintf(colValue, "%hi", *((SWORD *) colDefs[i].PtrDataObj));
+ colValue.Printf("%hi", *((SWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_USHORT:
- sprintf(colValue, "%hu", *((UWORD *) colDefs[i].PtrDataObj));
+ colValue.Printf("%hu", *((UWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_SLONG:
- sprintf(colValue, "%li", *((SDWORD *) colDefs[i].PtrDataObj));
+ colValue.Printf("%li", *((SDWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_ULONG:
- sprintf(colValue, "%lu", *((UDWORD *) colDefs[i].PtrDataObj));
+ colValue.Printf("%lu", *((UDWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_FLOAT:
- sprintf(colValue, "%.6f", *((SFLOAT *) colDefs[i].PtrDataObj));
+ colValue.Printf("%.6f", *((SFLOAT *) colDefs[i].PtrDataObj));
break;
case SQL_C_DOUBLE:
- sprintf(colValue, "%.6f", *((SDOUBLE *) colDefs[i].PtrDataObj));
+ colValue.Printf("%.6f", *((SDOUBLE *) colDefs[i].PtrDataObj));
break;
}
strcat(pWhereClause, colValue);
{
if (IsModified())
{
- char buf[400];
wxString title;
GetPrintableName(title);
else
msgTitle = wxString(_("Warning"));
- sprintf(buf, _("Do you want to save changes to document %s?"), (const char *)title);
- int res = wxMessageBox(buf, msgTitle, wxYES_NO|wxCANCEL|wxICON_QUESTION,
- GetDocumentWindow());
+ wxString prompt;
+ prompt.Printf(_("Do you want to save changes to document %s?"),
+ (const char *)title);
+ int res = wxMessageBox(prompt, msgTitle,
+ wxYES_NO|wxCANCEL|wxICON_QUESTION,
+ GetDocumentWindow());
if (res == wxNO)
{
Modify(FALSE);
// Make a default document name
bool wxDocManager::MakeDefaultName(wxString& name)
{
- char buf[256];
- sprintf(buf, _("unnamed%d"), m_defaultDocumentNameCounter);
- m_defaultDocumentNameCounter ++;
- name = buf;
+ name.Printf(_("unnamed%d"), m_defaultDocumentNameCounter);
+ m_defaultDocumentNameCounter++;
+
return TRUE;
}
{
// We can only have multiple filters in Windows
#ifdef __WXMSW__
- char *descrBuf = new char[1000];
+ char *descrBuf = new char[1000]; // FIXME static buffer
descrBuf[0] = 0;
int i;
for (i = 0; i < noTemplates; i++)
for (i = 0; i < m_fileHistoryN; i++)
if (m_fileHistory[i])
{
- char buf[400];
- sprintf(buf, "&%d %s", i+1, m_fileHistory[i]);
+ wxString buf;
+ buf.Printf("&%d %s", i+1, m_fileHistory[i]);
wxNode* node = m_fileMenus.First();
while (node)
{
void wxFileHistory::Load(wxConfigBase& config)
{
m_fileHistoryN = 0;
- char buf[400];
- sprintf(buf, "file%d", m_fileHistoryN+1);
- wxString historyFile("");
+ wxString buf;
+ buf.Printf("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_fileHistoryN ++;
- sprintf(buf, "file%d", m_fileHistoryN+1);
+ buf.Printf("file%d", m_fileHistoryN+1);
historyFile = "";
}
AddFilesToMenu();
bool wxFileConfig::Write(const wxString& key, long lValue)
{
// ltoa() is not ANSI :-(
- char szBuf[40]; // should be good for sizeof(long) <= 16 (128 bits)
- sprintf(szBuf, "%ld", lValue);
- return Write(key, szBuf);
+ wxString buf;
+ buf.Printf("%ld", lValue);
+ return Write(key, buf);
}
bool wxFileConfig::Flush(bool /* bCurrentOnly */)
#define _MAXPATHLEN 500
-#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList)
-#endif
-
extern char *wxBuffer;
void wxPathList::Add (const wxString& path)
#else
static short last_temp = 0; // cache last to speed things a bit
// At most 1000 temp files to a process! We use a ring count.
- char tmp[100];
+ char tmp[100]; // FIXME static buffer
for (short suffix = last_temp + 1; suffix != last_temp; ++suffix %= 1000)
{
char *wxFindNextFile(void)
{
#ifndef __VMS__
- static char buf[400];
+ static char buf[400]; // FIXME static buffer
/* MATTHEW: [2] Don't crash if we read too many times */
if (!wxDirStream)
#ifdef _MSC_VER
#pragma warning(default:4706) // assignment within conditional expression
-#endif // VC++
\ No newline at end of file
+#endif // VC++
{
wxNode *head = m_headers.First();
- while (head) {
+ while (head)
+ {
wxString *str = (wxString *)head->Data();
- char buf[100];
- sprintf(buf, "%s: %s\n\r", head->GetKeyString(), str->GetData());
- Write(buf, strlen(buf));
+ wxString buf;
+ buf.Printf("%s: %s\n\r", head->GetKeyString(), str->GetData());
+
+ Write(buf, buf.Len());
head = head->Next();
}
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
#endif
wxPostScriptDC::wxPostScriptDC ()
int wxString::PrintfV(const char* pszFormat, va_list argptr)
{
-#if defined(__BORLANDC__) || defined(__GNUWIN32__)
- static char s_szScratch[1024];
-
- int iLen = vsprintf(s_szScratch, pszFormat, argptr);
- AllocBeforeWrite(iLen);
- strcpy(m_pchData, s_szScratch);
-
- return iLen;
-#else
-
// static buffer to avoid dynamic memory allocation each time
static char s_szScratch[1024];
free(buffer);
return iLen;
-#endif
}
// ----------------------------------------------------------------------------
wxExprDatabase *thewxExprDatabase = NULL;
wxExprErrorHandler currentwxExprErrorHandler;
-IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList)
-
wxExpr::wxExpr(const wxString& functor)
{
type = wxExprList;