[ttssh2-commit] [10482] 不要な値範囲チェックを削除

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2023年 1月 14日 (土) 11:01:39 JST


Revision: 10482
          https://osdn.net/projects/ttssh2/scm/svn/commits/10482
Author:   zmatsuo
Date:     2023-01-14 11:01:39 +0900 (Sat, 14 Jan 2023)
Log Message:
-----------
不要な値範囲チェックを削除

- wchar_t の値の範囲は0以上(0...65535)
- warning: comparison is always true due to limited range of data type
- 警告: データ型の範囲制限によって、比較が常に true となります

Modified Paths:
--------------
    trunk/teraterm/common/ttlib_static_cpp.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib_static_cpp.cpp
===================================================================
--- trunk/teraterm/common/ttlib_static_cpp.cpp	2023-01-14 01:57:04 UTC (rev 10481)
+++ trunk/teraterm/common/ttlib_static_cpp.cpp	2023-01-14 02:01:39 UTC (rev 10482)
@@ -1674,7 +1674,7 @@
 
 	len = wcslen(FName);
 	for (i=0; i<len; i++) {
-		if ((FName[i] >= 0 && FName[i] < ' ') || wcschr(invalidFileNameCharsW, FName[i])) {
+		if ((FName[i] < ' ') || wcschr(invalidFileNameCharsW, FName[i])) {
 			return TRUE;
 		}
 	}
@@ -1697,12 +1697,12 @@
 	len = wcslen(FName);
 	dest = (wchar_t *)malloc(sizeof(wchar_t) * (len + 1));
 
-	if ((c >= 0 && c < ' ') || wcschr(invalidFileNameCharsW, c)) {
+	if ((c < ' ') || wcschr(invalidFileNameCharsW, c)) {
 		c = 0;
 	}
 
 	for (i = 0; i < len; i++) {
-		if ((FName[i] >= 0 && FName[i] < ' ') || wcschr(invalidFileNameCharsW, FName[i])) {
+		if ((FName[i] < ' ') || wcschr(invalidFileNameCharsW, FName[i])) {
 			if (c) {
 				dest[j++] = c;
 			}


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