Skip to content

Commit 077894f

Browse files
committed
Fix creation of string from UTF8 data and remove some redundant code.
1 parent efea1d3 commit 077894f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Tools/pl.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ id process_plist(NSData *inputData)
7777
NSString *string = nil;
7878

7979
// return if nil
80-
if (inputData == NULL || inputData == nil)
80+
if (nil == inputData)
8181
{
8282
return nil;
8383
}
8484

8585
// Initialize a string with the contents of the file.
86-
string = [NSString stringWithUTF8String: (char *)[inputData bytes]];
86+
string = AUTORELEASE([[NSString alloc] initWithData: inputData
87+
encoding: NSUTF8StringEncoding]);
8788

8889
// Convert the string into a property list. If there is a parsing error
8990
// the property list interpreter will throw an exception.
@@ -114,10 +115,6 @@ id process_plist(NSData *inputData)
114115

115116
// Read in the input from the file.
116117
inputData = [fileHandle readDataToEndOfFile];
117-
if ([inputData length] == 0)
118-
{
119-
return nil;
120-
}
121118
}
122119
else
123120
{

0 commit comments

Comments
 (0)