diff --git a/Shared Source/Classes/Model/PWDarcsChangePatch.m b/Shared Source/Classes/Model/PWDarcsChangePatch.m index e6bb63f..63ae02f 100644 --- a/Shared Source/Classes/Model/PWDarcsChangePatch.m +++ b/Shared Source/Classes/Model/PWDarcsChangePatch.m @@ -108,9 +108,9 @@ - (id)initWithOpenGzFile:(gzFile)gzPatchFile alreadyReadString:(NSString *)currP // Read in the next line of the patch. If we read "] {\n" then we know this patch will definitely never match the regexp. char lineBuffer[LINE_BUFFER_LENGH]; char *line = gzgets(PW_gzPatchFile, lineBuffer, LINE_BUFFER_LENGH); + // zlib.h says gzgets should never return Z_NULL, but this can often signal the end-of-file, so we need to check it here if (line != Z_NULL) { - // zlib.h says gzgets should never return Z_NULL, but this can often signal the end-of-file, so we need to check it here NSString *newLine = [NSString stringWithCString:line encoding:PATCH_STRING_ENCODING]; [PW_currPatchString appendString:newLine]; if ([newLine isEqualToString:@"] {\n"]) diff --git a/Shared Source/Tests/PWDarcsChangePatchTest.m b/Shared Source/Tests/PWDarcsChangePatchTest.m index cec31c2..d875bf0 100644 --- a/Shared Source/Tests/PWDarcsChangePatchTest.m +++ b/Shared Source/Tests/PWDarcsChangePatchTest.m @@ -87,7 +87,7 @@ - (void)testCompressedChangePatchWithLongComment @"Patch type not correctly set."); STAssertEqualObjects([(PWDarcsChangePatch *)patch longComment], @" Some or all of the OgreKit framework's headers have no newlines at the end of\n the file. Enabling this warning triggers it every time one of Patchworks's\n source files includes an OgreKit header. And it's not a big deal anyway.", @"Long comment didn't correctly parse."); - } +} - (void)testUncompressedChangePatch