/ Check-in [68cbc6b4]
Login

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

Overview
Comment:Add "b" to fopen() in the hexio tests so that extra carriage returns are not inserted on win32 and OS/2. Test harness change only - no changes to the core SQLite code. (CVS 5124)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 68cbc6b45c98ebaeca74e1ff5acc3ff7e34f45e9
User & Date: drh 2008-05-12 16:17:42
Context
2008-05-12
16:56
check that DosWrite() was successful before trying again (CVS 5125) check-in: 1ef6458b user: pweilbacher tags: trunk
16:17
Add "b" to fopen() in the hexio tests so that extra carriage returns are not inserted on win32 and OS/2. Test harness change only - no changes to the core SQLite code. (CVS 5124) check-in: 68cbc6b4 user: drh tags: trunk
12:41
Temporarily disable extended IO error code tests. (CVS 5123) check-in: f204df3c user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_hexio.c.

    13     13   ** implements TCL commands for reading and writing the binary
    14     14   ** database files and displaying the content of those files as
    15     15   ** hexadecimal.  We could, in theory, use the built-in "binary"
    16     16   ** command of TCL to do a lot of this, but there are some issues
    17     17   ** with historical versions of the "binary" command.  So it seems
    18     18   ** easier and safer to build our own mechanism.
    19     19   **
    20         -** $Id: test_hexio.c,v 1.6 2007/10/19 17:47:25 drh Exp $
           20  +** $Id: test_hexio.c,v 1.7 2008/05/12 16:17:42 drh Exp $
    21     21   */
    22     22   #include "sqliteInt.h"
    23     23   #include "tcl.h"
    24     24   #include <stdlib.h>
    25     25   #include <string.h>
    26     26   #include <assert.h>
    27     27   
................................................................................
   115    115     if( Tcl_GetIntFromObj(interp, objv[2], &offset) ) return TCL_ERROR;
   116    116     if( Tcl_GetIntFromObj(interp, objv[3], &amt) ) return TCL_ERROR;
   117    117     zFile = Tcl_GetString(objv[1]);
   118    118     zBuf = sqlite3_malloc( amt*2+1 );
   119    119     if( zBuf==0 ){
   120    120       return TCL_ERROR;
   121    121     }
   122         -  in = fopen(zFile, "r");
          122  +  in = fopen(zFile, "rb");
          123  +  if( in==0 ){
          124  +    in = fopen(zFile, "r");
          125  +  }
   123    126     if( in==0 ){
   124    127       Tcl_AppendResult(interp, "cannot open input file ", zFile, 0);
   125    128       return TCL_ERROR;
   126    129     }
   127    130     fseek(in, offset, SEEK_SET);
   128    131     got = fread(zBuf, 1, amt, in);
   129    132     fclose(in);
................................................................................
   164    167     zFile = Tcl_GetString(objv[1]);
   165    168     zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[3], &nIn);
   166    169     aOut = sqlite3_malloc( nIn/2 );
   167    170     if( aOut==0 ){
   168    171       return TCL_ERROR;
   169    172     }
   170    173     nOut = sqlite3TestHexToBin(zIn, nIn, aOut);
   171         -  out = fopen(zFile, "r+");
          174  +  out = fopen(zFile, "r+b");
          175  +  if( out==0 ){
          176  +    out = fopen(zFile, "r+");
          177  +  }
   172    178     if( out==0 ){
   173    179       Tcl_AppendResult(interp, "cannot open output file ", zFile, 0);
   174    180       return TCL_ERROR;
   175    181     }
   176    182     fseek(out, offset, SEEK_SET);
   177    183     written = fwrite(aOut, 1, nOut, out);
   178    184     sqlite3_free(aOut);