[ttssh2-commit] [9463] コンパイラの警告対策

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 10月 14日 (木) 23:51:10 JST


Revision: 9463
          https://osdn.net/projects/ttssh2/scm/svn/commits/9463
Author:   zmatsuo
Date:     2021-10-14 23:51:10 +0900 (Thu, 14 Oct 2021)
Log Message:
-----------
コンパイラの警告対策

- cast size_t -> int
- replace strdup() -> _strdup()
- 'code_page' may be used uninitialized in this function (ttcmn.c)

Modified Paths:
--------------
    trunk/teraterm/common/codeconv.cpp
    trunk/teraterm/common/dlglib_tmpl.cpp
    trunk/teraterm/teraterm/ttdebug.cpp
    trunk/teraterm/ttpcmn/ttcmn.c

-------------- next part --------------
Modified: trunk/teraterm/common/codeconv.cpp
===================================================================
--- trunk/teraterm/common/codeconv.cpp	2021-10-09 15:39:06 UTC (rev 9462)
+++ trunk/teraterm/common/codeconv.cpp	2021-10-14 14:51:10 UTC (rev 9463)
@@ -1037,7 +1037,7 @@
 void WideCharToACP_t(const wchar_t *wstr_ptr, char *mb_ptr, size_t mb_len)
 {
 	const DWORD flags = 0;
-	size_t out_len = WideCharToMultiByte(CP_ACP, flags, wstr_ptr, -1, mb_ptr, mb_len, NULL, NULL);
+	size_t out_len = WideCharToMultiByte(CP_ACP, flags, wstr_ptr, -1, mb_ptr, (int)mb_len, NULL, NULL);
 	if (out_len == 0) {
 		// \x95ϊ\xB7\x8E\xB8\x94s
 		DWORD err = GetLastError();
@@ -1069,7 +1069,7 @@
 {
 	size_t out_len = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS,
 										 str_ptr, -1,
-										 wstr_ptr, wstr_len);
+										 wstr_ptr, (int)wstr_len);
 	if (out_len == wstr_len) {
 		wstr_ptr[wstr_len-1] = 0;
 	}

Modified: trunk/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- trunk/teraterm/common/dlglib_tmpl.cpp	2021-10-09 15:39:06 UTC (rev 9462)
+++ trunk/teraterm/common/dlglib_tmpl.cpp	2021-10-14 14:51:10 UTC (rev 9463)
@@ -390,7 +390,7 @@
 	} else {
 		// copy with replacing font
 		int size_namediff =
-			wcslen(FontFaceName) - wcslen(logfont.lfFaceName);
+			(int)wcslen(FontFaceName) - (int)wcslen(logfont.lfFaceName);
 		size_namediff *= sizeof(WCHAR);
 		size_namediff += 3;		// \x83e\x83L\x83X\x83g\x81A\x83t\x83H\x83\x93\x83g\x96\xBC\x92\xB7\x82\xC5align\x82\xAA\x95ω\xBB\x82\xB7\x82\xE9
 		size_t new_size_forcast = prev_size + size_namediff;

Modified: trunk/teraterm/teraterm/ttdebug.cpp
===================================================================
--- trunk/teraterm/teraterm/ttdebug.cpp	2021-10-09 15:39:06 UTC (rev 9462)
+++ trunk/teraterm/teraterm/ttdebug.cpp	2021-10-14 14:51:10 UTC (rev 9463)
@@ -265,10 +265,10 @@
 	char *version;
 	asprintf(&version, "r%04d", SVNVERSION);
 #else
-	char *version = strdup("unknown");
+	char *version = _strdup("unknown");
 #endif
 	wchar_t *dump_file;
-	aswprintf(&dump_file, L"%s\\teraterm_%hs_%04d%02d%02d-%02d%02d%02d.dmp",
+	aswprintf(&dump_file, L"%s\\teraterm_%hs_%04u%02u%02u-%02u%02u%02u.dmp",
 			  desktop, version,
 			  local_time.wYear, local_time.wMonth, local_time.wDay,
 			  local_time.wHour, local_time.wMinute, local_time.wSecond);

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2021-10-09 15:39:06 UTC (rev 9462)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2021-10-14 14:51:10 UTC (rev 9463)
@@ -1213,6 +1213,7 @@
 				break;
 			default:
 				assert(FALSE);
+				code_page = 936;
 				break;
 			}
 		}


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