]> git.saurik.com Git - cydia.git/commitdiff
Reformat UIHardware$, using autorelease instead of explicit release.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 4 Oct 2010 11:11:27 +0000 (04:11 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 4 Oct 2010 11:13:11 +0000 (04:13 -0700)
Cydia.mm

index b0a9e14782b82978d20210c10c0b9acdee9be164..ee8c7d6cab0ec3e513af4dcf4f29f3962786feab 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -8663,19 +8663,20 @@ static NSNumber *shouldPlayKeyboardSounds;
 
 Class $UIHardware;
 
-MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int soundIndex) {
-    switch (soundIndex) {
+MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int sound) {
+    switch (sound) {
         case 1104: // Keyboard Button Clicked
         case 1105: // Keyboard Delete Repeated
-            if (!shouldPlayKeyboardSounds) {
-                NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"];
-                shouldPlayKeyboardSounds = [[dict objectForKey:@"keyboard"] ?: (id)kCFBooleanTrue retain];
-                [dict release];
+            if (shouldPlayKeyboardSounds == nil) {
+                NSDictionary *dict([[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"] autorelease]);
+                shouldPlayKeyboardSounds = [([dict objectForKey:@"keyboard"] ?: (id) kCFBooleanTrue) retain];
             }
+
             if (![shouldPlayKeyboardSounds boolValue])
                 break;
+
         default:
-            _UIHardware$_playSystemSound$(self, _cmd, soundIndex);
+            _UIHardware$_playSystemSound$(self, _cmd, sound);
     }
 }