if( [fn caseInsensitiveCompare:s] ) break;
   NSLog(@"%@ != %@", fn, s);


compare methods return NSOrderedSame (==0) if the strings are the same so
your test here seems incorrect.

On Sat, Mar 21, 2009 at 7:26 PM, Wesley Spikes <wesley.spi...@gmail.com>wrote:

> Odds are, it's a bug that is based entirely in my code, but it's bugging me
> now, and I've hit a road block mentally. Any help provided would be greatly
> appreciated.
>
> Please excuse the crypticness of this message, but I'm only able to
> disclose
> the parts of the code in question.
>
> The basic overview of what's happening in the code is [classInst
> findIndexOfFilename:inData:] is being called, with the filename being
> passed
> in from a directory enumeration. A manual browsing through the data makes
> it
> look like all aspects of it appear like it should work.
>
> If anything further needs to be known, just let me know, I'll likely be
> able
> to provide.
>
> At the moment, I'm pretty sure it should work by the looks of it. What's
> really bothersome about it to me is that the output of the first error
> shows
> that the entry at 10:28:17.401 is the only entry that is outputted by
> findIndexOfFilename:inData:, and none of the subsequent entries are
> presented as having been checked. *scratches head*
>
> ==== First failed output record in the XCode console
> [Session started at 2009-03-21 10:28:17 -0700.]
> 2009-03-21 10:28:17.400 IX2[52319:10b] "Contents"
> 2009-03-21 10:28:17.401 IX2[52319:10b] "Contents" != "Contents"
> 2009-03-21 10:28:17.407 IX2[52319:10b] Hmm, it appears that "Contents" is
> not in passed data pointer. pname=<<cut path>>/Contents
>
> ==== The code to find the index -- before this is called, the caller is
> currently calling NSLog(@"%@", fn);
> - (int) findIndexOfFilename:(NSString*)fn
>                     inData:(S_KH_DATA*)data
> {
>  int ctr       = 0;
>  NSString *s;
>
>  // this would indicate a failure in our build process
>  assert( data[0].filename != NULL );
>
>  do {
>    s = [NSString stringWithCString:data[ctr].filename
> encoding:NSUTF8StringEncoding];
>    if( [fn length] != [s length] ) continue; // don't go and do a full
> compare if diff lens
>    if( [fn caseInsensitiveCompare:s] ) break;
>    NSLog(@"%@ != %@", fn, s);
>  } while( data[++ctr].filename != NULL );
>
>  if( data[ctr].filename != NULL )
>    return ctr;
>  return -1;
> }
>
> ==== The structure that is the data[x]
> typedef struct _S_KH_DATA
>  {
>    uint8_t   fs_type;                      // 1 is directory, 2 is plain
> file, 3 is executable file, 0 is unset/ignore
>    char     *filename;                     // filename is the name of the
> filesystem
>    uint8_t   hash[SHA512_DIGEST_LENGTH];   // sha2-512
>  } S_KH_DATA;
>
> ==== The data being passed (first entries only, abbreviated)
> S_KH_DATA kh_data [] = {
>  { KHD_TYPE_DIRECTORY, "", 0 },
>  { KHD_TYPE_DIRECTORY, "Contents", 0 },
>  { KHD_TYPE_DIRECTORY, "Contents/MacOS", 0 },
>  { KHD_TYPE_PLAIN_FILE, "Contents/Info.plist", { 0x82, ..., 0xe3, } },
>  ...
>  { 0, NULL, 0 },
> };
>
>
> --
> Wesley Spikes
> wesley.spi...@gmail.com
> _______________________________________________
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to jja...@gmail.com
>
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to