gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3415 - in GNUnet/src/util: os string


From: durner
Subject: [GNUnet-SVN] r3415 - in GNUnet/src/util: os string
Date: Sun, 24 Sep 2006 13:32:52 -0700 (PDT)

Author: durner
Date: 2006-09-24 13:32:18 -0700 (Sun, 24 Sep 2006)
New Revision: 3415

Modified:
   GNUnet/src/util/os/installpath.c
   GNUnet/src/util/string/string.c
Log:
fix MinGW

Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c    2006-09-24 19:51:33 UTC (rev 3414)
+++ GNUnet/src/util/os/installpath.c    2006-09-24 20:32:18 UTC (rev 3415)
@@ -91,11 +91,11 @@
   
   path = MALLOC(4097);
   GetModuleFileName(NULL, path, 4096);
-  idx = path + strlen(idx);
+  idx = path + strlen(path);
   while ( (idx > path) && 
-         (path != '\\') &&
-         (path != '/') )
-    idx++;
+         (*idx != '\\') &&
+         (*idx != '/') )
+    idx--;
   *idx = '\0';
   return path;  
 }

Modified: GNUnet/src/util/string/string.c
===================================================================
--- GNUnet/src/util/string/string.c     2006-09-24 19:51:33 UTC (rev 3414)
+++ GNUnet/src/util/string/string.c     2006-09-24 20:32:18 UTC (rev 3415)
@@ -323,7 +323,7 @@
 #else
   fn = MALLOC(MAX_PATH + 1);
 
-  if ((lRet = plibc_conv_to_win_path(fil, buffer)) != ERROR_SUCCESS) {
+  if ((lRet = plibc_conv_to_win_path(fil, fn)) != ERROR_SUCCESS) {
     SetErrnoFromWinError(lRet);
     GE_LOG_STRERROR(ectx,
                    GE_USER | GE_WARNING | GE_IMMEDIATE,
@@ -331,8 +331,8 @@
     return NULL;
   }
   /* is the path relative? */
-  if ( (strncmp(buffer + 1, ":\\", 2) != 0) &&
-       (strncmp(buffer, "\\\\", 2) != 0)) {
+  if ( (strncmp(fn + 1, ":\\", 2) != 0) &&
+       (strncmp(fn, "\\\\", 2) != 0)) {
     char szCurDir[MAX_PATH + 1];
     lRet = GetCurrentDirectory(MAX_PATH + 1, szCurDir);
     if (lRet + strlen(fn) + 1 > (MAX_PATH + 1)) {
@@ -342,12 +342,14 @@
                      "GetCurrentDirectory");
       return NULL;
     }
-    SNPRINTF(fn,
+    buffer = MALLOC(MAX_PATH + 1);
+    SNPRINTF(buffer,
             MAX_PATH+1,
-            "%s\\%s", szCurDir, buffer);
-  } else {
-    strcpy(fn, buffer);
+            "%s\\%s", szCurDir, fn);
+    FREE(fn);
+    fn = buffer;
   }
+
   return fn;
 #endif
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]