debian/0000775000000000000000000000000012053161731007167 5ustar debian/changelog0000664000000000000000000000100512053161731011035 0ustar sbjson (2.3.2-2build1) raring; urgency=low * Rebuild for gnustep-base 1.24 transition. -- Benjamin Drung Wed, 21 Nov 2012 15:23:21 +0100 sbjson (2.3.2-2) unstable; urgency=low * Build with hardening enabled. * Correctly link with libobjc and libgnustep-base. -- Jeroen Dekkers Fri, 29 Jun 2012 19:09:28 +0200 sbjson (2.3.2-1) unstable; urgency=low * Initial release. (Closes: #672134) -- Jeroen Dekkers Wed, 09 May 2012 15:18:17 +0200 debian/libsbjson2.3.install0000664000000000000000000000002711733471410012770 0ustar usr/lib/libSBJson.so.* debian/libsbjson-dev.install0000664000000000000000000000006011733437636013332 0ustar usr/include/GNUstep/SBJson usr/lib/libSBJson.so debian/patches/0000775000000000000000000000000011773360735010633 5ustar debian/patches/0001-add-makefiles.patch0000664000000000000000000000264611773360735014730 0ustar From: Jeroen Dekkers Date: Sat, 24 Mar 2012 22:33:59 +0100 Subject: add-makefiles --- Classes/GNUmakefile | 29 +++++++++++++++++++++++++++++ GNUmakefile | 9 +++++++++ 2 files changed, 38 insertions(+) create mode 100644 Classes/GNUmakefile create mode 100644 GNUmakefile diff --git a/Classes/GNUmakefile b/Classes/GNUmakefile new file mode 100644 index 0000000..625d963 --- /dev/null +++ b/Classes/GNUmakefile @@ -0,0 +1,29 @@ +# GNUstep makefile +include $(GNUSTEP_MAKEFILES)/common.make + +LIBRARY_NAME = SBJson + +SBJson_VERSION=2.3.2 + +SBJson_INCLUDE_DIRS = -std=gnu99 + +SBJson_HEADER_FILES = \ + SBJson.h \ + NSObject+SBJSON.h \ + NSString+SBJSON.h \ + SBJsonBase.h \ + SBJsonParser.h \ + SBJsonWriter.h + +SBJson_OBJC_FILES = \ + NSObject+SBJSON.m \ + NSString+SBJSON.m \ + SBJsonBase.m \ + SBJsonParser.m \ + SBJsonWriter.m + +SBJson_LIBRARIES_DEPEND_UPON += -lgnustep-base -lobjc + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/library.make +-include GNUmakefile.postamble diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..22b9785 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,9 @@ +# GNUstep makefile + +include $(GNUSTEP_MAKEFILES)/common.make + +SUBPROJECTS += Classes + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/aggregate.make +-include GNUmakefile.postamble debian/patches/series0000664000000000000000000000007411753220523012035 0ustar 0001-add-makefiles.patch 0002-remove-objc2.0-features.patch debian/patches/0002-remove-objc2.0-features.patch0000664000000000000000000002027211753220523016466 0ustar From: Jeroen Dekkers Date: Sat, 24 Mar 2012 22:33:59 +0100 Subject: remove-objc2.0-features --- Classes/SBJsonBase.h | 8 ++++- Classes/SBJsonBase.m | 23 +++++++++++++++- Classes/SBJsonParser.m | 12 ++++++-- Classes/SBJsonWriter.h | 10 +++++++ Classes/SBJsonWriter.m | 68 +++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 109 insertions(+), 12 deletions(-) diff --git a/Classes/SBJsonBase.h b/Classes/SBJsonBase.h index 7b10844..ee72767 100644 --- a/Classes/SBJsonBase.h +++ b/Classes/SBJsonBase.h @@ -66,7 +66,7 @@ enum { malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0. */ -@property NSUInteger maxDepth; +// @property NSUInteger maxDepth; /** @brief Return an error trace, or nil if there was no errors. @@ -75,7 +75,11 @@ enum { You need to check the return value of the call you're making to figure out if the call actually failed, before you know call this method. */ - @property(copy,readonly) NSArray* errorTrace; +#if GNUSTEP +- (NSArray *) errorTrace; +#else +@property(copy,readonly) NSArray* errorTrace; +#endif /// @internal for use in subclasses to add errors to the stack trace - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str; diff --git a/Classes/SBJsonBase.m b/Classes/SBJsonBase.m index 6684325..ef33ec3 100644 --- a/Classes/SBJsonBase.m +++ b/Classes/SBJsonBase.m @@ -33,13 +33,16 @@ NSString * SBJSONErrorDomain = @"org.brautaset.JSON.ErrorDomain"; @implementation SBJsonBase +#if !GNUSTEP @synthesize errorTrace; @synthesize maxDepth; +#endif - (id)init { self = [super init]; if (self) - self.maxDepth = 512; + maxDepth = 512; + return self; } @@ -48,6 +51,24 @@ NSString * SBJSONErrorDomain = @"org.brautaset.JSON.ErrorDomain"; [super dealloc]; } +#if GNUSTEP +- (NSArray *) errorTrace +{ + return errorTrace; +} + +- (void) setMaxDepth: (NSUInteger) newMaxDepth +{ + maxDepth = newMaxDepth; +} + +- (NSUInteger) maxDepth +{ + return maxDepth; +} + +#endif + - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str { NSDictionary *userInfo; if (!errorTrace) { diff --git a/Classes/SBJsonParser.m b/Classes/SBJsonParser.m index 222ef70..e87e096 100644 --- a/Classes/SBJsonParser.m +++ b/Classes/SBJsonParser.m @@ -29,7 +29,7 @@ #import "SBJsonParser.h" -@interface SBJsonParser () +@interface SBJsonParser (SBJsonPrivate) - (BOOL)scanValue:(NSObject **)o; @@ -106,7 +106,7 @@ static char ctrl[0x22]; return tmp; if (error) - *error = [self.errorTrace lastObject]; + *error = [errorTrace lastObject]; return nil; } @@ -342,7 +342,11 @@ static char ctrl[0x22]; return NO; break; } +#if GNUSTEP + [*o appendFormat: @"%C", uc]; +#else CFStringAppendCharacters((CFMutableStringRef)*o, &uc, 1); +#endif c++; } else if (*c < 0x20) { @@ -498,8 +502,10 @@ static char ctrl[0x22]; encoding:NSUTF8StringEncoding freeWhenDone:NO]; [str autorelease]; - if (str && (*o = [NSDecimalNumber decimalNumberWithString:str])) + if (str && (*o = [NSDecimalNumber decimalNumberWithString:str + locale:nil])) { return YES; + } [self addErrorWithCode:EPARSENUM description: @"Failed creating decimal instance"]; return NO; diff --git a/Classes/SBJsonWriter.h b/Classes/SBJsonWriter.h index ae1a597..7099c85 100644 --- a/Classes/SBJsonWriter.h +++ b/Classes/SBJsonWriter.h @@ -66,7 +66,12 @@ JSON with linebreaks after each array value and dictionary key/value pair, indented two spaces per nesting level. */ +#if GNUSTEP +- (void) setHumanReadable: (BOOL) newValue; +- (BOOL) humanReadable; +#else @property BOOL humanReadable; +#endif /** @brief Whether or not to sort the dictionary keys in the output. @@ -74,7 +79,12 @@ If this is set to YES, the dictionary keys in the JSON output will be in sorted order. (This is useful if you need to compare two structures, for example.) The default is NO. */ +#if GNUSTEP +- (void) setSortKeys: (BOOL) newValue; +- (BOOL) sortKeys; +#else @property BOOL sortKeys; +#endif /** @brief Return JSON representation (or fragment) for the given object. diff --git a/Classes/SBJsonWriter.m b/Classes/SBJsonWriter.m index 83e8a20..0bf6568 100644 --- a/Classes/SBJsonWriter.m +++ b/Classes/SBJsonWriter.m @@ -27,9 +27,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + #import "SBJsonWriter.h" -@interface SBJsonWriter () +@interface SBJsonWriter (SBJsonPrivate) - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json; - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json; @@ -42,8 +44,10 @@ @implementation SBJsonWriter +#if !GNUSTEP @synthesize sortKeys; @synthesize humanReadable; +#endif static NSMutableCharacterSet *kEscapeChars; @@ -52,6 +56,30 @@ static NSMutableCharacterSet *kEscapeChars; [kEscapeChars addCharactersInString: @"\"\\"]; } +#if GNUSTEP +- (void) setHumanReadable: (BOOL) newValue +{ + humanReadable = newValue; +} + +- (BOOL) humanReadable +{ + return humanReadable; +} +#endif + +#if GNUSTEP +- (void) setSortKeys: (BOOL) newValue +{ + sortKeys = newValue; +} + +- (BOOL) sortKeys +{ + return sortKeys; +} +#endif + - (NSString*)stringWithObject:(id)value { [self clearErrorTrace]; @@ -78,7 +106,7 @@ static NSMutableCharacterSet *kEscapeChars; return tmp; if (error) - *error = [self.errorTrace lastObject]; + *error = [errorTrace lastObject]; return nil; } @@ -102,10 +130,11 @@ static NSMutableCharacterSet *kEscapeChars; } else if ([fragment isKindOfClass:[NSNumber class]]) { if ('c' == *[fragment objCType]) { [json appendString:[fragment boolValue] ? @"true" : @"false"]; +#if !GNUSTEP } else if ([fragment isEqualToNumber:(NSNumber*)kCFNumberNaN]) { [self addErrorWithCode:EUNSUPPORTED description:@"NaN is not a valid number in JSON"]; return NO; - +#endif } else if (isinf([fragment doubleValue])) { [self addErrorWithCode:EUNSUPPORTED description:@"Infinity is not a valid number in JSON"]; return NO; @@ -126,14 +155,26 @@ static NSMutableCharacterSet *kEscapeChars; } - (BOOL)appendArray:(NSArray*)fragment into:(NSMutableString*)json { +#if GNUSTEP + NSEnumerator *fragmentEnum; + id value; + + fragmentEnum = [fragment objectEnumerator]; +#endif + if (maxDepth && ++depth > maxDepth) { [self addErrorWithCode:EDEPTH description: @"Nested too deep"]; return NO; } [json appendString:@"["]; - BOOL addComma = NO; - for (id value in fragment) { + BOOL addComma = NO; +#if GNUSTEP + while ((value = [fragmentEnum nextObject])) +#else + for (id value in fragment) +#endif + { if (addComma) [json appendString:@","]; else @@ -164,10 +205,21 @@ static NSMutableCharacterSet *kEscapeChars; NSString *colon = [self humanReadable] ? @" : " : @":"; BOOL addComma = NO; NSArray *keys = [fragment allKeys]; - if (self.sortKeys) +#if GNUSTEP + NSEnumerator *keysEnum; + id value; + + keysEnum = [keys objectEnumerator]; +#endif + + if (sortKeys) keys = [keys sortedArrayUsingSelector:@selector(compare:)]; +#if GNUSTEP + while ((value = [keysEnum nextObject])) { +#else for (id value in keys) { +#endif if (addComma) [json appendString:@","]; else @@ -223,7 +275,11 @@ static NSMutableCharacterSet *kEscapeChars; if (uc < 0x20) { [json appendFormat:@"\\u%04x", uc]; } else { +#if GNUSTEP + [json appendFormat: @"%C", uc]; +#else CFStringAppendCharacters((CFMutableStringRef)json, &uc, 1); +#endif } break; debian/source/0000775000000000000000000000000011773360735010504 5ustar debian/source/format0000664000000000000000000000001411733437636011713 0ustar 3.0 (quilt) debian/compat0000664000000000000000000000000211752342362010373 0ustar 9 debian/copyright0000664000000000000000000000344611733576146011147 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: SBJson Upstream-Contact: Stig Brautaset Source: http://stig.github.com/json-framework/ Files: * Copyright: 2007-2010 Stig Brautaset License: BSD-3-clause Files: debian/* Copyright: 2012 Jeroen Dekkers License: BSD-3-clause License: BSD-3-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. . * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/libsbjson2.3.lintian-overrides0000664000000000000000000000004211733573407014766 0ustar package-name-doesnt-match-sonames debian/rules0000775000000000000000000000062111773360735010263 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow include /usr/share/dpkg/buildflags.mk # FIXME: dpkg-buildflags / cdbs should support OBJCFLAGS DEB_MAKE_BUILD_TARGET = all messages=yes OBJCFLAGS="$(CFLAGS)" include /usr/share/cdbs/1/rules/gnustep.mk include /usr/share/cdbs/1/class/gnumakefile.mk debian/control0000664000000000000000000000232711773360735010613 0ustar Source: sbjson Section: libs Priority: optional Maintainer: Jeroen Dekkers Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cdbs, gobjc, gnustep-make, libgnustep-base-dev Standards-Version: 3.9.3 Homepage: http://stig.github.com/json-framework Vcs-Browser: https://github.com/dekkers/sbjson Vcs-Git: git://github.com/dekkers/sbjson.git Package: libsbjson2.3 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${gnustep:Depends} Provides: libsbjson Description: Objective-C JSON library A strict JSON parser and generator for Objective-C. It adds categories to existing Objective-C objects for a super-simple interface. More flexible APIs are also provided for added control. . This package contains the shared library. Package: libsbjson-dev Section: libdevel Priority: extra Architecture: any Depends: libsbjson2.3 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, ${gnustep:Depends} Description: Objective-C JSON library (development files) A strict JSON parser and generator for Objective-C. It adds categories to existing Objective-C objects for a super-simple interface. More flexible APIs are also provided for added control. . This package contains the development files. debian/gbp.conf0000664000000000000000000000021411733437636010621 0ustar [DEFAULT] # the default branch for upstream sources upstream-branch=upstream # the default branch for the debian patch debian-branch=debian