diff --git a/ObjectiveGit/Categories/NSData+Git.h b/ObjectiveGit/Categories/NSData+Git.h index 9054bbb1..d042332f 100644 --- a/ObjectiveGit/Categories/NSData+Git.h +++ b/ObjectiveGit/Categories/NSData+Git.h @@ -25,12 +25,10 @@ /// behavior of the returned buffer is undefined. - (git_buf)git_buf; -/// Creates a git_buf from the data and then checks if the buffer contains a NUL -/// byte. +/// Returns whether the data contains a NUL byte. - (BOOL)git_containsNUL; -/// Creates a git_buf from the data and then checks if the buffer looks like it -/// contains binary data. +/// Returns whether the data looks like it contains binary data. - (BOOL)git_isBinary; @end diff --git a/ObjectiveGit/Categories/NSData+Git.m b/ObjectiveGit/Categories/NSData+Git.m index 42d31f21..592a4b5e 100644 --- a/ObjectiveGit/Categories/NSData+Git.m +++ b/ObjectiveGit/Categories/NSData+Git.m @@ -5,8 +5,8 @@ #import "NSData+Git.h" #import "NSError+Git.h" +#import "git2/blob.h" #import "git2/errors.h" -#import "git2/deprecated.h" @implementation NSData (Git) @@ -46,13 +46,11 @@ - (git_buf)git_buf { } - (BOOL)git_containsNUL { - git_buf buffer = self.git_buf; - return git_buf_contains_nul(&buffer) > 0; + return memchr(self.bytes, '\0', self.length) != NULL; } - (BOOL)git_isBinary { - git_buf buffer = self.git_buf; - return git_buf_is_binary(&buffer) > 0; + return git_blob_data_is_binary(self.bytes, self.length) > 0; } @end