Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | use blob_strip_bom in main.c <p>This has the effect that on Windows the --args file accepts a unicode file, starting with a UTF-16 BOM as well |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | use-blob_strip_bom |
| Files: | files | file ages | folders |
| SHA1: |
cbb24cf854fc03528f5745ceb671b7d7 |
| User & Date: | jan.nijtmans 2012-10-26 08:19:48.951 |
| Original Comment: | use blob_strip_blob in main.c <p>This has the effect that on Windows the --args file accepts a unicode file, starting with a UTF-16 BOM as well |
Context
|
2012-10-26
| ||
| 09:07 | use blob_strip_bom() in wikiformat.c <p>This has the effect that on Windows wiki pages can now be in unicode as well. ... (check-in: 05033666fd user: jan.nijtmans tags: use-blob_strip_bom) | |
| 08:19 | use blob_strip_bom in main.c <p>This has the effect that on Windows the --args file accepts a unicode file, starting with a UTF-16 BOM as well ... (check-in: cbb24cf854 user: jan.nijtmans tags: use-blob_strip_bom) | |
| 02:35 | Improvements to side-by-side diff alignment. ... (check-in: 511405f426 user: drh tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
474 475 476 477 478 479 480 | unsigned int nLine; /* Number of lines in the file*/ unsigned int i, j, k; /* Loop counters */ int n; /* Number of bytes in one line */ char *z; /* General use string pointer */ char **newArgv; /* New expanded g.argv under construction */ char const * zFileName; /* input file name */ FILE * zInFile; /* input FILE */ | < | | 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | unsigned int nLine; /* Number of lines in the file*/ unsigned int i, j, k; /* Loop counters */ int n; /* Number of bytes in one line */ char *z; /* General use string pointer */ char **newArgv; /* New expanded g.argv under construction */ char const * zFileName; /* input file name */ FILE * zInFile; /* input FILE */ #ifdef _WIN32 WCHAR buf[MAX_PATH]; #endif g.argc = argc; g.argv = argv; #ifdef _WIN32 parse_windows_command_line(&g.argc, &g.argv); GetModuleFileNameW(NULL, buf, MAX_PATH); |
| ︙ | ︙ | |||
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
}else{
blob_read_from_channel(&file, zInFile, -1);
if(stdin != zInFile){
fclose(zInFile);
}
zInFile = NULL;
}
z = blob_str(&file);
for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++;
newArgv = fossil_malloc( sizeof(char*)*(g.argc + nLine*2) );
for(j=0; j<i; j++) newArgv[j] = g.argv[j];
blob_rewind(&file);
while( (n = blob_line(&file, &line))>0 ){
if( n<=1 ) continue;
z = blob_buffer(&line);
z[n-1] = 0;
| > < < < < < < < < < < | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
}else{
blob_read_from_channel(&file, zInFile, -1);
if(stdin != zInFile){
fclose(zInFile);
}
zInFile = NULL;
}
blob_strip_bom(&file, 1);
z = blob_str(&file);
for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++;
newArgv = fossil_malloc( sizeof(char*)*(g.argc + nLine*2) );
for(j=0; j<i; j++) newArgv[j] = g.argv[j];
blob_rewind(&file);
while( (n = blob_line(&file, &line))>0 ){
if( n<=1 ) continue;
z = blob_buffer(&line);
z[n-1] = 0;
if((n>1) && ('\r'==z[n-2])){
if(n==2) continue /*empty line*/;
z[n-2] = 0;
}
newArgv[j++] = z;
if( z[0]=='-' ){
for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
if( z[k] ){
z[k] = 0;
k++;
if( z[k] ) newArgv[j++] = &z[k];
|
| ︙ | ︙ | |||
848 849 850 851 852 853 854 |
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
| | | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
WCHAR *zUnicode = fossil_utf8_to_unicode(zNewCmd);
if( g.fSystemTrace ) {
char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
rc = _wsystem(zUnicode);
fossil_mbcs_free(zUnicode);
|
| ︙ | ︙ |