[Ttssh2-commit] [7650] GetFileAttributes()の戻値を-1などの直値ではなく INVALID_FILE_ATTRIBUTES と比較するようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 5月 6日 (月) 23:13:54 JST


Revision: 7650
          https://osdn.net/projects/ttssh2/scm/svn/commits/7650
Author:   zmatsuo
Date:     2019-05-06 23:13:54 +0900 (Mon, 06 May 2019)
Log Message:
-----------
GetFileAttributes()の戻値を-1などの直値ではなく INVALID_FILE_ATTRIBUTES と比較するようにした

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpfile/ttfile.c
    trunk/ttpmenu/registry.cpp
    trunk/ttpmenu/ttpmenu.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2019-05-06 13:42:01 UTC (rev 7649)
+++ trunk/teraterm/common/ttlib.c	2019-05-06 14:13:54 UTC (rev 7650)
@@ -905,7 +905,7 @@
 	strncpy_s(MyDocSetupFName, sizeof(MyDocSetupFName), MyDoc, _TRUNCATE);
 	AppendSlash(MyDocSetupFName,sizeof(MyDocSetupFName));
 	strncat_s(MyDocSetupFName, sizeof(MyDocSetupFName), file, _TRUNCATE);
-	if (GetFileAttributes(MyDocSetupFName) != -1) {
+	if (GetFileAttributes(MyDocSetupFName) != INVALID_FILE_ATTRIBUTES) {
 		strncpy_s(dest, destlen, MyDocSetupFName, _TRUNCATE);
 		return;
 	}

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-05-06 13:42:01 UTC (rev 7649)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-05-06 14:13:54 UTC (rev 7650)
@@ -2169,7 +2169,7 @@
 	for (int i = 0; i < DropListCount; i++) {
 		const char *FileName = DropLists[i];
 		const DWORD attr = GetFileAttributes(FileName);
-		if (attr == (DWORD)-1 ) {
+		if (attr == INVALID_FILE_ATTRIBUTES) {
 			FileCount++;
 		} else if (attr & FILE_ATTRIBUTE_DIRECTORY) {
 			DirectoryCount++;

Modified: trunk/teraterm/ttpfile/ttfile.c
===================================================================
--- trunk/teraterm/ttpfile/ttfile.c	2019-05-06 13:42:01 UTC (rev 7649)
+++ trunk/teraterm/ttpfile/ttfile.c	2019-05-06 14:13:54 UTC (rev 7650)
@@ -505,7 +505,7 @@
 	if (FuncId == GTF_LOG) {
 		DWORD logdir = GetFileAttributes(fv->LogDefaultPath);
 		// \x83\x8D\x83O\x95ۑ\xB6\x82̏ꍇ\x82͏\x89\x8A\xFA\x83t\x83H\x83\x8B\x83_\x82\xF0\x8C\x88\x82ߑł\xBF\x82\xB5\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B(2007.8.24 yutaka)
-		if (logdir != -1 && logdir & FILE_ATTRIBUTE_DIRECTORY) {
+		if (logdir != INVALID_FILE_ATTRIBUTES && logdir & FILE_ATTRIBUTE_DIRECTORY) {
 			// LogDefaultPath\x82\xAA\x91\xB6\x8D݂\xB7\x82\xE9\x82Ȃ\xE7\x81A\x82\xBB\x82\xB1\x82\xF0\x8F\x89\x8A\xFA\x83t\x83H\x83\x8B\x83_\x82ɂ\xB7\x82\xE9\x81B(2007.11.30 maya)
 			ofn.lpstrInitialDir = fv->LogDefaultPath;
 		}

Modified: trunk/ttpmenu/registry.cpp
===================================================================
--- trunk/ttpmenu/registry.cpp	2019-05-06 13:42:01 UTC (rev 7649)
+++ trunk/ttpmenu/registry.cpp	2019-05-06 14:13:54 UTC (rev 7650)
@@ -46,7 +46,7 @@
 void checkIniFile()
 {
 	DWORD dwAttr = ::GetFileAttributes(getModuleName());
-	bUseINI = dwAttr != 0xFFFFFFFF;
+	bUseINI = dwAttr != INVALID_FILE_ATTRIBUTES;
 }
 
 /* ==========================================================================

Modified: trunk/ttpmenu/ttpmenu.cpp
===================================================================
--- trunk/ttpmenu/ttpmenu.cpp	2019-05-06 13:42:01 UTC (rev 7649)
+++ trunk/ttpmenu/ttpmenu.cpp	2019-05-06 14:13:54 UTC (rev 7650)
@@ -1769,7 +1769,7 @@
 	GetModuleFileName(NULL, modulePath, sizeof(modulePath));
 	ExtractDirName(modulePath, modulePath);
 	SetCurrentDirectory(modulePath);
-	if (::GetFileAttributes(g_JobInfo.szTeraTerm) == 0xFFFFFFFF) {
+	if (::GetFileAttributes(g_JobInfo.szTeraTerm) == INVALID_FILE_ATTRIBUTES) {
 		dwErr = ::GetLastError();
 		if (dwErr == ERROR_FILE_NOT_FOUND || dwErr == ERROR_PATH_NOT_FOUND) {
 			UTIL_get_lang_msg("MSG_ERROR_CHECKFILE", uimsg, sizeof(uimsg),


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