[o2on-svn] [31] FIX: CreateFileの戻り値がINVALID_HANDLE_VALUEの時に、

Back to archive index

o2on svn commit o2on-****@lists*****
2008年 2月 21日 (木) 00:09:08 JST


Revision: 31
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=o2on&view=rev&rev=31
Author:   laxmi
Date:     2008-02-21 00:09:08 +0900 (Thu, 21 Feb 2008)

Log Message:
-----------
FIX:CreateFileの戻り値がINVALID_HANDLE_VALUEの時に、
デストラクタでCloseHandleを呼び出してしまう

Modified Paths:
--------------
    trunk/o2on/src.o2on/file.h

Modified: trunk/o2on/src.o2on/file.h
===================================================================
--- trunk/o2on/src.o2on/file.h	2008-02-17 16:03:59 UTC (rev 30)
+++ trunk/o2on/src.o2on/file.h	2008-02-20 15:09:08 UTC (rev 31)
@@ -37,7 +37,7 @@
 
 public:
 	File(void)
-		: hFile(NULL)
+		: hFile(INVALID_HANDLE_VALUE)
 	{
 	}
 
@@ -170,9 +170,9 @@
 
 	void close(void)
 	{
-		if (hFile) {
+		if (hFile != INVALID_HANDLE_VALUE) {
 			CloseHandle(hFile);
-			hFile = NULL;
+			hFile = INVALID_HANDLE_VALUE;
 		}
 	}
 
@@ -208,7 +208,7 @@
 
 public:
 	MappedFile(void)
-		: hFile(NULL)
+		: hFile(INVALID_HANDLE_VALUE)
 		, hMap(NULL)
 		, addrP(NULL)
 		, ov(NULL)
@@ -313,9 +313,9 @@
 			delete ov;
 			ov = NULL;
 		}
-		if (hFile) {
+		if (hFile != INVALID_HANDLE_VALUE) {
 			CloseHandle(hFile);
-			hFile = NULL;
+			hFile = INVALID_HANDLE_VALUE;
 		}
 	}
 




o2on-svn メーリングリストの案内
Back to archive index