win32: fix ansi build

This commit is contained in:
OV2 2013-01-31 14:04:30 +01:00
parent 58f28b2dde
commit c691b610e4
3 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,6 @@
#include "CXML.h"
#include <windows.h>
#include <stdio.h>
#include "_tfwopen.h"
#ifndef UNICODE
#define _tFromTCHAR(x) CPToWide(x,CP_ACP)

View File

@ -176,7 +176,6 @@
#ifdef UNICODE
#include <windows.h>
#include "_tfwopen.h"
@ -204,6 +203,8 @@ WideToCP::WideToCP(const wchar_t *wideChars, unsigned int cp) {
WideCharToMultiByte(cp,0,wideChars,-1,cpchars,requiredChars,NULL,NULL);
}
#ifdef UNICODE
extern "C" FILE *_tfwopen(const char *filename, const char *mode ) {
wchar_t mode_w[30];
lstrcpyn(mode_w,Utf8ToWide(mode),29);

View File

@ -175,11 +175,11 @@
***********************************************************************************/
#ifdef UNICODE
#ifndef _TFWOPEN_H
#define _TFWOPEN_H
#ifdef UNICODE
#include <stdio.h>
#ifdef __cplusplus
@ -194,8 +194,9 @@ int _twopen(const char *filename, int oflag, int pmode);
}
#endif
#endif // UNICODE
#ifdef __cplusplus
#include <fstream>
class Utf8ToWide {
private:
@ -233,6 +234,12 @@ public:
operator char *() { return cpchars; }
};
#endif // __cplusplus
#ifdef UNICODE
#ifdef __cplusplus
#include <fstream>
namespace std {
class u8nifstream: public std::ifstream
{
@ -283,6 +290,7 @@ __forceinline static int remove(const char *filename) {
__forceinline static int open(const char *filename, int oflag, int pmode) {
return _twopen(filename, oflag, pmode);
}
#endif // _TFWOPEN_H
#endif
#endif // UNICODE
#endif // _TFWOPEN_H