35#define NO_DYNAMIC_PLIST_DTD_CHANGE 
   43#ifndef NO_DYNAMIC_PLIST_DTD_CHANGE 
   44static NSData *ChangeDTDIfApplicable(NSData *data);
 
   54    NSString    *error = 
nil;
 
   58#ifndef NO_DYNAMIC_PLIST_DTD_CHANGE 
   59        data = ChangeDTDIfApplicable(data);
 
   62        result = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:&error];
 
   65#if OOLITE_RELEASE_PLIST_ERROR_STRINGS 
   69            if (error == 
nil) error = 
@"<no error message>";
 
   70            if (whereFrom == 
nil) whereFrom = 
@"<data in memory>";
 
 
  102#ifndef NO_DYNAMIC_PLIST_DTD_CHANGE 
  103static NSData *ChangeDTDIfApplicable(NSData *data)
 
  105    const uint8_t       *bytes = NULL;
 
  106    uint8_t             *newBytes = NULL;
 
  111    const char          xmlDeclLine[] = 
"<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>";
 
  112    const char          *appleDTDLines[] = 
 
  114                            "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">",
 
  115                            "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">",
 
  118    const char          gstepDTDLine[] = 
"<!DOCTYPE plist PUBLIC \"-//GNUstep//DTD plist 0.9//EN\" \"http://www.gnustep.org/plist-0_9.xml\">";
 
  119    const char          *srcDTDLine = NULL;
 
  120    size_t              srcDTDLineSize = 0;
 
  123    length = [data length];
 
  124    if (length < 
sizeof xmlDeclLine) 
return data;
 
  126    bytes = [data bytes];
 
  129    if (memcmp(bytes, xmlDeclLine, 
sizeof xmlDeclLine - 1) != 0) 
return data;
 
  131    offset += sizeof xmlDeclLine - 1;
 
  137        srcDTDLine = appleDTDLines[i];
 
  138        if (srcDTDLine == NULL)  
return data;  
 
  140        srcDTDLineSize = strlen(appleDTDLines[i]);
 
  142        if (srcDTDLineSize <= length - 
offset &&
 
  143            memcmp(bytes + 
offset, srcDTDLine, srcDTDLineSize) == 0)
 
  152    newLength = length - 
offset + sizeof xmlDeclLine + sizeof gstepDTDLine - 1;
 
  153    newBytes = malloc(newLength);
 
  154    if (newBytes == NULL) 
return data;
 
  157    memcpy(newBytes, xmlDeclLine, 
sizeof xmlDeclLine - 1);
 
  158    newOffset = 
sizeof xmlDeclLine - 1;
 
  159    newBytes[newOffset++] = 
'\n';
 
  160    memcpy(newBytes + newOffset, gstepDTDLine, 
sizeof gstepDTDLine - 1);
 
  161    newOffset += sizeof gstepDTDLine - 1;
 
  162    memcpy(newBytes + newOffset, bytes + 
offset, length - 
offset);
 
  164    return [NSData dataWithBytes:newBytes length:newLength];
 
  175    return [[NSData oo_dataWithOXZFile:path] retain];
 
  179    return [[NSData alloc] initWithContentsOfMappedFile:path];
 
  181    NSFileManager   *fmgr = [NSFileManager defaultManager];
 
  184    if ([fmgr fileExistsAtPath:path isDirectory:&dir])
 
  188            return [[NSData alloc] initWithContentsOfMappedFile:path];
 
 
  232    if (value != 
nil && ![value isKindOfClass:
class])
 
 
#define OOLog(class, format,...)
 
NSString *const kOOLogFileNotFound
 
NSArray * OOArrayFromData(NSData *data, NSString *whereFrom)
 
static NSString *const kOOLogPListFoundationParseError
 
static id ValueIfClass(id value, Class class)
 
id OOPropertyListFromData(NSData *data, NSString *whereFrom)
 
id OOPropertyListFromFile(NSString *path)
 
NSDictionary * OODictionaryFromFile(NSString *path)
 
NSArray * OOArrayFromFile(NSString *path)
 
static NSString *const kOOLogPListWrongType
 
static NSData * CopyDataFromFile(NSString *path)
 
NSDictionary * OODictionaryFromData(NSData *data, NSString *whereFrom)