Removed scprintf, aprintf and snprintf stuff and use newXprintf
This commit is contained in:
parent
16a683f4d1
commit
f264a7ea74
|
@ -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:
|
||||
|
|
|
@ -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,...)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user