/ Check-in [af5dcc9c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Accomplish fileio standalone for Win32 with less intervention.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: af5dcc9c2a3a45d10b985f6b7ea18d39c75502ed10fa6496aad787dbe8c8c3fb
User & Date: larrybr 2021-09-20 21:42:39
Context
2021-09-21
17:26
Add the "PRAGMA table_list" command with its corresponding eponymous table-valued function: "pragma_table_list". (check-in: 2c0e7ae5 user: drh tags: trunk)
2021-09-20
21:42
Accomplish fileio standalone for Win32 with less intervention. (check-in: af5dcc9c user: larrybr tags: trunk)
20:15
Allow fileio extension to be a stand-alone DLL for Win32 (check-in: d1cc3105 user: larrybr tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/misc/fileio.c.

234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
#  /* To allow a standalone DLL, use this next replacement function: */
#  undef sqlite3_win32_utf8_to_unicode
#  define sqlite3_win32_utf8_to_unicode utf8_to_utf16
#
LPWSTR utf8_to_utf16(const char *z){
  int nAllot = MultiByteToWideChar(CP_UTF8, 0, z, -1, NULL, 0);
  LPWSTR rv = malloc(nAllot * sizeof(WCHAR));
  if( rv!=0 && 0 < MultiByteToWideChar(CP_UTF8, 0, z, -1, rv, nAllot) )
    return rv;
  free(rv);
  return 0;
}
#endif

/*
** This function attempts to normalize the time values found in the stat()
** buffer to UTC.  This is necessary on Win32, where the runtime library







|


|







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
#  /* To allow a standalone DLL, use this next replacement function: */
#  undef sqlite3_win32_utf8_to_unicode
#  define sqlite3_win32_utf8_to_unicode utf8_to_utf16
#
LPWSTR utf8_to_utf16(const char *z){
  int nAllot = MultiByteToWideChar(CP_UTF8, 0, z, -1, NULL, 0);
  LPWSTR rv = sqlite3_malloc(nAllot * sizeof(WCHAR));
  if( rv!=0 && 0 < MultiByteToWideChar(CP_UTF8, 0, z, -1, rv, nAllot) )
    return rv;
  sqlite3_free(rv);
  return 0;
}
#endif

/*
** This function attempts to normalize the time values found in the stat()
** buffer to UTC.  This is necessary on Win32, where the runtime library
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
  if( rc==SQLITE_OK ){
    rc = fsdirRegister(db);
  }
  return rc;
}

#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
   /* To allow a standalone DLL, make test_windirent.c take these next
    * 3 functions from C runtime instead of from SQLite library: */
#  undef sqlite3_malloc
#  define sqlite3_malloc malloc
#  undef sqlite3_free
#  define sqlite3_free free
#  undef sqlite3_stricmp
#  define sqlite3_stricmp stricmp
   /* Just pull in this .c so above redefines take said effect. As a
    * side-effect, this extension becomes a single translation unit. */
#  include "test_windirent.c"
#endif







|
<
<
|
<
<
<
<
|
|


1017
1018
1019
1020
1021
1022
1023
1024


1025




1026
1027
1028
1029
  if( rc==SQLITE_OK ){
    rc = fsdirRegister(db);
  }
  return rc;
}

#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
/* To allow a standalone DLL, make test_windirent.c use the same


 * redefined SQLite API calls as the above extension code does.




 * Just pull in this .c to accomplish this. As a beneficial side
 * effect, this extension becomes a single translation unit. */
#  include "test_windirent.c"
#endif