Fossil SCM
Cleanup: Move all occurrences of setmode() into fossil_binary_mode.
Commit
fa4371f3b53de0e3a2ed106b7e0dd4c3c8069e70
Parent
b65ed0b106c2e6a…
1 file changed
+5
-11
+5
-11
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -712,10 +712,13 @@ | ||
| 712 | 712 | */ |
| 713 | 713 | void fossil_binary_mode(FILE *p){ |
| 714 | 714 | #if defined(_WIN32) |
| 715 | 715 | _setmode(_fileno(p), _O_BINARY); |
| 716 | 716 | #endif |
| 717 | +#ifdef __EMX__ /* OS/2 */ | |
| 718 | + setmode(fileno(p), O_BINARY); | |
| 719 | +#endif | |
| 717 | 720 | } |
| 718 | 721 | |
| 719 | 722 | |
| 720 | 723 | |
| 721 | 724 | /* |
| @@ -1406,21 +1409,12 @@ | ||
| 1406 | 1409 | }else{ |
| 1407 | 1410 | zFile = g.argv[1]; |
| 1408 | 1411 | } |
| 1409 | 1412 | g.httpOut = stdout; |
| 1410 | 1413 | g.httpIn = stdin; |
| 1411 | -#if defined(_WIN32) | |
| 1412 | - /* Set binary mode on windows to avoid undesired translations | |
| 1413 | - ** between \n and \r\n. */ | |
| 1414 | - setmode(_fileno(g.httpOut), _O_BINARY); | |
| 1415 | - setmode(_fileno(g.httpIn), _O_BINARY); | |
| 1416 | -#endif | |
| 1417 | -#ifdef __EMX__ | |
| 1418 | - /* Similar hack for OS/2 */ | |
| 1419 | - setmode(fileno(g.httpOut), O_BINARY); | |
| 1420 | - setmode(fileno(g.httpIn), O_BINARY); | |
| 1421 | -#endif | |
| 1414 | + fossil_binary_mode(g.httpOut); | |
| 1415 | + fossil_binary_mode(g.httpIn); | |
| 1422 | 1416 | g.cgiOutput = 1; |
| 1423 | 1417 | blob_read_from_file(&config, zFile); |
| 1424 | 1418 | while( blob_line(&config, &line) ){ |
| 1425 | 1419 | if( !blob_token(&line, &key) ) continue; |
| 1426 | 1420 | if( blob_buffer(&key)[0]=='#' ) continue; |
| 1427 | 1421 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -712,10 +712,13 @@ | |
| 712 | */ |
| 713 | void fossil_binary_mode(FILE *p){ |
| 714 | #if defined(_WIN32) |
| 715 | _setmode(_fileno(p), _O_BINARY); |
| 716 | #endif |
| 717 | } |
| 718 | |
| 719 | |
| 720 | |
| 721 | /* |
| @@ -1406,21 +1409,12 @@ | |
| 1406 | }else{ |
| 1407 | zFile = g.argv[1]; |
| 1408 | } |
| 1409 | g.httpOut = stdout; |
| 1410 | g.httpIn = stdin; |
| 1411 | #if defined(_WIN32) |
| 1412 | /* Set binary mode on windows to avoid undesired translations |
| 1413 | ** between \n and \r\n. */ |
| 1414 | setmode(_fileno(g.httpOut), _O_BINARY); |
| 1415 | setmode(_fileno(g.httpIn), _O_BINARY); |
| 1416 | #endif |
| 1417 | #ifdef __EMX__ |
| 1418 | /* Similar hack for OS/2 */ |
| 1419 | setmode(fileno(g.httpOut), O_BINARY); |
| 1420 | setmode(fileno(g.httpIn), O_BINARY); |
| 1421 | #endif |
| 1422 | g.cgiOutput = 1; |
| 1423 | blob_read_from_file(&config, zFile); |
| 1424 | while( blob_line(&config, &line) ){ |
| 1425 | if( !blob_token(&line, &key) ) continue; |
| 1426 | if( blob_buffer(&key)[0]=='#' ) continue; |
| 1427 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -712,10 +712,13 @@ | |
| 712 | */ |
| 713 | void fossil_binary_mode(FILE *p){ |
| 714 | #if defined(_WIN32) |
| 715 | _setmode(_fileno(p), _O_BINARY); |
| 716 | #endif |
| 717 | #ifdef __EMX__ /* OS/2 */ |
| 718 | setmode(fileno(p), O_BINARY); |
| 719 | #endif |
| 720 | } |
| 721 | |
| 722 | |
| 723 | |
| 724 | /* |
| @@ -1406,21 +1409,12 @@ | |
| 1409 | }else{ |
| 1410 | zFile = g.argv[1]; |
| 1411 | } |
| 1412 | g.httpOut = stdout; |
| 1413 | g.httpIn = stdin; |
| 1414 | fossil_binary_mode(g.httpOut); |
| 1415 | fossil_binary_mode(g.httpIn); |
| 1416 | g.cgiOutput = 1; |
| 1417 | blob_read_from_file(&config, zFile); |
| 1418 | while( blob_line(&config, &line) ){ |
| 1419 | if( !blob_token(&line, &key) ) continue; |
| 1420 | if( blob_buffer(&key)[0]=='#' ) continue; |
| 1421 |