Thread: [Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[535] trunk/FuseImporter/ LibspectrumMetadata
Brought to you by:
fredm
From: <fr...@us...> - 2008-10-28 13:39:45
|
Revision: 535 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=535&view=rev Author: fredm Date: 2008-10-28 11:37:49 +0000 (Tue, 28 Oct 2008) Log Message: ----------- Log filename that causes an error. Modified Paths: -------------- trunk/FuseImporter/LibspectrumMetadataImporter.m Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2008-10-21 12:05:43 UTC (rev 534) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2008-10-28 11:37:49 UTC (rev 535) @@ -162,7 +162,7 @@ vsnprintf( err_msg, 256, format, ap ); - NSLog(@"LibspectrumMetadataImporter: error `%s': %s\n", err_msg ); + NSLog(@"LibspectrumMetadataImporter: error `%s': %s\n", fsrep, err_msg ); return LIBSPECTRUM_ERROR_NONE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2010-08-06 13:51:59
|
Revision: 644 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=644&view=rev Author: fredm Date: 2010-08-06 13:51:53 +0000 (Fri, 06 Aug 2010) Log Message: ----------- Switch to new de-facto character encoding for TZX blocks from WoS. Modified Paths: -------------- trunk/FuseImporter/LibspectrumMetadataImporter.m Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2010-05-30 12:55:56 UTC (rev 643) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2010-08-06 13:51:53 UTC (rev 644) @@ -261,20 +261,20 @@ case 0: [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + encoding:NSWindowsCP1252StringEncoding] forKey:(NSString *)kMDItemTitle]; break; case 1: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding]; + encoding:NSWindowsCP1252StringEncoding]; [attributes setObject:[info componentsSeparatedByString:@"\n"] forKey:(NSString *)kMDItemPublishers]; break; case 2: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding]; + encoding:NSWindowsCP1252StringEncoding]; [attributes setObject:[info componentsSeparatedByString:@"\n"] forKey:(NSString *)kMDItemAuthors]; break; @@ -282,44 +282,62 @@ [attributes setObject:[NSNumber numberWithInt: [[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] intValue]] + encoding:NSWindowsCP1252StringEncoding] intValue]] forKey:(NSString *)kMDItemRecordingYear]; break; case 4: // We will want to translate from "English" etc. info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding]; + encoding:NSWindowsCP1252StringEncoding]; [attributes setObject:[info componentsSeparatedByString:@"\n"] forKey:(NSString *)kMDItemLanguages]; break; case 5: [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + encoding:NSWindowsCP1252StringEncoding] forKey:@"net_sourceforge_projects_fuse_emulator_Category"]; break; case 6: - [attributes setObject:[NSString stringWithCString: - (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + { + const char *infoString = + libspectrum_tape_block_texts( block, i ); + NSMutableString *priceString = + [NSMutableString stringWithCString:infoString + encoding:NSWindowsCP1252StringEncoding]; + // WoS Infoseek has been putting HTML-style "€" in for the + // Euro symbol which isn't in the ISO Latin 1 string encoding. + // Martijn has agreed to use CP1252 (a superset of Latin 1) + // instead. + // In case of encountering some old blocks we support + // translating "€" to the correect sign as well as + // supporting CP1252 encoding on import replace it with the + // standard euro sign + [priceString replaceOccurrencesOfString:@"€" + withString:@"€" + options:NSCaseInsensitiveSearch + range:NSMakeRange(0, [priceString length])]; + // Also should consider UKP from some TZX Vault info blocks? + [attributes setObject:priceString forKey:@"net_sourceforge_projects_fuse_emulator_Price"]; + } break; case 7: [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + encoding:NSWindowsCP1252StringEncoding] forKey:@"net_sourceforge_projects_fuse_emulator_Loader"]; break; case 8: [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + encoding:NSWindowsCP1252StringEncoding] forKey:@"net_sourceforge_projects_fuse_emulator_Origin"]; break; case 255: [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSISOLatin1StringEncoding] + encoding:NSWindowsCP1252StringEncoding] forKey:(NSString *)kMDItemComment]; break; default: NSLog(@"(Unknown string): %s", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2012-10-29 12:08:43
|
Revision: 696 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=696&view=rev Author: fredm Date: 2012-10-29 12:08:37 +0000 (Mon, 29 Oct 2012) Log Message: ----------- Remove some redundant NSString creation. Modified Paths: -------------- trunk/FuseImporter/LibspectrumMetadataImporter.m Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-10-29 12:07:19 UTC (rev 695) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-10-29 12:08:37 UTC (rev 696) @@ -113,15 +113,15 @@ libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS3)]]; return; default: - [machines addObject:[NSString stringWithString:@"Unknown machine"]]; + [machines addObject:@"Unknown machine"]; return; } case 3: switch( id ) { case 0: - [peripherals addObject:[NSString stringWithString:@"AY-3-8192"]]; return; + [peripherals addObject:@"AY-3-8192"]; return; default: - [peripherals addObject:[NSString stringWithString:@"Unknown sound device"]]; + [peripherals addObject:@"Unknown sound device"]; return; } case 4: @@ -147,7 +147,7 @@ libspectrum_joystick_name(LIBSPECTRUM_JOYSTICK_FULLER)]]; return; default: - [peripherals addObject:[NSString stringWithString:@"Unknown joystick"]]; + [peripherals addObject:@"Unknown joystick"]; return; } default: NSLog(@"Unknown type"); return; @@ -440,28 +440,26 @@ /* FIXME: Other connected hardware? */ if( libspectrum_snap_zxatasp_active( snap ) ) { - [peripherals addObject:[NSString stringWithString:@"ZXATASP"]]; + [peripherals addObject:@"ZXATASP"]; } if( libspectrum_snap_zxcf_active( snap ) ) { - [peripherals addObject:[NSString stringWithString:@"ZXCF"]]; + [peripherals addObject:@"ZXCF"]; } if( libspectrum_snap_interface1_active( snap ) ) { - [peripherals addObject: - [NSString stringWithString:@"Interface I"]]; + [peripherals addObject:@"Interface I"]; } if( libspectrum_snap_interface2_active( snap ) ) { - [peripherals addObject: - [NSString stringWithString:@"Interface II Cartridge"]]; + [peripherals addObject:@"Interface II Cartridge"]; } if( libspectrum_snap_dock_active( snap ) && libspectrum_snap_machine(snap) != LIBSPECTRUM_MACHINE_SE ) { - [peripherals addObject:[NSString stringWithString:@"Timex Dock Cartidge"]]; + [peripherals addObject:@"Timex Dock Cartidge"]; } if( libspectrum_snap_beta_active( snap ) ) { - [peripherals addObject:[NSString stringWithString:@"Beta Disk"]]; + [peripherals addObject:@"Beta Disk"]; } if( libspectrum_snap_plusd_active( snap ) ) { - [peripherals addObject:[NSString stringWithString:@"+D Disk"]]; + [peripherals addObject:@"+D Disk"]; } if( [peripherals count] ) { @@ -546,15 +544,15 @@ switch( length ) { case HICOLOUR_SCR_SIZE: - mode = [NSString stringWithString:@"HiColour"]; + mode = @"HiColour"; width = 256; break; case STANDARD_SCR_SIZE: - mode = [NSString stringWithString:@"Standard"]; + mode = @"Standard"; width = 256; break; case HIRES_SCR_SIZE: - mode = [NSString stringWithString:@"HiRes"]; + mode = @"HiRes"; width = 512; break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2012-11-02 10:22:42
|
Revision: 700 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=700&view=rev Author: fredm Date: 2012-11-02 10:22:35 +0000 (Fri, 02 Nov 2012) Log Message: ----------- Convert to modern Objective-C syntax. Modified Paths: -------------- trunk/FuseImporter/LibspectrumMetadataImporter.m Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-10-29 12:28:20 UTC (rev 699) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-11-02 10:22:35 UTC (rev 700) @@ -37,6 +37,10 @@ #include <libspectrum.h> +static libspectrum_error +libspectrum_importer_error_function( libspectrum_error error, + const char *format, va_list ap ); + static char fsrep[MAXPATHLEN+1]; static int @@ -87,30 +91,24 @@ case 0: switch( id ) { case 0: - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_16)]]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_16))]; return; case 1: - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_48)]]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_48))]; return; case 2: [machines addObject:[NSString stringWithFormat:@"%s (Issue 1)", libspectrum_machine_name(LIBSPECTRUM_MACHINE_48)]]; return; case 3: - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_128)]]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_128))]; return; case 4: - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS2)]]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS2))]; return; case 5: - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS2A)]]; - [machines addObject:[NSString stringWithUTF8String: - libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS3)]]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS2A))]; + [machines addObject:@(libspectrum_machine_name(LIBSPECTRUM_MACHINE_PLUS3))]; return; default: [machines addObject:@"Unknown machine"]; @@ -154,7 +152,7 @@ } } -libspectrum_error +static libspectrum_error libspectrum_importer_error_function( libspectrum_error error, const char *format, va_list ap ) { @@ -190,8 +188,7 @@ return NO; } - [attributes setObject:[NSNumber numberWithInt:1] - forKey:(NSString *)kMDItemAudioChannelCount]; + attributes[(NSString *)kMDItemAudioChannelCount] = @1; block = libspectrum_tape_iterator_init( &iterator, tape ); @@ -259,44 +256,37 @@ switch( libspectrum_tape_block_ids( block, i ) ) { case 0: - [attributes setObject:[NSString stringWithCString: + attributes[(NSString *)kMDItemTitle] = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] - forKey:(NSString *)kMDItemTitle]; + encoding:NSWindowsCP1252StringEncoding]; break; case 1: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - [attributes setObject:[info componentsSeparatedByString:@"\n"] - forKey:(NSString *)kMDItemPublishers]; + attributes[(NSString *)kMDItemPublishers] = [info componentsSeparatedByString:@"\n"]; break; case 2: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - [attributes setObject:[info componentsSeparatedByString:@"\n"] - forKey:(NSString *)kMDItemAuthors]; + attributes[(NSString *)kMDItemAuthors] = [info componentsSeparatedByString:@"\n"]; break; case 3: - [attributes setObject:[NSNumber numberWithInt: - [[NSString stringWithCString: + attributes[(NSString *)kMDItemRecordingYear] = @([[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] intValue]] - forKey:(NSString *)kMDItemRecordingYear]; + encoding:NSWindowsCP1252StringEncoding] intValue]); break; case 4: // We will want to translate from "English" etc. info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - [attributes setObject:[info componentsSeparatedByString:@"\n"] - forKey:(NSString *)kMDItemLanguages]; + attributes[(NSString *)kMDItemLanguages] = [info componentsSeparatedByString:@"\n"]; break; case 5: - [attributes setObject:[NSString stringWithCString: + attributes[@"net_sourceforge_projects_fuse_emulator_Category"] = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] - forKey:@"net_sourceforge_projects_fuse_emulator_Category"]; + encoding:NSWindowsCP1252StringEncoding]; break; case 6: { @@ -318,27 +308,23 @@ options:NSCaseInsensitiveSearch range:NSMakeRange(0, [priceString length])]; // Also should consider UKP from some TZX Vault info blocks? - [attributes setObject:priceString - forKey:@"net_sourceforge_projects_fuse_emulator_Price"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Price"] = priceString; } break; case 7: - [attributes setObject:[NSString stringWithCString: + attributes[@"net_sourceforge_projects_fuse_emulator_Loader"] = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] - forKey:@"net_sourceforge_projects_fuse_emulator_Loader"]; + encoding:NSWindowsCP1252StringEncoding]; break; case 8: - [attributes setObject:[NSString stringWithCString: + attributes[@"net_sourceforge_projects_fuse_emulator_Origin"] = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] - forKey:@"net_sourceforge_projects_fuse_emulator_Origin"]; + encoding:NSWindowsCP1252StringEncoding]; break; case 255: - [attributes setObject:[NSString stringWithCString: + attributes[(NSString *)kMDItemComment] = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] - forKey:(NSString *)kMDItemComment]; + encoding:NSWindowsCP1252StringEncoding]; break; default: NSLog(@"(Unknown string): %s", (const char *)libspectrum_tape_block_texts( block, i )); @@ -364,12 +350,10 @@ } } if( [machines count] ) { - [attributes setObject:machines - forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = machines; } if( [peripherals count] ) { - [attributes setObject:peripherals - forKey:@"net_sourceforge_projects_fuse_emulator_Peripherals"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Peripherals"] = peripherals; } break; @@ -395,8 +379,7 @@ float duration = tstates_total/3500000.0; - [attributes setObject:[NSNumber numberWithFloat:duration] - forKey:(NSString *)kMDItemDurationSeconds]; + attributes[(NSString *)kMDItemDurationSeconds] = @(duration); error = libspectrum_tape_free( tape ); if( error != LIBSPECTRUM_ERROR_NONE ) { @@ -416,15 +399,10 @@ if( !libspectrum_snap_issue2(snap) && (libspectrum_snap_machine(snap) == LIBSPECTRUM_MACHINE_48 || libspectrum_snap_machine(snap) == LIBSPECTRUM_MACHINE_16) ) { - [attributes setObject:[NSArray arrayWithObject: - [NSString stringWithFormat:@"%s (Issue 1)", - libspectrum_machine_name(libspectrum_snap_machine(snap))]] - forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = @[[NSString stringWithFormat:@"%s (Issue 1)", + libspectrum_machine_name(libspectrum_snap_machine(snap))]]; } else { - [attributes setObject:[NSArray arrayWithObject: - [NSString stringWithUTF8String: - libspectrum_machine_name(libspectrum_snap_machine(snap))]] - forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = @[@(libspectrum_machine_name(libspectrum_snap_machine(snap)))]; } if( libspectrum_snap_joystick_active_count( snap ) ) { @@ -463,8 +441,7 @@ } if( [peripherals count] ) { - [attributes setObject:peripherals - forKey:@"net_sourceforge_projects_fuse_emulator_Peripherals"]; + attributes[@"net_sourceforge_projects_fuse_emulator_Peripherals"] = peripherals; } return error ? NO : YES; @@ -560,16 +537,12 @@ return NO; } - [attributes setObject:[NSNumber numberWithInt:width] - forKey:(NSString *)kMDItemPixelWidth]; - [attributes setObject:[NSNumber numberWithInt:192] - forKey:(NSString *)kMDItemPixelHeight]; - [attributes setObject:[NSNumber numberWithInt:0] - forKey:(NSString *)kMDItemOrientation]; - [attributes setObject:@"RGB" forKey:(NSString *)kMDItemColorSpace]; + attributes[(NSString *)kMDItemPixelWidth] = @(width); + attributes[(NSString *)kMDItemPixelHeight] = @192; + attributes[(NSString *)kMDItemOrientation] = @0; + attributes[(NSString *)kMDItemColorSpace] = @"RGB"; - [attributes setObject:mode - forKey:@"net_sourceforge_projects_fuse_emulator_GraphicsMode"]; + attributes[@"net_sourceforge_projects_fuse_emulator_GraphicsMode"] = mode; return YES; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fr...@us...> - 2012-11-23 12:20:55
|
Revision: 708 http://sourceforge.net/p/fuse-for-macosx/code/708 Author: fredm Date: 2012-11-23 12:20:54 +0000 (Fri, 23 Nov 2012) Log Message: ----------- Undo overzealous modernisation. Modified Paths: -------------- trunk/FuseImporter/LibspectrumMetadataImporter.m Modified: trunk/FuseImporter/LibspectrumMetadataImporter.m =================================================================== --- trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-11-23 11:26:32 UTC (rev 707) +++ trunk/FuseImporter/LibspectrumMetadataImporter.m 2012-11-23 12:20:54 UTC (rev 708) @@ -188,7 +188,8 @@ return NO; } - attributes[(NSString *)kMDItemAudioChannelCount] = @1; + [attributes setObject:[NSNumber numberWithInt:1] + forKey:(NSString *)kMDItemAudioChannelCount]; block = libspectrum_tape_iterator_init( &iterator, tape ); @@ -256,37 +257,44 @@ switch( libspectrum_tape_block_ids( block, i ) ) { case 0: - attributes[(NSString *)kMDItemTitle] = [NSString stringWithCString: + [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding]; + encoding:NSWindowsCP1252StringEncoding] + forKey:(NSString *)kMDItemTitle]; break; case 1: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - attributes[(NSString *)kMDItemPublishers] = [info componentsSeparatedByString:@"\n"]; + [attributes setObject:[info componentsSeparatedByString:@"\n"] + forKey:(NSString *)kMDItemPublishers]; break; case 2: info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - attributes[(NSString *)kMDItemAuthors] = [info componentsSeparatedByString:@"\n"]; + [attributes setObject:[info componentsSeparatedByString:@"\n"] + forKey:(NSString *)kMDItemAuthors]; break; case 3: - attributes[(NSString *)kMDItemRecordingYear] = @([[NSString stringWithCString: + [attributes setObject:[NSNumber numberWithInt: + [[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding] intValue]); + encoding:NSWindowsCP1252StringEncoding] intValue]] + forKey:(NSString *)kMDItemRecordingYear]; break; case 4: // We will want to translate from "English" etc. info = [NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) encoding:NSWindowsCP1252StringEncoding]; - attributes[(NSString *)kMDItemLanguages] = [info componentsSeparatedByString:@"\n"]; + [attributes setObject:[info componentsSeparatedByString:@"\n"] + forKey:(NSString *)kMDItemLanguages]; break; case 5: - attributes[@"net_sourceforge_projects_fuse_emulator_Category"] = [NSString stringWithCString: + [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding]; + encoding:NSWindowsCP1252StringEncoding] + forKey:@"net_sourceforge_projects_fuse_emulator_Category"]; break; case 6: { @@ -308,23 +316,27 @@ options:NSCaseInsensitiveSearch range:NSMakeRange(0, [priceString length])]; // Also should consider UKP from some TZX Vault info blocks? - attributes[@"net_sourceforge_projects_fuse_emulator_Price"] = priceString; + [attributes setObject:priceString + forKey:@"net_sourceforge_projects_fuse_emulator_Price"]; } break; case 7: - attributes[@"net_sourceforge_projects_fuse_emulator_Loader"] = [NSString stringWithCString: + [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding]; + encoding:NSWindowsCP1252StringEncoding] + forKey:@"net_sourceforge_projects_fuse_emulator_Loader"]; break; case 8: - attributes[@"net_sourceforge_projects_fuse_emulator_Origin"] = [NSString stringWithCString: + [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding]; + encoding:NSWindowsCP1252StringEncoding] + forKey:@"net_sourceforge_projects_fuse_emulator_Origin"]; break; case 255: - attributes[(NSString *)kMDItemComment] = [NSString stringWithCString: + [attributes setObject:[NSString stringWithCString: (const char *)libspectrum_tape_block_texts( block, i ) - encoding:NSWindowsCP1252StringEncoding]; + encoding:NSWindowsCP1252StringEncoding] + forKey:(NSString *)kMDItemComment]; break; default: NSLog(@"(Unknown string): %s", (const char *)libspectrum_tape_block_texts( block, i )); @@ -350,10 +362,12 @@ } } if( [machines count] ) { - attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = machines; + [attributes setObject:machines + forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; } if( [peripherals count] ) { - attributes[@"net_sourceforge_projects_fuse_emulator_Peripherals"] = peripherals; + [attributes setObject:peripherals + forKey:@"net_sourceforge_projects_fuse_emulator_Peripherals"]; } break; @@ -379,7 +393,8 @@ float duration = tstates_total/3500000.0; - attributes[(NSString *)kMDItemDurationSeconds] = @(duration); + [attributes setObject:[NSNumber numberWithFloat:duration] + forKey:(NSString *)kMDItemDurationSeconds]; error = libspectrum_tape_free( tape ); if( error != LIBSPECTRUM_ERROR_NONE ) { @@ -399,10 +414,15 @@ if( !libspectrum_snap_issue2(snap) && (libspectrum_snap_machine(snap) == LIBSPECTRUM_MACHINE_48 || libspectrum_snap_machine(snap) == LIBSPECTRUM_MACHINE_16) ) { - attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = @[[NSString stringWithFormat:@"%s (Issue 1)", - libspectrum_machine_name(libspectrum_snap_machine(snap))]]; + [attributes setObject:[NSArray arrayWithObject: + [NSString stringWithFormat:@"%s (Issue 1)", + libspectrum_machine_name(libspectrum_snap_machine(snap))]] + forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; } else { - attributes[@"net_sourceforge_projects_fuse_emulator_Machines"] = @[@(libspectrum_machine_name(libspectrum_snap_machine(snap)))]; + [attributes setObject:[NSArray arrayWithObject: + [NSString stringWithUTF8String: + libspectrum_machine_name(libspectrum_snap_machine(snap))]] + forKey:@"net_sourceforge_projects_fuse_emulator_Machines"]; } if( libspectrum_snap_joystick_active_count( snap ) ) { @@ -441,7 +461,8 @@ } if( [peripherals count] ) { - attributes[@"net_sourceforge_projects_fuse_emulator_Peripherals"] = peripherals; + [attributes setObject:peripherals + forKey:@"net_sourceforge_projects_fuse_emulator_Peripherals"]; } return error ? NO : YES; @@ -537,12 +558,16 @@ return NO; } - attributes[(NSString *)kMDItemPixelWidth] = @(width); - attributes[(NSString *)kMDItemPixelHeight] = @192; - attributes[(NSString *)kMDItemOrientation] = @0; - attributes[(NSString *)kMDItemColorSpace] = @"RGB"; + [attributes setObject:[NSNumber numberWithInt:width] + forKey:(NSString *)kMDItemPixelWidth]; + [attributes setObject:[NSNumber numberWithInt:192] + forKey:(NSString *)kMDItemPixelHeight]; + [attributes setObject:[NSNumber numberWithInt:0] + forKey:(NSString *)kMDItemOrientation]; + [attributes setObject:@"RGB" forKey:(NSString *)kMDItemColorSpace]; - attributes[@"net_sourceforge_projects_fuse_emulator_GraphicsMode"] = mode; + [attributes setObject:mode + forKey:@"net_sourceforge_projects_fuse_emulator_GraphicsMode"]; return YES; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |