• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
help with logic error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with logic error


  • Subject: help with logic error
  • From: 2551 <email@hidden>
  • Date: Thu, 12 Dec 2013 18:52:18 +0700

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: help with logic error
      • From: Uli Kusterer <email@hidden>
    • Re: help with logic error
      • From: Appa Rao Mulpuri <email@hidden>
    • Re: help with logic error
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Threaded drawing
  • Next by Date: Re: Threaded drawing - JPEG
  • Previous by thread: Re: iPad keyboards
  • Next by thread: Re: help with logic error
  • Index(es):
    • Date
    • Thread