incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: [CB-1164] Fix warnings and analyzer issues reported with the newer LLVM in Xcode 4.4
Date Mon, 30 Jul 2012 23:11:42 GMT
Updated Branches:
  refs/heads/master 2999028c7 -> 75bcbce99


[CB-1164] Fix warnings and analyzer issues reported with the newer LLVM in Xcode 4.4


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/75bcbce9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/75bcbce9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/75bcbce9

Branch: refs/heads/master
Commit: 75bcbce991b291eecf5a8a85d3d73f633cebc08e
Parents: 2999028
Author: Shazron Abdullah <shazron@apache.org>
Authored: Mon Jul 30 16:11:35 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Mon Jul 30 16:11:35 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVContact.m    |    2 +-
 CordovaLib/Classes/JSON/JSONKit.m  |   40 ++++++++++++++++--------------
 CordovaLib/Classes/NSData+Base64.m |    2 +-
 3 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/75bcbce9/CordovaLib/Classes/CDVContact.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVContact.m b/CordovaLib/Classes/CDVContact.m
index 9d63aee..73f4b73 100644
--- a/CordovaLib/Classes/CDVContact.m
+++ b/CordovaLib/Classes/CDVContact.m
@@ -440,7 +440,7 @@ static NSDictionary*	org_apache_cordova_contacts_defaultFields = nil;
 	bool bSuccess = ABRecordRemoveValue(aRecord, aProperty, &err);
 	if(!bSuccess){
 		CFStringRef errDescription = CFErrorCopyDescription(err);
-		NSLog(@"Unable to remove property %@: %@", aProperty, errDescription );
+		NSLog(@"Unable to remove property %d: %@", aProperty, errDescription );
 		CFRelease(errDescription);
 	}
 	return bSuccess;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/75bcbce9/CordovaLib/Classes/JSON/JSONKit.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/JSON/JSONKit.m b/CordovaLib/Classes/JSON/JSONKit.m
index b296259..15a7171 100644
--- a/CordovaLib/Classes/JSON/JSONKit.m
+++ b/CordovaLib/Classes/JSON/JSONKit.m
@@ -742,14 +742,16 @@ static void _CDVJKArrayRemoveObjectAtIndex(CDVJKArray *array, NSUInteger
objectI
 - (void)getObjects:(id *)objectsPtr range:(NSRange)range
 {
   NSParameterAssert((objects != NULL) && (count <= capacity));
-  if((objectsPtr     == NULL)  && (NSMaxRange(range) > 0UL))   { [NSException
raise:NSRangeException format:@"*** -[%@ %@]: pointer to objects array is NULL but range length
is %lu", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSMaxRange(range)];
       }
-  if((range.location >  count) || (NSMaxRange(range) > count)) { [NSException raise:NSRangeException
format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)",                          NSStringFromClass([self
class]), NSStringFromSelector(_cmd), NSMaxRange(range), count]; }
-  memcpy(objectsPtr, objects + range.location, range.length * sizeof(id));
+  if((objectsPtr     == NULL)  && (NSMaxRange(range) > 0UL))   { [NSException
raise:NSRangeException format:@"*** -[%@ %@]: pointer to objects array is NULL but range length
is %u", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSMaxRange(range)]; 
      }
+  if((range.location >  count) || (NSMaxRange(range) > count)) { [NSException raise:NSRangeException
format:@"*** -[%@ %@]: index (%u) beyond bounds (%u)",                          NSStringFromClass([self
class]), NSStringFromSelector(_cmd), NSMaxRange(range), count]; }
+  if (objectsPtr != NULL) {
+      memcpy(objectsPtr, objects + range.location, range.length * sizeof(id));
+  }
 }
 
 - (id)objectAtIndex:(NSUInteger)objectIndex
 {
-  if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]:
index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
+  if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]:
index (%u) beyond bounds (%u)", NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
   NSParameterAssert((objects != NULL) && (count <= capacity) && (objects[objectIndex]
!= NULL));
   return(objects[objectIndex]);
 }
@@ -770,7 +772,7 @@ static void _CDVJKArrayRemoveObjectAtIndex(CDVJKArray *array, NSUInteger
objectI
 {
   if(mutations   == 0UL)   { [NSException raise:NSInternalInconsistencyException format:@"***
-[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
   if(anObject    == NULL)  { [NSException raise:NSInvalidArgumentException       format:@"***
-[%@ %@]: attempt to insert nil",                    NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
-  if(objectIndex >  count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%lu) beyond bounds (%lu)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count + 1UL]; }
+  if(objectIndex >  count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%u) beyond bounds (%lu)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count + 1UL]; }
 #ifdef __clang_analyzer__
   [anObject retain]; // Stupid clang analyzer...  Issue #19.
 #else
@@ -783,7 +785,7 @@ static void _CDVJKArrayRemoveObjectAtIndex(CDVJKArray *array, NSUInteger
objectI
 - (void)removeObjectAtIndex:(NSUInteger)objectIndex
 {
   if(mutations   == 0UL)   { [NSException raise:NSInternalInconsistencyException format:@"***
-[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
-  if(objectIndex >= count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%lu) beyond bounds (%lu)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
+  if(objectIndex >= count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%u) beyond bounds (%u)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
   _CDVJKArrayRemoveObjectAtIndex(self, objectIndex);
   mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL;
 }
@@ -792,7 +794,7 @@ static void _CDVJKArrayRemoveObjectAtIndex(CDVJKArray *array, NSUInteger
objectI
 {
   if(mutations   == 0UL)   { [NSException raise:NSInternalInconsistencyException format:@"***
-[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
   if(anObject    == NULL)  { [NSException raise:NSInvalidArgumentException       format:@"***
-[%@ %@]: attempt to insert nil",                    NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
-  if(objectIndex >= count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%lu) beyond bounds (%lu)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
+  if(objectIndex >= count) { [NSException raise:NSRangeException                 format:@"***
-[%@ %@]: index (%u) beyond bounds (%u)",          NSStringFromClass([self class]), NSStringFromSelector(_cmd),
objectIndex, count]; }
 #ifdef __clang_analyzer__
   [anObject retain]; // Stupid clang analyzer...  Issue #19.
 #else
@@ -2595,18 +2597,18 @@ static int cdvjk_encode_add_atom_to_buffer(CDVJKEncodeState *encodeState,
void *
   BOOL workAroundMacOSXABIBreakingBug = NO;
   if(CDVJK_EXPECT_F(((NSUInteger)object) & 0x1)) { workAroundMacOSXABIBreakingBug = YES;
goto slowClassLookup; }
 
-       if(CDVJK_EXPECT_T(object->isa == encodeState->fastClassLookup.stringClass))
    { isClass = CDVJKClassString;     }
-  else if(CDVJK_EXPECT_T(object->isa == encodeState->fastClassLookup.numberClass))
    { isClass = CDVJKClassNumber;     }
-  else if(CDVJK_EXPECT_T(object->isa == encodeState->fastClassLookup.dictionaryClass))
{ isClass = CDVJKClassDictionary; }
-  else if(CDVJK_EXPECT_T(object->isa == encodeState->fastClassLookup.arrayClass)) 
    { isClass = CDVJKClassArray;      }
-  else if(CDVJK_EXPECT_T(object->isa == encodeState->fastClassLookup.nullClass))  
    { isClass = CDVJKClassNull;       }
+       if(CDVJK_EXPECT_T(object_getClass(object) == encodeState->fastClassLookup.stringClass))
    { isClass = CDVJKClassString;     }
+  else if(CDVJK_EXPECT_T(object_getClass(object) == encodeState->fastClassLookup.numberClass))
    { isClass = CDVJKClassNumber;     }
+  else if(CDVJK_EXPECT_T(object_getClass(object) == encodeState->fastClassLookup.dictionaryClass))
{ isClass = CDVJKClassDictionary; }
+  else if(CDVJK_EXPECT_T(object_getClass(object) == encodeState->fastClassLookup.arrayClass))
     { isClass = CDVJKClassArray;      }
+  else if(CDVJK_EXPECT_T(object_getClass(object) == encodeState->fastClassLookup.nullClass))
      { isClass = CDVJKClassNull;       }
   else {
   slowClassLookup:
-         if(CDVJK_EXPECT_T([object isKindOfClass:[NSString     class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.stringClass     = object->isa; } isClass = CDVJKClassString;
    }
-    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSNumber     class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.numberClass     = object->isa; } isClass = CDVJKClassNumber;
    }
-    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSDictionary class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.dictionaryClass = object->isa; } isClass = CDVJKClassDictionary;
}
-    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSArray      class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.arrayClass      = object->isa; } isClass = CDVJKClassArray;
     }
-    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSNull       class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.nullClass       = object->isa; } isClass = CDVJKClassNull;
      }
+         if(CDVJK_EXPECT_T([object isKindOfClass:[NSString     class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.stringClass     = object_getClass(object); } isClass
= CDVJKClassString;     }
+    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSNumber     class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.numberClass     = object_getClass(object); } isClass
= CDVJKClassNumber;     }
+    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSDictionary class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.dictionaryClass = object_getClass(object); } isClass
= CDVJKClassDictionary; }
+    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSArray      class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.arrayClass      = object_getClass(object); } isClass
= CDVJKClassArray;      }
+    else if(CDVJK_EXPECT_T([object isKindOfClass:[NSNull       class]])) { if(workAroundMacOSXABIBreakingBug
== NO) { encodeState->fastClassLookup.nullClass       = object_getClass(object); } isClass
= CDVJKClassNull;       }
     else {
       if((rerunningAfterClassFormatter == NO) && (
 #ifdef __BLOCKS__
@@ -2788,7 +2790,7 @@ static int cdvjk_encode_add_atom_to_buffer(CDVJKEncodeState *encodeState,
void *
           for(id keyObject in enumerateObject) {
             if(CDVJK_EXPECT_T(printComma)) { if(CDVJK_EXPECT_F(cdvjk_encode_write1(encodeState,
0L, ","))) { return(1); } }
             printComma = 1;
-            if(CDVJK_EXPECT_F((keyObject->isa      != encodeState->fastClassLookup.stringClass))
&& CDVJK_EXPECT_F(([keyObject   isKindOfClass:[NSString class]] == NO))) { cdvjk_encode_error(encodeState,
@"Key must be a string object."); return(1); }
+            if(CDVJK_EXPECT_F((object_getClass(keyObject)      != encodeState->fastClassLookup.stringClass))
&& CDVJK_EXPECT_F(([keyObject   isKindOfClass:[NSString class]] == NO))) { cdvjk_encode_error(encodeState,
@"Key must be a string object."); return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_add_atom_to_buffer(encodeState, keyObject))) 
                                                      { return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_write1(encodeState, 0L, ":")))               
                                                      { return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_add_atom_to_buffer(encodeState, (void *)CFDictionaryGetValue((CFDictionaryRef)object,
keyObject)))) { return(1); }
@@ -2799,7 +2801,7 @@ static int cdvjk_encode_add_atom_to_buffer(CDVJKEncodeState *encodeState,
void *
           for(idx = 0L; idx < dictionaryCount; idx++) {
             if(CDVJK_EXPECT_T(printComma)) { if(CDVJK_EXPECT_F(cdvjk_encode_write1(encodeState,
0L, ","))) { return(1); } }
             printComma = 1;
-            if(CDVJK_EXPECT_F(((id)keys[idx])->isa != encodeState->fastClassLookup.stringClass)
&& CDVJK_EXPECT_F([(id)keys[idx] isKindOfClass:[NSString class]] == NO)) { cdvjk_encode_error(encodeState,
@"Key must be a string object."); return(1); }
+            if(CDVJK_EXPECT_F(object_getClass(((id)keys[idx])) != encodeState->fastClassLookup.stringClass)
&& CDVJK_EXPECT_F([(id)keys[idx] isKindOfClass:[NSString class]] == NO)) { cdvjk_encode_error(encodeState,
@"Key must be a string object."); return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_add_atom_to_buffer(encodeState, keys[idx]))) 
  { return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_write1(encodeState, 0L, ":")))               
  { return(1); }
             if(CDVJK_EXPECT_F(cdvjk_encode_add_atom_to_buffer(encodeState, objects[idx])))
{ return(1); }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/75bcbce9/CordovaLib/Classes/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/NSData+Base64.m b/CordovaLib/Classes/NSData+Base64.m
index 0640607..49ddd52 100644
--- a/CordovaLib/Classes/NSData+Base64.m
+++ b/CordovaLib/Classes/NSData+Base64.m
@@ -282,7 +282,7 @@ char *CDVNewBase64Encode(
 //
 - (NSString *)base64EncodedString
 {
-	size_t outputLength;
+	size_t outputLength = 0;
 	char *outputBuffer =
 		CDVNewBase64Encode([self bytes], [self length], true, &outputLength);
 	


Mime
View raw message