Fossil SCM

Cleanup: Move all occurrences of setmode() into fossil_binary_mode.

drh 2012-04-06 13:05 trunk
Commit fa4371f3b53de0e3a2ed106b7e0dd4c3c8069e70
1 file changed +5 -11
+5 -11
--- src/main.c
+++ src/main.c
@@ -712,10 +712,13 @@
712712
*/
713713
void fossil_binary_mode(FILE *p){
714714
#if defined(_WIN32)
715715
_setmode(_fileno(p), _O_BINARY);
716716
#endif
717
+#ifdef __EMX__ /* OS/2 */
718
+ setmode(fileno(p), O_BINARY);
719
+#endif
717720
}
718721
719722
720723
721724
/*
@@ -1406,21 +1409,12 @@
14061409
}else{
14071410
zFile = g.argv[1];
14081411
}
14091412
g.httpOut = stdout;
14101413
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);
14221416
g.cgiOutput = 1;
14231417
blob_read_from_file(&config, zFile);
14241418
while( blob_line(&config, &line) ){
14251419
if( !blob_token(&line, &key) ) continue;
14261420
if( blob_buffer(&key)[0]=='#' ) continue;
14271421
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button