Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change calls to unlink() into file_delete(). The file_delete() routine converts filenames to MBCS from UTF if necessary. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | windows-i18n |
Files: | files | file ages | folders |
SHA1: |
eea64490987a16bb08ab88a45fee56ed |
User & Date: | drh 2011-05-02 13:31:01.178 |
Context
2011-05-03
| ||
01:12 | Update the fossil_system() function so that it converts the system command form UTF8 into MBCS before calling system(). Speculative fix for ticket [8d916f5fc30be3]. ... (check-in: a65c97afd6 user: drh tags: windows-i18n) | |
2011-05-02
| ||
13:31 | Change calls to unlink() into file_delete(). The file_delete() routine converts filenames to MBCS from UTF if necessary. ... (check-in: eea6449098 user: drh tags: windows-i18n) | |
13:10 | Merge in changes from trunk. ... (check-in: f8f1c4e9a3 user: drh tags: windows-i18n) | |
Changes
Changes to src/checkin.c.
︙ | ︙ | |||
300 301 302 303 304 305 306 | g.zLocalRoot, fossil_all_reserved_names() ); if( file_tree_name(g.zRepositoryName, &repo, 0) ){ db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); } while( db_step(&q)==SQLITE_ROW ){ if( allFlag ){ | | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | g.zLocalRoot, fossil_all_reserved_names() ); if( file_tree_name(g.zRepositoryName, &repo, 0) ){ db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); } while( db_step(&q)==SQLITE_ROW ){ if( allFlag ){ file_delete(db_column_text(&q, 0)); }else{ Blob ans; char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ", db_column_text(&q, 0)); blob_zero(&ans); prompt_user(prompt, &ans); if( blob_str(&ans)[0]=='y' ){ file_delete(db_column_text(&q, 0)); } } } db_finalize(&q); } /* |
︙ | ︙ | |||
408 409 410 411 412 413 414 | blob_reset(&text); while( fgets(zIn, sizeof(zIn), stdin)!=0 ){ if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break; blob_append(&text, zIn, -1); } } blob_remove_cr(&text); | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | blob_reset(&text); while( fgets(zIn, sizeof(zIn), stdin)!=0 ){ if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break; blob_append(&text, zIn, -1); } } blob_remove_cr(&text); file_delete(zFile); free(zFile); blob_zero(pComment); while( blob_line(&text, &line) ){ int i, n; char *z; n = blob_size(&line); z = blob_buffer(&line); |
︙ | ︙ |
Changes to src/checkout.c.
︙ | ︙ | |||
155 156 157 158 159 160 161 | blob_append(&hash, "\n", 1); blob_write_to_file(&hash, zManFile); free(zManFile); blob_reset(&hash); }else{ if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ zManFile = mprintf("%smanifest", g.zLocalRoot); | | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | blob_append(&hash, "\n", 1); blob_write_to_file(&hash, zManFile); free(zManFile); blob_reset(&hash); }else{ if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ zManFile = mprintf("%smanifest", g.zLocalRoot); file_delete(zManFile); free(zManFile); } if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); file_delete(zManFile); free(zManFile); } } } /* |
︙ | ︙ | |||
266 267 268 269 270 271 272 | static void unlink_local_database(int manifestOnly){ const char *zReserved; int i; for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ if( manifestOnly==0 || zReserved[0]=='m' ){ char *z; z = mprintf("%s%s", g.zLocalRoot, zReserved); | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | static void unlink_local_database(int manifestOnly){ const char *zReserved; int i; for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ if( manifestOnly==0 || zReserved[0]=='m' ){ char *z; z = mprintf("%s%s", g.zLocalRoot, zReserved); file_delete(z); free(z); } } } /* ** COMMAND: close |
︙ | ︙ |
Changes to src/clearsign.c.
︙ | ︙ | |||
50 51 52 53 54 55 56 | blob_zero(pOut); blob_read_from_file(pOut, zIn); }else{ if( pOut!=pIn ){ blob_copy(pOut, pIn); } } | | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 | blob_zero(pOut); blob_read_from_file(pOut, zIn); }else{ if( pOut!=pIn ){ blob_copy(pOut, pIn); } } file_delete(zOut); file_delete(zIn); free(zOut); free(zIn); return rc; } |
Changes to src/clone.c.
︙ | ︙ | |||
102 103 104 105 106 107 108 | g.xlinkClusterOnly = 1; nErr = client_sync(0,0,1,bPrivate,CONFIGSET_ALL,0); g.xlinkClusterOnly = 0; verify_cancel(); db_end_transaction(0); db_close(1); if( nErr ){ | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | g.xlinkClusterOnly = 1; nErr = client_sync(0,0,1,bPrivate,CONFIGSET_ALL,0); g.xlinkClusterOnly = 0; verify_cancel(); db_end_transaction(0); db_close(1); if( nErr ){ file_delete(g.argv[3]); fossil_fatal("server returned an error - clone aborted"); } db_open_repository(g.argv[3]); } db_begin_transaction(); fossil_print("Rebuilding repository meta-data...\n"); rebuild_db(0, 1, 0); |
︙ | ︙ |
Changes to src/db.c.
︙ | ︙ | |||
151 152 153 154 155 156 157 | db_finalize(pAllStmt); } if( nBegin ){ sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); nBegin = 0; if( isNewRepo ){ db_close(0); | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | db_finalize(pAllStmt); } if( nBegin ){ sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); nBegin = 0; if( isNewRepo ){ db_close(0); file_delete(g.zRepositoryName); } } busy = 0; db_close(0); } /* |
︙ | ︙ |
Changes to src/diffcmd.c.
︙ | ︙ | |||
112 113 114 115 116 117 118 | blob_append(&cmd, " ", 1); shell_escape(&cmd, zFile2); /* Run the external diff command */ fossil_system(blob_str(&cmd)); /* Delete the temporary file and clean up memory used */ | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | blob_append(&cmd, " ", 1); shell_escape(&cmd, zFile2); /* Run the external diff command */ fossil_system(blob_str(&cmd)); /* Delete the temporary file and clean up memory used */ file_delete(blob_str(&nameFile1)); blob_reset(&nameFile1); blob_reset(&cmd); } } /* ** Show the difference between two files, both in memory. |
︙ | ︙ | |||
166 167 168 169 170 171 172 | blob_append(&cmd, " ", 1); shell_escape(&cmd, zTemp2); /* Run the external diff command */ fossil_system(blob_str(&cmd)); /* Delete the temporary file and clean up memory used */ | | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | blob_append(&cmd, " ", 1); shell_escape(&cmd, zTemp2); /* Run the external diff command */ fossil_system(blob_str(&cmd)); /* Delete the temporary file and clean up memory used */ file_delete(zTemp1); file_delete(zTemp2); blob_reset(&cmd); } } /* ** Do a diff against a single file named in g.argv[2] from version zFrom ** against the same file on disk. |
︙ | ︙ |
Changes to src/file.c.
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | chmod(zFilename, buf.st_mode & ~0111); rc = 1; } } #endif /* _WIN32 */ return rc; } /* ** Create the directory named in the argument, if it does not already ** exist. If forceFlag is 1, delete any prior non-directory object ** with the same name. ** ** Return the number of errors. */ int file_mkdir(const char *zName, int forceFlag){ int rc = file_isdir(zName); if( rc==2 ){ if( !forceFlag ) return 1; | > > > > > > > > > | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | chmod(zFilename, buf.st_mode & ~0111); rc = 1; } } #endif /* _WIN32 */ return rc; } /* ** Delete a file. */ void file_delete(const char *zFilename){ char *z = fossil_utf8_to_mbcs(zFilename); unlink(z); fossil_mbcs_free(z); } /* ** Create the directory named in the argument, if it does not already ** exist. If forceFlag is 1, delete any prior non-directory object ** with the same name. ** ** Return the number of errors. */ int file_mkdir(const char *zName, int forceFlag){ int rc = file_isdir(zName); if( rc==2 ){ if( !forceFlag ) return 1; file_delete(zName); } if( rc!=1 ){ #if defined(_WIN32) return mkdir(zName); #else return mkdir(zName, 0755); #endif |
︙ | ︙ |
Changes to src/http_transport.c.
︙ | ︙ | |||
244 245 246 247 248 249 250 | ssl_close(); #endif }else if( g.urlIsFile ){ if( transport.pFile ){ fclose(transport.pFile); transport.pFile = 0; } | | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | ssl_close(); #endif }else if( g.urlIsFile ){ if( transport.pFile ){ fclose(transport.pFile); transport.pFile = 0; } file_delete(transport.zInFile); file_delete(transport.zOutFile); free(transport.zInFile); free(transport.zOutFile); }else{ socket_close(); } transport.isOpen = 0; } |
︙ | ︙ |
Changes to src/import.c.
︙ | ︙ | |||
695 696 697 698 699 700 701 | if( g.argc==4 ){ pIn = fopen(g.argv[3], "rb"); }else{ pIn = stdin; fossil_binary_mode(pIn); } if( !incrFlag ){ | | | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | if( g.argc==4 ){ pIn = fopen(g.argv[3], "rb"); }else{ pIn = stdin; fossil_binary_mode(pIn); } if( !incrFlag ){ if( forceFlag ) file_delete(g.argv[2]); db_create_repository(g.argv[2]); } db_open_repository(g.argv[2]); db_open_config(0); /* The following temp-tables are used to hold information needed for ** the import. |
︙ | ︙ |
Changes to src/merge.c.
︙ | ︙ | |||
413 414 415 416 417 418 419 | } undo_save(zName); db_multi_exec( "UPDATE vfile SET deleted=1 WHERE id=%d", idv ); if( !nochangeFlag ){ char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName); | | | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | } undo_save(zName); db_multi_exec( "UPDATE vfile SET deleted=1 WHERE id=%d", idv ); if( !nochangeFlag ){ char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName); file_delete(zFullPath); free(zFullPath); } } db_finalize(&q); /* ** Rename files that have taken a rename on P->M but which keep the same |
︙ | ︙ | |||
443 444 445 446 447 448 449 | "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)" " WHERE id=%d AND vid=%d", zNewName, idv, vid ); if( !nochangeFlag ){ char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); file_copy(zFullOldPath, zFullNewPath); | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | "UPDATE vfile SET pathname=%Q, origname=coalesce(origname,pathname)" " WHERE id=%d AND vid=%d", zNewName, idv, vid ); if( !nochangeFlag ){ char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); file_copy(zFullOldPath, zFullNewPath); file_delete(zFullOldPath); free(zFullNewPath); free(zFullOldPath); } } db_finalize(&q); |
︙ | ︙ |
Changes to src/merge3.c.
︙ | ︙ | |||
422 423 424 425 426 427 428 | azSubst[4] = "%merge"; azSubst[5] = zOther; azSubst[6] = "%output"; azSubst[7] = zOut; zCmd = string_subst(zGMerge, 8, azSubst); printf("%s\n", zCmd); fflush(stdout); fossil_system(zCmd); if( file_size(zOut)>=0 ){ blob_read_from_file(pOut, zOut); | | | | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | azSubst[4] = "%merge"; azSubst[5] = zOther; azSubst[6] = "%output"; azSubst[7] = zOut; zCmd = string_subst(zGMerge, 8, azSubst); printf("%s\n", zCmd); fflush(stdout); fossil_system(zCmd); if( file_size(zOut)>=0 ){ blob_read_from_file(pOut, zOut); file_delete(zPivot); file_delete(zOrig); file_delete(zOther); file_delete(zOut); } fossil_free(zCmd); fossil_free(zOut); } fossil_free(zPivot); fossil_free(zOrig); fossil_free(zOther); |
︙ | ︙ |
Changes to src/stash.c.
︙ | ︙ | |||
186 187 188 189 190 191 192 | if( rid==0 ){ db_ephemeral_blob(&q, 5, &delta); blob_write_to_file(&delta, zNPath); file_setexe(zNPath, isExec); fossil_print("ADD %s\n", zNew); }else if( isRemoved ){ fossil_print("DELETE %s\n", zOrig); | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | if( rid==0 ){ db_ephemeral_blob(&q, 5, &delta); blob_write_to_file(&delta, zNPath); file_setexe(zNPath, isExec); fossil_print("ADD %s\n", zNew); }else if( isRemoved ){ fossil_print("DELETE %s\n", zOrig); file_delete(zOPath); }else{ Blob a, b, out, disk; db_ephemeral_blob(&q, 5, &delta); blob_read_from_file(&disk, zOPath); content_get(rid, &a); blob_delta_apply(&a, &delta, &b); if( blob_compare(&disk, &a)==0 ){ |
︙ | ︙ | |||
216 217 218 219 220 221 222 | blob_reset(&a); blob_reset(&b); blob_reset(&disk); } blob_reset(&delta); if( fossil_strcmp(zOrig,zNew)!=0 ){ undo_save(zOrig); | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | blob_reset(&a); blob_reset(&b); blob_reset(&disk); } blob_reset(&delta); if( fossil_strcmp(zOrig,zNew)!=0 ){ undo_save(zOrig); file_delete(zOPath); } } db_finalize(&q); if( nConflict ){ fossil_print("WARNING: merge conflicts - see messages above for details.\n"); } } |
︙ | ︙ |
Changes to src/undo.c.
︙ | ︙ | |||
64 65 66 67 68 69 70 | }else{ fossil_print("NEW %s\n", zPathname); } blob_write_to_file(&new, zFullname); file_setexe(zFullname, old_exe); }else{ fossil_print("DELETE %s\n", zPathname); | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | }else{ fossil_print("NEW %s\n", zPathname); } blob_write_to_file(&new, zFullname); file_setexe(zFullname, old_exe); }else{ fossil_print("DELETE %s\n", zPathname); file_delete(zFullname); } blob_reset(&new); free(zFullname); db_finalize(&q); db_prepare(&q, "UPDATE undo SET content=:c, existsflag=%d, isExe=%d," " redoflag=NOT redoflag" |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
361 362 363 364 365 366 367 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); undo_save(zName); | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); undo_save(zName); if( !nochangeFlag ) file_delete(zFullPath); } }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ /* Merge the changes in the current tree into the target version */ Blob r, t, v; int rc; if( nameChng ){ fossil_print("MERGE %s -> %s\n", zName, zNewName); |
︙ | ︙ | |||
393 394 395 396 397 398 399 | if( !nochangeFlag ){ blob_write_to_file(&t, zFullNewPath); file_setexe(zFullNewPath, isexe); } fossil_print("***** Cannot merge binary file %s\n", zNewName); nConflict++; } | | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | if( !nochangeFlag ){ blob_write_to_file(&t, zFullNewPath); file_setexe(zFullNewPath, isexe); } fossil_print("***** Cannot merge binary file %s\n", zNewName); nConflict++; } if( nameChng && !nochangeFlag ) file_delete(zFullPath); blob_reset(&v); blob_reset(&t); blob_reset(&r); }else{ if( chnged ){ if( verboseFlag ) fossil_print("EDITED %s\n", zName); }else{ |
︙ | ︙ | |||
572 573 574 575 576 577 578 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); if( errCode==2 ){ if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ fossil_print("UNMANAGE: %s\n", zFile); }else{ undo_save(zFile); | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | zFull = mprintf("%/%/", g.zLocalRoot, zFile); errCode = historical_version_of_file(zRevision, zFile, &record, &isExe,2); if( errCode==2 ){ if( db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFile)==0 ){ fossil_print("UNMANAGE: %s\n", zFile); }else{ undo_save(zFile); file_delete(zFull); fossil_print("DELETE: %s\n", zFile); } db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); }else{ sqlite3_int64 mtime; undo_save(zFile); blob_write_to_file(&record, zFull); |
︙ | ︙ |
Changes to src/vfile.c.
︙ | ︙ | |||
284 285 286 287 288 289 290 | Stmt q; db_prepare(&q, "SELECT %Q || pathname FROM vfile" " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid); while( db_step(&q)==SQLITE_ROW ){ const char *zName; zName = db_column_text(&q, 0); | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | Stmt q; db_prepare(&q, "SELECT %Q || pathname FROM vfile" " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid); while( db_step(&q)==SQLITE_ROW ){ const char *zName; zName = db_column_text(&q, 0); file_delete(zName); } db_finalize(&q); db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid); } /* ** Check to see if the directory named in zPath is the top of a checkout. |
︙ | ︙ |
Changes to src/winhttp.c.
︙ | ︙ | |||
121 122 123 124 125 126 127 | } } end_request: if( out ) fclose(out); if( in ) fclose(in); closesocket(p->s); | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | } } end_request: if( out ) fclose(out); if( in ) fclose(in); closesocket(p->s); file_delete(zRequestFName); file_delete(zReplyFName); free(p); } /* ** Start a listening socket and process incoming HTTP requests on ** that socket. */ |
︙ | ︙ | |||
144 145 146 147 148 149 150 | WSADATA wd; SOCKET s = INVALID_SOCKET; SOCKADDR_IN addr; int idCnt = 0; int iPort = mnPort; Blob options; | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | WSADATA wd; SOCKET s = INVALID_SOCKET; SOCKADDR_IN addr; int idCnt = 0; int iPort = mnPort; Blob options; if( zStopper ) file_delete(zStopper); blob_zero(&options); if( zNotFound ){ blob_appendf(&options, " --notfound %s", zNotFound); } if( g.useLocalauth ){ blob_appendf(&options, " --localauth"); } |
︙ | ︙ |