Make it build. Add a README.

This commit is contained in:
Brent Simmons
2017-06-25 16:32:07 -07:00
parent 1ad4474b29
commit e9c19e427a
41 changed files with 454 additions and 485 deletions

View File

@@ -13,6 +13,7 @@
static BOOL bytesAreProbablyHTML(const char *bytes, NSUInteger numberOfBytes);
static BOOL bytesAreProbablyXML(const char *bytes, NSUInteger numberOfBytes);
static BOOL bytesStartWithStringIgnoringWhitespace(const char *string, const char *bytes, NSUInteger numberOfBytes);
static BOOL didFindString(const char *string, const char *bytes, NSUInteger numberOfBytes);
@implementation NSData (RSParser)
@@ -55,7 +56,7 @@ static BOOL bytesStartWithStringIgnoringWhitespace(const char *string, const cha
return NO;
}
return didFindString("<rss", bytes, length);
return didFindString("<rss", self.bytes, self.length);
}
- (BOOL)isProbablyAtom {
@@ -64,7 +65,7 @@ static BOOL bytesStartWithStringIgnoringWhitespace(const char *string, const cha
return NO;
}
return didFindString("<feed", bytes, length);
return didFindString("<feed", self.bytes, self.length);
}
@end
@@ -81,8 +82,8 @@ static BOOL bytesStartWithStringIgnoringWhitespace(const char *string, const cha
NSUInteger i = 0;
for (i = 0; i < numberOfBytes; i++) {
const char *ch = bytes[i];
if (ch == ' ' || ch = '\r' || ch == '\n' || ch == '\t') {
const char ch = bytes[i];
if (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t') {
continue;
}
@@ -110,7 +111,7 @@ static BOOL bytesAreProbablyHTML(const char *bytes, NSUInteger numberOfBytes) {
return YES;
}
if (didFindString("<", bytes, numberOfBytes) {
if (didFindString("<", bytes, numberOfBytes)) {
if (didFindString("doctype html", bytes, numberOfBytes)) {
return YES;
}
@@ -127,6 +128,6 @@ static BOOL bytesAreProbablyHTML(const char *bytes, NSUInteger numberOfBytes) {
static BOOL bytesAreProbablyXML(const char *bytes, NSUInteger numberOfBytes) {
return bytesStartWithStringIgnoringWhiteSpace("<?xml", bytes, numberOfBytes);
return bytesStartWithStringIgnoringWhitespace("<?xml", bytes, numberOfBytes);
}

View File

@@ -6,6 +6,7 @@
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
//
#import <CommonCrypto/CommonDigest.h>
#import "NSString+RSParser.h"

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
BOOL RSParser_IsEmpty(id _Nullable obj);
BOOL RSParserObjectIsEmpty(id _Nullable obj);
BOOL RSParserStringIsEmpty(NSString * _Nullable s);

View File

@@ -1,5 +1,5 @@
//
// RSXMLInternal.m
// RSParserInternal.m
// RSParser
//
// Created by Brent Simmons on 12/26/16.
@@ -7,7 +7,7 @@
//
#import <CommonCrypto/CommonDigest.h>
#import "RSXMLInternal.h"
#import "RSParserInternal.h"
static BOOL RSParserIsNil(id obj) {