gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18867 - Extractor/src/main


From: gnunet
Subject: [GNUnet-SVN] r18867 - Extractor/src/main
Date: Sat, 31 Dec 2011 19:39:09 +0100

Author: grothoff
Date: 2011-12-31 19:39:09 +0100 (Sat, 31 Dec 2011)
New Revision: 18867

Modified:
   Extractor/src/main/extractor.c
Log:
-LRN: Utf8isze LE to match newer plibc stuff - #2050

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2011-12-31 18:36:52 UTC (rev 18866)
+++ Extractor/src/main/extractor.c      2011-12-31 18:39:09 UTC (rev 18867)
@@ -184,7 +184,7 @@
           sizeof (fn),
           "/proc/%u/maps",
           getpid());
-  f = fopen(fn, "r");
+  f = FOPEN(fn, "r");
   if (f != NULL) {
     while (NULL != fgets(line, 1024, f)) {
       if ( (1 == sscanf(line,
@@ -514,10 +514,10 @@
 
   if (sc->path != NULL)
     return;
-  dir = opendir (path);
+  dir = OPENDIR (path);
   if (NULL == dir)
     return;
-  while (NULL != (ent = readdir (dir)))
+  while (NULL != (ent = READDIR (dir)))
     {
       if (ent->d_name[0] == '.')
        continue;
@@ -531,7 +531,7 @@
       sym = strdup (sym_name);
       if (sym == NULL)
        {
-         closedir (dir);
+         CLOSEDIR (dir);
          return;
        }
       dot = strstr (sym, ".");
@@ -552,7 +552,7 @@
             sc->short_name,
             path);
 #endif
-  closedir (dir);
+  CLOSEDIR (dir);
 }
 
 
@@ -766,6 +766,10 @@
 static int
 plugin_load (struct EXTRACTOR_PluginList *plugin)
 {
+#if WINDOWS
+  wchar_t wlibname[4097];
+  char llibname[4097];
+#endif
   lt_dladvise advise;
 
   if (plugin->libname == NULL)
@@ -783,8 +787,29 @@
   lt_dladvise_init (&advise);
   lt_dladvise_ext (&advise);
   lt_dladvise_local (&advise);
+#if WINDOWS
+  wlibname[0] = L'\0';
+  llibname[0] = '\0';
+  if (MultiByteToWideChar (CP_UTF8, 0, plugin->libname, -1, wlibname, 4097) <= 0
+      || WideCharToMultiByte (CP_ACP, 0, wlibname, -1, llibname, 4097, NULL, 
NULL) < 0)
+  {
+#if DEBUG
+      fprintf (stderr,
+              "Loading `%s' plugin failed: %s\n",
+              plugin->short_libname,
+              "can't convert plugin name to local encoding");
+      free (plugin->libname);
+      plugin->libname = NULL;
+      plugin->flags = EXTRACTOR_OPTION_DISABLED;
+      return -1;
+#endif
+  }
+  plugin->libraryHandle = lt_dlopenadvise (llibname,
+                                      advise);
+#else
   plugin->libraryHandle = lt_dlopenadvise (plugin->libname, 
                                       advise);
+#endif
   lt_dladvise_destroy(&advise);
   if (plugin->libraryHandle == NULL)
     {
@@ -2333,7 +2358,7 @@
   /* Set binary mode */
   mode |= O_BINARY;
 #endif
-  return open(fn, oflag, mode);
+  return OPEN(fn, oflag, mode);
 }
 
 




reply via email to

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