Changes On Branch win95-unicows
Not logged in

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

Changes In Branch win95-unicows Excluding Merge-Ins

This is equivalent to a diff from 71d46aba2e to 9cf5056af9

2012-09-18
00:03
Fix the <base> tag in the default header. check-in: eb1513b7a9 user: drh tags: trunk
2012-09-17
07:34
fix [ce73fc2173] Restore Win9x, using unicows eliminate all #ifdef UNICODE Closed-Leaf check-in: 9cf5056af9 user: jan.nijtmans tags: win95-unicows
2012-09-13
07:17
merge trunk check-in: 0930ed2085 user: jan.nijtmans tags: restore-win95
07:12
re-enable unicode commandline for MSVC build (previous commit accidently removed that) New version of dirent.h, which supports both MBCS and UNICODE check-in: 71d46aba2e user: jan.nijtmans tags: trunk
2012-09-11
18:49
enable unicode commandline for MinGW/MinGW-w64 as well remove unused MINGW_BROKEN_MAINARGS check-in: 274d8a1dcd user: jan.nijtmans tags: trunk

Changes to src/file.c.

  1123   1123   ** to a file, -1 is returned and nothing is written
  1124   1124   ** to the console.
  1125   1125   */
  1126   1126   int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
  1127   1127   #ifdef _WIN32
  1128   1128     int nChar;
  1129   1129     wchar_t *zUnicode; /* Unicode version of zUtf8 */
  1130         -#ifdef UNICODE
  1131   1130     DWORD dummy;
  1132         -#else
  1133         -  char *zConsole;    /* Console version of zUtf8 */
  1134         -  int codepage;      /* Console code page */
  1135         -#endif
  1136   1131   
  1137   1132     static int istty[2] = { -1, -1 };
  1138   1133     if( istty[toStdErr] == -1 ){
  1139   1134       istty[toStdErr] = _isatty(toStdErr + 1) != 0;
  1140   1135     }
  1141   1136     if( !istty[toStdErr] ){
  1142   1137       /* stdout/stderr is not a console. */
................................................................................
  1150   1145     }
  1151   1146     nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
  1152   1147     if( nChar==0 ){
  1153   1148       free(zUnicode);
  1154   1149       return 0;
  1155   1150     }
  1156   1151     zUnicode[nChar] = '\0';
  1157         -#ifdef UNICODE
  1158   1152     WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
  1159         -#else /* !UNICODE */
  1160         -  codepage = GetConsoleCP();
  1161         -  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, 0, 0, 0, 0);
  1162         -  zConsole = malloc( nByte + 1);
  1163         -  if( zConsole==0 ){
  1164         -    free(zUnicode);
  1165         -    return 0;
  1166         -  }
  1167         -  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, zConsole, nByte, 0, 0);
  1168         -  zConsole[nByte] = '\0';
  1169         -  free(zUnicode);
  1170         -  if( nByte == 0 ){
  1171         -    free(zConsole);
  1172         -    zConsole = 0;
  1173         -    return 0;
  1174         -  }
  1175         -  fwrite(zConsole, 1, nByte, toStdErr ? stderr : stdout);
  1176         -  fflush(toStdErr ? stderr : stdout);
  1177         -#endif /* UNICODE */
  1178   1153     return nChar;
  1179   1154   #else
  1180   1155     return -1;  /* No-op on unix */
  1181   1156   #endif
  1182   1157   }
  1183   1158   
  1184   1159   /*

Changes to src/main.c.

   195    195     const char *azAuxName[MX_AUX]; /* Name of each aux() or option() value */
   196    196     char *azAuxParam[MX_AUX];      /* Param of each aux() or option() value */
   197    197     const char *azAuxVal[MX_AUX];  /* Value of each aux() or option() value */
   198    198     const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
   199    199     int anAuxCols[MX_AUX];         /* Number of columns for option() values */
   200    200   
   201    201     int allowSymlinks;             /* Cached "allow-symlinks" option */
          202  +#ifdef _WIN32
          203  +  int isNT;
          204  +#endif
   202    205   
   203    206   #ifdef FOSSIL_ENABLE_JSON
   204    207     struct FossilJsonBits {
   205    208       int isJsonMode;            /* True if running in JSON mode, else
   206    209                                     false. This changes how errors are
   207    210                                     reported. In JSON mode we try to
   208    211                                     always output JSON-form error
................................................................................
   468    471     int n;                    /* Number of bytes in one line */
   469    472     char *z;                  /* General use string pointer */
   470    473     char **newArgv;           /* New expanded g.argv under construction */
   471    474     char const * zFileName;   /* input file name */
   472    475     FILE * zInFile;           /* input FILE */
   473    476     int foundBom = -1;        /* -1= not searched yet, 0 = no; 1=yes */
   474    477   #ifdef _WIN32
   475         -  wchar_t buf[MAX_PATH];
          478  +  TCHAR buf[MAX_PATH];
   476    479   #endif
   477    480   
   478    481     g.argc = argc;
   479    482     g.argv = argv;
   480    483   #ifdef _WIN32
   481    484     parse_windows_command_line(&g.argc, &g.argv);
   482         -  GetModuleFileNameW(NULL, buf, MAX_PATH);
          485  +  GetModuleFileName(NULL, buf, MAX_PATH);
   483    486     g.argv[0] = fossil_unicode_to_utf8(buf);
   484         -#ifdef UNICODE
   485    487     for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
   486         -#else
   487         -  for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
   488         -#endif
   489    488   #endif
   490    489     for(i=1; i<g.argc-1; i++){
   491    490       z = g.argv[i];
   492    491       if( z[0]!='-' ) continue;
   493    492       z++;
   494    493       if( z[0]=='-' ) z++;
   495    494       if( z[0]==0 ) return;   /* Stop searching at "--" */
................................................................................
   555    554   ** This procedure runs first.
   556    555   */
   557    556   int main(int argc, char **argv)
   558    557   {
   559    558     const char *zCmdName = "unknown";
   560    559     int idx;
   561    560     int rc;
          561  +#ifdef _WIN32
          562  +  OSVERSIONINFOA sInfo;
          563  +#endif
   562    564   
   563    565     sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
   564    566     memset(&g, 0, sizeof(g));
          567  +#ifdef _WIN32
          568  +  sInfo.dwOSVersionInfoSize = sizeof(sInfo);
          569  +  GetVersionExA(&sInfo);
          570  +  g.isNT = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT;
          571  +#endif
   565    572     g.now = time(0);
   566    573   #ifdef FOSSIL_ENABLE_JSON
   567    574   #if defined(NDEBUG)
   568    575     g.json.errorDetailParanoia = 2 /* FIXME: make configurable
   569    576                                       One problem we have here is that this
   570    577                                       code is needed before the db is opened,
   571    578                                       so we can't sql for it.*/;
................................................................................
   832    839   */
   833    840   int fossil_system(const char *zOrigCmd){
   834    841     int rc;
   835    842   #if defined(_WIN32)
   836    843     /* On windows, we have to put double-quotes around the entire command.
   837    844     ** Who knows why - this is just the way windows works.
   838    845     */
   839         -  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
   840         -  wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
          846  +  char *zNewCmd;
          847  +  TCHAR *zUnicode;
          848  +
          849  +  if (g.isNT) {
          850  +    zNewCmd = mprintf("\"%s\"", zOrigCmd);
          851  +  } else {
          852  +    zNewCmd = mprintf("%s", zOrigCmd);
          853  +  }
          854  +  zUnicode = fossil_utf8_to_unicode(zNewCmd);
   841    855     if( g.fSystemTrace ) {
   842    856       char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
   843    857       fossil_puts(zOut, 1);
   844    858       fossil_free(zOut);
   845    859     }
   846         -  rc = _wsystem(zUnicode);
          860  +  rc = _tsystem(zUnicode);
   847    861     fossil_mbcs_free(zUnicode);
   848         -  free(zNewCmd);
          862  +  fossil_free(zNewCmd);
   849    863   #else
   850    864     /* On unix, evaluate the command directly.
   851    865     */
   852    866     if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
   853    867     rc = system(zOrigCmd);
   854    868   #endif
   855    869     return rc;

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         -
   139    134   /*
   140    135   ** Start a listening socket and process incoming HTTP requests on
   141    136   ** that socket.
   142    137   */
   143    138   void win32_http_server(
   144    139     int mnPort, int mxPort,   /* Range of allowed TCP port numbers */
   145    140     const char *zBrowser,     /* Command to launch browser.  (Or NULL) */
................................................................................
   559    554   **
   560    555   */
   561    556   void cmd_win32_service(void){
   562    557     int n;
   563    558     const char *zMethod;
   564    559     const char *zSvcName = "Fossil-DSCM";    /* Default service name */
   565    560   
          561  +#ifdef _WIN32
          562  +  if( !g.isNT ) {
          563  +    fossil_fatal("%s command not support on Windows 9x", g.argv[1]);
          564  +  }
          565  +#endif
   566    566     if( g.argc<3 ){
   567    567       usage("create|delete|show|start|stop ...");
   568    568     }
   569    569     zMethod = g.argv[2];
   570    570     n = strlen(zMethod);
   571    571   
   572    572     if( strncmp(zMethod, "create", n)==0 ){

Changes to win/Makefile.mingw.

   147    147   TCC += -DFOSSIL_ENABLE_JSON=1
   148    148   RCC += -DFOSSIL_ENABLE_JSON=1
   149    149   endif
   150    150   
   151    151   #### We add the -static option here so that we can build a static
   152    152   #    executable that will run in a chroot jail.
   153    153   #
   154         -LIB = -static
          154  +LIB = -municows -static
   155    155   
   156    156   # OpenSSL: Add the necessary libraries required, if enabled.
   157    157   ifdef FOSSIL_ENABLE_SSL
   158    158   LIB += -lssl -lcrypto -lgdi32
   159    159   endif
   160    160   
   161    161   # Tcl: Add the necessary libraries required, if enabled.