SQLite

Check-in [eafd8aa186]
Login

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

Overview
Comment:Fix compiler warnings. When forcing the delete of a WAL file, do not fail if the WAL files does not exist. All "veryquick.tcl" tests are now passing on Linux under the standard compile-time options.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: eafd8aa1862fb4bbe0d2441cbd110aba1abc772c
User & Date: drh 2014-05-09 13:27:38.567
Context
2014-05-09
14:56
Fix a misplaced #endif and a C99-ism in the unix VFS. (check-in: c8d384d146 user: drh tags: apple-osx)
13:27
Fix compiler warnings. When forcing the delete of a WAL file, do not fail if the WAL files does not exist. All "veryquick.tcl" tests are now passing on Linux under the standard compile-time options. (check-in: eafd8aa186 user: drh tags: apple-osx)
12:18
Fix an incorrect check for API misuse. (check-in: 856400dc20 user: drh tags: apple-osx)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
7248
7249
7250
7251
7252
7253
7254

7255
7256
7257
7258
7259
7260
7261
      pPager->pWal = 0;
      pagerFixMaplimit(pPager);

      /* Ensure that the WAL file is deleted even if the PERSIST_WAL
      ** hint is enabled. */
      if( rc==SQLITE_OK ){
        rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);

      }
    }
  }
  return rc;
}

#endif /* !SQLITE_OMIT_WAL */







>







7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
      pPager->pWal = 0;
      pagerFixMaplimit(pPager);

      /* Ensure that the WAL file is deleted even if the PERSIST_WAL
      ** hint is enabled. */
      if( rc==SQLITE_OK ){
        rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
        if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;
      }
    }
  }
  return rc;
}

#endif /* !SQLITE_OMIT_WAL */
Changes to src/test1.c.
5330
5331
5332
5333
5334
5335
5336

5337
5338

5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377

5378
5379

5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
 */
static int path_is_local(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){

  const char *zPath;
  int nPath;

  
  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
                     Tcl_GetStringFromObj(objv[0], 0), " PATH", 0);
    return TCL_ERROR;
  }
  zPath = Tcl_GetStringFromObj(objv[1], &nPath);
  
#ifdef __APPLE__
  {
    struct statfs fsInfo;
    if( statfs(zPath, &fsInfo) == -1 ){
      int err = errno;
      Tcl_AppendResult(interp, "Error calling statfs on path",
                       Tcl_NewIntObj(err), 0);
      return TCL_ERROR;
    }
    if( fsInfo.f_flags&MNT_LOCAL ){
      Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
    } else {
      Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 
    }
  }
#else
  Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
#endif
  
  return TCL_OK;  
}

/*
 ** tclcmd:   path_is_dos PWD
 */
static int path_is_dos(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){

  const char *zPath;
  int nPath;

  
  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
                     Tcl_GetStringFromObj(objv[0], 0), " PATH", 0);
    return TCL_ERROR;
  }
  zPath = Tcl_GetStringFromObj(objv[1], &nPath);
  
#ifdef __APPLE__
  {
    struct statfs fsInfo;
    if( statfs(zPath, &fsInfo) == -1 ){
      int err = errno;
      Tcl_AppendResult(interp, "Error calling statfs on path",
                       Tcl_NewIntObj(err), 0);
      return TCL_ERROR;
    }
    if (0 == strncmp("msdos", fsInfo.f_fstypename, 5)) {
      Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
    } else if (0 == strncmp("exfat", fsInfo.f_fstypename, 5)) {
      Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
    } else {
      Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 
    }
  }
#else
  Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 
#endif
  
  return TCL_OK;  
}







>


>







<
<
<
<
|
|
|
|
|
|
|
|
|
|
<

















>


>







<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
<







5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347




5348
5349
5350
5351
5352
5353
5354
5355
5356
5357

5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385




5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397

5398
5399
5400
5401
5402
5403
5404
 */
static int path_is_local(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
#ifdef __APPLE__
  const char *zPath;
  int nPath;
  struct statfs fsInfo;
  
  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
                     Tcl_GetStringFromObj(objv[0], 0), " PATH", 0);
    return TCL_ERROR;
  }
  zPath = Tcl_GetStringFromObj(objv[1], &nPath);




  if( statfs(zPath, &fsInfo) == -1 ){
    int err = errno;
    Tcl_AppendResult(interp, "Error calling statfs on path",
                     Tcl_NewIntObj(err), 0);
    return TCL_ERROR;
  }
  if( fsInfo.f_flags&MNT_LOCAL ){
    Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
  } else {
    Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 

  }
#else
  Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
#endif
  
  return TCL_OK;  
}

/*
 ** tclcmd:   path_is_dos PWD
 */
static int path_is_dos(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
#ifdef __APPLE__
  const char *zPath;
  int nPath;
  struct statfs fsInfo;
  
  if( objc!=2 ){
    Tcl_AppendResult(interp, "wrong # args: should be \"",
                     Tcl_GetStringFromObj(objv[0], 0), " PATH", 0);
    return TCL_ERROR;
  }
  zPath = Tcl_GetStringFromObj(objv[1], &nPath);




  if( statfs(zPath, &fsInfo) == -1 ){
    int err = errno;
    Tcl_AppendResult(interp, "Error calling statfs on path",
                     Tcl_NewIntObj(err), 0);
    return TCL_ERROR;
  }
  if (0 == strncmp("msdos", fsInfo.f_fstypename, 5)) {
    Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
  } else if (0 == strncmp("exfat", fsInfo.f_fstypename, 5)) {
    Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); 
  } else {
    Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 

  }
#else
  Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); 
#endif
  
  return TCL_OK;  
}