changeset 4451:033c455bbe99

Refactored automated rwops tests so read and write directories can be more easily customized. The refactored tests were written in recognition that Mac and iPhone current working directories are usually not going to work. Resource directories are in bundles and write directories are restricted to certain areas. In theory, other platforms may have this problem too, hence the refactoring. Also updated the Xcode iPhone project to use 3.2 as the Base SDK, but 3.1 as the Deployment SDK (for iPhone/iPad compatibility.)
author Eric Wing <ewing . public |-at-| gmail . com>
date Sun, 09 May 2010 06:58:30 -0700
parents abd88bbaea2a
children 4011619aab7e
files Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj test/automated/Makefile test/automated/rwops/TestSupportRWops.h test/automated/rwops/TestSupportRWops_Cocoa.m test/automated/rwops/TestSupportRWops_Generic.c test/automated/rwops/Test_rwopsbundlesupport.h test/automated/rwops/Test_rwopsbundlesupport.m test/automated/rwops/rwops.c
diffstat 8 files changed, 157 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat May 08 08:23:46 2010 -0700
+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun May 09 06:58:30 2010 -0700
@@ -34,6 +34,7 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */; };
 		006E9852119550FB001DE610 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9831119550FB001DE610 /* audio.c */; };
 		006E9853119550FB001DE610 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9834119550FB001DE610 /* common.c */; };
 		006E9859119550FB001DE610 /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E983D119550FB001DE610 /* platform.c */; };
@@ -42,7 +43,6 @@
 		006E985C119550FB001DE610 /* render.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9844119550FB001DE610 /* render.c */; };
 		006E985D119550FB001DE610 /* read in Copy rwops */ = {isa = PBXBuildFile; fileRef = 006E9847119550FB001DE610 /* read */; };
 		006E985E119550FB001DE610 /* rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9848119550FB001DE610 /* rwops.c */; };
-		006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */; };
 		006E9860119550FB001DE610 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984C119550FB001DE610 /* SDL_at.c */; };
 		006E9861119550FB001DE610 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E984F119550FB001DE610 /* surface.c */; };
 		006E9862119550FB001DE610 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 006E9851119550FB001DE610 /* testsdl.c */; };
@@ -264,6 +264,8 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSupportRWops_Cocoa.m; sourceTree = "<group>"; };
+		001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSupportRWops.h; sourceTree = "<group>"; };
 		006E982211955059001DE610 /* testsdl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsdl.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		006E982411955059001DE610 /* testsdl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testsdl-Info.plist"; sourceTree = "<group>"; };
 		006E9831119550FB001DE610 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = "<group>"; };
@@ -286,8 +288,6 @@
 		006E9847119550FB001DE610 /* read */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = read; sourceTree = "<group>"; };
 		006E9848119550FB001DE610 /* rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rwops.c; sourceTree = "<group>"; };
 		006E9849119550FB001DE610 /* rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rwops.h; sourceTree = "<group>"; };
-		006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test_rwopsbundlesupport.h; sourceTree = "<group>"; };
-		006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Test_rwopsbundlesupport.m; sourceTree = "<group>"; };
 		006E984C119550FB001DE610 /* SDL_at.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_at.c; path = ../../test/automated/SDL_at.c; sourceTree = SOURCE_ROOT; };
 		006E984D119550FB001DE610 /* SDL_at.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_at.h; path = ../../test/automated/SDL_at.h; sourceTree = SOURCE_ROOT; };
 		006E984F119550FB001DE610 /* surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = surface.c; sourceTree = "<group>"; };
@@ -609,11 +609,11 @@
 		006E9846119550FB001DE610 /* rwops */ = {
 			isa = PBXGroup;
 			children = (
+				001E39A51196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m */,
+				001E39A61196EE6F00A3F5B8 /* TestSupportRWops.h */,
 				006E9847119550FB001DE610 /* read */,
 				006E9848119550FB001DE610 /* rwops.c */,
 				006E9849119550FB001DE610 /* rwops.h */,
-				006E984A119550FB001DE610 /* Test_rwopsbundlesupport.h */,
-				006E984B119550FB001DE610 /* Test_rwopsbundlesupport.m */,
 			);
 			name = rwops;
 			path = ../../test/automated/rwops;
@@ -694,10 +694,10 @@
 		29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
 			isa = PBXGroup;
 			children = (
-				006E982F119550E4001DE610 /* TestResources */,
-				006E982E119550D8001DE610 /* AutomatedTests */,
 				FD99B8BC0DD52E5C00FB1D6B /* Public Headers */,
 				FD99B8BD0DD52E6D00FB1D6B /* Library Source */,
+				006E982E119550D8001DE610 /* AutomatedTests */,
+				006E982F119550E4001DE610 /* TestResources */,
 				29B97323FDCFA39411CA2CEA /* Frameworks */,
 				19C28FACFE9D520D11CA2CBB /* Products */,
 				006E982411955059001DE610 /* testsdl-Info.plist */,
@@ -1313,10 +1313,10 @@
 				006E985B119550FB001DE610 /* rect.c in Sources */,
 				006E985C119550FB001DE610 /* render.c in Sources */,
 				006E985E119550FB001DE610 /* rwops.c in Sources */,
-				006E985F119550FB001DE610 /* Test_rwopsbundlesupport.m in Sources */,
 				006E9860119550FB001DE610 /* SDL_at.c in Sources */,
 				006E9861119550FB001DE610 /* surface.c in Sources */,
 				006E9862119550FB001DE610 /* testsdl.c in Sources */,
+				001E39A71196EE6F00A3F5B8 /* TestSupportRWops_Cocoa.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1505,15 +1505,15 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_DEBUGGING_SYMBOLS = full;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = NO;
+				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
 				ONLY_ACTIVE_ARCH = NO;
 				PREBINDING = NO;
-				SDKROOT = iphoneos3.1.2;
+				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 			};
 			name = Debug;
@@ -1522,13 +1522,14 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				GCC_C_LANGUAGE_STANDARD = c99;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = NO;
+				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
 				PREBINDING = NO;
-				SDKROOT = iphoneos3.1.2;
+				SDKROOT = iphoneos3.2;
 				TARGETED_DEVICE_FAMILY = "1,2";
 			};
 			name = Release;
@@ -1537,7 +1538,6 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				COPY_PHASE_STRIP = NO;
 				DEPLOYMENT_LOCATION = NO;
@@ -1553,7 +1553,6 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
--- a/test/automated/Makefile	Sat May 08 08:23:46 2010 -0700
+++ b/test/automated/Makefile	Sun May 09 06:58:30 2010 -0700
@@ -10,6 +10,7 @@
 SRC         	:= testsdl.c \
 						platform/platform.c \
 						rwops/rwops.c \
+						rwops/TestSupportRWops.c \
 						rect/rect.c \
 						surface/surface.c \
 						render/render.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/rwops/TestSupportRWops.h	Sun May 09 06:58:30 2010 -0700
@@ -0,0 +1,14 @@
+
+#include <stdio.h>
+#include "SDL.h"
+
+#ifndef TestSupportRWops_h
+#define TestSupportRWops_h
+
+FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode);
+FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode);
+SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode);
+SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/rwops/TestSupportRWops_Cocoa.m	Sun May 09 06:58:30 2010 -0700
@@ -0,0 +1,89 @@
+#import "TestSupportRWops.h"
+#import <Foundation/Foundation.h>
+#include "SDL.h"
+
+/* For proper OS X applications, the resources are contained inside the application bundle.
+ So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
+ Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
+ We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
+ but we would somehow need to know what the bundle identifiers we need to search are.
+ Conversely, write directories are usually not in the bundles. This implementation uses NSTemporaryDirectory,
+ but consider Preferences, Application Support, Documents, etc.
+ Also, note the bundle layouts are different for iPhone and Mac.
+*/
+
+const char* RWOPS_READ = "rwops/read";
+const char* RWOPS_WRITE = "write";
+
+
+FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
+{
+    FILE* fp = NULL;
+
+	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
+	if(strcmp("r", mode) && strcmp("rb", mode))
+	{
+		return fopen(file, mode);
+	}
+	
+	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
+
+
+	NSFileManager* file_manager = [NSFileManager defaultManager];
+	NSString* resource_path = [[NSBundle mainBundle] resourcePath];
+
+	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+
+	NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
+	if([file_manager fileExistsAtPath:full_path_with_file_to_try])
+	{
+		fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+	}
+	else
+	{
+		fp = fopen(file, mode);
+	}
+
+	[autorelease_pool drain];
+
+	return fp;
+}
+
+FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
+{
+    FILE* fp = NULL;
+	
+	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
+	
+	NSFileManager* file_manager = [NSFileManager defaultManager];
+	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
+
+	fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+	
+	[autorelease_pool drain];
+	
+	return fp;
+}
+
+SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode)
+{
+	return SDL_RWFromFile(file, mode);
+}
+
+SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode)
+{
+	SDL_RWops* rw = NULL;
+
+	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
+	
+	NSFileManager* file_manager = [NSFileManager defaultManager];
+	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
+	
+	rw = SDL_RWFromFile( [full_path_with_file_to_try fileSystemRepresentation], mode );
+
+	[autorelease_pool drain];
+	return rw;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/automated/rwops/TestSupportRWops_Generic.c	Sun May 09 06:58:30 2010 -0700
@@ -0,0 +1,28 @@
+/* Generic implementation for file opening routines.
+* Customizations for specific platforms should go in alternative files.
+*/
+#include <stdio.h>
+#include "SDL.h"
+
+const char* RWOPS_READ = "rwops/read";
+const char* RWOPS_WRITE = "rwops/write";
+
+FILE* TestSupportRWops_OpenFPFromReadDir(const char *file, const char *mode)
+{
+	return fopen(file, mode);
+}
+
+FILE* TestSupportRWops_OpenFPFromWriteDir(const char *file, const char *mode)
+{
+	return fopen(file, mode);
+}
+
+SDL_RWops* TestSupportRWops_OpenRWopsFromReadDir(const char *file, const char *mode)
+{
+	return SDL_RWFromFile(file, mode);
+}
+
+SDL_RWops* TestSupportRWops_OpenRWopsFromWriteDir(const char *file, const char *mode)
+{
+	return SDL_RWFromFile(file, mode);
+}
--- a/test/automated/rwops/Test_rwopsbundlesupport.h	Sat May 08 08:23:46 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#ifdef __APPLE__
-
-#include <stdio.h>
-
-#ifndef SDL_rwopsbundlesupport_h
-#define SDL_rwopsbundlesupport_h
-FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode);
-FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode);
-
-#endif
-#endif
--- a/test/automated/rwops/Test_rwopsbundlesupport.m	Sat May 08 08:23:46 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-#ifdef __APPLE__
-#import <Foundation/Foundation.h>
-
-/* For proper OS X applications, the resources are contained inside the application bundle.
- So the strategy is to first check the application bundle for the file, then fallback to the current working directory.
- Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app.
- We might want to use bundle identifiers, e.g. org.libsdl.sdl to get the bundle for the framework,
- but we would somehow need to know what the bundle identifiers we need to search are.
- Also, note the bundle layouts are different for iPhone and Mac.
-*/
-FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode)
-{
-    FILE* fp = NULL;
-
-	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
-	if(strcmp("r", mode) && strcmp("rb", mode))
-	{
-		return fopen(file, mode);
-	}
-	
-	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
-
-
-	NSFileManager* file_manager = [NSFileManager defaultManager];
-	NSString* resource_path = [[NSBundle mainBundle] resourcePath];
-
-	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
-
-	NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
-	if([file_manager fileExistsAtPath:full_path_with_file_to_try])
-	{
-		fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
-	}
-	else
-	{
-		fp = fopen(file, mode);
-	}
-
-	[autorelease_pool drain];
-
-	return fp;
-}
-
-FILE* Test_OpenFPFromTemporaryDir(const char *file, const char *mode)
-{
-    FILE* fp = NULL;
-	
-	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
-	
-	
-	NSFileManager* file_manager = [NSFileManager defaultManager];
-	
-	NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
-	
-	NSString* full_path_with_file_to_try = [NSTemporaryDirectory() stringByAppendingPathComponent:ns_string_file_component];
-	fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
-	
-	[autorelease_pool drain];
-	
-	return fp;
-}
-#endif
--- a/test/automated/rwops/rwops.c	Sat May 08 08:23:46 2010 -0700
+++ b/test/automated/rwops/rwops.c	Sun May 09 06:58:30 2010 -0700
@@ -9,17 +9,11 @@
 
 #include "SDL.h"
 #include "../SDL_at.h"
-#if __APPLE__
-#include "Test_rwopsbundlesupport.h"
-#endif
-
-#define RWOPS_READ      "rwops/read"
+#include "TestSupportRWops.h"
 
-#if __APPLE__
-#define RWOPS_WRITE		"write"
-#else
-#define RWOPS_WRITE     "rwops/write"
-#endif
+/* Defined in TestSupportRWops implementation to allow flexibility. */
+extern const char* RWOPS_READ;
+extern const char* RWOPS_WRITE;
 
 static const char hello_world[] = "Hello World!";
 
@@ -193,16 +187,16 @@
    SDL_ATbegin( "SDL_RWFromFile" );
 
    /* Read test. */
-   rw = SDL_RWFromFile( RWOPS_READ, "r" );
-   if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_READ"'", rw != NULL ))
+   rw = TestSupportRWops_OpenRWopsFromReadDir( RWOPS_READ, "r" );
+   if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_READ", rw != NULL ))
       return;
    if (rwops_testGeneric( rw, 0 ))
       return;
    SDL_FreeRW( rw );
 
    /* Write test. */
-   rw = SDL_RWFromFile( RWOPS_WRITE, "w+" );
-   if (SDL_ATassert( "Opening memory with SDL_RWFromFile '"RWOPS_WRITE"'", rw != NULL ))
+   rw = TestSupportRWops_OpenRWopsFromWriteDir( RWOPS_WRITE, "w+" );
+   if (SDL_ATassert( "Opening memory with SDL_RWFromFile RWOPS_WRITE", rw != NULL ))
       return;
    if (rwops_testGeneric( rw, 1 ))
       return;
@@ -226,12 +220,8 @@
    SDL_ATbegin( "SDL_RWFromFP" );
 
    /* Run read tests. */
-#if __APPLE__
-	fp = Test_OpenFPFromBundleOrFallback( RWOPS_READ, "r" );
-#else
-   fp = fopen( RWOPS_READ, "r" );
-#endif
-   if (SDL_ATassert( "Failed to open file '"RWOPS_READ"'", fp != NULL))
+   fp = TestSupportRWops_OpenFPFromReadDir( RWOPS_READ, "r" );
+   if (SDL_ATassert( "Failed to open file 'WOPS_READ", fp != NULL))
       return;
    rw = SDL_RWFromFP( fp, 1 );
    if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))
@@ -241,12 +231,8 @@
    SDL_FreeRW( rw );
 
    /* Run write tests. */
-#if __APPLE__
-	fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" );
-#else
-   fp = fopen( RWOPS_WRITE, "w+" );
-#endif
-   if (SDL_ATassert( "Failed to open file '"RWOPS_WRITE"'", fp != NULL))
+   fp = TestSupportRWops_OpenFPFromWriteDir( RWOPS_WRITE, "w+" );
+   if (SDL_ATassert( "Failed to open file RWOPS_WRITE", fp != NULL))
       return;
    rw = SDL_RWFromFP( fp, 1 );
    if (SDL_ATassert( "Opening memory with SDL_RWFromFP", rw != NULL ))