Fossil SCM

Tested now on win32 and cygwin (with some fixes, please evaluate!). I cannot test it on OSX, but I think this should function as intended.

jan.nijtmans 2012-11-29 09:53 UTC ticket-e399bc
Commit a0148eac539221cd05e0ff4958d2e96d06321416
2 files changed +5 -5 +2 -2
+5 -5
--- src/file.c
+++ src/file.c
@@ -655,18 +655,18 @@
655655
int i;
656656
wchar_t zPwd[2000];
657657
if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
658658
fossil_fatal("cannot find the current working directory.");
659659
}
660
- zPwdUtf8 = fossil_unicode_to_utf8(zPwd);
660
+ zPwdUtf8 = fossil_filename_to_utf8(zPwd);
661661
nPwd = strlen(zPwdUtf8);
662662
if( nPwd > nBuf-1 ){
663663
fossil_fatal("pwd too big: max %d\n", nBuf-1);
664664
}
665665
for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
666666
memcpy(zBuf, zPwdUtf8, nPwd+1);
667
- fossil_unicode_free(zPwdUtf8);
667
+ fossil_filename_free(zPwdUtf8);
668668
#else
669669
if( getcwd(zBuf, nBuf-1)==0 ){
670670
if( errno==ERANGE ){
671671
fossil_fatal("pwd too big: max %d\n", nBuf-1);
672672
}else{
@@ -1012,11 +1012,11 @@
10121012
10131013
#if defined(_WIN32)
10141014
wchar_t zTmpPath[MAX_PATH];
10151015
10161016
if( GetTempPathW(MAX_PATH, zTmpPath) ){
1017
- azDirs[0] = fossil_unicode_to_utf8(zTmpPath);
1017
+ azDirs[0] = fossil_filename_to_utf8(zTmpPath);
10181018
}
10191019
10201020
azDirs[1] = fossil_getenv("TEMP");
10211021
azDirs[2] = fossil_getenv("TMP");
10221022
#endif
@@ -1093,18 +1093,18 @@
10931093
10941094
#endif /* INTERFACE */
10951095
10961096
/*
10971097
** Return the value of an environment variable as UTF8.
1098
-** Use fossil_unicode_free() to release resources.
1098
+** Use fossil_filename_free() to release resources.
10991099
*/
11001100
char *fossil_getenv(const char *zName){
11011101
#ifdef _WIN32
11021102
wchar_t *uName = fossil_utf8_to_unicode(zName);
11031103
void *zValue = _wgetenv(uName);
11041104
fossil_unicode_free(uName);
1105
- if( zValue ) zValue = fossil_unicode_to_utf8(zValue);
1105
+ if( zValue ) zValue = fossil_filename_to_utf8(zValue);
11061106
#else
11071107
char *zValue = getenv(zName);
11081108
#endif
11091109
return zValue;
11101110
}
11111111
--- src/file.c
+++ src/file.c
@@ -655,18 +655,18 @@
655 int i;
656 wchar_t zPwd[2000];
657 if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
658 fossil_fatal("cannot find the current working directory.");
659 }
660 zPwdUtf8 = fossil_unicode_to_utf8(zPwd);
661 nPwd = strlen(zPwdUtf8);
662 if( nPwd > nBuf-1 ){
663 fossil_fatal("pwd too big: max %d\n", nBuf-1);
664 }
665 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
666 memcpy(zBuf, zPwdUtf8, nPwd+1);
667 fossil_unicode_free(zPwdUtf8);
668 #else
669 if( getcwd(zBuf, nBuf-1)==0 ){
670 if( errno==ERANGE ){
671 fossil_fatal("pwd too big: max %d\n", nBuf-1);
672 }else{
@@ -1012,11 +1012,11 @@
1012
1013 #if defined(_WIN32)
1014 wchar_t zTmpPath[MAX_PATH];
1015
1016 if( GetTempPathW(MAX_PATH, zTmpPath) ){
1017 azDirs[0] = fossil_unicode_to_utf8(zTmpPath);
1018 }
1019
1020 azDirs[1] = fossil_getenv("TEMP");
1021 azDirs[2] = fossil_getenv("TMP");
1022 #endif
@@ -1093,18 +1093,18 @@
1093
1094 #endif /* INTERFACE */
1095
1096 /*
1097 ** Return the value of an environment variable as UTF8.
1098 ** Use fossil_unicode_free() to release resources.
1099 */
1100 char *fossil_getenv(const char *zName){
1101 #ifdef _WIN32
1102 wchar_t *uName = fossil_utf8_to_unicode(zName);
1103 void *zValue = _wgetenv(uName);
1104 fossil_unicode_free(uName);
1105 if( zValue ) zValue = fossil_unicode_to_utf8(zValue);
1106 #else
1107 char *zValue = getenv(zName);
1108 #endif
1109 return zValue;
1110 }
1111
--- src/file.c
+++ src/file.c
@@ -655,18 +655,18 @@
655 int i;
656 wchar_t zPwd[2000];
657 if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
658 fossil_fatal("cannot find the current working directory.");
659 }
660 zPwdUtf8 = fossil_filename_to_utf8(zPwd);
661 nPwd = strlen(zPwdUtf8);
662 if( nPwd > nBuf-1 ){
663 fossil_fatal("pwd too big: max %d\n", nBuf-1);
664 }
665 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
666 memcpy(zBuf, zPwdUtf8, nPwd+1);
667 fossil_filename_free(zPwdUtf8);
668 #else
669 if( getcwd(zBuf, nBuf-1)==0 ){
670 if( errno==ERANGE ){
671 fossil_fatal("pwd too big: max %d\n", nBuf-1);
672 }else{
@@ -1012,11 +1012,11 @@
1012
1013 #if defined(_WIN32)
1014 wchar_t zTmpPath[MAX_PATH];
1015
1016 if( GetTempPathW(MAX_PATH, zTmpPath) ){
1017 azDirs[0] = fossil_filename_to_utf8(zTmpPath);
1018 }
1019
1020 azDirs[1] = fossil_getenv("TEMP");
1021 azDirs[2] = fossil_getenv("TMP");
1022 #endif
@@ -1093,18 +1093,18 @@
1093
1094 #endif /* INTERFACE */
1095
1096 /*
1097 ** Return the value of an environment variable as UTF8.
1098 ** Use fossil_filename_free() to release resources.
1099 */
1100 char *fossil_getenv(const char *zName){
1101 #ifdef _WIN32
1102 wchar_t *uName = fossil_utf8_to_unicode(zName);
1103 void *zValue = _wgetenv(uName);
1104 fossil_unicode_free(uName);
1105 if( zValue ) zValue = fossil_filename_to_utf8(zValue);
1106 #else
1107 char *zValue = getenv(zName);
1108 #endif
1109 return zValue;
1110 }
1111
+2 -2
--- src/main.c
+++ src/main.c
@@ -491,15 +491,15 @@
491491
g.argc = argc;
492492
g.argv = argv;
493493
#if defined(_WIN32) && !defined(__MINGW32__)
494494
parse_windows_command_line(&g.argc, &g.argv);
495495
GetModuleFileNameW(NULL, buf, MAX_PATH);
496
- g.nameOfExe = fossil_unicode_to_utf8(buf);
497
- for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
496
+ g.nameOfExe = fossil_filename_to_utf8(buf);
498497
#else
499498
g.nameOfExe = g.argv[0];
500499
#endif
500
+ for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
501501
for(i=1; i<g.argc-1; i++){
502502
z = g.argv[i];
503503
if( z[0]!='-' ) continue;
504504
z++;
505505
if( z[0]=='-' ) z++;
506506
--- src/main.c
+++ src/main.c
@@ -491,15 +491,15 @@
491 g.argc = argc;
492 g.argv = argv;
493 #if defined(_WIN32) && !defined(__MINGW32__)
494 parse_windows_command_line(&g.argc, &g.argv);
495 GetModuleFileNameW(NULL, buf, MAX_PATH);
496 g.nameOfExe = fossil_unicode_to_utf8(buf);
497 for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
498 #else
499 g.nameOfExe = g.argv[0];
500 #endif
 
501 for(i=1; i<g.argc-1; i++){
502 z = g.argv[i];
503 if( z[0]!='-' ) continue;
504 z++;
505 if( z[0]=='-' ) z++;
506
--- src/main.c
+++ src/main.c
@@ -491,15 +491,15 @@
491 g.argc = argc;
492 g.argv = argv;
493 #if defined(_WIN32) && !defined(__MINGW32__)
494 parse_windows_command_line(&g.argc, &g.argv);
495 GetModuleFileNameW(NULL, buf, MAX_PATH);
496 g.nameOfExe = fossil_filename_to_utf8(buf);
 
497 #else
498 g.nameOfExe = g.argv[0];
499 #endif
500 for(i=0; i<g.argc; i++) g.argv[i] = fossil_filename_to_utf8(g.argv[i]);
501 for(i=1; i<g.argc-1; i++){
502 z = g.argv[i];
503 if( z[0]!='-' ) continue;
504 z++;
505 if( z[0]=='-' ) z++;
506

Keyboard Shortcuts

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