Fossil

Check-in [23b849cc]
Login

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

Overview
Comment:Merge trunk. Eliminate need for special Makefile.Cygwin. Simplify handling of '\\?\' prefix: Only add it when necessary (calculated path>=260 chars).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | win32-longpath
Files: files | file ages | folders
SHA1:23b849cce52d18982c43e0d7ef2b865f2b0c03e1
User & Date: jan.nijtmans 2013-12-16 10:57:51
Context
2013-12-16
13:37
Fix bug in utf8.c (don't translate first ':' in extended path). Add test-case (win32-longpath.test). Some formatting (don't use tabs). check-in: 7d5c1bbd user: jan.nijtmans tags: win32-longpath
10:57
Merge trunk. Eliminate need for special Makefile.Cygwin. Simplify handling of '\\?\' prefix: Only add it when necessary (calculated path>=260 chars). check-in: 23b849cc user: jan.nijtmans tags: win32-longpath
10:46
If the name of a 'sym-<branchname>' tag sorts before the 'branch' tag, no option in the ci_edit page should be displayed to cancel the tag. Bug-fix discovered and implemented by Andy Bradford. check-in: 3529f2c4 user: jan.nijtmans tags: trunk
2013-12-13
13:53
merge trunk check-in: 46e1d4c8 user: jan.nijtmans tags: win32-longpath
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Deleted Makefile.Cygwin.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/make
#
# This is the top-level makefile for Fossil when the build is occurring
# on the Cygwin platform.
#
#### The toplevel directory of the source tree.  Fossil can be built
#    in a directory that is separate from the source tree.  Just change
#    the following to point from the build directory to the src/ folder.
#
SRCDIR = @srcdir@/src

#### The directory into which object code files should be written.
#    Having a "./" prefix in the value of this variable breaks our use of the
#    "makeheaders" tool when running make on the MinGW platform, apparently
#    due to some command line argument manipulation performed automatically
#    by the shell.
#
#
OBJDIR = bld

#### C Compiler and options for use in building executables that
#    will run on the platform that is doing the build.  This is used
#    to compile code-generator programs as part of the build process.
#    See TCC below for the C compiler for building the finished binary.
#
BCC = @CC_FOR_BUILD@

#### The suffix to add to final executable file.  When cross-compiling
#    to windows, make this ".exe".  Otherwise leave it blank.
#
E = @EXEEXT@

TCC = @CC@

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = tclsh

LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
INSTALLDIR =$(DESTDIR)@prefix@/bin
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@
SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096

include $(SRCDIR)/main.mk

distclean: clean
	rm -f autoconfig.h config.log Makefile
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































Changes to auto.def.

255
256
257
258
259
260
261
262
263
if {![cc-check-functions getpassphrase]} {
    # Haiku needs this
    cc-check-function-in-lib getpass bsd
}
cc-check-function-in-lib dlopen dl

make-template Makefile.in
make-template Makefile.Cygwin.in
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}







<

255
256
257
258
259
260
261

262
if {![cc-check-functions getpassphrase]} {
    # Haiku needs this
    cc-check-function-in-lib getpass bsd
}
cc-check-function-in-lib dlopen dl

make-template Makefile.in

make-config-header autoconfig.h -auto {USE_* FOSSIL_*}

Changes to src/clone.c.

119
120
121
122
123
124
125

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
  const char *zDefaultUser;   /* Optional name of the default user */
  int nErr = 0;
  int bPrivate = 0;           /* Also clone private branches */
  int urlFlags = URL_PROMPT_PW | URL_REMEMBER;

  if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE;
  if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;

  clone_ssh_find_options();
  url_proxy_options();
  if( g.argc < 4 ){
    usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
  }
  db_open_config(0);
  if( file_size(g.argv[3])>0 ){
    fossil_fatal("file already exists: %s", g.argv[3]);
  }

  zDefaultUser = find_option("admin-user","A",1);

  url_parse(g.argv[2], urlFlags);
  if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser;
  if( g.urlIsFile ){
    file_copy(g.urlName, g.argv[3]);
    db_close(1);
    db_open_repository(g.argv[3]);
    db_record_repository_filename(g.argv[3]);







>










<
<







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136


137
138
139
140
141
142
143
  const char *zDefaultUser;   /* Optional name of the default user */
  int nErr = 0;
  int bPrivate = 0;           /* Also clone private branches */
  int urlFlags = URL_PROMPT_PW | URL_REMEMBER;

  if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE;
  if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
  zDefaultUser = find_option("admin-user","A",1);
  clone_ssh_find_options();
  url_proxy_options();
  if( g.argc < 4 ){
    usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
  }
  db_open_config(0);
  if( file_size(g.argv[3])>0 ){
    fossil_fatal("file already exists: %s", g.argv[3]);
  }



  url_parse(g.argv[2], urlFlags);
  if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser;
  if( g.urlIsFile ){
    file_copy(g.urlName, g.argv[3]);
    db_close(1);
    db_open_repository(g.argv[3]);
    db_record_repository_filename(g.argv[3]);

Changes to src/info.c.

1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
....
2293
2294
2295
2296
2297
2298
2299



2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
....
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
  }
  modPending = moderation_pending(rid);
  if( modPending ){
    @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
  }
  @ <tr><th>Ticket:</th>
  @ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
  if(zTktTitle){
        @<br>%h(zTktTitle)
  }
  @</td></tr>
  @ <tr><th>Date:</th><td>
  hyperlink_to_date(zDate, "</td></tr>");
  @ <tr><th>User:</th><td>
  hyperlink_to_user(pTktChng->zUser, zDate, "</td></tr>");
................................................................................

  @ <tr><th align="right" valign="top">Tags:</th>
  @ <td valign="top">
  @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) />
  @ Add the following new tag name to this check-in:</label>
  @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)"
  @ onkeyup="gebi('newtag').checked=!!this.value" />



  db_prepare(&q,
     "SELECT tag.tagid, tagname, tagxref.value FROM tagxref, tag"
     " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
     " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)"
     "               ELSE tagname END /*sort*/",
     rid
  );
  while( db_step(&q)==SQLITE_ROW ){
    int tagid = db_column_int(&q, 0);
    const char *zTagName = db_column_text(&q, 1);
    int isSpecialTag = strncmp(zTagName, "sym-", 4)!=0;
    char zLabel[30];

    if (tagid == TAG_CLOSED){
      fHasClosed = 1;
    }else if (tagid == TAG_COMMENT){
      continue;
    }else if (tagid == TAG_BRANCH){
      zBranchName = mprintf("%s", db_column_text(&q, 2));
      continue;
    }else if( !isSpecialTag && zBranchName &&
        strcmp(&zTagName[4], zBranchName)==0){
      continue;
    }
    sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
    @ <br /><label>
    if( P(zLabel) ){
      @ <input type="checkbox" name="c%d(tagid)" checked="checked" />
    }else{
................................................................................
      @ Mark branch
      @ <span style="font-weight:bold" id="cbranch">%h(zBranchName)</span>
      @ as "closed" so that its leafs no longer appear on the "leaves" page
      @ and are no longer labeled as a leaf "<b>Leaf</b>"</label>
      @ </td></tr>
    }
  }
  if(zBranchName) fossil_free(zBranchName);


  @ <tr><td colspan="2">
  @ <input type="submit" name="preview" value="Preview" />
  @ <input type="submit" name="apply" value="Apply Changes" />
  @ <input type="submit" name="cancel" value="Cancel" />
  @ </td></tr>
  @ </table>
  @ </div></form>
  style_footer();
}







|







 







>
>
>










|


|

|

<
<
<
|
|







 







|











1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
....
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319



2320
2321
2322
2323
2324
2325
2326
2327
2328
....
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
  }
  modPending = moderation_pending(rid);
  if( modPending ){
    @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
  }
  @ <tr><th>Ticket:</th>
  @ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
  if( zTktTitle ){
        @<br>%h(zTktTitle)
  }
  @</td></tr>
  @ <tr><th>Date:</th><td>
  hyperlink_to_date(zDate, "</td></tr>");
  @ <tr><th>User:</th><td>
  hyperlink_to_user(pTktChng->zUser, zDate, "</td></tr>");
................................................................................

  @ <tr><th align="right" valign="top">Tags:</th>
  @ <td valign="top">
  @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) />
  @ Add the following new tag name to this check-in:</label>
  @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)"
  @ onkeyup="gebi('newtag').checked=!!this.value" />
  zBranchName = db_text(0, "SELECT value FROM tagxref, tag"
     " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
     " AND tagxref.tagid=%d", rid, TAG_BRANCH);
  db_prepare(&q,
     "SELECT tag.tagid, tagname, tagxref.value FROM tagxref, tag"
     " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
     " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)"
     "               ELSE tagname END /*sort*/",
     rid
  );
  while( db_step(&q)==SQLITE_ROW ){
    int tagid = db_column_int(&q, 0);
    const char *zTagName = db_column_text(&q, 1);
    int isSpecialTag = fossil_strncmp(zTagName, "sym-", 4)!=0;
    char zLabel[30];

    if( tagid == TAG_CLOSED ){
      fHasClosed = 1;
    }else if( (tagid == TAG_COMMENT) || (tagid == TAG_BRANCH) ){
      continue;



    }else if( !isSpecialTag && zTagName &&
        fossil_strcmp(&zTagName[4], zBranchName)==0){
      continue;
    }
    sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid);
    @ <br /><label>
    if( P(zLabel) ){
      @ <input type="checkbox" name="c%d(tagid)" checked="checked" />
    }else{
................................................................................
      @ Mark branch
      @ <span style="font-weight:bold" id="cbranch">%h(zBranchName)</span>
      @ as "closed" so that its leafs no longer appear on the "leaves" page
      @ and are no longer labeled as a leaf "<b>Leaf</b>"</label>
      @ </td></tr>
    }
  }
  if( zBranchName ) fossil_free(zBranchName);


  @ <tr><td colspan="2">
  @ <input type="submit" name="preview" value="Preview" />
  @ <input type="submit" name="apply" value="Apply Changes" />
  @ <input type="submit" name="cancel" value="Cancel" />
  @ </td></tr>
  @ </table>
  @ </div></form>
  style_footer();
}

Changes to src/login.c.

396
397
398
399
400
401
402

403
404
405
406
407
408
409
    if( strncmp("http", zAgent+i,4)==0 ) return 0;
  }
  if( strncmp(zAgent, "Mozilla/", 8)==0 ){
    if( atoi(&zAgent[8])<4 ) return 0;  /* Many bots advertise as Mozilla/3 */
    if( strglob("*Firefox/[1-9]*", zAgent) ) return 1;
    if( strglob("*Chrome/[1-9]*", zAgent) ) return 1;
    if( strglob("*(compatible;?MSIE?[1789]*", zAgent) ) return 1;

    if( strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent) ) return 1;
    return 0;
  }
  if( strncmp(zAgent, "Opera/", 6)==0 ) return 1;
  if( strncmp(zAgent, "Safari/", 7)==0 ) return 1;
  if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1;
  if( strncmp(zAgent, "NetSurf/", 8)==0 ) return 1;







>







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
    if( strncmp("http", zAgent+i,4)==0 ) return 0;
  }
  if( strncmp(zAgent, "Mozilla/", 8)==0 ){
    if( atoi(&zAgent[8])<4 ) return 0;  /* Many bots advertise as Mozilla/3 */
    if( strglob("*Firefox/[1-9]*", zAgent) ) return 1;
    if( strglob("*Chrome/[1-9]*", zAgent) ) return 1;
    if( strglob("*(compatible;?MSIE?[1789]*", zAgent) ) return 1;
    if( strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent) ) return 1; /* IE11+ */
    if( strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent) ) return 1;
    return 0;
  }
  if( strncmp(zAgent, "Opera/", 6)==0 ) return 1;
  if( strncmp(zAgent, "Safari/", 7)==0 ) return 1;
  if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1;
  if( strncmp(zAgent, "NetSurf/", 8)==0 ) return 1;

Changes to src/sqlite3.c.

30805
30806
30807
30808
30809
30810
30811

30812
30813
30814
30815
30816
30817
30818
.....
31033
31034
31035
31036
31037
31038
31039
31040

31041
31042
31043
31044
31045
31046
31047
.....
31109
31110
31111
31112
31113
31114
31115



31116

31117
31118
31119
31120
31121
31122
31123
.....
35123
35124
35125
35126
35127
35128
35129
35130
35131


35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148



35149
35150
35151


35152
35153



35154
35155
35156
35157
35158










35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
.....
36116
36117
36118
36119
36120
36121
36122
36123
36124
36125
36126
36127
36128
36129
36130
36131
36132
36133
36134
36135
36136
36137
36138
36139
** This file contains code that is specific to Windows.
*/
#if SQLITE_OS_WIN               /* This file is used for Windows only */

#ifdef __CYGWIN__
# include <sys/cygwin.h>
# include <errno.h> /* amalgamator: keep */

#endif

/*
** Include code that is common to all os_*.c files
*/
/************** Include os_common.h in the middle of os_win.c ****************/
/************** Begin file os_common.h ***************************************/
................................................................................
 with SQLITE_OMIT_WAL."
#endif

/*
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)

#  define SQLITE_WIN32_HAS_ANSI
#endif

/*
** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
................................................................................
#endif

/*
** Maximum pathname length (in chars) for WinNT.  This should normally be
** UNICODE_STRING_MAX_CHARS.
*/
#ifndef SQLITE_WINNT_MAX_PATH_CHARS



#  define SQLITE_WINNT_MAX_PATH_CHARS   (UNICODE_STRING_MAX_CHARS)

#endif

/*
** Maximum pathname length (in bytes) for Win32.  The MAX_PATH macro is in
** characters, so we allocate 4 bytes per character assuming worst-case of
** 4-bytes-per-character for UTF8.
*/
................................................................................
}
#endif

/*
** Convert a UTF-8 filename into whatever form the underlying
** operating system wants filenames in.  Space to hold the result
** is obtained from malloc and must be freed by the calling
** function. When running on NT and zFilename is absolute, the
** resulting path is guaranteed to start with "\\?\".


*/
static void *winConvertFromUtf8Filename(const char *zFilename){
  void *zConverted = 0;
  if( osIsNT() ){
    int nChar;
    LPWSTR zWideFilename;

    nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);
    if( nChar==0 ){
      return 0;
    }
    zWideFilename = sqlite3MallocZero( (nChar*sizeof(zWideFilename[0]))+12 );
    if( zWideFilename==0 ){
      return 0;
    }
    if( winIsDirSep(zFilename[0]) && winIsDirSep(zFilename[1])
        && zFilename[2]!='?' ){



      memcpy(zWideFilename, L"\\\\?\\UNC\\", 16);
      nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename+2, -1,
                                    zWideFilename+8, nChar);


    }else if( winIsDriveLetterAndColon(zFilename)
        && winIsDirSep(zFilename[2]) ){



      memcpy(zWideFilename, L"\\\\?\\", 8);
      nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1,
                                    zWideFilename+4, nChar);
      zWideFilename[6] = '\\';
    }else{










      nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1,
                                    zWideFilename, nChar);
    }
    if( nChar==0 ){
      sqlite3_free(zWideFilename);
      zWideFilename = 0;
    }
    zConverted = zWideFilename;
  }
#ifdef SQLITE_WIN32_HAS_ANSI
................................................................................
    if( nByte==0 ){
      sqlite3_free(zConverted);
      sqlite3_free(zTemp);
      return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
                         "winFullPathname2", zRelative);
    }
    sqlite3_free(zConverted);
    if( memcmp(zTemp, L"\\\\?\\", 8)==0 ){
      if( memcmp(zTemp+4, L"UNC\\", 8) ){
        zTemp[6] = '\\';
        zOut = winUnicodeToUtf8(zTemp+6);
      }else{
        zOut = winUnicodeToUtf8(zTemp+4);
      }
    }else{
      zOut = winUnicodeToUtf8(zTemp);
    }
    sqlite3_free(zTemp);
  }
#ifdef SQLITE_WIN32_HAS_ANSI
  else{
    char *zTemp;
    nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0);
    if( nByte==0 ){







>







 







|
>







 







>
>
>
|
>







 







|
|
>
>











|
|
|
<
|
|
>
>
>
|
|
|
>
>
|
|
>
>
>
|
|
|
|
<
>
>
>
>
>
>
>
>
>
>
|
|
<







 







<
<
<
<
<
<
<
<
|
<







30805
30806
30807
30808
30809
30810
30811
30812
30813
30814
30815
30816
30817
30818
30819
.....
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
31048
31049
.....
31111
31112
31113
31114
31115
31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
.....
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153

35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
35172

35173
35174
35175
35176
35177
35178
35179
35180
35181
35182
35183
35184

35185
35186
35187
35188
35189
35190
35191
.....
36139
36140
36141
36142
36143
36144
36145








36146

36147
36148
36149
36150
36151
36152
36153
** This file contains code that is specific to Windows.
*/
#if SQLITE_OS_WIN               /* This file is used for Windows only */

#ifdef __CYGWIN__
# include <sys/cygwin.h>
# include <errno.h> /* amalgamator: keep */
# include <limits.h> /* amalgamator: keep */
#endif

/*
** Include code that is common to all os_*.c files
*/
/************** Include os_common.h in the middle of os_win.c ****************/
/************** Begin file os_common.h ***************************************/
................................................................................
 with SQLITE_OMIT_WAL."
#endif

/*
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI) \
   && !defined(_WIN64) && !defined(__x86_64__) && !defined(__CYGWIN__)
#  define SQLITE_WIN32_HAS_ANSI
#endif

/*
** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
................................................................................
#endif

/*
** Maximum pathname length (in chars) for WinNT.  This should normally be
** UNICODE_STRING_MAX_CHARS.
*/
#ifndef SQLITE_WINNT_MAX_PATH_CHARS
#  ifdef __CYGWIN__
#    define SQLITE_WINNT_MAX_PATH_CHARS   (PATH_MAX)
#  else
#    define SQLITE_WINNT_MAX_PATH_CHARS   (UNICODE_STRING_MAX_CHARS)
#  endif
#endif

/*
** Maximum pathname length (in bytes) for Win32.  The MAX_PATH macro is in
** characters, so we allocate 4 bytes per character assuming worst-case of
** 4-bytes-per-character for UTF8.
*/
................................................................................
}
#endif

/*
** Convert a UTF-8 filename into whatever form the underlying
** operating system wants filenames in.  Space to hold the result
** is obtained from malloc and must be freed by the calling
** function. When running on NT,
** the resulting path >= 260 chars and zFilename is absolute,
** "\\?\" will be added in front the path: No Win32 API function
** accepts such long paths without this prefix.
*/
static void *winConvertFromUtf8Filename(const char *zFilename){
  void *zConverted = 0;
  if( osIsNT() ){
    int nChar;
    LPWSTR zWideFilename;

    nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);
    if( nChar==0 ){
      return 0;
    }
    if( nChar>=SQLITE_WIN32_MAX_PATH_CHARS ){
      /* No Win32 API functions can handle such long paths. Let's see if
       * we can do something about it. If not, just leave it as is. */

      if( winIsDirSep(zFilename[0]) && winIsDirSep(zFilename[1])
          && zFilename[2]!='?' ){
        /* It's an UNC path, convert it to an extended UNC path. */
   	    zWideFilename = sqlite3MallocZero( (nChar+6)*sizeof(WCHAR) );
   	    if( !zWideFilename ){
          memcpy(zWideFilename, L"\\\\?\\UNC\\", 16);
          nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename+2, -1,
                                        zWideFilename+8, nChar);
   	    }
        return zWideFilename;
      }else if( winIsDriveLetterAndColon(zFilename)
          && winIsDirSep(zFilename[2]) ){
        /* It has a correct drive prefix, convert to extended form. */
   	    zWideFilename = sqlite3MallocZero( (nChar+4)*sizeof(WCHAR) );
   	    if( !zWideFilename ){
          memcpy(zWideFilename, L"\\\\?\\", 8);
          nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1,
                                        zWideFilename+4, nChar);
          zWideFilename[6] = '\\';

   	    }
        return zWideFilename;
      }
      /* Another form, e.g. relative path or maybe it already
       * has the '\\?\' prefix. Just leave it as-is. */
    }
    zWideFilename = sqlite3MallocZero( nChar*sizeof(WCHAR) );
    if( zWideFilename==0 ){
      return 0;
    }
    nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1,
                                  zWideFilename, nChar);

    if( nChar==0 ){
      sqlite3_free(zWideFilename);
      zWideFilename = 0;
    }
    zConverted = zWideFilename;
  }
#ifdef SQLITE_WIN32_HAS_ANSI
................................................................................
    if( nByte==0 ){
      sqlite3_free(zConverted);
      sqlite3_free(zTemp);
      return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
                         "winFullPathname2", zRelative);
    }
    sqlite3_free(zConverted);








    zOut = winUnicodeToUtf8(zTemp);

    sqlite3_free(zTemp);
  }
#ifdef SQLITE_WIN32_HAS_ANSI
  else{
    char *zTemp;
    nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0);
    if( nByte==0 ){

Changes to src/timeline.c.

1119
1120
1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132
....
1495
1496
1497
1498
1499
1500
1501



1502
1503
1504
1505
1506
1507
1508
  }
  if( P("brbg")!=0 ){
    tmFlags |= TIMELINE_BRCOLOR;
    url_add_parameter(&url, "brbg", 0);
  }
  if( P("unhide")!=0 ){
    tmFlags |= TIMELINE_UNHIDE;

  }
  if( P("ubg")!=0 ){
    tmFlags |= TIMELINE_UCOLOR;
    url_add_parameter(&url, "ubg", 0);
  }
  if( zUses!=0 ){
    int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
................................................................................
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        if( tmFlags & TIMELINE_FCHANGES ){
          timeline_submenu(&url, "Hide Files", "v", 0, 0);
        }else{
          timeline_submenu(&url, "Show Files", "v", "", 0);
        }



      }
    }
  }
  if( P("showsql") ){
    @ <blockquote>%h(blob_str(&sql))</blockquote>
  }
  blob_zero(&sql);







>







 







>
>
>







1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
....
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
  }
  if( P("brbg")!=0 ){
    tmFlags |= TIMELINE_BRCOLOR;
    url_add_parameter(&url, "brbg", 0);
  }
  if( P("unhide")!=0 ){
    tmFlags |= TIMELINE_UNHIDE;
    url_add_parameter(&url, "unhide", 0);
  }
  if( P("ubg")!=0 ){
    tmFlags |= TIMELINE_UCOLOR;
    url_add_parameter(&url, "ubg", 0);
  }
  if( zUses!=0 ){
    int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
................................................................................
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        if( tmFlags & TIMELINE_FCHANGES ){
          timeline_submenu(&url, "Hide Files", "v", 0, 0);
        }else{
          timeline_submenu(&url, "Show Files", "v", "", 0);
        }
        if( (tmFlags & TIMELINE_UNHIDE)==0 ){
          timeline_submenu(&url, "Unhide", "unhide", "", 0);
        }
      }
    }
  }
  if( P("showsql") ){
    @ <blockquote>%h(blob_str(&sql))</blockquote>
  }
  blob_zero(&sql);