Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix static analyzer warning #11

Closed
wants to merge 1 commit into from

4 participants

@ysoldak

XCode's "Analyze" action discovers several issues in "MPLib/lib/NSData_Base64/NSData+MPBase64.m"
They all can be fixed by nullifying respective array with a single line.

iOS developers usually do Analyze before submitting their app to review and issues in a lib would not make them happy.

(This is not my solution, but I've just merged it to my fork from another fork appsocial@6fe14ab)

@pmj

How about changing this to

unsigned char accumulated[BASE64_UNIT_SIZE] = {0};

That's a lot shorter and, IMO, clearer. (As per the C standard, the remaining elements will also be initialised to 0)

@kasrak

This has been fixed. Thanks!

@kasrak kasrak closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2011
  1. @kaler

    Fix static analyzer warning

    kaler authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  MPLib/lib/NSData_Base64/NSData+MPBase64.m
View
1  MPLib/lib/NSData_Base64/NSData+MPBase64.m
@@ -88,6 +88,7 @@
// Accumulate 4 valid characters (ignore everything else)
//
unsigned char accumulated[BASE64_UNIT_SIZE];
+ memset(accumulated, 0, sizeof(unsigned char) * BASE64_UNIT_SIZE);
size_t accumulateIndex = 0;
while (i < length)
{
Something went wrong with that request. Please try again.