[Ttssh2-commit] [7400] Merge branch 'trunk' r7399 into cmake

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 1月 19日 (土) 17:22:07 JST


Revision: 7400
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7400
Author:   zmatsuo
Date:     2019-01-19 17:22:07 +0900 (Sat, 19 Jan 2019)
Log Message:
-----------
Merge branch 'trunk' r7399 into cmake

Revision Links:
--------------
    http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7399

Modified Paths:
--------------
    branches/cmake/teraterm/common/codeconv.cpp
    branches/cmake/teraterm/common/codeconv.h
    branches/cmake/teraterm/teraterm/vtdisp.c
    branches/cmake/teraterm/teraterm/vtterm.c
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/ttpcmn/language.c
    branches/cmake/teraterm/ttpcmn/ttpcmn.v10.vcxproj
    branches/cmake/teraterm/ttpcmn/ttpcmn.v11.vcxproj
    branches/cmake/teraterm/ttpcmn/ttpcmn.v12.vcxproj
    branches/cmake/teraterm/ttpcmn/ttpcmn.v14.vcxproj
    branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj
    branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj.filters
    branches/cmake/teraterm/ttpcmn/ttpcmn.v9.vcproj

-------------- next part --------------
Modified: branches/cmake/teraterm/common/codeconv.cpp
===================================================================
--- branches/cmake/teraterm/common/codeconv.cpp	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/common/codeconv.cpp	2019-01-19 08:22:07 UTC (rev 7400)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 TeraTerm Project
+ * Copyright (C) 2018-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,11 @@
 #define free(p)       _free_dbg((p), _NORMAL_BLOCK)
 #endif
 
+int CP932ToWideChar(const char *cp932_ptr, int cp932_len, wchar_t *wstr_ptr, int wstr_len)
+{
+	return MultiByteToWideChar(932, 0, cp932_ptr, cp932_len, wstr_ptr, wstr_len);
+}
+
 /**
  *	wchar_t\x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x83}\x83\x8B\x83`\x83o\x83C\x83g\x95\xB6\x8E\x9A\x97\xF1\x82֕ϊ\xB7
  *	@param[in]	*wstr_ptr	wchar_t\x95\xB6\x8E\x9A\x97\xF1

Modified: branches/cmake/teraterm/common/codeconv.h
===================================================================
--- branches/cmake/teraterm/common/codeconv.h	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/common/codeconv.h	2019-01-19 08:22:07 UTC (rev 7400)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 TeraTerm Project
+ * Copyright (C) 2018-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,9 +34,15 @@
 extern "C" {
 #endif
 
+// MultiByteToWideChar() wrappers
+//	CP932(shift-jis) to wchar(UTF-16)
+int CP932ToWideChar(const char *cp932_ptr, int cp932_len, wchar_t *wstr_ptr, int wstr_len);
+
+// API wrappers
 char *_WideCharToMultiByte(const wchar_t *wstr_ptr, size_t wstr_len, int code_page, size_t *mb_len_);
 wchar_t *_MultiByteToWideChar(const char *str_ptr, size_t str_len, int code_page, size_t *w_len_);
 
+// convinience funcs  (for windows api params)
 const char *ToCharA(const char *strA);
 const char *ToCharW(const wchar_t *strW);
 const char *ToCharU8(const char *strU8);

Modified: branches/cmake/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.c	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/teraterm/vtdisp.c	2019-01-19 08:22:07 UTC (rev 7400)
@@ -2841,7 +2841,7 @@
 	Count = 6;
 #endif
 
-	setlocale(LC_ALL, ts.Locale);
+	setlocale(LC_ALL, ts.Locale);	// TODO \x83R\x81[\x83h\x95ϊ\xB7\x82\xB1\x82\xB1\x82ł\xB7\x82\xE9?,\x96\xB3\x8C\x{27B0B3}\x82ꂽ\x83R\x81[\x83h
 
 	ch = Buff[Count];
 	Buff[Count] = 0;

Modified: branches/cmake/teraterm/teraterm/vtterm.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtterm.c	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/teraterm/vtterm.c	2019-01-19 08:22:07 UTC (rev 7400)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -5524,10 +5524,7 @@
 
 	unsigned int code;
 	unsigned short cset;
-	char *locptr;
 
-	locptr = setlocale(LC_ALL, ts.Locale);
-
 	if (ts.FallbackToCP932 && Fallbacked) {
 		return ParseFirstJP(b);
 	}

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2019-01-19 08:22:07 UTC (rev 7400)
@@ -1884,7 +1884,6 @@
 static void EscapeFilename(const char *src, char *dest)
 {
 #define ESCAPE_CHARS	" ;&()$!`'[]{}#^~"
-	setlocale(LC_ALL, ts.Locale);
 	const char *s = src;
 	char *d = dest;
 	while (*s) {

Modified: branches/cmake/teraterm/ttpcmn/language.c
===================================================================
--- branches/cmake/teraterm/ttpcmn/language.c	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/language.c	2019-01-19 08:22:07 UTC (rev 7400)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2006-2017 TeraTerm Project
+ * (C) 2006-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
 #include <mbstring.h>
 #include <locale.h>
 
+#include "codeconv.h"
 #include "sjis2uni.map"
 
 #if !defined(DllExport)
@@ -81,19 +82,18 @@
 	unsigned int c, c1, c2, c3;
 	unsigned char *ptr, buf[3];
 	unsigned short cset;
+	unsigned char KCode_h;
 	int len = 0;
 
 	*byte = 2;
 
 	// CP932\x82\xA9\x82\xE7UTF-16LE\x82֕ϊ\xB7\x82\xB7\x82\xE9
-	setlocale(LC_ALL, locale);
-
-	buf[0] = KCode >> 8;
-	if (buf[0] > 0) {
-		len++;
+	KCode_h = (unsigned char)(KCode >> 8);
+	if (KCode_h != 0) {
+		buf[len++] = KCode_h;
 	}
 	buf[len++] = KCode & 0xff;
-	ret = mbtowc(&wchar, buf, len);
+	ret = CP932ToWideChar(buf, len, &wchar, 1);
 	if (ret <= 0) { // \x95ϊ\xB7\x8E\xB8\x94s
 		cset = 0;
 		if (_stricmp(locale, DEFAULT_LOCALE) == 0) {

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v10.vcxproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v10.vcxproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v10.vcxproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -122,6 +122,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\codeconv.cpp" />
     <ClCompile Include="..\common\i18n.c" />
     <ClCompile Include="language.c" />
     <ClCompile Include="..\common\servicenames.c" />

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v11.vcxproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v11.vcxproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v11.vcxproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -128,6 +128,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\codeconv.cpp" />
     <ClCompile Include="..\common\i18n.c" />
     <ClCompile Include="language.c" />
     <ClCompile Include="..\common\servicenames.c" />

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v12.vcxproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v12.vcxproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v12.vcxproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -128,6 +128,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\codeconv.cpp" />
     <ClCompile Include="..\common\i18n.c" />
     <ClCompile Include="..\common\ttlib.c" />
     <ClCompile Include="language.c" />

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v14.vcxproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v14.vcxproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v14.vcxproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -128,6 +128,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\codeconv.cpp" />
     <ClCompile Include="..\common\i18n.c" />
     <ClCompile Include="..\common\ttlib.c" />
     <ClCompile Include="language.c" />

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -131,6 +131,7 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\codeconv.cpp" />
     <ClCompile Include="..\common\i18n.c" />
     <ClCompile Include="..\common\ttlib.c" />
     <ClCompile Include="language.c" />

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj.filters
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj.filters	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v15.vcxproj.filters	2019-01-19 08:22:07 UTC (rev 7400)
@@ -34,6 +34,9 @@
     <ClCompile Include="..\common\ttlib.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\common\codeconv.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="cmn_res.h">
@@ -65,4 +68,4 @@
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file

Modified: branches/cmake/teraterm/ttpcmn/ttpcmn.v9.vcproj
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttpcmn.v9.vcproj	2019-01-19 08:18:37 UTC (rev 7399)
+++ branches/cmake/teraterm/ttpcmn/ttpcmn.v9.vcproj	2019-01-19 08:22:07 UTC (rev 7400)
@@ -206,6 +206,10 @@
 			Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
 			>
 			<File
+				RelativePath="..\common\codeconv.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\common\i18n.c"
 				>
 			</File>


Ttssh2-commit メーリングリストの案内
Back to archive index