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

Nicolas Bacca arisme at users.sourceforge.net
Fri Apr 4 05:12:13 CEST 2003


Update of /cvsroot/scummvm/scummvm/backends/wince/missing
In directory sc8-pr-cvs1:/tmp/cvs-serv14642

Modified Files:
	missing.cpp 
Log Message:
Adding _heapchk

Index: missing.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/missing/missing.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- missing.cpp	20 Jan 2003 07:53:14 -0000	1.4
+++ missing.cpp	4 Apr 2003 13:11:32 -0000	1.5
@@ -387,10 +387,14 @@
 		if (compar(key, (void*)((size_t)base + size * i)) == 0)
 			return (void*)((size_t)base + size * i);
 	return NULL;
-}
+}
 
 #if _WIN32_WCE < 300 || defined(_TEST_HPC_STDIO)
 
+int _heapchk() {
+	return _HEAPOK;
+}
+
 void *calloc(size_t n, size_t s) {
 	void *result = malloc(n * s);
 	if (result) 
@@ -398,135 +402,135 @@
 
 	return result;
 }
-
-#ifndef _TEST_HPC_STDIO
+
+#ifndef _TEST_HPC_STDIO
 
 int isdigit(int c) {
 	return (c >='0' && c <= '9');
-}
-
-int isprint(int c) {
-	return (c >= ' ' && c <= '~');
-}
-
-int isspace(int c) {
-	return (c == ' ');
-}
-
-#endif
-
-int printf(const char *format, ...) {
-	// useless anyway :)
-	return 0;
-}
-
-FILE *fopen(const char *path, const char *mode) {
-	TCHAR tempo[MAX_PATH];
-	HANDLE result;
-	bool writeAccess = (mode[0] == 'W' || mode[0] == 'w');
-
-	MultiByteToWideChar(CP_ACP, 0, path, strlen(path) + 1, tempo, sizeof(tempo));
-
-	result = CreateFile(tempo, ( 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;
-}
-
-int fclose(FILE *stream) {
-	CloseHandle((HANDLE)stream);
-	return 1;
-}
-
-int fseek(FILE *stream, long offset, int whence) {
-	SetFilePointer((HANDLE)stream, offset, NULL, (whence == SEEK_CUR ? FILE_CURRENT : whence == SEEK_END ? FILE_END : FILE_BEGIN));
-	return 0;
-}
-
-long ftell(FILE *stream) {
-	return (SetFilePointer((HANDLE)stream, 0, NULL, FILE_CURRENT));
-}
-
-size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
-	DWORD sizeWritten;
-
-	WriteFile((HANDLE)stream, ptr, size * nmemb, &sizeWritten, NULL);
-
-	if (size != 0)
-		return sizeWritten / size;
-	else
-		return 0;
-}
-
-size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
-	DWORD sizeRead;
-
-	ReadFile((HANDLE)stream, ptr, size * nmemb, &sizeRead, NULL);
-
-	if (size != 0)
-		return sizeRead / size;
-	else
-		return 0;
-}
-
-char *fgets(char *s, int size, FILE *stream) {
-	int i = 0;
-	char tempo[1];
-
-	memset(s, 0, size);
-	while (fread(tempo, 1, 1, stream)) {
-		//if (tempo[0] == '\r')
-		//	break;
-		if (tempo[0] == '\r')
-			continue;
-		s[i++] = tempo[0];
-		if (tempo[0] == '\n')
-			break;
-		if (i == size)
-			break;
-	}
-	if (!i)
-		return NULL;
-	else
-		return s;
-}
-
-int feof(FILE *stream) {
-	DWORD fileSize;
-	DWORD filePos;
-	fileSize = GetFileSize((HANDLE)stream, NULL);
-	filePos = SetFilePointer((HANDLE)stream, 0, 0, FILE_CURRENT);
-	return (filePos == 0xFFFFFFFF || filePos > (fileSize - 1));
-}
-
-int fprintf(FILE *stream, const char *format, ...) {
-	char buf[1024];
-	va_list va;
-
-	va_start(va, format);
-	vsprintf(buf, format, va);
-	va_end(va);
-
-	if (buf[strlen(buf) - 1] == '\n') {
-		int i = strlen(buf) - 1;
-		buf[i] = '\r';
-		buf[i + 1] = '\n';
-		buf[i + 2] = 0;
-	}
-
-	return fwrite(buf, 1, strlen(buf), stream);
-}
-
-FILE* _getstdfilex(int) {
-	return NULL;
-}
-
-void clearerr(FILE *stream) {
-}
-
-int fflush(FILE *stream) {
-	return 0;
+}
+
+int isprint(int c) {
+	return (c >= ' ' && c <= '~');
+}
+
+int isspace(int c) {
+	return (c == ' ');
+}
+
+#endif
+
+int printf(const char *format, ...) {
+	// useless anyway :)
+	return 0;
+}
+
+FILE *fopen(const char *path, const char *mode) {
+	TCHAR tempo[MAX_PATH];
+	HANDLE result;
+	bool writeAccess = (mode[0] == 'W' || mode[0] == 'w');
+
+	MultiByteToWideChar(CP_ACP, 0, path, strlen(path) + 1, tempo, sizeof(tempo));
+
+	result = CreateFile(tempo, ( 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;
+}
+
+int fclose(FILE *stream) {
+	CloseHandle((HANDLE)stream);
+	return 1;
+}
+
+int fseek(FILE *stream, long offset, int whence) {
+	SetFilePointer((HANDLE)stream, offset, NULL, (whence == SEEK_CUR ? FILE_CURRENT : whence == SEEK_END ? FILE_END : FILE_BEGIN));
+	return 0;
+}
+
+long ftell(FILE *stream) {
+	return (SetFilePointer((HANDLE)stream, 0, NULL, FILE_CURRENT));
+}
+
+size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
+	DWORD sizeWritten;
+
+	WriteFile((HANDLE)stream, ptr, size * nmemb, &sizeWritten, NULL);
+
+	if (size != 0)
+		return sizeWritten / size;
+	else
+		return 0;
+}
+
+size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
+	DWORD sizeRead;
+
+	ReadFile((HANDLE)stream, ptr, size * nmemb, &sizeRead, NULL);
+
+	if (size != 0)
+		return sizeRead / size;
+	else
+		return 0;
+}
+
+char *fgets(char *s, int size, FILE *stream) {
+	int i = 0;
+	char tempo[1];
+
+	memset(s, 0, size);
+	while (fread(tempo, 1, 1, stream)) {
+		//if (tempo[0] == '\r')
+		//	break;
+		if (tempo[0] == '\r')
+			continue;
+		s[i++] = tempo[0];
+		if (tempo[0] == '\n')
+			break;
+		if (i == size)
+			break;
+	}
+	if (!i)
+		return NULL;
+	else
+		return s;
+}
+
+int feof(FILE *stream) {
+	DWORD fileSize;
+	DWORD filePos;
+	fileSize = GetFileSize((HANDLE)stream, NULL);
+	filePos = SetFilePointer((HANDLE)stream, 0, 0, FILE_CURRENT);
+	return (filePos == 0xFFFFFFFF || filePos > (fileSize - 1));
+}
+
+int fprintf(FILE *stream, const char *format, ...) {
+	char buf[1024];
+	va_list va;
+
+	va_start(va, format);
+	vsprintf(buf, format, va);
+	va_end(va);
+
+	if (buf[strlen(buf) - 1] == '\n') {
+		int i = strlen(buf) - 1;
+		buf[i] = '\r';
+		buf[i + 1] = '\n';
+		buf[i + 2] = 0;
+	}
+
+	return fwrite(buf, 1, strlen(buf), stream);
+}
+
+FILE* _getstdfilex(int) {
+	return NULL;
+}
+
+void clearerr(FILE *stream) {
+}
+
+int fflush(FILE *stream) {
+	return 0;
 }
 
 void assert (int expression) {





More information about the Scummvm-git-logs mailing list