[X2Go-Commits] [nx-libs] 104/108: Convert existing Xprintf style calls to asprintf style

git-admin at x2go.org git-admin at x2go.org
Fri Nov 9 20:36:00 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository nx-libs.

commit b09a72b08c7effeac42652f087f0b8f16bc74763
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Tue Oct 30 00:00:45 2018 +0100

    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 at oracle.com>
      Date:   Sat Nov 27 20:09:04 2010 -0800
    
        Convert existing Xprintf style calls to asprintf style
    
        Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
        Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
        Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    
        Backported-to-NX-by: Ulrich Sibiller <uli42 at gmx.de>
---
 nx-X11/programs/Xserver/xkb/ddxList.c | 36 +++++++++++++++++++++++------------
 nx-X11/programs/Xserver/xkb/ddxLoad.c | 22 ++++++++++++---------
 2 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/nx-X11/programs/Xserver/xkb/ddxList.c b/nx-X11/programs/Xserver/xkb/ddxList.c
index 5466cff..cc95c86 100644
--- a/nx-X11/programs/Xserver/xkb/ddxList.c
+++ b/nx-X11/programs/Xserver/xkb/ddxList.c
@@ -162,34 +162,46 @@ char	tmpname[PATH_MAX];
 #endif
     if (XkbBaseDirectory!=NULL) {
 	if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
-	    buf = Xprintf("%s/%s.dir",XkbBaseDirectory,componentDirs[what]);
-	    in= fopen(buf,"r");
+	   if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
+			componentDirs[what]) == -1)
+	       buf = NULL;
+	   else
+	       in = fopen(buf,"r");
 	}
 	if (!in) {
 	    haveDir= False;
 	    free(buf);
-	    buf = Xprintf(
+	    if (asprintf
+	       (&buf,
 		"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
-                XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
-		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+		XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
+		(long) ((xkbDebugFlags < 2) ? 1 :
+			((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
 		file W32_tmpfile
-                );
+		   ) == -1)
+	       buf = NULL;
 	}
     }
     else {
 	if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
-	    buf = Xprintf("%s.dir",componentDirs[what]);
-	    in= fopen(buf,"r");
+	   if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
+	       buf = NULL;
+	   else
+	       in = fopen(buf,"r");
+	    buf = NULL;
 	}
 	if (!in) {
 	    haveDir= False;
 	    free(buf);
-	    buf = Xprintf(
+	    if (asprintf
+	       (&buf,
 		"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
-                componentDirs[what],(long)
-		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
+		componentDirs[what],
+		(long) ((xkbDebugFlags < 2) ? 1 :
+			((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
 		file W32_tmpfile
-                );
+		   ) == -1)
+	       buf = NULL;
 	}
     }
     status= Success;
diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c
index fca0cd6..d635128 100644
--- a/nx-X11/programs/Xserver/xkb/ddxLoad.c
+++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c
@@ -248,19 +248,21 @@ char 	*cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
         char *xkbbasedir = XkbBaseDirectory;
         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,
 		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
 		xkbbasedir,(map?"-m ":""),(map?map:""),
 		PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
-		xkm_output_dir,outFile);
+		xkm_output_dir,outFile) == -1)
+            cmd = NULL;
     }
     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)),
 		(map?"-m ":""),(map?map:""),
 		PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
-		xkm_output_dir,outFile);
+		xkm_output_dir,outFile) == -1)
+            cmd = NULL;
     }
 #ifdef DEBUG
     if (xkbDebugFlags) {
@@ -336,13 +338,14 @@ char tmpname[PATH_MAX];
         char *xkbbasedir = XkbBaseDirectory;
         char *xkbbindir = XkbBinDirectory;
         
-	buf = Xprintf(
-	   "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
+	if (asprintf(&buf,
+		"\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
 		xkbbindir,
 		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
 		xkbbasedir, xkmfile,
 		PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
-		xkm_output_dir,keymap);
+		xkm_output_dir,keymap) == -1)
+            buf = NULL;
     }
     else {
 #ifndef WIN32
@@ -350,12 +353,13 @@ char tmpname[PATH_MAX];
 #else
         char *xkmfile = tmpname;
 #endif
-	buf = Xprintf(
+	if (asprintf(&buf,
 		"xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
 		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
                 xkmfile,
 		PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
-		xkm_output_dir,keymap);
+		xkm_output_dir,keymap) == -1)
+            buf = NULL;
     }
     
     #ifdef TEST

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list