Commit b09a72b0 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Convert existing Xprintf style calls to asprintf style

This commit + some more adaption in ddxLoad.c which where no longer present when Alan did the patch. However, our code still has them: Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Nov 27 20:09:04 2010 -0800 Convert existing Xprintf style calls to asprintf style Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarJeremy Huddleston <jeremyhu@apple.com> Reviewed-by: 's avatarMikhail Gusarov <dottedmag@dottedmag.net> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent b01e29ef
...@@ -162,34 +162,46 @@ char tmpname[PATH_MAX]; ...@@ -162,34 +162,46 @@ char tmpname[PATH_MAX];
#endif #endif
if (XkbBaseDirectory!=NULL) { if (XkbBaseDirectory!=NULL) {
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) { if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
buf = Xprintf("%s/%s.dir",XkbBaseDirectory,componentDirs[what]); if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
in= fopen(buf,"r"); componentDirs[what]) == -1)
buf = NULL;
else
in = fopen(buf,"r");
} }
if (!in) { if (!in) {
haveDir= False; haveDir= False;
free(buf); free(buf);
buf = Xprintf( if (asprintf
(&buf,
"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg, "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long) XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), (long) ((xkbDebugFlags < 2) ? 1 :
((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
file W32_tmpfile file W32_tmpfile
); ) == -1)
buf = NULL;
} }
} }
else { else {
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) { if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
buf = Xprintf("%s.dir",componentDirs[what]); if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
in= fopen(buf,"r"); buf = NULL;
else
in = fopen(buf,"r");
buf = NULL;
} }
if (!in) { if (!in) {
haveDir= False; haveDir= False;
free(buf); free(buf);
buf = Xprintf( if (asprintf
(&buf,
"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg, "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
componentDirs[what],(long) componentDirs[what],
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), (long) ((xkbDebugFlags < 2) ? 1 :
((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
file W32_tmpfile file W32_tmpfile
); ) == -1)
buf = NULL;
} }
} }
status= Success; status= Success;
......
...@@ -248,19 +248,21 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; ...@@ -248,19 +248,21 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
char *xkbbasedir = XkbBaseDirectory; char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory; char *xkbbindir = XkbBinDirectory;
cmd = Xprintf("\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", if (asprintf(&cmd,"\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
xkbbindir, xkbbindir,
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
xkbbasedir,(map?"-m ":""),(map?map:""), xkbbasedir,(map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile); xkm_output_dir,outFile) == -1)
cmd = NULL;
} }
else { else {
cmd = Xprintf("xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", if (asprintf(&cmd, "xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
(map?"-m ":""),(map?map:""), (map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile); xkm_output_dir,outFile) == -1)
cmd = NULL;
} }
#ifdef DEBUG #ifdef DEBUG
if (xkbDebugFlags) { if (xkbDebugFlags) {
...@@ -336,13 +338,14 @@ char tmpname[PATH_MAX]; ...@@ -336,13 +338,14 @@ char tmpname[PATH_MAX];
char *xkbbasedir = XkbBaseDirectory; char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory; char *xkbbindir = XkbBinDirectory;
buf = Xprintf( if (asprintf(&buf,
"\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
xkbbindir, xkbbindir,
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
xkbbasedir, xkmfile, xkbbasedir, xkmfile,
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap); xkm_output_dir,keymap) == -1)
buf = NULL;
} }
else { else {
#ifndef WIN32 #ifndef WIN32
...@@ -350,12 +353,13 @@ char tmpname[PATH_MAX]; ...@@ -350,12 +353,13 @@ char tmpname[PATH_MAX];
#else #else
char *xkmfile = tmpname; char *xkmfile = tmpname;
#endif #endif
buf = Xprintf( if (asprintf(&buf,
"xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
xkmfile, xkmfile,
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
xkm_output_dir,keymap); xkm_output_dir,keymap) == -1)
buf = NULL;
} }
#ifdef TEST #ifdef TEST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment