/ Check-in [ac27f38e]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Permit the 'test_fs' test module to be compiled and used on MinGW.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ac27f38eef7a241d56124c263d9f8c91f372a77f
User & Date: mistachkin 2016-01-05 01:48:29
Context
2016-01-05
03:39
Another attempt to get reuse of excess opcode array space working correctly on all architectures and platforms. check-in: 2f858374 user: drh tags: trunk
01:48
Permit the 'test_fs' test module to be compiled and used on MinGW. check-in: ac27f38e user: mistachkin tags: trunk
2016-01-04
23:43
Fix a corner case in the opcode-array reuse logic where the number of bytes of reusable space might be computed to be a negative number, due to unusual system alignment restrictions and rounding error. check-in: 1aa53014 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/test_fs.c.

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

82

83
84
85
86
87
88
89
...
227
228
229
230
231
232
233






234

235
236
237
238
239
240
241

#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#if SQLITE_OS_UNIX
# include <unistd.h>
# include <dirent.h>
# ifndef DIRENT
#  define DIRENT dirent
# endif
#endif
#if SQLITE_OS_WIN
# include <io.h>

# include "test_windirent.h"

# ifndef S_ISREG
#  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE

................................................................................
** Skip the cursor to the next entry.
*/
static int fsdirNext(sqlite3_vtab_cursor *cur){
  FsdirCsr *pCsr = (FsdirCsr*)cur;

  if( pCsr->pDir ){
    struct DIRENT *pRes = 0;






    readdir_r(pCsr->pDir, &pCsr->entry, &pRes);

    if( pRes==0 ){
      closedir(pCsr->pDir);
      pCsr->pDir = 0;
    }
    pCsr->iRowid++;
  }








|








>
|
>







 







>
>
>
>
>
>

>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
...
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250

#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#if SQLITE_OS_UNIX || defined(__MINGW_H)
# include <unistd.h>
# include <dirent.h>
# ifndef DIRENT
#  define DIRENT dirent
# endif
#endif
#if SQLITE_OS_WIN
# include <io.h>
# if !defined(__MINGW_H)
#  include "test_windirent.h"
# endif
# ifndef S_ISREG
#  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE

................................................................................
** Skip the cursor to the next entry.
*/
static int fsdirNext(sqlite3_vtab_cursor *cur){
  FsdirCsr *pCsr = (FsdirCsr*)cur;

  if( pCsr->pDir ){
    struct DIRENT *pRes = 0;
#if defined(__MINGW_H)
    pRes = readdir(pCsr->pDir);
    if( pRes!=0 ){
      memcpy(&pCsr->entry, pRes, sizeof(struct DIRENT));
    }
#else
    readdir_r(pCsr->pDir, &pCsr->entry, &pRes);
#endif
    if( pRes==0 ){
      closedir(pCsr->pDir);
      pCsr->pDir = 0;
    }
    pCsr->iRowid++;
  }

Changes to test/vtabH.test.

138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      }
      return $res
    } else {
      return [glob -nocomplain $pattern]
    }
  }

  # Read the first 5 entries from the root directory.  Except, ignore
  # files that contain the "$" character in their names as these are
  # special files on some Windows platforms.
  #
  set res [list]
  foreach p [lrange [list_root_files] 0 4] {
    if {$::tcl_platform(platform) eq "windows"} {
      if {![regexp {\$} $p]} {lappend res $p}
    } else {
      lappend res "/$p"
    }
  }
  do_execsql_test 3.1 {
    SELECT path FROM fstree WHERE path NOT GLOB '*$*' LIMIT 5;
  } $res
  
  # Read all entries in the current directory.
  #
  proc contents {pattern} {
    set res [list]
    foreach f [list_files $pattern] {
      lappend res $f
      if {[file isdir $f]} {







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







138
139
140
141
142
143
144
















145
146
147
148
149
150
151
      }
      return $res
    } else {
      return [glob -nocomplain $pattern]
    }
  }

















  # Read all entries in the current directory.
  #
  proc contents {pattern} {
    set res [list]
    foreach f [list_files $pattern] {
      lappend res $f
      if {[file isdir $f]} {