Fossil SCM

Set binary translation mode on windows for import and export. Ticket [feeb8a91eb838f743ae9]

drh 2010-11-17 13:15 trunk
Commit b408ece7f603de55b73e6a9711384cbb1c715e11
--- src/export.c
+++ src/export.c
@@ -105,10 +105,11 @@
105105
db_find_and_open_repository(1);
106106
107107
/* Step 1: Generate "blob" records for every artifact that is part
108108
** of a check-in
109109
*/
110
+ fossil_binary_mode(stdout);
110111
db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0");
111112
while( db_step(&q)==SQLITE_ROW ){
112113
int rid = db_column_int(&q, 0);
113114
Blob content;
114115
content_get(rid, &content);
115116
--- src/export.c
+++ src/export.c
@@ -105,10 +105,11 @@
105 db_find_and_open_repository(1);
106
107 /* Step 1: Generate "blob" records for every artifact that is part
108 ** of a check-in
109 */
 
110 db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0");
111 while( db_step(&q)==SQLITE_ROW ){
112 int rid = db_column_int(&q, 0);
113 Blob content;
114 content_get(rid, &content);
115
--- src/export.c
+++ src/export.c
@@ -105,10 +105,11 @@
105 db_find_and_open_repository(1);
106
107 /* Step 1: Generate "blob" records for every artifact that is part
108 ** of a check-in
109 */
110 fossil_binary_mode(stdout);
111 db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0");
112 while( db_step(&q)==SQLITE_ROW ){
113 int rid = db_column_int(&q, 0);
114 Blob content;
115 content_get(rid, &content);
116
--- src/import.c
+++ src/import.c
@@ -593,10 +593,11 @@
593593
}
594594
if( g.argc==4 ){
595595
pIn = fopen(g.argv[3], "rb");
596596
}else{
597597
pIn = stdin;
598
+ fossil_binary_mode(pIn);
598599
}
599600
if( forceFlag ) unlink(g.argv[2]);
600601
db_create_repository(g.argv[2]);
601602
db_open_repository(g.argv[2]);
602603
db_open_config(0);
603604
--- src/import.c
+++ src/import.c
@@ -593,10 +593,11 @@
593 }
594 if( g.argc==4 ){
595 pIn = fopen(g.argv[3], "rb");
596 }else{
597 pIn = stdin;
 
598 }
599 if( forceFlag ) unlink(g.argv[2]);
600 db_create_repository(g.argv[2]);
601 db_open_repository(g.argv[2]);
602 db_open_config(0);
603
--- src/import.c
+++ src/import.c
@@ -593,10 +593,11 @@
593 }
594 if( g.argc==4 ){
595 pIn = fopen(g.argv[3], "rb");
596 }else{
597 pIn = stdin;
598 fossil_binary_mode(pIn);
599 }
600 if( forceFlag ) unlink(g.argv[2]);
601 db_create_repository(g.argv[2]);
602 db_open_repository(g.argv[2]);
603 db_open_config(0);
604
+10
--- src/main.c
+++ src/main.c
@@ -407,10 +407,20 @@
407407
*/
408408
rc = system(zOrigCmd);
409409
#endif
410410
return rc;
411411
}
412
+
413
+/*
414
+** Turn off any NL to CRNL translation on the stream given as an
415
+** argument. This is a no-op on unix but is necessary on windows.
416
+*/
417
+void fossil_binary_mode(FILE *p){
418
+#if defined(_WIN32)
419
+ _setmode(_fileno(p), _O_BINARY);
420
+#endif
421
+}
412422
413423
414424
415425
/*
416426
** Return a name for an SQLite error code
417427
--- src/main.c
+++ src/main.c
@@ -407,10 +407,20 @@
407 */
408 rc = system(zOrigCmd);
409 #endif
410 return rc;
411 }
 
 
 
 
 
 
 
 
 
 
412
413
414
415 /*
416 ** Return a name for an SQLite error code
417
--- src/main.c
+++ src/main.c
@@ -407,10 +407,20 @@
407 */
408 rc = system(zOrigCmd);
409 #endif
410 return rc;
411 }
412
413 /*
414 ** Turn off any NL to CRNL translation on the stream given as an
415 ** argument. This is a no-op on unix but is necessary on windows.
416 */
417 void fossil_binary_mode(FILE *p){
418 #if defined(_WIN32)
419 _setmode(_fileno(p), _O_BINARY);
420 #endif
421 }
422
423
424
425 /*
426 ** Return a name for an SQLite error code
427

Keyboard Shortcuts

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