To: vim-dev@vim.org Subject: Patch 5.6a.025 (extra) Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6a.025 (extra) Problem: Win32 GUI: The tables for toupper() and tolower() are initialized too late. (Mike Steed) Solution: Move the initialization to win32_init() and call it from main(). Files: src/main.c, src/os_w32.c, src/proto/os_w32.pro *** ../vim-5.6a.24/src/main.c Tue Jan 11 16:54:05 2000 --- src/main.c Thu Jan 13 22:58:37 2000 *************** *** 310,315 **** --- 310,319 ---- setlocale(LC_ALL, ""); /* for ctype() and the like */ #endif + #ifdef MSWIN + win32_init(); /* init toupper() and tolower() tables */ + #endif + #ifdef USE_GUI_MAC /* Macinthosh needs this before any memory is allocated. */ gui_prepare(&argc, argv); /* Prepare for possibly starting GUI sometime */ *** ../vim-5.6a.24/src/os_win32.c Mon Dec 20 09:59:14 1999 --- src/os_win32.c Thu Jan 13 22:49:23 2000 *************** *** 1474,1492 **** char **argv) { char temp[256]; - int i; /* store the name of the executable, may be used for $VIM */ GetModuleFileName(NULL, temp, 255); if (*temp != NUL) exe_name = FullName_save((char_u *)temp, FALSE); - /* Init the tables for toupper() and tolower() */ - for (i = 0; i < 256; ++i) - toupper_tab[i] = tolower_tab[i] = i; - CharUpperBuff(toupper_tab, 256); - CharLowerBuff(tolower_tab, 256); - #ifdef USE_GUI_WIN32 return OK; /* GUI always has a tty */ #else --- 1474,1485 ---- *************** *** 1496,1501 **** --- 1489,1508 ---- #endif } + /* + * Init the tables for toupper() and tolower(). + */ + void + win32_init(void) + { + int i; + + /* Init the tables for toupper() and tolower() */ + for (i = 0; i < 256; ++i) + toupper_tab[i] = tolower_tab[i] = i; + CharUpperBuff(toupper_tab, 256); + CharLowerBuff(tolower_tab, 256); + } /* * Return TRUE if the input comes from a terminal, FALSE otherwise. *** ../vim-5.6a.24/src/proto/os_win32.pro Mon Dec 20 09:58:57 1999 --- src/proto/os_win32.pro Thu Jan 13 22:59:24 2000 *************** *** 6,11 **** --- 6,12 ---- void mch_windinit __ARGS((void)); void mch_windexit __ARGS((int r)); int mch_check_win __ARGS((int argc, char **argv)); + void win32_init __ARGS((void)); int mch_input_isatty __ARGS((void)); void fname_case __ARGS((char_u *name)); void mch_settitle __ARGS((char_u *title, char_u *icon)); *** ../vim-5.6a.24/src/version.c Thu Jan 13 23:00:08 2000 --- src/version.c Thu Jan 13 22:59:39 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 25, /**/ -- hundred-and-one symptoms of being an internet addict: 154. You fondle your mouse. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /