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" <2551p...@gmail.com> 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 (Cocoa-dev@lists.apple.com) > >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: >https://lists.apple.com/mailman/options/cocoa-dev/apparaom%40ivycomptech.c >om > >This email sent to appar...@ivycomptech.com 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com