2 #include "GlobalFunctions.h"
5 #include "CharacterHelper.h"
8 BOOL
GetMMXAvailable ( void ) // 適当
17 extern "C" BOOL GetMMXAvailable(void)
19 #ifdef ENABLE_ASSEMBLY
21 unsigned long nRegisterEDX;
27 __asm mov nRegisterEDX, edx
34 if (nRegisterEDX & 0x800000)
35 RETURN_ON_EXCEPTION(__asm emms, FALSE)
46 #endif // #ifndef __GNUC_IA32__
49 int ReadSafe(CIO
* pIO
, void * pBuffer
, int nBytes
)
51 unsigned int nBytesRead
= 0;
52 int nRetVal
= pIO
->Read(pBuffer
, nBytes
, &nBytesRead
);
53 if (nRetVal
== ERROR_SUCCESS
)
55 if (nBytes
!= int(nBytesRead
))
56 nRetVal
= ERROR_IO_READ
;
62 int WriteSafe(CIO
* pIO
, void * pBuffer
, int nBytes
)
64 unsigned int nBytesWritten
= 0;
65 int nRetVal
= pIO
->Write(pBuffer
, nBytes
, &nBytesWritten
);
66 if (nRetVal
== ERROR_SUCCESS
)
68 if (nBytes
!= int(nBytesWritten
))
69 nRetVal
= ERROR_IO_WRITE
;
75 BOOL
FileExists(wchar_t * pFilename
)
77 if (0 == wcscmp(pFilename
, "-") || 0 == wcscmp(pFilename
, "/dev/stdin"))
85 HANDLE hFind
= FindFirstFile(pFilename
, &WFD
);
86 if (hFind
!= INVALID_HANDLE_VALUE
)
96 CSmartPtr
<char> spANSI(GetANSIFromUTF16(pFilename
), TRUE
);
100 if (stat(spANSI
, &b
) != 0)
103 if (!S_ISREG(b
.st_mode
))