[ttssh2-commit] [9994] コンパイラ警告対応

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 6月 11日 (土) 00:20:04 JST


Revision: 9994
          https://osdn.net/projects/ttssh2/scm/svn/commits/9994
Author:   zmatsuo
Date:     2022-06-11 00:20:03 +0900 (Sat, 11 Jun 2022)
Log Message:
-----------
コンパイラ警告対応

- warning C4996: 'localtime': This function or variable may be unsafe. Consider using localtime_s instead.
- localtime() を localtime_s() に置きかえた

Modified Paths:
--------------
    trunk/teraterm/teraterm/addsetting.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2022-06-10 15:19:51 UTC (rev 9993)
+++ trunk/teraterm/teraterm/addsetting.cpp	2022-06-10 15:20:03 UTC (rev 9994)
@@ -1500,7 +1500,7 @@
 {
 	char buf[80], buf2[80];
 	time_t time_local;
-	struct tm *tm_local;
+	struct tm tm_local;
 
 	// Viewlog Editor path (2005.1.29 yutaka)
 	GetDlgItemTextA(IDC_VIEWLOG_EDITOR, ts.ViewlogEditor, _countof(ts.ViewlogEditor));
@@ -1519,9 +1519,9 @@
 
 	// \x8C\xBB\x8Dݎ\x9E\x8D\x8F\x82\xF0\x8E擾
 	time(&time_local);
-	tm_local = localtime(&time_local);
+	localtime_s(&tm_local, & time_local);
 	// \x8E\x9E\x8D\x8F\x95\xB6\x8E\x9A\x97\xF1\x82ɕϊ\xB7
-	if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, tm_local) == 0) {
+	if (strlen(buf) != 0 && strftime(buf2, sizeof(buf2), buf, &tm_local) == 0) {
 		static const TTMessageBoxInfoW info = {
 			"Tera Term",
 			"MSG_ERROR", L"ERROR",


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