This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sqlite3 fixes for cygwin-1.7


Reini Urban schrieb:
I needed the attached patch for the new cygwin-1.7,
where cygwin_conv_to_full_win32_path() is deprecated.

But I doubt that this patch is fully correct.
winFullPathname is mainly used to get the driveletter to check for the disksize
and will fail for subst'ed drives.

And I saw databases which were created at the cwd instead of the given path.

Maybe someone sees the obvious mistake.

The sqlite ticket id is
http://www.sqlite.org/src/tktview/2fd50fa6656950e19826089cd1abf19c35c26409

Oops, no attachment. Here it is: -- Reini Urban http://phpwiki.org/ http://murbreak.at/
2009-08-21 Reini Urban <rurban@x-ray.at>

        * os_win32.c (winFullPathname): support cygwin-1.7, fails with subst'ed drives

diff -u sqlite-3.6.17/src/os_win.c.orig sqlite-3.6.17/src/os_win.c
--- sqlite-3.6.17/src/os_win.c.orig	2009-08-08 19:44:58.000000000 +0200
+++ sqlite-3.6.17/src/os_win.c	2009-08-21 09:07:33.906250000 +0200
@@ -48,6 +48,7 @@
 
 #ifdef __CYGWIN__
 # include <sys/cygwin.h>
+# include <cygwin/version.h>
 #endif
 
 /*
@@ -1525,9 +1526,34 @@
   
 #if defined(__CYGWIN__)
   UNUSED_PARAMETER(nFull);
+#if (CYGWIN_VERSION_API_MINOR >= 181)
+  int nByte;
+  char *zOut;
+  WCHAR *zConverted;
+  nByte = nFull + 260 + 1001; /* from the cygwin sources */
+  zConverted = malloc( nByte*sizeof(zConverted[0]) );
+  if( zConverted==0 ){
+    return SQLITE_NOMEM;
+  }
+  cygwin_conv_path(CCP_POSIX_TO_WIN_W, zRelative, zConverted, nByte*sizeof(zConverted[0]));
+#if 0
+  printf("%s => %ls => %ls\n", zRelative, zConverted, &zConverted[4]);
+#endif
+  /* 4th: "\\?\D:..." => "D:..." */
+  zOut = unicodeToUtf8(&zConverted[4]);
+  free(zConverted);
+  if( zOut ){
+    sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zOut);
+    free(zOut);
+    return SQLITE_OK;
+  }else{
+    return SQLITE_NOMEM;
+  }
+#else
   cygwin_conv_to_full_win32_path(zRelative, zFull);
   return SQLITE_OK;
 #endif
+#endif
 
 #if SQLITE_OS_WINCE
   UNUSED_PARAMETER(nFull);

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]