[Ttssh2-commit] [8011] codeconv の const を削除

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 23日 (金) 23:13:45 JST


Revision: 8011
          https://osdn.net/projects/ttssh2/scm/svn/commits/8011
Author:   zmatsuo
Date:     2019-08-23 23:13:45 +0900 (Fri, 23 Aug 2019)
Log Message:
-----------
codeconv の const を削除

Modified Paths:
--------------
    branches/unicode_buf/teraterm/common/codeconv.cpp
    branches/unicode_buf/teraterm/common/codeconv.h

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/common/codeconv.cpp
===================================================================
--- branches/unicode_buf/teraterm/common/codeconv.cpp	2019-08-23 14:13:15 UTC (rev 8010)
+++ branches/unicode_buf/teraterm/common/codeconv.cpp	2019-08-23 14:13:45 UTC (rev 8011)
@@ -617,7 +617,7 @@
 			return 0;
 		}
 		use_default_char = FALSE;
-		mb_len = ::WideCharToMultiByte(code_page, 0, u16_str, u16_len, mb_ptr, mb_len, NULL, &use_default_char);
+		mb_len = ::WideCharToMultiByte(code_page, 0, u16_str, (int)u16_len, mb_ptr, (int)mb_len, NULL, &use_default_char);
 		if (use_default_char) {
 			// \x95ϊ\xB7\x82ł\xAB\x82\xB8\x81A\x8A\xF9\x92\xE8\x82̕\xB6\x8E\x9A\x82\xF0\x8Eg\x82\xC1\x82\xBD
 			return 0;
@@ -826,7 +826,7 @@
 	if (wstr_len == 0) {
 		wstr_len = wcslen(wstr_ptr) + 1;
 	}
-    int len;
+    size_t len;
 	if (code_page == CP_UTF8 || code_page == 932) {
 		size_t wl = wstr_len;
 		size_t ml;
@@ -853,7 +853,7 @@
 	} else {
 		len = ::WideCharToMultiByte(code_page, flags,
 									wstr_ptr, (DWORD)wstr_len,
-									mb_ptr, len,
+									mb_ptr, (int)len,
 									NULL,NULL);
 	}
 	if (len == 0) {
@@ -928,58 +928,58 @@
 	return wstr_ptr;
 }
 
-const char *ToCharW(const wchar_t *strW)
+char *ToCharW(const wchar_t *strW)
 {
-	const char *strA = _WideCharToMultiByte(strW, 0, CP_ACP, NULL);
+	char *strA = _WideCharToMultiByte(strW, 0, CP_ACP, NULL);
 	return strA;
 }
 
-const char *ToCharA(const char *strA)
+char *ToCharA(const char *strA)
 {
 	return _strdup(strA);
 }
 
-const char *ToCharU8(const char *strU8)
+char *ToCharU8(const char *strU8)
 {
-	const wchar_t *strW = _MultiByteToWideChar(strU8, 0, CP_UTF8, NULL);
+	wchar_t *strW = _MultiByteToWideChar(strU8, 0, CP_UTF8, NULL);
 	if (strW == NULL) {
 		return NULL;
 	}
-	const char *strA = _WideCharToMultiByte(strW, 0, CP_ACP, NULL);
+	char *strA = _WideCharToMultiByte(strW, 0, CP_ACP, NULL);
 	free((void *)strW);
 	return strA;
 }
 
-const wchar_t *ToWcharA(const char *strA)
+wchar_t *ToWcharA(const char *strA)
 {
 	wchar_t *strW = _MultiByteToWideChar(strA, 0, CP_ACP, NULL);
 	return strW;
 }
 
-const wchar_t *ToWcharW(const wchar_t *strW)
+wchar_t *ToWcharW(const wchar_t *strW)
 {
 	return _wcsdup(strW);
 }
 
-const wchar_t *ToWcharU8(const char *strU8)
+wchar_t *ToWcharU8(const char *strU8)
 {
-	const wchar_t *strW = _MultiByteToWideChar(strU8, 0, CP_UTF8, NULL);
+	wchar_t *strW = _MultiByteToWideChar(strU8, 0, CP_UTF8, NULL);
 	return strW;
 }
 
-const char *ToU8W(const wchar_t *strW)
+char *ToU8W(const wchar_t *strW)
 {
-	const char *strU8 = _WideCharToMultiByte(strW, 0, CP_UTF8, NULL);
+	char *strU8 = _WideCharToMultiByte(strW, 0, CP_UTF8, NULL);
 	return strU8;
 }
 
-const char *ToU8A(const char *strA)
+char *ToU8A(const char *strA)
 {
 	const wchar_t *strW = _MultiByteToWideChar(strA, 0, CP_ACP, NULL);
 	if (strW == NULL) {
 		return NULL;
 	}
-	const char *strU8 = _WideCharToMultiByte(strW, 0, CP_UTF8, NULL);
+	char *strU8 = _WideCharToMultiByte(strW, 0, CP_UTF8, NULL);
 	free((void *)strW);
 	return strU8;
 }

Modified: branches/unicode_buf/teraterm/common/codeconv.h
===================================================================
--- branches/unicode_buf/teraterm/common/codeconv.h	2019-08-23 14:13:15 UTC (rev 8010)
+++ branches/unicode_buf/teraterm/common/codeconv.h	2019-08-23 14:13:45 UTC (rev 8011)
@@ -61,14 +61,14 @@
 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);
-const wchar_t *ToWcharA(const char *strA);
-const wchar_t *ToWcharW(const wchar_t *strW);
-const wchar_t *ToWcharU8(const char *strU8);
-const char *ToU8A(const char *strA);
-const char *ToU8W(const wchar_t *strW);
+char *ToCharA(const char *strA);
+char *ToCharW(const wchar_t *strW);
+char *ToCharU8(const char *strU8);
+wchar_t *ToWcharA(const char *strA);
+wchar_t *ToWcharW(const wchar_t *strW);
+wchar_t *ToWcharU8(const char *strU8);
+char *ToU8A(const char *strA);
+char *ToU8W(const wchar_t *strW);
 
 #if defined(_UNICODE)
 #define ToTcharA(s)		ToWcharA(s)


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