Changes On Branch eclipse-project
Not logged in

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

Changes In Branch eclipse-project Excluding Merge-Ins

This is equivalent to a diff from 4913964321 to 2017d2f832

2012-09-25
06:40
allow Eclipse to be used as fossil development IDE, merged from "fossil-eclipse" branch, which is now closed. check-in: ae356a7b2e user: jan.nijtmans tags: trunk
2012-09-06
10:23
Show the number of changes following a "fossil update". check-in: 3db1cf69e5 user: drh tags: trunk
09:10
merge trunk enable UNICODE mode (experimental) Closed-Leaf check-in: 2017d2f832 user: jan.nijtmans tags: eclipse-project
2012-09-05
20:54
Do not count divider lines as "items" on the timeline. check-in: 4913964321 user: drh tags: trunk
20:45
Enhancements to localtime processing and to the label resolution on the a=, b=, and c= query parameters to the timeline page. check-in: 41c3c1900b user: drh tags: trunk
13:45
merge trunk, fix compilation on Cygwin/Linux check-in: c05ba6b0d7 user: jan.nijtmans tags: eclipse-project

Added .project.

            1  +<?xml version="1.0" encoding="UTF-8"?>
            2  +<projectDescription>
            3  +	<name>fossil</name>
            4  +	<comment></comment>
            5  +	<projects>
            6  +	</projects>
            7  +	<buildSpec>
            8  +	</buildSpec>
            9  +	<natures>
           10  +	</natures>
           11  +</projectDescription>

Added .settings/org.eclipse.core.resources.prefs.

            1  +eclipse.preferences.version=1
            2  +encoding/<project>=UTF-8

Added .settings/org.eclipse.core.runtime.prefs.

            1  +eclipse.preferences.version=1
            2  +line.separator=\n

Changes to src/add.c.

    37     37   ** Return the N-th name.  The first name has N==0.  When all names have
    38     38   ** been used, return 0.
    39     39   */
    40     40   const char *fossil_reserved_name(int N){
    41     41     /* Possible names of the local per-checkout database file and
    42     42     ** its associated journals
    43     43     */
    44         -  static const char *azName[] = {
           44  +  static const char *const azName[] = {
    45     45        "_FOSSIL_",
    46     46        "_FOSSIL_-journal",
    47     47        "_FOSSIL_-wal",
    48     48        "_FOSSIL_-shm",
    49     49        ".fslckout",
    50     50        ".fslckout-journal",
    51     51        ".fslckout-wal",
................................................................................
    59     59        ".fos-wal",
    60     60        ".fos-shm",
    61     61     };
    62     62   
    63     63     /* Names of auxiliary files generated by SQLite when the "manifest"
    64     64     ** properity is enabled
    65     65     */
    66         -  static const char *azManifest[] = {
           66  +  static const char *const azManifest[] = {
    67     67        "manifest",
    68     68        "manifest.uuid",
    69     69     };
    70     70   
    71     71     /* Cached setting "manifest" */
    72     72     static int cachedManifest = -1;
    73     73   
................................................................................
   529    529   ** can be made at the next commit/checkin.
   530    530   **
   531    531   ** See also: changes, status
   532    532   */
   533    533   void mv_cmd(void){
   534    534     int i;
   535    535     int vid;
   536         -  char *zDest;
          536  +  const char *zDest;
   537    537     Blob dest;
   538    538     Stmt q;
   539    539   
   540    540     db_must_be_within_tree();
   541    541     vid = db_lget_int("checkout", 0);
   542    542     if( vid==0 ){
   543    543       fossil_panic("no checkout rename files in");

Changes to src/allrepo.c.

   197    197     db_finalize(&q);
   198    198     
   199    199     /* If any repositories whose names appear in the ~/.fossil file could not
   200    200     ** be found, remove those names from the ~/.fossil file.
   201    201     */
   202    202     if( bag_count(&outOfDate)>0 ){
   203    203       Blob sql;
   204         -    char *zSep = "(";
          204  +    const char *zSep = "(";
   205    205       int rowid;
   206    206       blob_zero(&sql);
   207    207       blob_appendf(&sql, "DELETE FROM global_config WHERE rowid IN ");
   208    208       for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){
   209    209         blob_appendf(&sql, "%s%d", zSep, rowid);
   210    210         zSep = ",";
   211    211       }

Changes to src/blob.c.

   765    765   ** Return the number of bytes written.
   766    766   */
   767    767   int blob_write_to_file(Blob *pBlob, const char *zFilename){
   768    768     FILE *out;
   769    769     int wrote;
   770    770   
   771    771     if( zFilename[0]==0 || (zFilename[0]=='-' && zFilename[1]==0) ){
   772         -    int n;
          772  +    int n = blob_size(pBlob);
   773    773   #if defined(_WIN32)
   774         -    if( _isatty(fileno(stdout)) ){
   775         -      char *z;
   776         -      z = fossil_utf8_to_console(blob_str(pBlob));
   777         -      n = strlen(z);
   778         -      fwrite(z, 1, n, stdout);
   779         -      free(z);
          774  +    if( fossil_utf8_to_console(blob_buffer(pBlob), n, 0) >= 0 ){
   780    775         return n;
   781    776       }
   782    777   #endif
   783         -    n = blob_size(pBlob);
   784    778       fwrite(blob_buffer(pBlob), 1, n, stdout);
   785    779       return n;
   786    780     }else{
   787    781       int i, nName;
   788    782       char *zName, zBuf[1000];
   789    783   
   790    784       nName = strlen(zFilename);

Changes to src/branch.c.

   163    163     if( g.argc==3 ){
   164    164       fossil_print(
   165    165         "\n"
   166    166         "Note: the local check-out has not been updated to the new\n"
   167    167         "      branch.  To begin working on the new branch, do this:\n"
   168    168         "\n"
   169    169         "      %s update %s\n",
   170         -      fossil_nameofexe(), zBranch
          170  +      g.argv[0], zBranch
   171    171       );
   172    172     }
   173    173   
   174    174   
   175    175     /* Commit */
   176    176     db_end_transaction(0);
   177    177     

Changes to src/captcha.c.

    96     96     z[k] = 0;
    97     97     return z;     
    98     98   }
    99     99   #endif /* CAPTCHA==1 */
   100    100   
   101    101   
   102    102   #if CAPTCHA==2
   103         -static const char *azFont2[] = {
          103  +static const char *const azFont2[] = {
   104    104    /* 0 */
   105    105    "  __  ",
   106    106    " /  \\ ",
   107    107    "| () |",
   108    108    " \\__/ ",
   109    109   
   110    110    /* 1 */
................................................................................
   221    221     }
   222    222     z[k] = 0;
   223    223     return z;     
   224    224   }
   225    225   #endif /* CAPTCHA==2 */
   226    226   
   227    227   #if CAPTCHA==3
   228         -static const char *azFont3[] = {
          228  +static const char *const azFont3[] = {
   229    229     /* 0 */
   230    230     "  ___  ",
   231    231     " / _ \\ ",
   232    232     "| | | |",
   233    233     "| | | |",
   234    234     "| |_| |",
   235    235     " \\___/ ",

Changes to src/cgi.c.

  1353   1353     return 0;
  1354   1354   }
  1355   1355   
  1356   1356   
  1357   1357   /*
  1358   1358   ** Name of days and months.
  1359   1359   */
  1360         -static const char *azDays[] =
         1360  +static const char *const azDays[] =
  1361   1361       {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", 0};
  1362         -static const char *azMonths[] =
         1362  +static const char *const azMonths[] =
  1363   1363       {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
  1364   1364        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 0};
  1365   1365   
  1366   1366   
  1367   1367   /*
  1368   1368   ** Returns an RFC822-formatted time string suitable for HTTP headers.
  1369   1369   ** The timezone is always GMT.  The value returned is always a

Changes to src/checkout.c.

   184    184   **
   185    185   ** See also: update
   186    186   */
   187    187   void checkout_cmd(void){
   188    188     int forceFlag;                 /* Force checkout even if edits exist */
   189    189     int keepFlag;                  /* Do not change any files on disk */
   190    190     int latestFlag;                /* Checkout the latest version */
   191         -  char *zVers;                   /* Version to checkout */
          191  +  const char *zVers;             /* Version to checkout */
   192    192     int promptFlag;                /* True to prompt before overwriting */
   193    193     int vid, prior;
   194    194     Blob cksum1, cksum1b, cksum2;
   195    195     
   196    196     db_must_be_within_tree();
   197    197     db_begin_transaction();
   198    198     forceFlag = find_option("force","f",0)!=0;

Changes to src/clearsign.c.

    26     26   ** Clearsign the given blob.  Put the signed version in
    27     27   ** pOut.
    28     28   */
    29     29   int clearsign(Blob *pIn, Blob *pOut){
    30     30     char *zRand;
    31     31     char *zIn;
    32     32     char *zOut;
    33         -  char *zBase = db_get("pgp-command", "gpg --clearsign -o ");
           33  +  const char *zBase = db_get("pgp-command", "gpg --clearsign -o ");
    34     34     char *zCmd;
    35     35     int rc;
    36     36     if( is_false(zBase) ){
    37     37       return 0;
    38     38     }
    39     39     zRand = db_text(0, "SELECT hex(randomblob(10))");
    40     40     zOut = mprintf("out-%s", zRand);

Changes to src/configure.c.

   914    914         }else if( fossil_strcmp(zName,"@reportfmt")==0 ){
   915    915           db_multi_exec("DELETE FROM reportfmt");
   916    916         }
   917    917       }
   918    918       db_end_transaction(0);
   919    919       fossil_print("Configuration reset to factory defaults.\n");
   920    920       fossil_print("To recover, use:  %s %s import %s\n", 
   921         -            fossil_nameofexe(), g.argv[1], zBackup);
          921  +            g.argv[0], g.argv[1], zBackup);
   922    922     }else
   923    923     {
   924    924       fossil_fatal("METHOD should be one of:"
   925    925                    " export import merge pull push reset");
   926    926     }
   927    927   }

Changes to src/db.c.

    90     90     }
    91     91     else if( g.cgiOutput ){
    92     92       g.cgiOutput = 0;
    93     93       cgi_printf("<h1>Database Error</h1>\n"
    94     94                  "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
    95     95       cgi_reply();
    96     96     }else{
    97         -    fprintf(stderr, "%s: %s\n\n%s", fossil_nameofexe(), z, zRebuildMsg);
           97  +    char *zOut = mprintf("%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
           98  +    fossil_puts(zOut, 1);
           99  +    fossil_free(zOut);
    98    100     }
    99    101     free(z);
   100    102     db_force_rollback();
   101    103     fossil_exit(rc);
   102    104   }
   103    105   
   104    106   /*

Changes to src/diff.c.

  1647   1647   /*
  1648   1648   ** The input pParent is the next most recent ancestor of the file
  1649   1649   ** being annotated.  Do another step of the annotation.  Return true
  1650   1650   ** if additional annotation is required.  zPName is the tag to insert
  1651   1651   ** on each line of the file being annotated that was contributed by
  1652   1652   ** pParent.  Memory to hold zPName is leaked.
  1653   1653   */
  1654         -static int annotation_step(Annotator *p, Blob *pParent, char *zPName){
         1654  +static int annotation_step(Annotator *p, Blob *pParent, const char *zPName){
  1655   1655     int i, j;
  1656   1656     int lnTo;
  1657   1657     int iPrevLevel;
  1658   1658     int iThisLevel;
  1659   1659   
  1660   1660     /* Prepare the parent file to be diffed */
  1661   1661     p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),

Changes to src/diffcmd.c.

   285    285     while( db_step(&q)==SQLITE_ROW ){
   286    286       const char *zPathname = db_column_text(&q,0);
   287    287       int isDeleted = db_column_int(&q, 1);
   288    288       int isChnged = db_column_int(&q,2);
   289    289       int isNew = db_column_int(&q,3);
   290    290       int srcid = db_column_int(&q, 4);
   291    291       int isLink = db_column_int(&q, 5);
   292         -    char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
   293         -    char *zToFree = zFullName;
          292  +    char *zToFree = mprintf("%s%s", g.zLocalRoot, zPathname);
          293  +    const char *zFullName = zToFree;
   294    294       int showDiff = 1;
   295    295       if( isDeleted ){
   296    296         fossil_print("DELETED  %s\n", zPathname);
   297    297         if( !asNewFile ){ showDiff = 0; zFullName = NULL_DEVICE; }
   298    298       }else if( file_access(zFullName, 0) ){
   299    299         fossil_print("MISSING  %s\n", zPathname);
   300    300         if( !asNewFile ){ showDiff = 0; }

Changes to src/file.c.

  1114   1114   #else
  1115   1115     char *zValue = getenv(zName);
  1116   1116   #endif
  1117   1117     return zValue;
  1118   1118   }
  1119   1119   
  1120   1120   /*
  1121         -** Translate UTF8 to MBCS for display on the console.  Return a pointer to the
  1122         -** translated text..  Call fossil_mbcs_free() to deallocate any memory
  1123         -** used to store the returned pointer when done.
         1121  +** Display UTF8 on the console.  Return the number of
         1122  +** Characters written. If stdout or stderr is redirected
         1123  +** to a file, -1 is returned and nothing is written
         1124  +** to the console.
  1124   1125   */
  1125         -char *fossil_utf8_to_console(const char *zUtf8){
         1126  +int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
  1126   1127   #ifdef _WIN32
  1127         -  int nChar, nByte;
  1128         -  WCHAR *zUnicode;   /* Unicode version of zUtf8 */
         1128  +  int nChar;
         1129  +  wchar_t *zUnicode; /* Unicode version of zUtf8 */
         1130  +#ifdef UNICODE
         1131  +  DWORD dummy;
         1132  +#else
  1129   1133     char *zConsole;    /* Console version of zUtf8 */
  1130   1134     int codepage;      /* Console code page */
         1135  +#endif
         1136  +
         1137  +  static int istty[2] = { -1, -1 };
         1138  +  if( istty[toStdErr] == -1 ){
         1139  +    istty[toStdErr] = _isatty(toStdErr + 1) != 0;
         1140  +  }
         1141  +  if( !istty[toStdErr] ){
         1142  +    /* stdout/stderr is not a console. */
         1143  +    return -1;
         1144  +  }
  1131   1145   
  1132         -  nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, NULL, 0);
  1133         -  zUnicode = malloc( nChar*sizeof(zUnicode[0]) );
         1146  +  nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, NULL, 0);
         1147  +  zUnicode = malloc( (nChar + 1) *sizeof(zUnicode[0]) );
  1134   1148     if( zUnicode==0 ){
  1135   1149       return 0;
  1136   1150     }
  1137         -  nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
         1151  +  nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
  1138   1152     if( nChar==0 ){
  1139   1153       free(zUnicode);
  1140   1154       return 0;
  1141   1155     }
         1156  +  zUnicode[nChar] = '\0';
         1157  +#ifdef UNICODE
         1158  +  WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
         1159  +#else /* !UNICODE */
  1142   1160     codepage = GetConsoleCP();
  1143         -  nByte = WideCharToMultiByte(codepage, 0, zUnicode, -1, 0, 0, 0, 0);
  1144         -  zConsole = malloc( nByte );
         1161  +  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, 0, 0, 0, 0);
         1162  +  zConsole = malloc( nByte + 1);
  1145   1163     if( zConsole==0 ){
  1146   1164       free(zUnicode);
  1147   1165       return 0;
  1148   1166     }
  1149         -  nByte = WideCharToMultiByte(codepage, 0, zUnicode, -1, zConsole, nByte, 0, 0);
         1167  +  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, zConsole, nByte, 0, 0);
         1168  +  zConsole[nByte] = '\0';
  1150   1169     free(zUnicode);
  1151   1170     if( nByte == 0 ){
  1152   1171       free(zConsole);
  1153   1172       zConsole = 0;
         1173  +    return 0;
  1154   1174     }
  1155         -  return zConsole;
         1175  +  fwrite(zConsole, 1, nByte, toStdErr ? stderr : stdout);
         1176  +  fflush(toStdErr ? stderr : stdout);
         1177  +#endif /* UNICODE */
         1178  +  return nChar;
  1156   1179   #else
  1157         -  return (char*)zUtf8;  /* No-op on unix */
         1180  +  return -1;  /* No-op on unix */
  1158   1181   #endif  
  1159   1182   }
  1160   1183   
  1161   1184   /*
  1162   1185   ** Translate MBCS to UTF8.  Return a pointer.  Call fossil_mbcs_free()
  1163   1186   ** to deallocate any memory used to store the returned pointer when done.
  1164   1187   */

Changes to src/http_socket.c.

    64     64     free(socketErrMsg);
    65     65     socketErrMsg = 0;
    66     66   }
    67     67   
    68     68   /*
    69     69   ** Set the socket error message.
    70     70   */
    71         -void socket_set_errmsg(char *zFormat, ...){
           71  +void socket_set_errmsg(const char *zFormat, ...){
    72     72     va_list ap;
    73     73     socket_clear_errmsg();
    74     74     va_start(ap, zFormat);
    75     75     socketErrMsg = vmprintf(zFormat, ap);
    76     76     va_end(ap);
    77     77   }
    78     78   

Changes to src/json.c.

   346    346     int const rc = cson_array_append( g.json.gc.a, v );
   347    347     assert( NULL != g.json.gc.a );
   348    348     if( 0 != rc ){
   349    349       cson_value_free( v );
   350    350     }
   351    351     assert( (0==rc) && "Adding item to GC failed." );
   352    352     if(0!=rc){
   353         -    fprintf(stderr,"%s: FATAL: alloc error.\n", fossil_nameofexe())
          353  +    fprintf(stderr,"%s: FATAL: alloc error.\n", g.argv[0])
   354    354           /* reminder: allocation error is the only reasonable cause of
   355    355              error here, provided g.json.gc.a and v are not NULL.
   356    356           */
   357    357           ;
   358    358       fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere
   359    359                       where this function is called again.
   360    360                     */;
................................................................................
  1626   1626     }
  1627   1627     resp = json_create_response(rc, msg, NULL);
  1628   1628     if(!resp){
  1629   1629       /* about the only error case here is out-of-memory. DO NOT
  1630   1630          call fossil_panic() here because that calls this function.
  1631   1631       */
  1632   1632       fprintf(stderr, "%s: Fatal error: could not allocate "
  1633         -            "response object.\n", fossil_nameofexe());
         1633  +            "response object.\n", g.argv[0]);
  1634   1634       fossil_exit(1);
  1635   1635     }
  1636   1636     if( g.isHTTP ){
  1637   1637       if(alsoOutput){
  1638   1638         json_send_response(resp);
  1639   1639       }else{
  1640   1640         /* almost a duplicate of json_send_response() :( */

Changes to src/main.c.

   329    329     free(g.zErrMsg);
   330    330     if(g.db){
   331    331       db_close(0);
   332    332     }
   333    333   }
   334    334   
   335    335   /*
   336         -** Convert all arguments from mbcs to UTF-8. Then
          336  +** Convert all arguments from mbcs (or unicode) to UTF-8. Then
   337    337   ** search g.argv for arguments "--args FILENAME". If found, then
   338    338   ** (1) remove the two arguments from g.argv
   339    339   ** (2) Read the file FILENAME
   340    340   ** (3) Use the contents of FILE to replace the two removed arguments:
   341    341   **     (a) Ignore blank lines in the file
   342    342   **     (b) Each non-empty line of the file is an argument, except
   343    343   **     (c) If the line begins with "-" and contains a space, it is broken
   344    344   **         into two arguments at the space.
   345    345   */
   346         -static void expand_args_option(int argc, char **argv){
          346  +static void expand_args_option(int argc, void *argv){
   347    347     Blob file = empty_blob;   /* Content of the file */
   348    348     Blob line = empty_blob;   /* One line of the file */
   349    349     unsigned int nLine;       /* Number of lines in the file*/
   350    350     unsigned int i, j, k;     /* Loop counters */
   351    351     int n;                    /* Number of bytes in one line */
   352         -  char *z;            /* General use string pointer */
   353         -  char **newArgv;     /* New expanded g.argv under construction */
          352  +  char *z;                  /* General use string pointer */
          353  +  char **newArgv;           /* New expanded g.argv under construction */
   354    354     char const * zFileName;   /* input file name */
   355    355     FILE * zInFile;           /* input FILE */
   356    356     int foundBom = -1;        /* -1= not searched yet, 0 = no; 1=yes */
   357    357   #ifdef _WIN32
   358    358     wchar_t buf[MAX_PATH];
   359    359   #endif
   360    360   
   361    361     g.argc = argc;
   362    362     g.argv = argv;
   363    363   #ifdef _WIN32
   364    364     GetModuleFileNameW(NULL, buf, MAX_PATH);
   365    365     g.argv[0] = fossil_unicode_to_utf8(buf);
          366  +#ifdef UNICODE
          367  +  for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
          368  +#else
   366    369     for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
          370  +#endif
   367    371   #endif
   368    372     for(i=1; i<g.argc-1; i++){
   369    373       z = g.argv[i];
   370    374       if( z[0]!='-' ) continue;
   371    375       z++;
   372    376       if( z[0]=='-' ) z++;
   373    377       if( z[0]==0 ) return;   /* Stop searching at "--" */
................................................................................
   428    432     g.argc = j;
   429    433     g.argv = newArgv;
   430    434   }
   431    435   
   432    436   /*
   433    437   ** This procedure runs first.
   434    438   */
   435         -int main(int argc, char **argv){
          439  +#if defined(_WIN32) && defined(UNICODE)
          440  +int wmain(int argc, wchar_t **argv)
          441  +#else
          442  +int main(int argc, char **argv)
          443  +#endif
          444  +{
   436    445     const char *zCmdName = "unknown";
   437    446     int idx;
   438    447     int rc;
   439    448   
   440    449     sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
   441    450     memset(&g, 0, sizeof(g));
   442    451     g.now = time(0);
................................................................................
  1740   1749   **   --th-trace          trace TH1 execution (for debugging purposes)
  1741   1750   **
  1742   1751   ** See also: cgi, http, winsrv
  1743   1752   */
  1744   1753   void cmd_webserver(void){
  1745   1754     int iPort, mxPort;        /* Range of TCP ports allowed */
  1746   1755     const char *zPort;        /* Value of the --port option */
  1747         -  char *zBrowser;           /* Name of web browser program */
         1756  +  const char *zBrowser;     /* Name of web browser program */
  1748   1757     char *zBrowserCmd = 0;    /* Command to launch the web browser */
  1749   1758     int isUiCmd;              /* True if command is "ui", not "server' */
  1750   1759     const char *zNotFound;    /* The --notfound option or NULL */
  1751   1760     int flags = 0;            /* Server flags */
  1752   1761   
  1753   1762   #if defined(_WIN32)
  1754   1763     const char *zStopperFile;    /* Name of file used to terminate server */
................................................................................
  1777   1786     }
  1778   1787   #if !defined(_WIN32)
  1779   1788     /* Unix implementation */
  1780   1789     if( isUiCmd ){
  1781   1790   #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__)
  1782   1791       zBrowser = db_get("web-browser", 0);
  1783   1792       if( zBrowser==0 ){
  1784         -      static char *azBrowserProg[] = { "xdg-open", "gnome-open", "firefox" };
         1793  +      static const char *const azBrowserProg[] = { "xdg-open", "gnome-open", "firefox" };
  1785   1794         int i;
  1786   1795         zBrowser = "echo";
  1787   1796         for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){
  1788   1797           if( binaryOnPath(azBrowserProg[i]) ){
  1789   1798             zBrowser = azBrowserProg[i];
  1790   1799             break;
  1791   1800           }

Changes to src/makeheaders.c.

  1642   1642       return 0;
  1643   1643     }
  1644   1644     pLast = pLast->pNext;
  1645   1645     for(p=pFirst; p && p!=pLast; p=p->pNext){
  1646   1646       if( p->eType==TT_Id ){
  1647   1647         static IdentTable sReserved;
  1648   1648         static int isInit = 0;
  1649         -      static char *aWords[] = { "char", "class", 
         1649  +      static const char *const aWords[] = { "char", "class",
  1650   1650          "const", "double", "enum", "extern", "EXPORT", "ET_PROC", 
  1651   1651          "float", "int", "long",
  1652   1652          "PRIVATE", "PROTECTED", "PUBLIC",
  1653   1653          "register", "static", "struct", "sizeof", "signed", "typedef", 
  1654   1654          "union", "volatile", "virtual", "void", };
  1655   1655     
  1656   1656         if( !isInit ){
................................................................................
  3251   3251     );
  3252   3252   }
  3253   3253   
  3254   3254   /*
  3255   3255   ** The following text contains a few simple #defines that we want
  3256   3256   ** to be available to every file.
  3257   3257   */
  3258         -static char zInit[] = 
         3258  +static const char zInit[] =
  3259   3259     "#define INTERFACE 0\n"
  3260   3260     "#define EXPORT_INTERFACE 0\n"
  3261   3261     "#define LOCAL_INTERFACE 0\n"
  3262   3262     "#define EXPORT\n"
  3263   3263     "#define LOCAL static\n"
  3264   3264     "#define PUBLIC\n"
  3265   3265     "#define PRIVATE\n"

Changes to src/makemake.tcl.

   332    332   # This is a makefile for use on Windows/Linux/Darwin/Cygwin using MinGW or
   333    333   # MinGW-w64.
   334    334   #
   335    335   
   336    336   #### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
   337    337   #    By default, this is an empty string (i.e. use the native compiler).
   338    338   #
   339         -PREFIX =
   340    339   # PREFIX = mingw32-
   341    340   # PREFIX = i686-pc-mingw32-
   342         -# PREFIX = i686-w64-mingw32-
          341  +PREFIX = i686-w64-mingw32-
   343    342   # PREFIX = x86_64-w64-mingw32-
   344    343   
   345    344   #### The toplevel directory of the source tree.  Fossil can be built
   346    345   #    in a directory that is separate from the source tree.  Just change
   347    346   #    the following to point from the build directory to the src/ folder.
   348    347   #
   349    348   SRCDIR = src
................................................................................
   423    422   
   424    423   #### C Compile and options for use in building executables that
   425    424   #    will run on the target platform.  This is usually the same
   426    425   #    as BCC, unless you are cross-compiling.  This C compiler builds
   427    426   #    the finished binary for fossil.  The BCC compiler above is used
   428    427   #    for building intermediate code-generator tools.
   429    428   #
   430         -TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
          429  +TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
   431    430   
   432    431   #### Compile resources for use in building executables that will run
   433    432   #    on the target platform.
   434    433   #
   435    434   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   436    435   
   437    436   # With HTTPS support
................................................................................
   494    493   #    or linking with it will not work (exact reason unknown).
   495    494   #
   496    495   ifdef FOSSIL_ENABLE_TCL
   497    496   LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
   498    497   else
   499    498   LIB += -lkernel32 -lws2_32
   500    499   endif
          500  +
          501  +LIB += -municode
   501    502   
   502    503   #### Tcl shell for use in running the fossil test suite.  This is only
   503    504   #    used for testing.
   504    505   #
   505         -TCLSH = tclsh
          506  +TCLSH = tclsh86
   506    507   
   507    508   #### Nullsoft installer MakeNSIS location
   508    509   #
   509    510   MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
   510    511   
   511    512   #### Include a configuration file that can override any one of these settings.
   512    513   #
................................................................................
   892    893   #ZLIB    = zdll.lib
   893    894   ZINCDIR = $(MSCDIR)\extra\include
   894    895   ZLIBDIR = $(MSCDIR)\extra\lib
   895    896   ZLIB    = zlib.lib
   896    897   
   897    898   INCL   = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
   898    899   
   899         -CFLAGS = -nologo -MT -O2
          900  +CFLAGS = -nologo -MT -O2 -DUNICODE -D_UNICODE
   900    901   BCC    = $(CC) $(CFLAGS)
   901    902   TCC    = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
   902    903   LIBS   = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
   903    904   LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
   904    905   }
   905    906   regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS
   906    907   writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n"

Changes to src/printf.c.

   812    812   **
   813    813   ** On windows, transform the output into the current terminal encoding
   814    814   ** if the output is going to the screen.  If output is redirected into
   815    815   ** a file, no translation occurs.  No translation ever occurs on unix.
   816    816   */
   817    817   void fossil_puts(const char *z, int toStdErr){
   818    818   #if defined(_WIN32)
   819         -  static int once = 1;
   820         -  static int istty[2];
   821         -  char *zToFree = 0;
   822         -  if( once ){
   823         -    istty[0] = _isatty(fileno(stdout));
   824         -    istty[1] = _isatty(fileno(stderr));
   825         -    once = 0;
          819  +  if( fossil_utf8_to_console(z, strlen(z), toStdErr) >= 0 ){
          820  +    return;
   826    821     }
          822  +#endif
   827    823     assert( toStdErr==0 || toStdErr==1 );
   828         -  if( istty[toStdErr] ) z = zToFree = fossil_utf8_to_console(z);
   829    824     fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
   830         -  free(zToFree);
   831         -#else
   832         -  fwrite(z, 1, strlen(z), toStdErr ? stderr : stdout);
   833         -#endif
   834    825     fflush(toStdErr ? stderr : stdout);
   835    826   }
   836    827   
   837    828   /*
   838    829   ** Write output for user consumption.  If g.cgiOutput is enabled, then
   839    830   ** send the output as part of the CGI reply.  If g.cgiOutput is false,
   840    831   ** then write on standard output.

Changes to src/rebuild.c.

   606    606         fossil_print("done\n");
   607    607       }
   608    608       if( activateWal ){
   609    609         db_multi_exec("PRAGMA journal_mode=WAL;");
   610    610       }
   611    611     }
   612    612     if( showStats ){
   613         -    static struct { int idx; const char *zLabel; } aStat[] = {
          613  +    static const struct { int idx; const char *zLabel; } aStat[] = {
   614    614          { CFTYPE_ANY,       "Artifacts:" },
   615    615          { CFTYPE_MANIFEST,  "Manifests:" },
   616    616          { CFTYPE_CLUSTER,   "Clusters:" },
   617    617          { CFTYPE_CONTROL,   "Tags:" },
   618    618          { CFTYPE_WIKI,      "Wikis:" },
   619    619          { CFTYPE_TICKET,    "Tickets:" },
   620    620          { CFTYPE_ATTACHMENT,"Attachments:" },
................................................................................
   814    814     }
   815    815   }
   816    816   
   817    817   /*
   818    818   ** Recursively read all files from the directory zPath and install
   819    819   ** every file read as a new artifact in the repository.
   820    820   */
   821         -void recon_read_dir(char *zPath){
          821  +void recon_read_dir(const char *zPath){
   822    822     FOSSIL_DIR *d;
   823    823     struct fossil_dirent *pEntry;
   824    824     Blob aContent; /* content of the just read artifact */
   825    825     static int nFileRead = 0;
   826    826     void *zUnicodePath;
   827    827     char *zUtf8Name;
   828    828   

Changes to src/report.c.

   168    168     }
   169    169     switch( code ){
   170    170       case SQLITE_SELECT:
   171    171       case SQLITE_FUNCTION: {
   172    172         break;
   173    173       }
   174    174       case SQLITE_READ: {
   175         -      static const char *azAllowed[] = {
          175  +      static const char *const azAllowed[] = {
   176    176            "ticket",
   177    177            "blob",
   178    178            "filename",
   179    179            "mlink",
   180    180            "plink",
   181    181            "event",
   182    182            "tag",

Changes to src/shell.c.

   449    449   #define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
   450    450   #define MODE_Html     4  /* Generate an XHTML table */
   451    451   #define MODE_Insert   5  /* Generate SQL "insert" statements */
   452    452   #define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
   453    453   #define MODE_Csv      7  /* Quote strings, numbers are plain */
   454    454   #define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */
   455    455   
   456         -static const char *modeDescr[] = {
          456  +static const char *const modeDescr[] = {
   457    457     "line",
   458    458     "column",
   459    459     "list",
   460    460     "semi",
   461    461     "html",
   462    462     "insert",
   463    463     "tcl",
................................................................................
  1379   1379     }
  1380   1380     return rc;
  1381   1381   }
  1382   1382   
  1383   1383   /*
  1384   1384   ** Text of a help message
  1385   1385   */
  1386         -static char zHelp[] =
         1386  +static const char zHelp[] =
  1387   1387     ".backup ?DB? FILE      Backup DB (default \"main\") to FILE\n"
  1388   1388     ".bail ON|OFF           Stop after hitting an error.  Default OFF\n"
  1389   1389     ".databases             List names and files of attached databases\n"
  1390   1390     ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
  1391   1391     "                         If TABLE specified, only dump tables matching\n"
  1392   1392     "                         LIKE pattern TABLE.\n"
  1393   1393     ".echo ON|OFF           Turn command echo on or off\n"
................................................................................
  1434   1434     "                         LIKE pattern TABLE.\n"
  1435   1435     ".timeout MS            Try opening locked tables for MS milliseconds\n"
  1436   1436     ".trace FILE|off        Output each SQL statement as it is run\n"
  1437   1437     ".vfsname ?AUX?         Print the name of the VFS stack\n"
  1438   1438     ".width NUM1 NUM2 ...   Set column widths for \"column\" mode\n"
  1439   1439   ;
  1440   1440   
  1441         -static char zTimerHelp[] =
         1441  +static const char zTimerHelp[] =
  1442   1442     ".timer ON|OFF          Turn the CPU timer measurement on or off\n"
  1443   1443   ;
  1444   1444   
  1445   1445   /* Forward reference */
  1446   1446   static int process_input(struct callback_data *p, FILE *in);
  1447   1447   
  1448   1448   /*

Changes to src/tag.c.

   396    396     }
   397    397     n = strlen(g.argv[2]);
   398    398     if( n==0 ){
   399    399       goto tag_cmd_usage;
   400    400     }
   401    401   
   402    402     if( strncmp(g.argv[2],"add",n)==0 ){
   403         -    char *zValue;
          403  +    const char *zValue;
   404    404       const char *zDateOvrd = find_option("date-override",0,1);
   405    405       const char *zUserOvrd = find_option("user-override",0,1);
   406    406       if( g.argc!=5 && g.argc!=6 ){
   407    407         usage("add ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?");
   408    408       }
   409    409       zValue = g.argc==6 ? g.argv[5] : 0;
   410    410       db_begin_transaction();

Changes to src/th.c.

  2294   2294   ** The special list characters have the 0x10 flag set
  2295   2295   **
  2296   2296   **    { } [ ] \ ; ' "
  2297   2297   **
  2298   2298   **    " 0x22
  2299   2299   **
  2300   2300   */
  2301         -static unsigned char aCharProp[256] = {
         2301  +static const unsigned char aCharProp[256] = {
  2302   2302     0,  0,  0,  0,  0,  0,  0,  0,     0,  1,  1,  1,  1,  1,  0,  0,   /* 0x0. */
  2303   2303     0,  0,  1,  1,  0,  0,  0,  0,     0,  0,  0,  0,  0,  0,  0,  0,   /* 0x1. */
  2304   2304     5,  4, 20,  4,  4,  4,  4,  4,     4,  4,  4,  4,  4,  4,  4,  4,   /* 0x2. */
  2305   2305     6,  6,  6,  6,  6,  6,  6,  6,     6,  6,  4, 20,  4,  4,  4,  4,   /* 0x3. */
  2306   2306     4, 12, 12, 12, 12, 12, 12, 12,    12, 12, 12, 12, 12, 12, 12, 12,   /* 0x4. */
  2307   2307    12, 12, 12, 12, 12, 12, 12, 12,    12, 12, 12, 20, 20, 20,  4,  4,   /* 0x5. */
  2308   2308     4, 12, 12, 12, 12, 12, 12, 12,    12, 12, 12, 12, 12, 12, 12, 12,   /* 0x6. */

Changes to src/timeline.c.

  1453   1453   **
  1454   1454   */
  1455   1455   void timeline_cmd(void){
  1456   1456     Stmt q;
  1457   1457     int n, k;
  1458   1458     const char *zCount;
  1459   1459     const char *zType;
  1460         -  char *zOrigin;
         1460  +  const char *zOrigin;
  1461   1461     char *zDate;
  1462   1462     Blob sql;
  1463   1463     int objid = 0;
  1464   1464     Blob uuid;
  1465   1465     int mode = 0 ;       /* 0:none  1: before  2:after  3:children  4:parents */
  1466   1466     int showfilesFlag = 0 ;
  1467   1467     showfilesFlag = find_option("showfiles","f", 0)!=0;

Changes to src/tkt.c.

    24     24   
    25     25   /*
    26     26   ** The list of database user-defined fields in the TICKET table.
    27     27   ** The real table also contains some addition fields for internal
    28     28   ** used.  The internal-use fields begin with "tkt_".
    29     29   */
    30     30   static int nField = 0;
    31         -static char **azField = 0;    /* Names of database fields */
    32         -static char **azValue = 0;    /* Original values */
    33         -static char **azAppend = 0;   /* Value to be appended */
           31  +static const char **azField = 0;    /* Names of database fields */
           32  +static const char **azValue = 0;    /* Original values */
           33  +static const char **azAppend = 0;   /* Value to be appended */
    34     34   
    35     35   /*
    36     36   ** Compare two entries in azField for sorting purposes
    37     37   */
    38     38   static int nameCmpr(const void *a, const void *b){
    39     39     return fossil_strcmp(*(char**)a, *(char**)b);
    40     40   }
................................................................................
  1115   1115         /* read all given ticket field/value pairs from command line */
  1116   1116         if( i==g.argc ){
  1117   1117           fossil_fatal("empty %s command aborted!",g.argv[2]);
  1118   1118         }
  1119   1119         getAllTicketFields();
  1120   1120         /* read commandline and assign fields in the azValue array */
  1121   1121         while( i<g.argc ){
  1122         -        char *zFName;
  1123         -        char *zFValue;
         1122  +        const char *zFName;
         1123  +        const char *zFValue;
  1124   1124           int j;
  1125   1125           int append = 0;
  1126   1126   
  1127   1127           zFName = g.argv[i++];
  1128   1128           if( i==g.argc ){
  1129   1129             fossil_fatal("missing value for '%s'!",zFName);
  1130   1130           }
  1131   1131           zFValue = g.argv[i++];
  1132   1132           if( tktEncoding == tktFossilize ){
  1133         -          zFValue=mprintf("%s",zFValue);
  1134         -          defossilize(zFValue);
         1133  +          char *z = mprintf("%s",zFValue);
         1134  +          defossilize(z);
         1135  +          zFValue = z;
  1135   1136           }
  1136   1137           append = (zFName[0] == '+');
  1137   1138           if (append){
  1138   1139             zFName++;
  1139   1140           }
  1140   1141           j = fieldId(zFName);
  1141   1142           if( j == -1 ){
................................................................................
  1151   1152   
  1152   1153         /* now add the needed artifacts to the repository */
  1153   1154         blob_zero(&tktchng);
  1154   1155         /* add the time to the ticket manifest */
  1155   1156         blob_appendf(&tktchng, "D %s\n", zDate);
  1156   1157         /* append defined elements */
  1157   1158         for(i=0; i<nField; i++){
  1158         -        char *zValue = 0;
  1159         -        char *zPfx;
         1159  +        const char *zValue = 0;
         1160  +        const char *zPfx;
  1160   1161   
  1161   1162           if (azAppend[i] && azAppend[i][0] ){
  1162   1163             zPfx = " +";
  1163   1164             zValue = azAppend[i];
  1164   1165           } else if( azValue[i] && azValue[i][0] ){
  1165   1166             zPfx = " ";
  1166   1167             zValue = azValue[i];

Changes to src/translate.c.

     1      1   /*
     2         -** Copyright (c) 2002 D. Richard Hipp
            2  +** Copyright © 2002 D. Richard Hipp
     3      3   **
     4      4   ** This program is free software; you can redistribute it and/or
     5      5   ** modify it under the terms of the Simplified BSD License (also
     6      6   ** known as the "2-Clause License" or "FreeBSD License".)
     7      7   
     8      8   ** This program is distributed in the hope that it will be useful,
     9      9   ** but without any warranty; without even the implied warranty of
................................................................................
    74     74   static void trans(FILE *in, FILE *out){
    75     75     int i, j, k;          /* Loop counters */
    76     76     char c1, c2;          /* Characters used to start a comment */
    77     77     int lastWasEq = 0;    /* True if last non-whitespace character was "=" */
    78     78     int lastWasComma = 0; /* True if last non-whitespace character was "," */
    79     79     char zLine[2000];     /* A single line of input */
    80     80     char zOut[4000];      /* The input line translated into appropriate output */
           81  +  int isFirstline = 1;  /* True if this is the first line */
    81     82   
    82     83     c1 = c2 = '-';
    83     84     while( fgets(zLine, sizeof(zLine), in) ){
           85  +    if (isFirstline) {
           86  +      static const char bom[] = { 0xEF, 0xBB, 0xBF };
           87  +      if( memcmp(zLine, bom, 3)==0 ) {
           88  +    	  memmove(zLine, zLine+3, sizeof(zLine)-3);
           89  +      }
           90  +      isFirstline = 0;
           91  +    }
    84     92       for(i=0; zLine[i] && isspace(zLine[i]); i++){}
    85     93       if( zLine[i]!='@' ){
    86     94         if( inPrint || inStr ) end_block(out);
    87         -      fprintf(out,"%s",zLine);
           95  +      for(i=0,j=0; zLine[i]; i++){
           96  +        if (128 <= (unsigned char)zLine[i]) {
           97  +          sprintf(&zOut[j], "\\0x%.2X", zLine[i] & 0xFF);
           98  +          j += 5;
           99  +        } else {
          100  +          zOut[j++] = zLine[i];
          101  +        }
          102  +      }
          103  +      zOut[j] = 0;
          104  +      fprintf(out,"%s",zOut);
    88    105                          /* 0123456789 12345 */
    89    106         if( strncmp(zLine, "/* @-comment: ", 14)==0 ){
    90    107           c1 = zLine[14];
    91    108           c2 = zLine[15];
    92    109         }
    93    110         i += strlen(&zLine[i]);
    94    111         while( i>0 && isspace(zLine[i-1]) ){ i--; }
................................................................................
   108    125         if( indent<0 ) indent = 0;
   109    126         omitline = 0;
   110    127         for(j=0; zLine[i] && zLine[i]!='\r' && zLine[i]!='\n'; i++){
   111    128           if( zLine[i]==c1 && (c2==' ' || zLine[i+1]==c2) ){
   112    129              omitline = 1; break; 
   113    130           }
   114    131           if( zLine[i]=='"' || zLine[i]=='\\' ){ zOut[j++] = '\\'; }
   115         -        zOut[j++] = zLine[i];
          132  +        if (128 <= (unsigned char)zLine[i]) {
          133  +          sprintf(&zOut[j], "\\0x%.2X", zLine[i] & 0xFF);
          134  +          j += 5;
          135  +        } else {
          136  +          zOut[j++] = zLine[i];
          137  +        }
   116    138         }
   117    139         while( j>0 && isspace(zOut[j-1]) ){ j--; }
   118    140         zOut[j] = 0;
   119    141         if( j<=0 && omitline ){
   120    142           fprintf(out,"\n");
   121    143         }else{
   122    144           fprintf(out,"%*s\"%s\\n\"\n",indent, "", zOut);
................................................................................
   132    154         int nC;
   133    155         char c;
   134    156         i++;
   135    157         if( isspace(zLine[i]) ){ i++; }
   136    158         indent = i;
   137    159         for(j=0; zLine[i] && zLine[i]!='\r' && zLine[i]!='\n'; i++){
   138    160           if( zLine[i]=='"' || zLine[i]=='\\' ){ zOut[j++] = '\\'; }
   139         -        zOut[j++] = zLine[i];
          161  +        if (128 <= (unsigned char)zLine[i]) {
          162  +          sprintf(&zOut[j], "\\0x%.2X", zLine[i] & 0xFF);
          163  +          j += 5;
          164  +        } else {
          165  +          zOut[j++] = zLine[i];
          166  +        }
   140    167           if( zLine[i]!='%' || zLine[i+1]=='%' || zLine[i+1]==0 ) continue;
   141    168           for(nC=1; zLine[i+nC] && zLine[i+nC]!='('; nC++){}
   142    169           if( zLine[i+nC]!='(' || !isalpha(zLine[i+nC-1]) ) continue;
   143    170           while( --nC ) zOut[j++] = zLine[++i];
   144    171           zArg[nArg++] = ',';
   145    172           k = 0; i++;
   146    173           while( (c = zLine[i])!=0 ){

Changes to src/wiki.c.

   961    961       blob_write_to_file(&body, zFile);
   962    962       blob_reset(&body);
   963    963       manifest_destroy(pWiki);
   964    964       return;
   965    965     }else
   966    966     if( strncmp(g.argv[2],"commit",n)==0
   967    967         || strncmp(g.argv[2],"create",n)==0 ){
   968         -    char *zPageName;
          968  +    const char *zPageName;
   969    969       Blob content;
   970    970       if( g.argc!=4 && g.argc!=5 ){
   971    971         usage("commit PAGENAME ?FILE?");
   972    972       }
   973    973       zPageName = g.argv[3];
   974    974       if( g.argc==4 ){
   975    975         blob_read_from_channel(&content, stdin, -1);

Changes to src/winhttp.c.

   127    127     if( in ) fclose(in);
   128    128     closesocket(p->s);
   129    129     file_delete(zRequestFName);
   130    130     file_delete(zReplyFName);
   131    131     free(p);
   132    132   }
   133    133   
          134  +#if !defined(UNICODE)
          135  +#  define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
          136  +#  define fossil_utf8_to_unicode fossil_utf8_to_mbcs
          137  +#endif
          138  +
   134    139   /*
   135    140   ** Start a listening socket and process incoming HTTP requests on
   136    141   ** that socket.
   137    142   */
          143  +
   138    144   void win32_http_server(
   139    145     int mnPort, int mxPort,   /* Range of allowed TCP port numbers */
   140    146     const char *zBrowser,     /* Command to launch browser.  (Or NULL) */
   141    147     const char *zStopper,     /* Stop server when this file is exists (Or NULL) */
   142    148     const char *zNotFound,    /* The --notfound option, or NULL */
   143    149     int flags                 /* One or more HTTP_SERVER_ flags */
   144    150   ){
   145    151     WSADATA wd;
   146    152     SOCKET s = INVALID_SOCKET;
   147    153     SOCKADDR_IN addr;
   148    154     int idCnt = 0;
   149    155     int iPort = mnPort;
   150    156     Blob options;
   151         -  char zTmpPath[MAX_PATH];
          157  +  TCHAR zTmpPath[MAX_PATH];
   152    158   
   153    159     if( zStopper ) file_delete(zStopper);
   154    160     blob_zero(&options);
   155    161     if( zNotFound ){
   156    162       blob_appendf(&options, " --notfound %s", zNotFound);
   157    163     }
   158    164     if( g.useLocalauth ){
................................................................................
   192    198         fossil_fatal("unable to open listening socket on any"
   193    199                      " port in the range %d..%d", mnPort, mxPort);
   194    200       }
   195    201     }
   196    202     if( !GetTempPath(MAX_PATH, zTmpPath) ){
   197    203       fossil_fatal("unable to get path to the temporary directory.");
   198    204     }
   199         -  zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort);
          205  +  zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_unicode_to_utf8(zTmpPath), iPort);
   200    206     fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
   201    207     if( zBrowser ){
   202    208       zBrowser = mprintf(zBrowser, iPort);
   203    209       fossil_print("Launch webbrowser: %s\n", zBrowser);
   204    210       fossil_system(zBrowser);
   205    211     }
   206    212     fossil_print("Type Ctrl-C to stop the HTTP server\n");
................................................................................
   247    253   */
   248    254   typedef struct HttpService HttpService;
   249    255   struct HttpService {
   250    256     int port;                 /* Port on which the http server should run */
   251    257     const char *zNotFound;    /* The --notfound option, or NULL */
   252    258     int flags;                /* One or more HTTP_SERVER_ flags */
   253    259     int isRunningAsService;   /* Are we running as a service ? */
   254         -  const char *zServiceName; /* Name of the service */
          260  +  const TCHAR *zServiceName;/* Name of the service */
   255    261     SOCKET s;                 /* Socket on which the http server listens */
   256    262   };
   257    263   
   258    264   /*
   259    265   ** Variables used for running as windows service.
   260    266   */
   261    267   static HttpService hsData = {8080, NULL, 0, 0, NULL, INVALID_SOCKET};
................................................................................
   296    302                0,
   297    303                (LPTSTR) &tmp,
   298    304                0,
   299    305                NULL
   300    306              );
   301    307     }
   302    308     if( nMsg ){
   303         -    zMsg = fossil_mbcs_to_utf8(tmp);
          309  +    zMsg = fossil_unicode_to_utf8(tmp);
   304    310     }else{
   305    311       fossil_fatal("unable to get system error message.");
   306    312     }
   307    313     if( tmp ){
   308    314       LocalFree((HLOCAL) tmp);
   309    315     }
   310    316     return zMsg;
................................................................................
   382    388     /* Update the service information. */
   383    389     hsData.isRunningAsService = 1;
   384    390     if( argc>0 ){
   385    391       hsData.zServiceName = argv[0];
   386    392     }
   387    393   
   388    394     /* Register the service control handler function */
   389         -  sshStatusHandle = RegisterServiceCtrlHandler("", win32_http_service_ctrl);
          395  +  sshStatusHandle = RegisterServiceCtrlHandler(TEXT(""), win32_http_service_ctrl);
   390    396     if( !sshStatusHandle ){
   391    397       win32_report_service_status(SERVICE_STOPPED, NO_ERROR, 0);
   392    398       return;
   393    399     }
   394    400   
   395    401     /* Set service specific data and report that the service is starting. */
   396    402     ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
................................................................................
   427    433   int win32_http_service(
   428    434     int nPort,                /* TCP port number */
   429    435     const char *zNotFound,    /* The --notfound option, or NULL */
   430    436     int flags                 /* One or more HTTP_SERVER_ flags */
   431    437   ){
   432    438     /* Define the service table. */
   433    439     SERVICE_TABLE_ENTRY ServiceTable[] =
   434         -    {{"", (LPSERVICE_MAIN_FUNCTION)win32_http_service_main}, {NULL, NULL}};
          440  +    {{TEXT(""), (LPSERVICE_MAIN_FUNCTION)win32_http_service_main}, {NULL, NULL}};
   435    441     
   436    442     /* Initialize the HttpService structure. */
   437    443     hsData.port = nPort;
   438    444     hsData.zNotFound = zNotFound;
   439    445     hsData.flags = flags;
   440    446   
   441    447     /* Try to start the control dispatcher thread for the service. */
................................................................................
   445    451       }else{
   446    452         fossil_fatal("error from StartServiceCtrlDispatcher()");
   447    453       }
   448    454     }
   449    455     return 0;
   450    456   }
   451    457   
   452         -/*
          458  +#ifdef _WIN32
          459  +/* dupe ifdef needed for mkindex
   453    460   ** COMMAND: winsrv*
   454    461   ** Usage: fossil winsrv METHOD ?SERVICE-NAME? ?OPTIONS?
   455    462   **
   456    463   ** Where METHOD is one of: create delete show start stop.
   457    464   **
   458    465   ** The winsrv command manages Fossil as a Windows service.  This allows
   459    466   ** (for example) Fossil to be running in the background when no user
................................................................................
   563    570     zMethod = g.argv[2];
   564    571     n = strlen(zMethod);
   565    572   
   566    573     if( strncmp(zMethod, "create", n)==0 ){
   567    574       SC_HANDLE hScm;
   568    575       SC_HANDLE hSvc;
   569    576       SERVICE_DESCRIPTION
   570         -      svcDescr = {"Fossil - Distributed Software Configuration Management"};
          577  +      svcDescr = {TEXT("Fossil - Distributed Software Configuration Management")};
   571    578       char *zErrFmt = "unable to create service '%s': %s";
   572    579       DWORD dwStartType = SERVICE_DEMAND_START;
   573    580       const char *zDisplay    = find_option("display", "D", 1);
   574    581       const char *zStart      = find_option("start", "S", 1);
   575    582       const char *zUsername   = find_option("username", "U", 1);
   576    583       const char *zPassword   = find_option("password", "W", 1);
   577    584       const char *zPort       = find_option("port", "P", 1);
................................................................................
   622    629       if( zLocalAuth ) blob_append(&binPath, " --localauth", -1);
   623    630       blob_appendf(&binPath, " \"%s\"", g.zRepositoryName);
   624    631       /* Create the service. */
   625    632       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   626    633       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   627    634       hSvc = CreateService(
   628    635                hScm,                                    /* Handle to the SCM */
   629         -             fossil_utf8_to_mbcs(zSvcName),           /* Name of the service */
   630         -             fossil_utf8_to_mbcs(zDisplay),           /* Display name */
          636  +             fossil_utf8_to_unicode(zSvcName),           /* Name of the service */
          637  +             fossil_utf8_to_unicode(zDisplay),           /* Display name */
   631    638                SERVICE_ALL_ACCESS,                      /* Desired access */
   632    639                SERVICE_WIN32_OWN_PROCESS,               /* Service type */
   633    640                dwStartType,                             /* Start type */
   634    641                SERVICE_ERROR_NORMAL,                    /* Error control */
   635         -             fossil_utf8_to_mbcs(blob_str(&binPath)), /* Binary path */
          642  +             fossil_utf8_to_unicode(blob_str(&binPath)), /* Binary path */
   636    643                NULL,                                    /* Load ordering group */
   637    644                NULL,                                    /* Tag value */
   638    645                NULL,                                    /* Service dependencies */
   639         -             fossil_utf8_to_mbcs(zUsername),          /* Service account */
   640         -             fossil_utf8_to_mbcs(zPassword)           /* Account password */
          646  +             fossil_utf8_to_unicode(zUsername),          /* Service account */
          647  +             fossil_utf8_to_unicode(zPassword)           /* Account password */
   641    648              );
   642    649       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   643    650       /* Set the service description. */
   644    651       ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
   645    652       fossil_print("Service '%s' successfully created.\n", zSvcName);
   646    653       CloseServiceHandle(hSvc);
   647    654       CloseServiceHandle(hScm);
................................................................................
   656    663       if( g.argc==4 ){
   657    664         zSvcName = g.argv[3];
   658    665       }else if( g.argc>4 ){
   659    666         fossil_fatal("to much arguments for delete method.");
   660    667       }
   661    668       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   662    669       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   663         -    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
          670  +    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   664    671       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   665    672       QueryServiceStatus(hSvc, &sstat);
   666    673       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   667    674         fossil_print("Stopping service '%s'", zSvcName);
   668    675         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   669    676           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   670    677             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   693    700       SC_HANDLE hScm;
   694    701       SC_HANDLE hSvc;
   695    702       SERVICE_STATUS sstat;
   696    703       LPQUERY_SERVICE_CONFIG pSvcConfig;
   697    704       LPSERVICE_DESCRIPTION pSvcDescr;
   698    705       BOOL bStatus;
   699    706       DWORD nRequired;
   700         -    char *zErrFmt = "unable to show service '%s': %s";
   701         -    static const char *zSvcTypes[] = {
          707  +    const char *zErrFmt = "unable to show service '%s': %s";
          708  +    static const char *const zSvcTypes[] = {
   702    709         "Driver service",
   703    710         "File system driver service",
   704    711         "Service runs in its own process",
   705    712         "Service shares a process with other services",
   706    713         "Service can interact with the desktop"
   707    714       };
   708    715       const char *zSvcType = "";
   709         -    static char *zSvcStartTypes[] = {
          716  +    static const char *const zSvcStartTypes[] = {
   710    717         "Started by the system loader",
   711    718         "Started by the IoInitSystem function",
   712    719         "Started automatically by the service control manager",
   713    720         "Started manually",
   714    721         "Service cannot be started"
   715    722       };
   716    723       const char *zSvcStartType = "";
   717         -    static const char *zSvcStates[] = {
          724  +    static const char *const zSvcStates[] = {
   718    725         "Stopped", "Starting", "Stopping", "Running",
   719    726         "Continue pending", "Pause pending", "Paused"
   720    727       };
   721    728       const char *zSvcState = "";
   722    729   
   723    730       verify_all_options();
   724    731       if( g.argc==4 ){
   725    732         zSvcName = g.argv[3];
   726    733       }else if( g.argc>4 ){
   727    734         fossil_fatal("to much arguments for show method.");
   728    735       }
   729    736       hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
   730    737       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   731         -    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), GENERIC_READ);
          738  +    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
   732    739       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   733    740       /* Get the service configuration */
   734    741       bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
   735    742       if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
   736    743         fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   737    744       }
   738    745       pSvcConfig = fossil_malloc(nRequired);
................................................................................
   776    783         case SERVICE_CONTINUE_PENDING: zSvcState = zSvcStates[4]; break;
   777    784         case SERVICE_PAUSE_PENDING:    zSvcState = zSvcStates[5]; break;
   778    785         case SERVICE_PAUSED:           zSvcState = zSvcStates[6]; break;
   779    786       }
   780    787       /* Print service information to terminal */
   781    788       fossil_print("Service name .......: %s\n", zSvcName);
   782    789       fossil_print("Display name .......: %s\n",
   783         -                 fossil_mbcs_to_utf8(pSvcConfig->lpDisplayName));
          790  +                 fossil_unicode_to_utf8(pSvcConfig->lpDisplayName));
   784    791       fossil_print("Service description : %s\n",
   785         -                 fossil_mbcs_to_utf8(pSvcDescr->lpDescription));
          792  +                 fossil_unicode_to_utf8(pSvcDescr->lpDescription));
   786    793       fossil_print("Service type .......: %s.\n", zSvcType);
   787    794       fossil_print("Service start type .: %s.\n", zSvcStartType);
   788    795       fossil_print("Binary path name ...: %s\n",
   789         -                 fossil_mbcs_to_utf8(pSvcConfig->lpBinaryPathName));
          796  +                 fossil_unicode_to_utf8(pSvcConfig->lpBinaryPathName));
   790    797       fossil_print("Service username ...: %s\n",
   791         -                 fossil_mbcs_to_utf8(pSvcConfig->lpServiceStartName));
          798  +                 fossil_unicode_to_utf8(pSvcConfig->lpServiceStartName));
   792    799       fossil_print("Current state ......: %s.\n", zSvcState);
   793    800       /* Cleanup */
   794    801       fossil_free(pSvcConfig);
   795    802       fossil_free(pSvcDescr);
   796    803       CloseServiceHandle(hSvc);
   797    804       CloseServiceHandle(hScm);
   798    805     }else
................................................................................
   806    813       if( g.argc==4 ){
   807    814         zSvcName = g.argv[3];
   808    815       }else if( g.argc>4 ){
   809    816         fossil_fatal("to much arguments for start method.");
   810    817       }
   811    818       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   812    819       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   813         -    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
          820  +    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   814    821       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   815    822       QueryServiceStatus(hSvc, &sstat);
   816    823       if( sstat.dwCurrentState!=SERVICE_RUNNING ){
   817    824         fossil_print("Starting service '%s'", zSvcName);
   818    825         if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
   819    826           if( !StartService(hSvc, 0, NULL) ){
   820    827             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   842    849       if( g.argc==4 ){
   843    850         zSvcName = g.argv[3];
   844    851       }else if( g.argc>4 ){
   845    852         fossil_fatal("to much arguments for stop method.");
   846    853       }
   847    854       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   848    855       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   849         -    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
          856  +    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   850    857       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   851    858       QueryServiceStatus(hSvc, &sstat);
   852    859       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   853    860         fossil_print("Stopping service '%s'", zSvcName);
   854    861         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   855    862           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   856    863             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   870    877     }else
   871    878     {
   872    879       fossil_fatal("METHOD should be one of:"
   873    880                    " create delete show start stop");
   874    881     }
   875    882     return;
   876    883   }
          884  +#endif /* _WIN32 */
   877    885   
   878    886   #endif /* _WIN32  -- This code is for win32 only */

Changes to src/xfer.c.

   268    268   static int send_delta_parent(
   269    269     Xfer *pXfer,            /* The transfer context */
   270    270     int rid,                /* record id of the file to send */
   271    271     int isPrivate,          /* True if rid is a private artifact */
   272    272     Blob *pContent,         /* The content of the file to send */
   273    273     Blob *pUuid             /* The UUID of the file to send */
   274    274   ){
   275         -  static const char *azQuery[] = {
          275  +  static const char *const azQuery[] = {
   276    276       "SELECT pid FROM plink x"
   277    277       " WHERE cid=%d"
   278    278       "   AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
   279    279       "   AND NOT EXISTS(SELECT 1 FROM plink y"
   280    280                         " WHERE y.pid=x.cid AND y.cid=x.pid)",
   281    281   
   282    282       "SELECT pid FROM mlink x"

Added test/世界/界世.txt.

            1  +Just some text

Changes to win/Makefile.mingw.

    11     11   # This is a makefile for use on Windows/Linux/Darwin/Cygwin using MinGW or
    12     12   # MinGW-w64.
    13     13   #
    14     14   
    15     15   #### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
    16     16   #    By default, this is an empty string (i.e. use the native compiler).
    17     17   #
    18         -PREFIX =
    19     18   # PREFIX = mingw32-
    20     19   # PREFIX = i686-pc-mingw32-
    21         -# PREFIX = i686-w64-mingw32-
           20  +PREFIX = i686-w64-mingw32-
    22     21   # PREFIX = x86_64-w64-mingw32-
    23     22   
    24     23   #### The toplevel directory of the source tree.  Fossil can be built
    25     24   #    in a directory that is separate from the source tree.  Just change
    26     25   #    the following to point from the build directory to the src/ folder.
    27     26   #
    28     27   SRCDIR = src
................................................................................
   102    101   
   103    102   #### C Compile and options for use in building executables that
   104    103   #    will run on the target platform.  This is usually the same
   105    104   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    105   #    the finished binary for fossil.  The BCC compiler above is used
   107    106   #    for building intermediate code-generator tools.
   108    107   #
   109         -TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
          108  +TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
   110    109   
   111    110   #### Compile resources for use in building executables that will run
   112    111   #    on the target platform.
   113    112   #
   114    113   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   115    114   
   116    115   # With HTTPS support
................................................................................
   173    172   #    or linking with it will not work (exact reason unknown).
   174    173   #
   175    174   ifdef FOSSIL_ENABLE_TCL
   176    175   LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
   177    176   else
   178    177   LIB += -lkernel32 -lws2_32
   179    178   endif
          179  +
          180  +LIB += -municode
   180    181   
   181    182   #### Tcl shell for use in running the fossil test suite.  This is only
   182    183   #    used for testing.
   183    184   #
   184         -TCLSH = tclsh
          185  +TCLSH = tclsh86
   185    186   
   186    187   #### Nullsoft installer MakeNSIS location
   187    188   #
   188    189   MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
   189    190   
   190    191   #### Include a configuration file that can override any one of these settings.
   191    192   #

Changes to win/Makefile.mingw.mistachkin.

    11     11   # This is a makefile for use on Windows/Linux/Darwin/Cygwin using MinGW or
    12     12   # MinGW-w64.
    13     13   #
    14     14   
    15     15   #### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
    16     16   #    By default, this is an empty string (i.e. use the native compiler).
    17     17   #
    18         -PREFIX =
    19     18   # PREFIX = mingw32-
    20     19   # PREFIX = i686-pc-mingw32-
    21         -# PREFIX = i686-w64-mingw32-
           20  +PREFIX = i686-w64-mingw32-
    22     21   # PREFIX = x86_64-w64-mingw32-
    23     22   
    24     23   #### The toplevel directory of the source tree.  Fossil can be built
    25     24   #    in a directory that is separate from the source tree.  Just change
    26     25   #    the following to point from the build directory to the src/ folder.
    27     26   #
    28     27   SRCDIR = src
................................................................................
   102    101   
   103    102   #### C Compile and options for use in building executables that
   104    103   #    will run on the target platform.  This is usually the same
   105    104   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    105   #    the finished binary for fossil.  The BCC compiler above is used
   107    106   #    for building intermediate code-generator tools.
   108    107   #
   109         -TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
          108  +TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
   110    109   
   111    110   #### Compile resources for use in building executables that will run
   112    111   #    on the target platform.
   113    112   #
   114    113   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   115    114   
   116    115   # With HTTPS support
................................................................................
   173    172   #    or linking with it will not work (exact reason unknown).
   174    173   #
   175    174   ifdef FOSSIL_ENABLE_TCL
   176    175   LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
   177    176   else
   178    177   LIB += -lkernel32 -lws2_32
   179    178   endif
          179  +
          180  +LIB += -municode
   180    181   
   181    182   #### Tcl shell for use in running the fossil test suite.  This is only
   182    183   #    used for testing.
   183    184   #
   184         -TCLSH = tclsh
          185  +TCLSH = tclsh86
   185    186   
   186    187   #### Nullsoft installer MakeNSIS location
   187    188   #
   188    189   MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
   189    190   
   190    191   #### Include a configuration file that can override any one of these settings.
   191    192   #

Changes to win/Makefile.msc.

    30     30   #ZLIB    = zdll.lib
    31     31   ZINCDIR = $(MSCDIR)\extra\include
    32     32   ZLIBDIR = $(MSCDIR)\extra\lib
    33     33   ZLIB    = zlib.lib
    34     34   
    35     35   INCL   = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
    36     36   
    37         -CFLAGS = -nologo -MT -O2
           37  +CFLAGS = -nologo -MT -O2 -DUNICODE -D_UNICODE
    38     38   BCC    = $(CC) $(CFLAGS)
    39     39   TCC    = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
    40     40   LIBS   = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
    41     41   LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
    42     42   
    43     43   SQLITE_OPTIONS = /DSQLITE_OMIT_LOAD_EXTENSION=1 /DSQLITE_THREADSAFE=0 /DSQLITE_DEFAULT_FILE_FORMAT=4 /DSQLITE_ENABLE_STAT3 /Dlocaltime=fossil_localtime /DSQLITE_ENABLE_LOCKING_STYLE=0
    44     44