diff --git a/Source/NSData.m b/Source/NSData.m index 4ab1bc394..08e328ef2 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -124,7 +124,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len, NSZone* zone) NSLog(@"Open (%s) attempt failed - bad path", thePath); return NO; } - theFile = fopen(thePath, "r"); + theFile = fopen(thePath, "rb"); 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); if (c != fileLength) { - NSLog(@"Fread of file contents failed - %s", strerror(errno)); + NSLog(@"read of file contents failed - %s", strerror(errno)); goto failure; } @@ -523,7 +523,7 @@ failure: else { strcpy(thePath, theRealPath); - theFile = fopen(thePath, "w"); + theFile = fopen(thePath, "wb"); } #else if (useAuxiliaryFile) @@ -545,7 +545,7 @@ failure: } /* Open the file (whether temp or real) for writing. */ - theFile = fopen(thePath, "w"); + theFile = fopen(thePath, "wb"); #endif if (theFile == NULL) /* Something went wrong; we weren't diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index 45cfbe98f..452f1a5dc 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -544,7 +544,7 @@ decode (const void *ptr) if (f) { - fp = fopen([f cString], "r"); + fp = fopen([f cString], "rb"); if (fp != NULL) { if (fscanf(fp, "%79s", zone_name) == 1) @@ -779,7 +779,7 @@ decode (const void *ptr) /* Read dictionary from file. */ abbreviationDictionary = [[NSMutableDictionary alloc] init]; fileName = [NSTimeZone getAbbreviationFile]; - file = fopen([fileName cString], "r"); + file = fopen([fileName cString], "rb"); if (file == NULL) [NSException raise: NSInternalInconsistencyException @@ -826,7 +826,7 @@ decode (const void *ptr) temp_array[i] = [[NSMutableArray alloc] init]; fileName = [NSTimeZone getRegionsFile]; - file = fopen([fileName cString], "r"); + file = fopen([fileName cString], "rb"); if (file == NULL) [NSException raise: NSInternalInconsistencyException