Re: help with logic error
Re: help with logic error
- Subject: Re: help with logic error
- From: Appa Rao Mulpuri <email@hidden>
- Date: Thu, 12 Dec 2013 12:02:35 +0000
- Thread-topic: help with logic error
Probably you may need to add the Default case in Switch case block or else
initialize with Zero rect.
- Apparao
On 12/12/13 5:22 PM, "2551" <email@hidden> wrote:
>Hi folks
>
>I need some help with a logic error the Static Analyzer is throwing up. I
>didn¹t write this code (in fact, its a piece of Apple sample code I¹m
>resuing in my project), and I¹m not quite sure how to correct it. It goes
>like this, where the numbers [1], [2], [3], [4] represent the end points
>of the analyzer's blue arrows:
>
> [1] const NSRect bounds = [self bounds];
>
> [backgroundColor set];
> NSRectFill(dirtyRect);
>
> const NSRulerOrientation orientation = [self orientation];
> NSRect borderLineRect;
> [2] switch (orientation) {
> case NSVerticalRuler:
> borderLineRect = NSMakeRect(NSMaxX(bounds)-1.0, 0, 1.0,
>NSHeight(bounds));
> break;
> case NSHorizontalRuler:
> borderLineRect = NSMakeRect(0, 0, NSWidth(bounds), 1.0);
> break;
> }
>
> [3]if [4]([self needsToDrawRect:borderLineRect]) {
> [[backgroundColor shadowWithLevel:0.4] set];
> NSRectFill(borderLineRect);
>
>The error message says, in full: Passed-by-value struct argument contains
>uninitialized data (e.g., via the field chain: 'origin.x¹).
>
>
>Thoughts much appreciated.
>
>
>Phil
>
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>om
>
>This email sent to email@hidden
This email and any attachments are confidential, and may be legally privileged and protected by copyright. If you are not the intended recipient dissemination or copying of this email is prohibited. If you have received this in error, please notify the sender by replying by email and then delete the email completely from your system. Any views or opinions are solely those of the sender. This communication is not intended to form a binding contract unless expressly indicated to the contrary and properly authorised. Any actions taken on the basis of this email are at the recipient's own risk.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden