Revision: 5869
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5869&view=rev
Author:   hofman
Date:     2009-10-12 16:56:00 +0000 (Mon, 12 Oct 2009)

Log Message:
-----------
return (NSNotFound, 0) when searching for empty data, as the 10.6 method does

Modified Paths:
--------------
    trunk/NSData_SKExtensions.m

Modified: trunk/NSData_SKExtensions.m
===================================================================
--- trunk/NSData_SKExtensions.m 2009-10-12 16:53:37 UTC (rev 5868)
+++ trunk/NSData_SKExtensions.m 2009-10-12 16:56:00 UTC (rev 5869)
@@ -56,9 +56,7 @@
     BOOL backward = (mask & NSDataSearchBackwards) != 0;
     BOOL anchored = (mask & NSDataSearchAnchored) != 0;
     
-    if (patternLength == 0)
-        return NSMakeRange(searchRange.location, 0);
-    if (patternLength > searchRange.length) {
+    if (patternLength == 0 || patternLength > searchRange.length) {
         // This test is a nice shortcut, but it's also necessary to avoid 
crashing: zero-length CFDatas will sometimes(?) return NULL for their bytes 
pointer, and the resulting pointer arithmetic can underflow.
         return NSMakeRange(NSNotFound, 0);
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to