Do fopen() with 'b' for binary data on windoze

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4200 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-05-05 18:47:44 +00:00
parent 1187dcf837
commit 129641643c
2 changed files with 7 additions and 7 deletions

View file

@ -124,7 +124,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len, NSZone* zone)
NSLog(@"Open (%s) attempt failed - bad path", thePath); NSLog(@"Open (%s) attempt failed - bad path", thePath);
return NO; return NO;
} }
theFile = fopen(thePath, "r"); theFile = fopen(thePath, "rb");
if (theFile == NULL) /* We failed to open the file. */ if (theFile == NULL) /* We failed to open the file. */
{ {
@ -175,7 +175,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len, NSZone* zone)
c = fread(tmp, 1, fileLength, theFile); c = fread(tmp, 1, fileLength, theFile);
if (c != fileLength) if (c != fileLength)
{ {
NSLog(@"Fread of file contents failed - %s", strerror(errno)); NSLog(@"read of file contents failed - %s", strerror(errno));
goto failure; goto failure;
} }
@ -523,7 +523,7 @@ failure:
else else
{ {
strcpy(thePath, theRealPath); strcpy(thePath, theRealPath);
theFile = fopen(thePath, "w"); theFile = fopen(thePath, "wb");
} }
#else #else
if (useAuxiliaryFile) if (useAuxiliaryFile)
@ -545,7 +545,7 @@ failure:
} }
/* Open the file (whether temp or real) for writing. */ /* Open the file (whether temp or real) for writing. */
theFile = fopen(thePath, "w"); theFile = fopen(thePath, "wb");
#endif #endif
if (theFile == NULL) /* Something went wrong; we weren't if (theFile == NULL) /* Something went wrong; we weren't

View file

@ -544,7 +544,7 @@ decode (const void *ptr)
if (f) if (f)
{ {
fp = fopen([f cString], "r"); fp = fopen([f cString], "rb");
if (fp != NULL) if (fp != NULL)
{ {
if (fscanf(fp, "%79s", zone_name) == 1) if (fscanf(fp, "%79s", zone_name) == 1)
@ -779,7 +779,7 @@ decode (const void *ptr)
/* Read dictionary from file. */ /* Read dictionary from file. */
abbreviationDictionary = [[NSMutableDictionary alloc] init]; abbreviationDictionary = [[NSMutableDictionary alloc] init];
fileName = [NSTimeZone getAbbreviationFile]; fileName = [NSTimeZone getAbbreviationFile];
file = fopen([fileName cString], "r"); file = fopen([fileName cString], "rb");
if (file == NULL) if (file == NULL)
[NSException [NSException
raise: NSInternalInconsistencyException raise: NSInternalInconsistencyException
@ -826,7 +826,7 @@ decode (const void *ptr)
temp_array[i] = [[NSMutableArray alloc] init]; temp_array[i] = [[NSMutableArray alloc] init];
fileName = [NSTimeZone getRegionsFile]; fileName = [NSTimeZone getRegionsFile];
file = fopen([fileName cString], "r"); file = fopen([fileName cString], "rb");
if (file == NULL) if (file == NULL)
[NSException [NSException
raise: NSInternalInconsistencyException raise: NSInternalInconsistencyException