- Timestamp:
- 04/28/05 22:33:14 (4 years ago)
- Files:
-
- trunk/JVChatTranscript.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/JVChatTranscript.m
r2558 r2569 1025 1025 [_logFile seekToFileOffset:_previousLogOffset]; 1026 1026 NSData *check = [_logFile readDataOfLength:9]; // check to see if there is an <envelope> here 1027 if( strncmp( "<envelope", [check bytes], 9 ) ) { // this is a bad offset!1027 if( [check length] != 9 || strncmp( "<envelope", [check bytes], 9 ) ) { // this is a bad offset! 1028 1028 _requiresNewEnvelope = YES; 1029 1029 _previousLogOffset = 0; … … 1034 1034 [_logFile seekToFileOffset:[_logFile seekToEndOfFile] - 1]; 1035 1035 NSData *check = [_logFile readDataOfLength:1]; // check to see if there is an trailing newline and correct 1036 if( ! strncmp( "\n", [check bytes], 1 ) ) offset++; // we need to eat the newline also1036 if( [check length] == 1 && ! strncmp( "\n", [check bytes], 1 ) ) offset++; // we need to eat the newline also 1037 1037 1038 1038 [_logFile seekToFileOffset:[_logFile offsetInFile] - offset]; 1039 1039 check = [_logFile readDataOfLength:offset]; // check to see if there is a </log> here 1040 if( strncmp( ( offset == 7 ? "</log>\n" : "</log>" ), [check bytes], offset ) ) { // this is a bad file!1040 if( [check length] != offset || strncmp( ( offset == 7 ? "</log>\n" : "</log>" ), [check bytes], offset ) ) { // this is a bad file! 1041 1041 [self setAutomaticallyWritesChangesToFile:NO]; 1042 1042 return;
