Fossil

Check-in [233a08f4fc]
Login

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

Overview
Comment:Fix handling of empty-string corner case for the file_simplify_name() function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 233a08f4fc1d5000aeea17b89adf307d2ec42bc130a52dd9ffb8c7644e79fb81
User & Date: mistachkin 2020-06-10 23:00:43.146
Context
2020-06-11
00:08
Test suite fixes. check-in: 5b1b25b4a9 user: mistachkin tags: trunk
2020-06-10
23:00
Fix handling of empty-string corner case for the file_simplify_name() function. check-in: 233a08f4fc user: mistachkin tags: trunk
21:46
Further improvements to the file name escaping on Windows. check-in: 9519c22556 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
965
966
967
968
969
970
971

972
973
974
975
976
977
978
** If the slash parameter is non-zero, the trailing slash, if any,
** is retained.
*/
int file_simplify_name(char *z, int n, int slash){
  int i = 1, j;
  assert( z!=0 );
  if( n<0 ) n = strlen(z);


  /* On windows and cygwin convert all \ characters to /
   * and remove extended path prefix if present */
#if defined(_WIN32) || defined(__CYGWIN__)
  for(j=0; j<n; j++){
    if( z[j]=='\\' ) z[j] = '/';
  }







>







965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
** If the slash parameter is non-zero, the trailing slash, if any,
** is retained.
*/
int file_simplify_name(char *z, int n, int slash){
  int i = 1, j;
  assert( z!=0 );
  if( n<0 ) n = strlen(z);
  if( n==0 ) return 0;

  /* On windows and cygwin convert all \ characters to /
   * and remove extended path prefix if present */
#if defined(_WIN32) || defined(__CYGWIN__)
  for(j=0; j<n; j++){
    if( z[j]=='\\' ) z[j] = '/';
  }