]> www.wagner.pp.ru Git - oss/less.git/commitdiff
Removed code page operation. Fix GLOB macros for 64-bit win32. Fixed debug flags... master
authorVictor Wagner <vitus@wagner.pp.ru>
Wed, 3 Aug 2016 14:42:58 +0000 (17:42 +0300)
committerVictor Wagner <vitus@wagner.pp.ru>
Wed, 3 Aug 2016 14:42:58 +0000 (17:42 +0300)
Makefile.wnm
charset.c
lglob.h
main.c
screen.c

index cd84a3b8bce2e2d19d8d88bbffa9c7866219927a..8a6ddb4c93260180706fb12506644c1e6faaffb4 100644 (file)
@@ -16,7 +16,7 @@ CFLAGS = /nologo /MD /W3 /EHsc /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /
 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:$(ARCH)
 
 # Debugging flags
-#CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+#CFLAGS = /nologo /MDd /W3 /EHsc /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
 #LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:$(ARCH)
 
 LD = link
index 69b035f1d4a736f667470c43eef4dee57e2434e9..b427c49f580a16b45d3d61befd8d52ec4f6abc25 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -323,11 +323,6 @@ set_charset()
                return;
        }
 #ifdef WIN32
-       SetConsoleOutputCP(65001);
-    _setmode(_fileno(stdout),_O_U8TEXT);
-    _setmode(_fileno(stderr),_O_U8TEXT);
-       if (isatty(fileno(stdin))) 
-               _setmode(_fileno(stdin),_O_U8TEXT);
        icharset("UTF-8",0);
        
 #else 
diff --git a/lglob.h b/lglob.h
index 87b5fb45cc7c0a4362a28c0deab508c235d7fb58..6d68bc73cecc919745a1f52506ae12141beb720a 100644 (file)
--- a/lglob.h
+++ b/lglob.h
@@ -69,7 +69,7 @@
                                        char dir[_MAX_DIR];     \
                                        char fname[_MAX_FNAME]; \
                                        char ext[_MAX_EXT];     \
-                                       long handle;
+                                       intptr_t handle;
 
 #else
 #if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) /* Borland C for Windows */
diff --git a/main.c b/main.c
index e4f35b9ac72eb34b2c6557999b940c9927d78887..149999cd4b537fa1d2b38bb969c18c845305772a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -51,7 +51,6 @@ extern int    jump_sline;
 
 #ifdef WIN32
 static char consoleTitle[256];
-static int  savedConsoleCodePage;
 #endif
 
 extern int     less_is_more;
@@ -104,7 +103,6 @@ main(argc, argv)
                }
        }
        GetConsoleTitle(consoleTitle, sizeof(consoleTitle)/sizeof(char));
-       savedConsoleCodePage = GetConsoleOutputCP();    
 #endif /* WIN32 */
 
        /*
@@ -406,7 +404,6 @@ quit(status)
 #endif
 #ifdef WIN32
        SetConsoleTitle(consoleTitle);
-       SetConsoleOutputCP(savedConsoleCodePage);
 #endif
        close_getchr();
        exit(status);
index 8f8a433aff64f393d1ce93f365502b9e355db7ca..6cd4cb9f54f7f690ab31c507527df870f07c9f67 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -2490,7 +2490,13 @@ WIN32textout(text, len)
 {
 #if MSDOS_COMPILER==WIN32C
        DWORD written;
-       WriteConsole(con_out, text, len, &written, NULL);
+       wchar_t widebuf[1024];
+       wchar_t *wb=widebuf;
+       if (len >= 1024) 
+               wb = (wchar_t *) malloc(len*sizeof(wchar_t));
+       written=MultiByteToWideChar(CP_UTF8,0,text,len,wb,len>1024?len:1024);
+       WriteConsoleW(con_out, wb, written, &written, NULL);
+       if (wb != widebuf) free(wb);
 #else
        char c = text[len];
        text[len] = '\0';