Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/src/test_hexio.c

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2007 April 6 2 ** 2007 April 6
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 in = fopen(zFile, "rb"); 120 in = fopen(zFile, "rb");
121 if( in==0 ){ 121 if( in==0 ){
122 in = fopen(zFile, "r"); 122 in = fopen(zFile, "r");
123 } 123 }
124 if( in==0 ){ 124 if( in==0 ){
125 Tcl_AppendResult(interp, "cannot open input file ", zFile, 0); 125 Tcl_AppendResult(interp, "cannot open input file ", zFile, 0);
126 return TCL_ERROR; 126 return TCL_ERROR;
127 } 127 }
128 fseek(in, offset, SEEK_SET); 128 fseek(in, offset, SEEK_SET);
129 got = fread(zBuf, 1, amt, in); 129 got = (int)fread(zBuf, 1, amt, in);
130 fclose(in); 130 fclose(in);
131 if( got<0 ){ 131 if( got<0 ){
132 got = 0; 132 got = 0;
133 } 133 }
134 sqlite3TestBinToHex(zBuf, got); 134 sqlite3TestBinToHex(zBuf, got);
135 Tcl_AppendResult(interp, zBuf, 0); 135 Tcl_AppendResult(interp, zBuf, 0);
136 sqlite3_free(zBuf); 136 sqlite3_free(zBuf);
137 return TCL_OK; 137 return TCL_OK;
138 } 138 }
139 139
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 nOut = sqlite3TestHexToBin(zIn, nIn, aOut); 171 nOut = sqlite3TestHexToBin(zIn, nIn, aOut);
172 out = fopen(zFile, "r+b"); 172 out = fopen(zFile, "r+b");
173 if( out==0 ){ 173 if( out==0 ){
174 out = fopen(zFile, "r+"); 174 out = fopen(zFile, "r+");
175 } 175 }
176 if( out==0 ){ 176 if( out==0 ){
177 Tcl_AppendResult(interp, "cannot open output file ", zFile, 0); 177 Tcl_AppendResult(interp, "cannot open output file ", zFile, 0);
178 return TCL_ERROR; 178 return TCL_ERROR;
179 } 179 }
180 fseek(out, offset, SEEK_SET); 180 fseek(out, offset, SEEK_SET);
181 written = fwrite(aOut, 1, nOut, out); 181 written = (int)fwrite(aOut, 1, nOut, out);
182 sqlite3_free(aOut); 182 sqlite3_free(aOut);
183 fclose(out); 183 fclose(out);
184 Tcl_SetObjResult(interp, Tcl_NewIntObj(written)); 184 Tcl_SetObjResult(interp, Tcl_NewIntObj(written));
185 return TCL_OK; 185 return TCL_OK;
186 } 186 }
187 187
188 /* 188 /*
189 ** USAGE: hexio_get_int HEXDATA 189 ** USAGE: hexio_get_int HEXDATA
190 ** 190 **
191 ** Interpret the HEXDATA argument as a big-endian integer. Return 191 ** Interpret the HEXDATA argument as a big-endian integer. Return
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 { "hexio_render_int32", hexio_render_int32 }, 379 { "hexio_render_int32", hexio_render_int32 },
380 { "utf8_to_utf8", utf8_to_utf8 }, 380 { "utf8_to_utf8", utf8_to_utf8 },
381 { "read_fts3varint", read_fts3varint }, 381 { "read_fts3varint", read_fts3varint },
382 }; 382 };
383 int i; 383 int i;
384 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ 384 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
385 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); 385 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0);
386 } 386 }
387 return TCL_OK; 387 return TCL_OK;
388 } 388 }
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/src/test_func.c ('k') | third_party/sqlite/sqlite-src-3080704/src/test_init.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698