mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Make it build. Add a README.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import "NSString+RSParser.h"
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
BOOL RSParser_IsEmpty(id _Nullable obj);
|
||||
BOOL RSParserObjectIsEmpty(id _Nullable obj);
|
||||
BOOL RSParserStringIsEmpty(NSString * _Nullable s);
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user