Fossil

Check-in [42951c59ae]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:One more thing I spotted (but cannot test!): UTF8-mac encoded values could enter fossil through environment variables as well...
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ticket-e399bc
Files: files | file ages | folders
SHA1: 42951c59ae7191100c484a89ad56970717cd77cc
User & Date: jan.nijtmans 2012-11-29 09:59:32.194
Context
2012-11-29
13:12
Translate decomposed-UTF8 filenames on MacOS into precomposed-UTF8. Fix for ticket [e399bc1edfe45b] Closed-Leaf check-in: 1002e7238c user: drh tags: ticket-e399bc
09:59
One more thing I spotted (but cannot test!): UTF8-mac encoded values could enter fossil through environment variables as well... check-in: 42951c59ae user: jan.nijtmans tags: ticket-e399bc
09:53
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. check-in: a0148eac53 user: jan.nijtmans tags: ticket-e399bc
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108

1109
1110
1111
1112
1113
1114
1115
** Use fossil_filename_free() to release resources.
*/
char *fossil_getenv(const char *zName){
#ifdef _WIN32
  wchar_t *uName = fossil_utf8_to_unicode(zName);
  void *zValue = _wgetenv(uName);
  fossil_unicode_free(uName);
  if( zValue ) zValue = fossil_filename_to_utf8(zValue);
#else
  char *zValue = getenv(zName);
#endif

  return zValue;
}

/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){







<



>







1098
1099
1100
1101
1102
1103
1104

1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
** Use fossil_filename_free() to release resources.
*/
char *fossil_getenv(const char *zName){
#ifdef _WIN32
  wchar_t *uName = fossil_utf8_to_unicode(zName);
  void *zValue = _wgetenv(uName);
  fossil_unicode_free(uName);

#else
  char *zValue = getenv(zName);
#endif
  if( zValue ) zValue = fossil_filename_to_utf8(zValue);
  return zValue;
}

/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){