Fossil SCM
Allow looks_like_utf8/16 to specify when the loop should stop, in stead of leaving it unspecified. Minor comment/doc fixes.
Commit
79f7eb2fc5c906cbc3fb3df8bc25fb49e7242ed2
Parent
f89e2eccbb9e286…
5 files changed
+5
-5
+2
-2
+11
-11
+3
-3
+3
-1
+5
-5
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -635,11 +635,11 @@ | ||
| 635 | 635 | file_tree_name(g.argv[ii], &b, 1); |
| 636 | 636 | iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b)); |
| 637 | 637 | if( iId<0 ){ |
| 638 | 638 | fossil_warning("fossil knows nothing about: %s", g.argv[ii]); |
| 639 | 639 | result = 1; |
| 640 | - } else { | |
| 640 | + }else{ | |
| 641 | 641 | g.aCommitFile[jj++] = iId; |
| 642 | 642 | } |
| 643 | 643 | blob_reset(&b); |
| 644 | 644 | } |
| 645 | 645 | g.aCommitFile[jj] = 0; |
| @@ -915,13 +915,13 @@ | ||
| 915 | 915 | static int allOk = 0; /* Set to true to disable this routine */ |
| 916 | 916 | |
| 917 | 917 | if( allOk ) return 0; |
| 918 | 918 | fUnicode = could_be_utf16(p, &bReverse); |
| 919 | 919 | if( fUnicode ){ |
| 920 | - lookFlags = looks_like_utf16(p, bReverse); | |
| 920 | + lookFlags = looks_like_utf16(p, bReverse, LOOK_NUL); | |
| 921 | 921 | }else{ |
| 922 | - lookFlags = looks_like_utf8(p); | |
| 922 | + lookFlags = looks_like_utf8(p, LOOK_NUL); | |
| 923 | 923 | } |
| 924 | 924 | if( lookFlags&(LOOK_BINARY|LOOK_LONG|LOOK_CR) || fUnicode ){ |
| 925 | 925 | const char *zWarning; |
| 926 | 926 | const char *zDisable; |
| 927 | 927 | const char *zConvert = "c=convert/"; |
| @@ -940,11 +940,11 @@ | ||
| 940 | 940 | }else{ |
| 941 | 941 | zWarning = "binary data"; |
| 942 | 942 | zConvert = ""; /* We cannot convert binary files. */ |
| 943 | 943 | } |
| 944 | 944 | zDisable = "\"binary-glob\" setting"; |
| 945 | - }else if( lookFlags&(LOOK_CR) && fUnicode ){ | |
| 945 | + }else if( (lookFlags&LOOK_CR) && fUnicode ){ | |
| 946 | 946 | if( crnlOk && encodingOk ){ |
| 947 | 947 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 948 | 948 | } |
| 949 | 949 | if( (lookFlags&LOOK_EOL) == LOOK_LONE_CR ){ |
| 950 | 950 | zWarning = "CR line endings and Unicode"; |
| @@ -1407,11 +1407,11 @@ | ||
| 1407 | 1407 | } |
| 1408 | 1408 | db_finalize(&q); |
| 1409 | 1409 | if( nConflict && !allowConflict ){ |
| 1410 | 1410 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 1411 | 1411 | "use --allow-conflict to override"); |
| 1412 | - } else if( abortCommit ){ | |
| 1412 | + }else if( abortCommit ){ | |
| 1413 | 1413 | fossil_fatal("one or more files were converted on your request; " |
| 1414 | 1414 | "please re-test before committing"); |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | 1417 | /* Create the new manifest */ |
| 1418 | 1418 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -635,11 +635,11 @@ | |
| 635 | file_tree_name(g.argv[ii], &b, 1); |
| 636 | iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b)); |
| 637 | if( iId<0 ){ |
| 638 | fossil_warning("fossil knows nothing about: %s", g.argv[ii]); |
| 639 | result = 1; |
| 640 | } else { |
| 641 | g.aCommitFile[jj++] = iId; |
| 642 | } |
| 643 | blob_reset(&b); |
| 644 | } |
| 645 | g.aCommitFile[jj] = 0; |
| @@ -915,13 +915,13 @@ | |
| 915 | static int allOk = 0; /* Set to true to disable this routine */ |
| 916 | |
| 917 | if( allOk ) return 0; |
| 918 | fUnicode = could_be_utf16(p, &bReverse); |
| 919 | if( fUnicode ){ |
| 920 | lookFlags = looks_like_utf16(p, bReverse); |
| 921 | }else{ |
| 922 | lookFlags = looks_like_utf8(p); |
| 923 | } |
| 924 | if( lookFlags&(LOOK_BINARY|LOOK_LONG|LOOK_CR) || fUnicode ){ |
| 925 | const char *zWarning; |
| 926 | const char *zDisable; |
| 927 | const char *zConvert = "c=convert/"; |
| @@ -940,11 +940,11 @@ | |
| 940 | }else{ |
| 941 | zWarning = "binary data"; |
| 942 | zConvert = ""; /* We cannot convert binary files. */ |
| 943 | } |
| 944 | zDisable = "\"binary-glob\" setting"; |
| 945 | }else if( lookFlags&(LOOK_CR) && fUnicode ){ |
| 946 | if( crnlOk && encodingOk ){ |
| 947 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 948 | } |
| 949 | if( (lookFlags&LOOK_EOL) == LOOK_LONE_CR ){ |
| 950 | zWarning = "CR line endings and Unicode"; |
| @@ -1407,11 +1407,11 @@ | |
| 1407 | } |
| 1408 | db_finalize(&q); |
| 1409 | if( nConflict && !allowConflict ){ |
| 1410 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 1411 | "use --allow-conflict to override"); |
| 1412 | } else if( abortCommit ){ |
| 1413 | fossil_fatal("one or more files were converted on your request; " |
| 1414 | "please re-test before committing"); |
| 1415 | } |
| 1416 | |
| 1417 | /* Create the new manifest */ |
| 1418 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -635,11 +635,11 @@ | |
| 635 | file_tree_name(g.argv[ii], &b, 1); |
| 636 | iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b)); |
| 637 | if( iId<0 ){ |
| 638 | fossil_warning("fossil knows nothing about: %s", g.argv[ii]); |
| 639 | result = 1; |
| 640 | }else{ |
| 641 | g.aCommitFile[jj++] = iId; |
| 642 | } |
| 643 | blob_reset(&b); |
| 644 | } |
| 645 | g.aCommitFile[jj] = 0; |
| @@ -915,13 +915,13 @@ | |
| 915 | static int allOk = 0; /* Set to true to disable this routine */ |
| 916 | |
| 917 | if( allOk ) return 0; |
| 918 | fUnicode = could_be_utf16(p, &bReverse); |
| 919 | if( fUnicode ){ |
| 920 | lookFlags = looks_like_utf16(p, bReverse, LOOK_NUL); |
| 921 | }else{ |
| 922 | lookFlags = looks_like_utf8(p, LOOK_NUL); |
| 923 | } |
| 924 | if( lookFlags&(LOOK_BINARY|LOOK_LONG|LOOK_CR) || fUnicode ){ |
| 925 | const char *zWarning; |
| 926 | const char *zDisable; |
| 927 | const char *zConvert = "c=convert/"; |
| @@ -940,11 +940,11 @@ | |
| 940 | }else{ |
| 941 | zWarning = "binary data"; |
| 942 | zConvert = ""; /* We cannot convert binary files. */ |
| 943 | } |
| 944 | zDisable = "\"binary-glob\" setting"; |
| 945 | }else if( (lookFlags&LOOK_CR) && fUnicode ){ |
| 946 | if( crnlOk && encodingOk ){ |
| 947 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 948 | } |
| 949 | if( (lookFlags&LOOK_EOL) == LOOK_LONE_CR ){ |
| 950 | zWarning = "CR line endings and Unicode"; |
| @@ -1407,11 +1407,11 @@ | |
| 1407 | } |
| 1408 | db_finalize(&q); |
| 1409 | if( nConflict && !allowConflict ){ |
| 1410 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 1411 | "use --allow-conflict to override"); |
| 1412 | }else if( abortCommit ){ |
| 1413 | fossil_fatal("one or more files were converted on your request; " |
| 1414 | "please re-test before committing"); |
| 1415 | } |
| 1416 | |
| 1417 | /* Create the new manifest */ |
| 1418 |
M
src/db.c
+2
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2186,12 +2186,12 @@ | ||
| 2186 | 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | 2188 | ** be unsigned. Default: off |
| 2189 | 2189 | ** |
| 2190 | 2190 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| 2191 | -** (versionable) text files in which it is ok to have CR+NL line endings. | |
| 2192 | -** Set to "*" to disable CR+NL checking. | |
| 2191 | +** (versionable) text files in which it is ok to have CR, CR+NL or mixed | |
| 2192 | +** line endings. Set to "*" to disable CR+NL checking. | |
| 2193 | 2193 | ** |
| 2194 | 2194 | ** default-perms Permissions given automatically to new users. For more |
| 2195 | 2195 | ** information on permissions see Users page in Server |
| 2196 | 2196 | ** Administration of the HTTP UI. Default: u. |
| 2197 | 2197 | ** |
| 2198 | 2198 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2186,12 +2186,12 @@ | |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| 2191 | ** (versionable) text files in which it is ok to have CR+NL line endings. |
| 2192 | ** Set to "*" to disable CR+NL checking. |
| 2193 | ** |
| 2194 | ** default-perms Permissions given automatically to new users. For more |
| 2195 | ** information on permissions see Users page in Server |
| 2196 | ** Administration of the HTTP UI. Default: u. |
| 2197 | ** |
| 2198 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2186,12 +2186,12 @@ | |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| 2191 | ** (versionable) text files in which it is ok to have CR, CR+NL or mixed |
| 2192 | ** line endings. Set to "*" to disable CR+NL checking. |
| 2193 | ** |
| 2194 | ** default-perms Permissions given automatically to new users. For more |
| 2195 | ** information on permissions see Users page in Server |
| 2196 | ** Administration of the HTTP UI. Default: u. |
| 2197 | ** |
| 2198 |
+11
-11
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -61,11 +61,11 @@ | ||
| 61 | 61 | |
| 62 | 62 | /* |
| 63 | 63 | ** This macro is designed to return non-zero if the specified blob contains |
| 64 | 64 | ** data that MAY be binary in nature; otherwise, zero will be returned. |
| 65 | 65 | */ |
| 66 | -#define looks_like_binary(blob) ((looks_like_utf8(blob)&LOOK_BINARY)!=LOOK_NONE) | |
| 66 | +#define looks_like_binary(blob) ((looks_like_utf8(blob, LOOK_BINARY)&LOOK_BINARY)!=LOOK_NONE) | |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | ** Output flags for the looks_like_utf8() and looks_like_utf16() routines used |
| 70 | 70 | ** to convey status information about the blob content. |
| 71 | 71 | */ |
| @@ -230,16 +230,16 @@ | ||
| 230 | 230 | ** switches between UTF-8 and other encodings occur. |
| 231 | 231 | ** |
| 232 | 232 | ** The only code points that this function cares about are the NUL character, |
| 233 | 233 | ** carriage-return, and line-feed. |
| 234 | 234 | ** |
| 235 | -** Whether or not this function examines the entire contents of the blob is | |
| 236 | -** officially unspecified. | |
| 235 | +** This function examines the contents of the blob until one of the flags | |
| 236 | +** specified in "stopFlags" is set. | |
| 237 | 237 | ** |
| 238 | 238 | ************************************ WARNING ********************************** |
| 239 | 239 | */ |
| 240 | -int looks_like_utf8(const Blob *pContent){ | |
| 240 | +int looks_like_utf8(const Blob *pContent, int stopFlags){ | |
| 241 | 241 | const char *z = blob_buffer(pContent); |
| 242 | 242 | unsigned int n = blob_size(pContent); |
| 243 | 243 | int j, c, flags = LOOK_NONE; /* Assume UTF-8 text, prove otherwise */ |
| 244 | 244 | |
| 245 | 245 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -252,11 +252,11 @@ | ||
| 252 | 252 | flags |= LOOK_LONE_CR; /* More chars, next char is not LF */ |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | j = (c!='\n'); |
| 256 | 256 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 257 | - while( --n>0 ){ | |
| 257 | + while( !(flags&stopFlags) && --n>0 ){ | |
| 258 | 258 | int c2 = c; |
| 259 | 259 | c = *++z; ++j; |
| 260 | 260 | if( c==0 ){ |
| 261 | 261 | flags |= LOOK_NUL; /* NUL character in a file -> binary */ |
| 262 | 262 | }else if( c=='\n' ){ |
| @@ -334,16 +334,16 @@ | ||
| 334 | 334 | ** switches between the UTF-16be and UTF-16le encodings occur. |
| 335 | 335 | ** |
| 336 | 336 | ** The only code points that this function cares about are the NUL character, |
| 337 | 337 | ** carriage-return, and line-feed. |
| 338 | 338 | ** |
| 339 | -** Whether or not this function examines the entire contents of the blob is | |
| 340 | -** officially unspecified. | |
| 339 | +** This function examines the contents of the blob until one of the flags | |
| 340 | +** specified in "stopFlags" is set. | |
| 341 | 341 | ** |
| 342 | 342 | ************************************ WARNING ********************************** |
| 343 | 343 | */ |
| 344 | -int looks_like_utf16(const Blob *pContent, int bReverse){ | |
| 344 | +int looks_like_utf16(const Blob *pContent, int bReverse, int stopFlags){ | |
| 345 | 345 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 346 | 346 | unsigned int n = blob_size(pContent); |
| 347 | 347 | int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */ |
| 348 | 348 | |
| 349 | 349 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -366,11 +366,11 @@ | ||
| 366 | 366 | j = (c!='\n'); |
| 367 | 367 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 368 | 368 | while( 1 ){ |
| 369 | 369 | int c2 = c; |
| 370 | 370 | n -= sizeof(WCHAR_T); |
| 371 | - if( n<sizeof(WCHAR_T) ) break; | |
| 371 | + if( (flags&stopFlags) || n<sizeof(WCHAR_T) ) break; | |
| 372 | 372 | c = *++z; |
| 373 | 373 | if( bReverse ){ |
| 374 | 374 | c = UTF16_SWAP(c); |
| 375 | 375 | } |
| 376 | 376 | ++j; |
| @@ -2541,12 +2541,12 @@ | ||
| 2541 | 2541 | if( g.argc!=3 ) usage("FILENAME"); |
| 2542 | 2542 | blob_read_from_file(&blob, g.argv[2]); |
| 2543 | 2543 | fUtf8 = starts_with_utf8_bom(&blob, 0); |
| 2544 | 2544 | fUtf16 = starts_with_utf16_bom(&blob, 0, &bRevUtf16); |
| 2545 | 2545 | fUnicode = could_be_utf16(&blob, &bRevUnicode); |
| 2546 | - lookFlags = fUnicode ? looks_like_utf16(&blob, bRevUnicode) : | |
| 2547 | - looks_like_utf8(&blob); | |
| 2546 | + lookFlags = fUnicode ? looks_like_utf16(&blob, bRevUnicode, 0) : | |
| 2547 | + looks_like_utf8(&blob, 0); | |
| 2548 | 2548 | fossil_print("File \"%s\" has %d bytes.\n",g.argv[2],blob_size(&blob)); |
| 2549 | 2549 | fossil_print("Starts with UTF-8 BOM: %s\n",fUtf8?"yes":"no"); |
| 2550 | 2550 | fossil_print("Starts with UTF-16 BOM: %s\n", |
| 2551 | 2551 | fUtf16?(bRevUtf16?"reversed":"yes"):"no"); |
| 2552 | 2552 | fossil_print("Looks like UTF-%s: %s\n",fUnicode?"16":"8", |
| 2553 | 2553 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -61,11 +61,11 @@ | |
| 61 | |
| 62 | /* |
| 63 | ** This macro is designed to return non-zero if the specified blob contains |
| 64 | ** data that MAY be binary in nature; otherwise, zero will be returned. |
| 65 | */ |
| 66 | #define looks_like_binary(blob) ((looks_like_utf8(blob)&LOOK_BINARY)!=LOOK_NONE) |
| 67 | |
| 68 | /* |
| 69 | ** Output flags for the looks_like_utf8() and looks_like_utf16() routines used |
| 70 | ** to convey status information about the blob content. |
| 71 | */ |
| @@ -230,16 +230,16 @@ | |
| 230 | ** switches between UTF-8 and other encodings occur. |
| 231 | ** |
| 232 | ** The only code points that this function cares about are the NUL character, |
| 233 | ** carriage-return, and line-feed. |
| 234 | ** |
| 235 | ** Whether or not this function examines the entire contents of the blob is |
| 236 | ** officially unspecified. |
| 237 | ** |
| 238 | ************************************ WARNING ********************************** |
| 239 | */ |
| 240 | int looks_like_utf8(const Blob *pContent){ |
| 241 | const char *z = blob_buffer(pContent); |
| 242 | unsigned int n = blob_size(pContent); |
| 243 | int j, c, flags = LOOK_NONE; /* Assume UTF-8 text, prove otherwise */ |
| 244 | |
| 245 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -252,11 +252,11 @@ | |
| 252 | flags |= LOOK_LONE_CR; /* More chars, next char is not LF */ |
| 253 | } |
| 254 | } |
| 255 | j = (c!='\n'); |
| 256 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 257 | while( --n>0 ){ |
| 258 | int c2 = c; |
| 259 | c = *++z; ++j; |
| 260 | if( c==0 ){ |
| 261 | flags |= LOOK_NUL; /* NUL character in a file -> binary */ |
| 262 | }else if( c=='\n' ){ |
| @@ -334,16 +334,16 @@ | |
| 334 | ** switches between the UTF-16be and UTF-16le encodings occur. |
| 335 | ** |
| 336 | ** The only code points that this function cares about are the NUL character, |
| 337 | ** carriage-return, and line-feed. |
| 338 | ** |
| 339 | ** Whether or not this function examines the entire contents of the blob is |
| 340 | ** officially unspecified. |
| 341 | ** |
| 342 | ************************************ WARNING ********************************** |
| 343 | */ |
| 344 | int looks_like_utf16(const Blob *pContent, int bReverse){ |
| 345 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 346 | unsigned int n = blob_size(pContent); |
| 347 | int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */ |
| 348 | |
| 349 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -366,11 +366,11 @@ | |
| 366 | j = (c!='\n'); |
| 367 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 368 | while( 1 ){ |
| 369 | int c2 = c; |
| 370 | n -= sizeof(WCHAR_T); |
| 371 | if( n<sizeof(WCHAR_T) ) break; |
| 372 | c = *++z; |
| 373 | if( bReverse ){ |
| 374 | c = UTF16_SWAP(c); |
| 375 | } |
| 376 | ++j; |
| @@ -2541,12 +2541,12 @@ | |
| 2541 | if( g.argc!=3 ) usage("FILENAME"); |
| 2542 | blob_read_from_file(&blob, g.argv[2]); |
| 2543 | fUtf8 = starts_with_utf8_bom(&blob, 0); |
| 2544 | fUtf16 = starts_with_utf16_bom(&blob, 0, &bRevUtf16); |
| 2545 | fUnicode = could_be_utf16(&blob, &bRevUnicode); |
| 2546 | lookFlags = fUnicode ? looks_like_utf16(&blob, bRevUnicode) : |
| 2547 | looks_like_utf8(&blob); |
| 2548 | fossil_print("File \"%s\" has %d bytes.\n",g.argv[2],blob_size(&blob)); |
| 2549 | fossil_print("Starts with UTF-8 BOM: %s\n",fUtf8?"yes":"no"); |
| 2550 | fossil_print("Starts with UTF-16 BOM: %s\n", |
| 2551 | fUtf16?(bRevUtf16?"reversed":"yes"):"no"); |
| 2552 | fossil_print("Looks like UTF-%s: %s\n",fUnicode?"16":"8", |
| 2553 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -61,11 +61,11 @@ | |
| 61 | |
| 62 | /* |
| 63 | ** This macro is designed to return non-zero if the specified blob contains |
| 64 | ** data that MAY be binary in nature; otherwise, zero will be returned. |
| 65 | */ |
| 66 | #define looks_like_binary(blob) ((looks_like_utf8(blob, LOOK_BINARY)&LOOK_BINARY)!=LOOK_NONE) |
| 67 | |
| 68 | /* |
| 69 | ** Output flags for the looks_like_utf8() and looks_like_utf16() routines used |
| 70 | ** to convey status information about the blob content. |
| 71 | */ |
| @@ -230,16 +230,16 @@ | |
| 230 | ** switches between UTF-8 and other encodings occur. |
| 231 | ** |
| 232 | ** The only code points that this function cares about are the NUL character, |
| 233 | ** carriage-return, and line-feed. |
| 234 | ** |
| 235 | ** This function examines the contents of the blob until one of the flags |
| 236 | ** specified in "stopFlags" is set. |
| 237 | ** |
| 238 | ************************************ WARNING ********************************** |
| 239 | */ |
| 240 | int looks_like_utf8(const Blob *pContent, int stopFlags){ |
| 241 | const char *z = blob_buffer(pContent); |
| 242 | unsigned int n = blob_size(pContent); |
| 243 | int j, c, flags = LOOK_NONE; /* Assume UTF-8 text, prove otherwise */ |
| 244 | |
| 245 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -252,11 +252,11 @@ | |
| 252 | flags |= LOOK_LONE_CR; /* More chars, next char is not LF */ |
| 253 | } |
| 254 | } |
| 255 | j = (c!='\n'); |
| 256 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 257 | while( !(flags&stopFlags) && --n>0 ){ |
| 258 | int c2 = c; |
| 259 | c = *++z; ++j; |
| 260 | if( c==0 ){ |
| 261 | flags |= LOOK_NUL; /* NUL character in a file -> binary */ |
| 262 | }else if( c=='\n' ){ |
| @@ -334,16 +334,16 @@ | |
| 334 | ** switches between the UTF-16be and UTF-16le encodings occur. |
| 335 | ** |
| 336 | ** The only code points that this function cares about are the NUL character, |
| 337 | ** carriage-return, and line-feed. |
| 338 | ** |
| 339 | ** This function examines the contents of the blob until one of the flags |
| 340 | ** specified in "stopFlags" is set. |
| 341 | ** |
| 342 | ************************************ WARNING ********************************** |
| 343 | */ |
| 344 | int looks_like_utf16(const Blob *pContent, int bReverse, int stopFlags){ |
| 345 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 346 | unsigned int n = blob_size(pContent); |
| 347 | int j, c, flags = LOOK_NONE; /* Assume UTF-16 text, prove otherwise */ |
| 348 | |
| 349 | if( n==0 ) return flags; /* Empty file -> text */ |
| @@ -366,11 +366,11 @@ | |
| 366 | j = (c!='\n'); |
| 367 | if( !j ) flags |= (LOOK_LF | LOOK_LONE_LF); /* Found LF as first char */ |
| 368 | while( 1 ){ |
| 369 | int c2 = c; |
| 370 | n -= sizeof(WCHAR_T); |
| 371 | if( (flags&stopFlags) || n<sizeof(WCHAR_T) ) break; |
| 372 | c = *++z; |
| 373 | if( bReverse ){ |
| 374 | c = UTF16_SWAP(c); |
| 375 | } |
| 376 | ++j; |
| @@ -2541,12 +2541,12 @@ | |
| 2541 | if( g.argc!=3 ) usage("FILENAME"); |
| 2542 | blob_read_from_file(&blob, g.argv[2]); |
| 2543 | fUtf8 = starts_with_utf8_bom(&blob, 0); |
| 2544 | fUtf16 = starts_with_utf16_bom(&blob, 0, &bRevUtf16); |
| 2545 | fUnicode = could_be_utf16(&blob, &bRevUnicode); |
| 2546 | lookFlags = fUnicode ? looks_like_utf16(&blob, bRevUnicode, 0) : |
| 2547 | looks_like_utf8(&blob, 0); |
| 2548 | fossil_print("File \"%s\" has %d bytes.\n",g.argv[2],blob_size(&blob)); |
| 2549 | fossil_print("Starts with UTF-8 BOM: %s\n",fUtf8?"yes":"no"); |
| 2550 | fossil_print("Starts with UTF-16 BOM: %s\n", |
| 2551 | fUtf16?(bRevUtf16?"reversed":"yes"):"no"); |
| 2552 | fossil_print("Looks like UTF-%s: %s\n",fUnicode?"16":"8", |
| 2553 |
+3
-3
| --- src/utf8.c | ||
| +++ src/utf8.c | ||
| @@ -200,15 +200,15 @@ | ||
| 200 | 200 | ++wUnicode; |
| 201 | 201 | } |
| 202 | 202 | nByte = cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, NULL, 0); |
| 203 | 203 | zPath = fossil_malloc(nByte); |
| 204 | 204 | cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, zPath, nByte); |
| 205 | - } else { | |
| 205 | + }else{ | |
| 206 | 206 | zPath = fossil_strdup(zUtf8); |
| 207 | 207 | zUtf8 = p = zPath; |
| 208 | 208 | while( (*p = *zUtf8++) != 0){ |
| 209 | - if (*p++ == '\\' ) { | |
| 209 | + if( *p++ == '\\' ) { | |
| 210 | 210 | p[-1] = '/'; |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | return zPath; |
| @@ -262,11 +262,11 @@ | ||
| 262 | 262 | nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar); |
| 263 | 263 | /* Split WriteConsoleW call into multiple chunks, if necessary. See: |
| 264 | 264 | * <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */ |
| 265 | 265 | while( written < nChar ){ |
| 266 | 266 | int size = nChar-written; |
| 267 | - if (size > 26000) size = 26000; | |
| 267 | + if( size > 26000 ) size = 26000; | |
| 268 | 268 | WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode+written, |
| 269 | 269 | size, &dummy, 0); |
| 270 | 270 | written += size; |
| 271 | 271 | } |
| 272 | 272 | free(zUnicode); |
| 273 | 273 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -200,15 +200,15 @@ | |
| 200 | ++wUnicode; |
| 201 | } |
| 202 | nByte = cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, NULL, 0); |
| 203 | zPath = fossil_malloc(nByte); |
| 204 | cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, zPath, nByte); |
| 205 | } else { |
| 206 | zPath = fossil_strdup(zUtf8); |
| 207 | zUtf8 = p = zPath; |
| 208 | while( (*p = *zUtf8++) != 0){ |
| 209 | if (*p++ == '\\' ) { |
| 210 | p[-1] = '/'; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | return zPath; |
| @@ -262,11 +262,11 @@ | |
| 262 | nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar); |
| 263 | /* Split WriteConsoleW call into multiple chunks, if necessary. See: |
| 264 | * <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */ |
| 265 | while( written < nChar ){ |
| 266 | int size = nChar-written; |
| 267 | if (size > 26000) size = 26000; |
| 268 | WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode+written, |
| 269 | size, &dummy, 0); |
| 270 | written += size; |
| 271 | } |
| 272 | free(zUnicode); |
| 273 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -200,15 +200,15 @@ | |
| 200 | ++wUnicode; |
| 201 | } |
| 202 | nByte = cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, NULL, 0); |
| 203 | zPath = fossil_malloc(nByte); |
| 204 | cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, zPath, nByte); |
| 205 | }else{ |
| 206 | zPath = fossil_strdup(zUtf8); |
| 207 | zUtf8 = p = zPath; |
| 208 | while( (*p = *zUtf8++) != 0){ |
| 209 | if( *p++ == '\\' ) { |
| 210 | p[-1] = '/'; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | return zPath; |
| @@ -262,11 +262,11 @@ | |
| 262 | nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar); |
| 263 | /* Split WriteConsoleW call into multiple chunks, if necessary. See: |
| 264 | * <https://connect.microsoft.com/VisualStudio/feedback/details/635230> */ |
| 265 | while( written < nChar ){ |
| 266 | int size = nChar-written; |
| 267 | if( size > 26000 ) size = 26000; |
| 268 | WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode+written, |
| 269 | size, &dummy, 0); |
| 270 | written += size; |
| 271 | } |
| 272 | free(zUnicode); |
| 273 |
+3
-1
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,13 +1,15 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | 2 | |
| 3 | 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | + * Cygwin: Fossil now understands win32 absolute paths starting with a drive | |
| 5 | + letter everywhere. The default value of the "case-sensitive" setting is | |
| 6 | + now FALSE. | |
| 4 | 7 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 5 | 8 | results, including the ability to subscribe to changes made |
| 6 | 9 | to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82]. |
| 7 | 10 | * JSON API: added the 'status' command to report local checkout status. |
| 8 | - | |
| 9 | 11 | |
| 10 | 12 | <h2>Changes For Version 1.25 (2013-02-16)</h2> |
| 11 | 13 | * Enhancements to ticket processing. There are now two tables: TICKET and |
| 12 | 14 | TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact. |
| 13 | 15 | Fields from ticket artifacts go into either or both of TICKET and |
| 14 | 16 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,13 +1,15 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 5 | results, including the ability to subscribe to changes made |
| 6 | to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82]. |
| 7 | * JSON API: added the 'status' command to report local checkout status. |
| 8 | |
| 9 | |
| 10 | <h2>Changes For Version 1.25 (2013-02-16)</h2> |
| 11 | * Enhancements to ticket processing. There are now two tables: TICKET and |
| 12 | TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact. |
| 13 | Fields from ticket artifacts go into either or both of TICKET and |
| 14 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,13 +1,15 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 5 | letter everywhere. The default value of the "case-sensitive" setting is |
| 6 | now FALSE. |
| 7 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 8 | results, including the ability to subscribe to changes made |
| 9 | to individual tickets. For example: [/timeline.rss?y=t&tkt=12fceeec82]. |
| 10 | * JSON API: added the 'status' command to report local checkout status. |
| 11 | |
| 12 | <h2>Changes For Version 1.25 (2013-02-16)</h2> |
| 13 | * Enhancements to ticket processing. There are now two tables: TICKET and |
| 14 | TICKETCHNG. There is one row in TICKETCHNG for each ticket artifact. |
| 15 | Fields from ticket artifacts go into either or both of TICKET and |
| 16 |