Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logic Error: The left operand of '&' is a garbage value

I used Twitter-OAuth-iPhone to synchronize the message in my app. It's all right in iOS4.
After upgraded to iOS5, choose menu 'Product' > 'Analyze', and got a few warnings.

In NSData+Base64.m, It's warning 'The left operand of '&' is a garbage value' enter image description here

Codes here:

if( ixinbuf == 4 ) {
ixinbuf = 0;
outbuf [0] = ( inbuf[0] << 2 ) | ( ( inbuf[1] & 0x30) >> 4 );
outbuf [1] = ( ( inbuf[1] & 0x0F ) << 4 ) | ( ( inbuf[2] & 0x3C ) >> 2 );
outbuf [2] = ( ( inbuf[2] & 0x03 ) << 6 ) | ( inbuf[3] & 0x3F );

for( i = 0; i < ctcharsinbuf; i++ ) 
    [mutableData appendBytes:&outbuf[i] length:1];
}

And there are other error message: error

Sorry I am a novice and have no any clue about these problems.
Would you help me fix it please?
Many THANKS!

Edit------------
Logic loop screenshot:

removing dead ImageShack link

Full Codes: https://github.com/bengottlieb/Twitter-OAuth-iPhone/blob/master/Twitter+OAuth/MGTwitterEngine/NSData+Base64.m

Thanks any suggestion!

like image 662
Jimi Avatar asked Oct 20 '11 15:10

Jimi


People also ask

What is left operand of assignment?

The left operand in all assignment expressions must be a modifiable lvalue. The type of the expression is the type of the left operand. The value of the expression is the value of the left operand after the assignment has completed. The result of an assignment expression is not an lvalue.


1 Answers

sidestep it by initializing inbuf to an empty char array:

unsigned char inbuf[4] = {};
unsigned char outbuf[3];
like image 173
user590305 Avatar answered Oct 15 '22 16:10

user590305