Fossil SCM
merge trunk
Commit
820f64320b24bb585ad8323a6fc1ace0b9f8b2e7
Parent
7aa9f66f926c031…
2 files changed
+22
-26
+2
-2
+22
-26
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -223,45 +223,43 @@ | ||
| 223 | 223 | ************************************ WARNING ********************************** |
| 224 | 224 | */ |
| 225 | 225 | int looks_like_utf8(const Blob *pContent, int *pFlags){ |
| 226 | 226 | const char *z = blob_buffer(pContent); |
| 227 | 227 | unsigned int n = blob_size(pContent); |
| 228 | - int j, c; | |
| 228 | + int j, c, flags = LOOK_NONE; | |
| 229 | 229 | |
| 230 | - if( pFlags ) *pFlags = LOOK_NONE; | |
| 230 | + if( pFlags ) *pFlags = flags; | |
| 231 | 231 | if( n==0 ) return 1; /* Empty file -> text */ |
| 232 | 232 | c = *z; |
| 233 | 233 | if( c==0 ){ |
| 234 | - if( pFlags ) *pFlags |= LOOK_NUL; | |
| 234 | + if( pFlags ) *pFlags = LOOK_NUL; | |
| 235 | 235 | return 0; /* NUL character in a file -> binary */ |
| 236 | 236 | } |
| 237 | 237 | j = (c!='\n'); |
| 238 | 238 | while( --n>0 ){ |
| 239 | 239 | c = *++z; ++j; |
| 240 | 240 | if( c==0 ){ |
| 241 | - if( pFlags ) *pFlags |= LOOK_NUL; | |
| 241 | + if( pFlags ) *pFlags = LOOK_NUL; | |
| 242 | 242 | return 0; /* NUL character in a file -> binary */ |
| 243 | 243 | } |
| 244 | 244 | if( c=='\n' ){ |
| 245 | 245 | int c2 = z[-1]; |
| 246 | - if( pFlags ){ | |
| 247 | - *pFlags |= LOOK_LF; | |
| 248 | - if( c2=='\r' ){ | |
| 249 | - *pFlags |= LOOK_CRLF; | |
| 250 | - } | |
| 246 | + flags |= LOOK_LF; | |
| 247 | + if( c2=='\r' ){ | |
| 248 | + flags |= LOOK_CRLF; | |
| 251 | 249 | } |
| 252 | 250 | if( j>LENGTH_MASK ){ |
| 253 | - if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 254 | - return 0; /* Very long line -> binary */ | |
| 251 | + flags |= LOOK_LENGTH; | |
| 255 | 252 | } |
| 256 | 253 | j = 0; |
| 257 | 254 | } |
| 258 | 255 | } |
| 259 | - if( j>LENGTH_MASK ){ | |
| 260 | - if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 256 | + if( (flags&LOOK_LENGTH) || (j>LENGTH_MASK) ){ | |
| 257 | + if( pFlags ) *pFlags = LOOK_LENGTH; | |
| 261 | 258 | return 0; /* Very long line -> binary */ |
| 262 | 259 | } |
| 260 | + if( pFlags ) *pFlags = flags; | |
| 263 | 261 | return 1; /* No problems seen -> not binary */ |
| 264 | 262 | } |
| 265 | 263 | |
| 266 | 264 | /* |
| 267 | 265 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| @@ -317,46 +315,44 @@ | ||
| 317 | 315 | ************************************ WARNING ********************************** |
| 318 | 316 | */ |
| 319 | 317 | int looks_like_utf16(const Blob *pContent, int *pFlags){ |
| 320 | 318 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 321 | 319 | unsigned int n = blob_size(pContent); |
| 322 | - int j, c; | |
| 320 | + int j, c, flags = LOOK_NONE; | |
| 323 | 321 | |
| 324 | - if( pFlags ) *pFlags = LOOK_NONE; | |
| 322 | + if( pFlags ) *pFlags = flags; | |
| 325 | 323 | if( n==0 ) return 1; /* Empty file -> text */ |
| 326 | 324 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 327 | 325 | c = *z; |
| 328 | 326 | if( c==0 ){ |
| 329 | - if( pFlags ) *pFlags |= LOOK_NUL; | |
| 327 | + if( pFlags ) *pFlags = LOOK_NUL; | |
| 330 | 328 | return 0; /* NUL character in a file -> binary */ |
| 331 | 329 | } |
| 332 | 330 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 333 | 331 | while( (n-=2)>0 ){ |
| 334 | 332 | c = *++z; ++j; |
| 335 | 333 | if( c==0 ){ |
| 336 | - if( pFlags ) *pFlags |= LOOK_NUL; | |
| 334 | + if( pFlags ) *pFlags = LOOK_NUL; | |
| 337 | 335 | return 0; /* NUL character in a file -> binary */ |
| 338 | 336 | } |
| 339 | 337 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 340 | 338 | int c2 = z[-1]; |
| 341 | - if( pFlags ){ | |
| 342 | - *pFlags |= LOOK_LF; | |
| 343 | - if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ | |
| 344 | - *pFlags |= LOOK_CRLF; | |
| 345 | - } | |
| 339 | + flags |= LOOK_LF; | |
| 340 | + if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ | |
| 341 | + flags |= LOOK_CRLF; | |
| 346 | 342 | } |
| 347 | 343 | if( j>UTF16_LENGTH_MASK ){ |
| 348 | - if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 349 | - return 0; /* Very long line -> binary */ | |
| 344 | + flags |= LOOK_LENGTH; | |
| 350 | 345 | } |
| 351 | 346 | j = 0; |
| 352 | 347 | } |
| 353 | 348 | } |
| 354 | - if( j>UTF16_LENGTH_MASK ){ | |
| 355 | - if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 349 | + if( (flags&LOOK_LENGTH) || (j>UTF16_LENGTH_MASK) ){ | |
| 350 | + if( pFlags ) *pFlags = LOOK_LENGTH; | |
| 356 | 351 | return 0; /* Very long line -> binary */ |
| 357 | 352 | } |
| 353 | + if( pFlags ) *pFlags = flags; | |
| 358 | 354 | return 1; /* No problems seen -> not binary */ |
| 359 | 355 | } |
| 360 | 356 | |
| 361 | 357 | /* |
| 362 | 358 | ** This function returns an array of bytes representing the byte-order-mark |
| 363 | 359 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -223,45 +223,43 @@ | |
| 223 | ************************************ WARNING ********************************** |
| 224 | */ |
| 225 | int looks_like_utf8(const Blob *pContent, int *pFlags){ |
| 226 | const char *z = blob_buffer(pContent); |
| 227 | unsigned int n = blob_size(pContent); |
| 228 | int j, c; |
| 229 | |
| 230 | if( pFlags ) *pFlags = LOOK_NONE; |
| 231 | if( n==0 ) return 1; /* Empty file -> text */ |
| 232 | c = *z; |
| 233 | if( c==0 ){ |
| 234 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 235 | return 0; /* NUL character in a file -> binary */ |
| 236 | } |
| 237 | j = (c!='\n'); |
| 238 | while( --n>0 ){ |
| 239 | c = *++z; ++j; |
| 240 | if( c==0 ){ |
| 241 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 242 | return 0; /* NUL character in a file -> binary */ |
| 243 | } |
| 244 | if( c=='\n' ){ |
| 245 | int c2 = z[-1]; |
| 246 | if( pFlags ){ |
| 247 | *pFlags |= LOOK_LF; |
| 248 | if( c2=='\r' ){ |
| 249 | *pFlags |= LOOK_CRLF; |
| 250 | } |
| 251 | } |
| 252 | if( j>LENGTH_MASK ){ |
| 253 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 254 | return 0; /* Very long line -> binary */ |
| 255 | } |
| 256 | j = 0; |
| 257 | } |
| 258 | } |
| 259 | if( j>LENGTH_MASK ){ |
| 260 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 261 | return 0; /* Very long line -> binary */ |
| 262 | } |
| 263 | return 1; /* No problems seen -> not binary */ |
| 264 | } |
| 265 | |
| 266 | /* |
| 267 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| @@ -317,46 +315,44 @@ | |
| 317 | ************************************ WARNING ********************************** |
| 318 | */ |
| 319 | int looks_like_utf16(const Blob *pContent, int *pFlags){ |
| 320 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 321 | unsigned int n = blob_size(pContent); |
| 322 | int j, c; |
| 323 | |
| 324 | if( pFlags ) *pFlags = LOOK_NONE; |
| 325 | if( n==0 ) return 1; /* Empty file -> text */ |
| 326 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 327 | c = *z; |
| 328 | if( c==0 ){ |
| 329 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 330 | return 0; /* NUL character in a file -> binary */ |
| 331 | } |
| 332 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 333 | while( (n-=2)>0 ){ |
| 334 | c = *++z; ++j; |
| 335 | if( c==0 ){ |
| 336 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 337 | return 0; /* NUL character in a file -> binary */ |
| 338 | } |
| 339 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 340 | int c2 = z[-1]; |
| 341 | if( pFlags ){ |
| 342 | *pFlags |= LOOK_LF; |
| 343 | if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ |
| 344 | *pFlags |= LOOK_CRLF; |
| 345 | } |
| 346 | } |
| 347 | if( j>UTF16_LENGTH_MASK ){ |
| 348 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 349 | return 0; /* Very long line -> binary */ |
| 350 | } |
| 351 | j = 0; |
| 352 | } |
| 353 | } |
| 354 | if( j>UTF16_LENGTH_MASK ){ |
| 355 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 356 | return 0; /* Very long line -> binary */ |
| 357 | } |
| 358 | return 1; /* No problems seen -> not binary */ |
| 359 | } |
| 360 | |
| 361 | /* |
| 362 | ** This function returns an array of bytes representing the byte-order-mark |
| 363 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -223,45 +223,43 @@ | |
| 223 | ************************************ WARNING ********************************** |
| 224 | */ |
| 225 | int looks_like_utf8(const Blob *pContent, int *pFlags){ |
| 226 | const char *z = blob_buffer(pContent); |
| 227 | unsigned int n = blob_size(pContent); |
| 228 | int j, c, flags = LOOK_NONE; |
| 229 | |
| 230 | if( pFlags ) *pFlags = flags; |
| 231 | if( n==0 ) return 1; /* Empty file -> text */ |
| 232 | c = *z; |
| 233 | if( c==0 ){ |
| 234 | if( pFlags ) *pFlags = LOOK_NUL; |
| 235 | return 0; /* NUL character in a file -> binary */ |
| 236 | } |
| 237 | j = (c!='\n'); |
| 238 | while( --n>0 ){ |
| 239 | c = *++z; ++j; |
| 240 | if( c==0 ){ |
| 241 | if( pFlags ) *pFlags = LOOK_NUL; |
| 242 | return 0; /* NUL character in a file -> binary */ |
| 243 | } |
| 244 | if( c=='\n' ){ |
| 245 | int c2 = z[-1]; |
| 246 | flags |= LOOK_LF; |
| 247 | if( c2=='\r' ){ |
| 248 | flags |= LOOK_CRLF; |
| 249 | } |
| 250 | if( j>LENGTH_MASK ){ |
| 251 | flags |= LOOK_LENGTH; |
| 252 | } |
| 253 | j = 0; |
| 254 | } |
| 255 | } |
| 256 | if( (flags&LOOK_LENGTH) || (j>LENGTH_MASK) ){ |
| 257 | if( pFlags ) *pFlags = LOOK_LENGTH; |
| 258 | return 0; /* Very long line -> binary */ |
| 259 | } |
| 260 | if( pFlags ) *pFlags = flags; |
| 261 | return 1; /* No problems seen -> not binary */ |
| 262 | } |
| 263 | |
| 264 | /* |
| 265 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| @@ -317,46 +315,44 @@ | |
| 315 | ************************************ WARNING ********************************** |
| 316 | */ |
| 317 | int looks_like_utf16(const Blob *pContent, int *pFlags){ |
| 318 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 319 | unsigned int n = blob_size(pContent); |
| 320 | int j, c, flags = LOOK_NONE; |
| 321 | |
| 322 | if( pFlags ) *pFlags = flags; |
| 323 | if( n==0 ) return 1; /* Empty file -> text */ |
| 324 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 325 | c = *z; |
| 326 | if( c==0 ){ |
| 327 | if( pFlags ) *pFlags = LOOK_NUL; |
| 328 | return 0; /* NUL character in a file -> binary */ |
| 329 | } |
| 330 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 331 | while( (n-=2)>0 ){ |
| 332 | c = *++z; ++j; |
| 333 | if( c==0 ){ |
| 334 | if( pFlags ) *pFlags = LOOK_NUL; |
| 335 | return 0; /* NUL character in a file -> binary */ |
| 336 | } |
| 337 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 338 | int c2 = z[-1]; |
| 339 | flags |= LOOK_LF; |
| 340 | if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ |
| 341 | flags |= LOOK_CRLF; |
| 342 | } |
| 343 | if( j>UTF16_LENGTH_MASK ){ |
| 344 | flags |= LOOK_LENGTH; |
| 345 | } |
| 346 | j = 0; |
| 347 | } |
| 348 | } |
| 349 | if( (flags&LOOK_LENGTH) || (j>UTF16_LENGTH_MASK) ){ |
| 350 | if( pFlags ) *pFlags = LOOK_LENGTH; |
| 351 | return 0; /* Very long line -> binary */ |
| 352 | } |
| 353 | if( pFlags ) *pFlags = flags; |
| 354 | return 1; /* No problems seen -> not binary */ |
| 355 | } |
| 356 | |
| 357 | /* |
| 358 | ** This function returns an array of bytes representing the byte-order-mark |
| 359 |
+2
-2
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -13,14 +13,14 @@ | ||
| 13 | 13 | # |
| 14 | 14 | |
| 15 | 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | 17 | # |
| 18 | -# PREFIX = | |
| 18 | +PREFIX = | |
| 19 | 19 | # PREFIX = mingw32- |
| 20 | 20 | # PREFIX = i686-pc-mingw32- |
| 21 | -PREFIX = i686-w64-mingw32- | |
| 21 | +# PREFIX = i686-w64-mingw32- | |
| 22 | 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | 23 | |
| 24 | 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | 25 | # in a directory that is separate from the source tree. Just change |
| 26 | 26 | # the following to point from the build directory to the src/ folder. |
| 27 | 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | # PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | # PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |