diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-12-03 12:04:15 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-12-03 12:04:15 +0000 |
commit | f264a7ea741f57fbc3bb900cfbb9e0cc23f46e90 (patch) | |
tree | fdf20f1246b0e7a5dac31a83a206130b171ccfc8 /hw/xwin | |
parent | 16a683f4d164899ecfdafb853f48cff10fd13fd4 (diff) |
Removed scprintf, aprintf and snprintf stuff and use newXprintf
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/ChangeLog | 8 | ||||
-rw-r--r-- | hw/xwin/win.h | 17 | ||||
-rwxr-xr-x | hw/xwin/windialogs.c | 17 | ||||
-rw-r--r-- | hw/xwin/winerror.c | 50 |
4 files changed, 24 insertions, 68 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index b2a97dd5c..6e010a294 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,11 @@ +2004-12-03 Alexander Gottwald <ago at freedesktop dot org> + + * windialogs.c: + * win.h: + * Imakefile: + * winerror.c: + Removed scprintf, aprintf and snprintf stuff and use newXprintf + 2004-12-02 Alexander Gottwald <ago at freedesktop dot org> * winwin32rootless.c: diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 06155508f..401206d53 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -139,13 +139,6 @@ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> -#ifndef HAS_SCPRINTF -extern int scprintf(const char *format, ...); -#else -#ifdef WIN32 -#define scprintf _scprintf -#endif -#endif #ifndef __CYGWIN__ #define sleep(x) Sleep(1000 * (x)) @@ -233,15 +226,9 @@ if (fDebugProcMsg) \ { \ char *pszTemp; \ int iLength; \ - \ - iLength = scprintf (str, ##__VA_ARGS__); \ - pszTemp = malloc (iLength + 1); \ - snprintf (pszTemp, iLength + 1, str, ##__VA_ARGS__); \ - pszTemp[iLength] = 0; \ - \ + pszTemp = Xprintf (str, ##__VA_ARGS__); \ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ - \ - free (pszTemp); \ + xfree (pszTemp); \ } #else #define DEBUG_MSG(str,...) diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index decbd8531..ebea141d6 100755 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -307,7 +307,6 @@ winExitDlgProc (HWND hDialog, UINT message, case WM_INITDIALOG: { char *pszConnectedClients; - int iReturn; /* Store pointers to private structures for future use */ s_pScreenPriv = (winPrivScreenPtr) lParam; @@ -322,21 +321,17 @@ winExitDlgProc (HWND hDialog, UINT message, MAKEINTRESOURCE(IDI_XWIN))); /* Format the connected clients string */ - iReturn = scprintf (CONNECTED_CLIENTS_FORMAT, - s_pScreenPriv->iConnectedClients); - if (iReturn <= 0) - return TRUE; - pszConnectedClients = malloc (iReturn + 1); + pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT, + s_pScreenPriv->iConnectedClients); if (!pszConnectedClients) - return TRUE; - snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT, - s_pScreenPriv->iConnectedClients); - pszConnectedClients[iReturn] = 0; + return TRUE; + + /* Set the number of connected clients */ SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED), pszConnectedClients); - free (pszConnectedClients); + xfree (pszConnectedClients); } return TRUE; diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index 53730c7ed..fa6212ff2 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -98,22 +98,12 @@ winMessageBoxF (const char *pszError, UINT uType, ...) char * pszMsgBox = NULL; va_list args; - /* Get length of formatted error string */ - va_start (args, uType); - i = scprintf (pszError, args); - va_end (args); - - /* Allocate memory for formatted error string */ - pszErrorF = malloc (i + 1); + va_start(args, uType); + pszErrorF = Xvprintf(pszError, args); + va_end(args); if (!pszErrorF) goto winMessageBoxF_Cleanup; - /* Create the formatted error string */ - va_start (args, uType); - snprintf (pszErrorF, i + 1, pszError, args); - pszErrorF[i] = 0; - va_end (args); - #define MESSAGEBOXF \ "%s\n" \ "Vendor: %s\n" \ @@ -122,24 +112,12 @@ winMessageBoxF (const char *pszError, UINT uType, ...) "XWin was started with the following command-line:\n\n" \ "%s\n" - /* Get length of message box string */ - i = scprintf (MESSAGEBOXF, - pszErrorF, - VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, - g_pszCommandLine); - - /* Allocate memory for message box string */ - pszMsgBox = malloc (i + 1); + pszMsgBox = Xprintf (MESSAGEBOXF, + pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, + g_pszCommandLine); if (!pszMsgBox) goto winMessageBoxF_Cleanup; - /* Format the message box string */ - snprintf (pszMsgBox, i + 1, MESSAGEBOXF, - pszErrorF, - VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, - g_pszCommandLine); - pszMsgBox[i] = 0; - /* Display the message box string */ MessageBox (NULL, pszMsgBox, @@ -148,20 +126,8 @@ winMessageBoxF (const char *pszError, UINT uType, ...) winMessageBoxF_Cleanup: if (pszErrorF) - free (pszErrorF); + xfree (pszErrorF); if (pszMsgBox) - free (pszMsgBox); + xfree (pszMsgBox); #undef MESSAGEBOXF } - -#ifndef HAS_SCPRINTF -extern int scprintf(const char *format, ...) -{ - int ret; - va_list va; - va_start(va, format); - ret = vsnprintf(NULL, 0, format, va); - va_end(va); - return ret; -} -#endif |