[Scummvm-cvs-logs] CVS: scummvm/backends/wince/missing missing.cpp,1.6,1.6.4.1

Nicolas Bacca arisme at users.sourceforge.net
Sat Feb 21 01:55:01 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/wince/missing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9365

Modified Files:
      Tag: branch-0-6-0
	missing.cpp 
Log Message:
Fix HandheldPC/PalmSizePC compile

Index: missing.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/missing/missing.cpp,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -d -r1.6 -r1.6.4.1
--- missing.cpp	11 May 2003 14:02:18 -0000	1.6
+++ missing.cpp	21 Feb 2004 09:42:52 -0000	1.6.4.1
@@ -7,6 +7,7 @@
 #include <windows.h>
 #include <tchar.h>
 #include <string.h>
+#include <stdlib.h>
 #include "sys/stat.h"
 #include "sys/time.h"
 #include "time.h"
@@ -16,6 +17,7 @@
 
 #if _WIN32_WCE < 300
 
+#define _STDAFX_H
 #include "portdefs.h"
 
 #else
@@ -362,10 +364,12 @@
 }
 
 /* And why do people use this? */
+#if _WIN32_WCE >= 300
 void abort()
 {
 	exit(1);
 }
+#endif
 
 /*
 IMHO, no project should use this one, it is not portable at all. This implementation
@@ -457,6 +461,22 @@
 		return (FILE*)result;
 }
 
+FILE * _wfopen(const TCHAR *path, const TCHAR *mode) {
+	HANDLE result;
+	bool writeAccess = (mode[0] == 'W' || mode[0] == 'w');
+	result = CreateFile(path, ( writeAccess ? GENERIC_WRITE : GENERIC_READ), 0, NULL, (writeAccess ? CREATE_ALWAYS : OPEN_EXISTING), FILE_ATTRIBUTE_NORMAL, NULL);
+	if (result == INVALID_HANDLE_VALUE)
+		return NULL;
+	else
+		return (FILE*)result;
+}
+
+FILE *_wfreopen(const TCHAR *path, const TCHAR *mode, FILE *stream) {
+	fclose(stream);
+	stream = _wfopen(path, mode);
+	return stream;
+}
+
 int fclose(FILE *stream) {
 	CloseHandle((HANDLE)stream);
 	return 1;
@@ -493,6 +513,14 @@
 		return 0;
 }
 
+int fgetc(FILE *stream) {
+	unsigned char c;
+	if (fread(&c, 1, 1, stream) != 1)
+		return -1;
+	else
+		return c;
+}
+
 char *fgets(char *s, int size, FILE *stream) {
 	int i = 0;
 	char tempo[1];
@@ -523,6 +551,10 @@
 	return (filePos == 0xFFFFFFFF || filePos > (fileSize - 1));
 }
 
+int ferror(FILE *stream) {
+	return 0; // FIXME !
+}
+
 int fprintf(FILE *stream, const char *format, ...) {
 	char buf[1024];
 	va_list va;
@@ -590,9 +622,7 @@
 	// not correct but that's all we are using
 
 	long int result;
-
 	sscanf(nptr, "%ld", &result);
-
 	return result;
 }
 		





More information about the Scummvm-git-logs mailing list