diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-11-27 20:09:04 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-12-07 11:10:35 -0800 |
commit | 03e8bfa1d122f7dea905d48c93cfd54afd991dfd (patch) | |
tree | 7b52cac0f43bb7f79ab9ec62054c74a18d8a28f2 /hw/xwin | |
parent | c95c1d338fdb62dbe3dba934b97324fa778b7fce (diff) |
Convert existing Xprintf style calls to asprintf style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/win.h | 7 | ||||
-rw-r--r-- | hw/xwin/windialogs.c | 5 | ||||
-rw-r--r-- | hw/xwin/winerror.c | 24 |
3 files changed, 21 insertions, 15 deletions
diff --git a/hw/xwin/win.h b/hw/xwin/win.h index f22a2d576..44307813c 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -221,9 +221,10 @@ if (fDebugProcMsg) \ { \ char *pszTemp; \ int iLength; \ - pszTemp = Xprintf (str, ##__VA_ARGS__); \ - MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ - free(pszTemp); \ + if (asprintf (&pszTemp, str, ##__VA_ARGS__) != -1) { \ + MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ + free (pszTemp); \ + } \ } #else #define DEBUG_MSG(str,...) diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index 22d8cd7f7..679b3fab5 100644 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -341,11 +341,10 @@ winExitDlgProc (HWND hDialog, UINT message, winInitDialog (hDialog); /* Format the connected clients string */ - pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT, + if (asprintf (&pszConnectedClients, CONNECTED_CLIENTS_FORMAT, (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are", s_pScreenPriv->iConnectedClients, - (s_pScreenPriv->iConnectedClients == 1) ? "" : "s"); - if (!pszConnectedClients) + (s_pScreenPriv->iConnectedClients == 1) ? "" : "s") == -1) return TRUE; diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index aadfd2858..5e32d090d 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -101,12 +101,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...) char * pszErrorF = NULL; char * pszMsgBox = NULL; va_list args; + int size; va_start(args, uType); - pszErrorF = Xvprintf(pszError, args); + size = vasprintf (&pszErrorF, pszError, args); va_end(args); - if (!pszErrorF) + if (size == -1) { + pszErrorF = NULL; goto winMessageBoxF_Cleanup; + } #define MESSAGEBOXF \ "%s\n" \ @@ -117,15 +120,18 @@ winMessageBoxF (const char *pszError, UINT uType, ...) "XWin was started with the following command-line:\n\n" \ "%s\n" - pszMsgBox = Xprintf (MESSAGEBOXF, - pszErrorF, XVENDORNAME, - XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT, - BUILDERADDR, - BUILDERSTRING, - g_pszCommandLine); + size = asprintf (&pszMsgBox, MESSAGEBOXF, + pszErrorF, XVENDORNAME, + XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, + XORG_VERSION_SNAP, XORG_VERSION_CURRENT, + BUILDERADDR, + BUILDERSTRING, + g_pszCommandLine); - if (!pszMsgBox) + if (size == -1) { + pszMsgBox = NULL; goto winMessageBoxF_Cleanup; + } /* Display the message box string */ MessageBox (NULL, |