Skip to content
Commits on Nov 17, 2011
  1. @johnezang

    Merge pull request #58 from samsoffes/master

    Surpress "multiple methods named" error
    johnezang committed Nov 17, 2011
  2. @soffes
  3. @soffes

    Surpress "multiple methods named" error

    I realize that `collection` won't always be an NSArray, but the cast will let the compiler know to expect a NSUInteger return type instead of `size_t` which is also a return type a method named `count` inside of JSONKit.
    soffes committed Nov 17, 2011
Commits on Sep 23, 2011
  1. @johnezang

    Fixes issues #9, #15, #40, aka "crashes on 64-bit Lion / 10.7 ABI".

    This commit implements a work around for a bug in 10.7 that was caused by
    a 10.7 64-bit ABI breaking change.
    
    Technically, this is not a bug in JSONKit, but with Mac OS X.
    
    When making changes to the ABI, it is (at least de facto) required to bump
    the "major version" of a shared library so that code designed around and
    built against the "guarantees" provided by previous versions ABI / API
    are not violated.
    
    Not only was this not done in 10.7, the ABI breaking change isn't even
    officially documented (to the best of my knowledge).  It's certainly not
    mentioned in the 10.7 release notes.
    johnezang committed Sep 23, 2011
  2. @johnezang

    Merge pull request #46 from jparise/cache-collisions

    Use memcmp() instead of strncmp() to compare cache buckets.
    johnezang committed Sep 23, 2011
Commits on Sep 22, 2011
  1. @johnezang

    Merge pull request #50 from atnan/fixclang2errors

    Fix compilation errors under Clang 3.0
    johnezang committed Sep 22, 2011
  2. @atnan
Commits on Aug 31, 2011
  1. @jparise

    Use memcmp() instead of strncmp() to compare cache buckets.

    In the rare case when a hash collision occurs between two values, the
    object cache's bucket-probing code needs to go as far as comparing the
    bytes content of the candidate bucket with the bytes content of the
    current token.
    
    For numeric values, 'bytes' refers to the raw bytes of the number.
    These byte representations may contain leading '\0' values.  strncmp()
    is only designed for comparing strings, so characters appearing after
    a '\0' are not compared.
    
    Therefore, if a hash collision occurs between two numeric values that
    only differ in their lower bytes, they will be assigned to the same
    bucket, and the cache will return the first token's object for the
    second token's value.
    
    memcmp() is binary-safe and considers all of the numbers' bytes,
    avoiding this problem.
    
    This is a rare case indeed, but here is an example that reproduces the
    problem:
    
        JSON Input:             [ 1734.75, 417.75 ]
        Identical Types:        double (8 bytes)
        Identical DJB Hashes:   2510392872
    
        JSONKit (strncmp):      [ 1734.75, 1734.75 ]    (boo!)
        JSONKit (memcmp):       [ 1734.75, 417.75 ]     (yay!)
    jparise committed Aug 30, 2011
Commits on Jun 16, 2011
  1. @johnezang

    Added note about Automatic Reference Counting (ARC) to README.md and …

    …some preprocessor-foo to JSONKit.m to check if JSONKit is being compiled with ARC / `-fobjc-arc` and #error if it is.
    johnezang committed Jun 16, 2011
Commits on Jun 5, 2011
  1. @johnezang
  2. @johnezang

    Minor tweak.

    johnezang committed Jun 5, 2011
  3. @johnezang

    Added "JKSerializeOptionEscapeForwardSlashes". Changed a number of <t…

    …able> constructions to the easier Markdown extra tables to see if the new github markdown processor accepts them. Also changed some <pre> items to ```objective-c / ``` fenced code style.
    johnezang committed Jun 5, 2011
Commits on Jun 3, 2011
  1. @johnezang
Commits on May 22, 2011
  1. @johnezang

    Fix typo.

    johnezang committed May 22, 2011
Commits on May 21, 2011
  1. @johnezang

    Moved the +load logic from JSONDecoder in to jk_collectionClassLoadTi…

    …meInitialization(). Missed the JSONDecoder +load stuff on the last commit. Related to issue #23.
    johnezang committed May 21, 2011
  2. @johnezang
  3. @johnezang

    Workarounds for issue #19 (the clang stuff) and issue #23. For issue #23

    , the code in the collection classes `+load` was removed and placed in a function with the `__attribute__ ((constructor))` attribute.  This is to work around an apparent bug when building JSONKit as a static library for iOS targets.  @ohhorob also opened a bug with apple- # 9461567.
    johnezang committed May 21, 2011
Commits on May 5, 2011
  1. @johnezang

    Merge pull request #22 from jordanbreeding/master

    Pull Xcode 4.1 update.
    johnezang committed May 5, 2011
Commits on May 4, 2011
  1. Pacify Xcode 4.1.

    Jordan Breeding committed May 4, 2011
Commits on May 2, 2011
  1. @johnezang
Commits on Apr 25, 2011
  1. @johnezang
Commits on Apr 22, 2011
  1. @johnezang

    Fixes a bug when removing items from a JKDictionary. Since JKDictiona…

    …ry is implemented using a hash table that uses linear probing, the removal function needs to "re-add" items that follow the removed item so that linear probe hash collisions are not "lost". Closes #17
    johnezang committed Apr 22, 2011
Commits on Mar 31, 2011
  1. @johnezang

    When commiting the fix for hash % dictionary->capacity, some local, i…

    …n progress edits made it in to the commit. This change backs them out.
    johnezang committed Mar 31, 2011
Commits on Mar 28, 2011
  1. @johnezang

    Fixes a bug when trying to retrieve a key from a dictionary that cont…

    …ains no items (div by zero: (keyHash % dictionary->capacity))
    johnezang committed Mar 28, 2011
  2. @johnezang

    Removed a comment line that got duplicated somehow when updating the …

    …license information.
    johnezang committed Mar 28, 2011
  3. @johnezang

    Modified the JSONKit so that it is dual licensed under either the BSD…

    … or Apache v2.0 license. This was motivated by the discussion at facebookarchive/three20#465
    johnezang committed Mar 28, 2011
Commits on Mar 25, 2011
  1. @johnezang
  2. @johnezang
  3. @johnezang
  4. @johnezang

    Try to clean up githubs markdown parsing of *s in <pre> blocks... mis…

    …sed a few from the last round
    johnezang committed Mar 25, 2011
  5. @johnezang
  6. @johnezang

    Update CHANGELOG.md and include an example of the new unsupported cla…

    …ss formatting feature.
    johnezang committed Mar 25, 2011
  7. @johnezang

    Two major changes and one minor change in this commit.

    Minor change: When JKSerializeOptionPretty is enabled, JSONKit now sorts the keys.
    
    Major changes:
    
    The way that JSONKit implements the collection classes was modified.  Specifically, JSONKit now follows the same strategy that the Cocoa collection classes use, which is to have a single subclass of the mutable collection class.  This concrete subclass has an ivar bit that determines whether or not that instance is mutable, and when an immutable instance receives a mutating message, it throws an exception.
    
    The second change is a new feature.  Normally, JSONKit can only serialize NSNull, NSNumber, NSString, NSArray, and NSDictioonary like objects.  It is now possible to serialize an object of any class via either a delegate or a ^block.
    
    The delegate or ^block must return an object that can be serialized by JSONKit, however, otherwise JSONKit will fail to serialize the object.  In other words, JSONKit tries to serialize an unsupported class of the object just once, and if the delegate or ^block returns another unsupported class, the second attempt to serialize will fail.  In practice, this is not a problem at all, but it does prevent endless recursive attempts to serialize an unsupported class.
    
    This makes it trivial to serialize objects like NSDate or NSData.  A NSDate object can be formatted using a NSDateFormatter to return a ISO-8601 'YYYY-MM-DDTHH:MM:SS.sssZ' type object, for example.  Or a NSData object could be Base64 encoded.
    
    This greatly simplifies things when you have a complex, nested objects with objects that do not belong to the classes that JSONKit can serialize.
    
    It should be noted that the same caching that JSONKit does for the supported class types also applies to the objects of an unsupported class- if the same object is serialized more than once and the object is still in the serialization cache, JSONKit will copy the previous serialization result instead of invoking the delegate or ^block again.  Therefore, you should not expect or depend on your delegate or block being called each time the same object needs to be serialized AND the delegate or block MUST return a "formatted object" that is STRICTLY invariant (that is to say the same object must always return the exact same formatted output).
    johnezang committed Mar 25, 2011
Commits on Mar 23, 2011
  1. @johnezang
  2. @johnezang

    This commit includes the "Serialize a single NSString" feature/pull r…

    …equest from issue #4 and issue #11.  Also replaces jk_encode() function with the JKSerializer class.  This is a forward looking change as placing the state in to an autoreleased object that does serializing means that we can always make sure that any resources we might have allocated will get released, no matter what.  This could be a problem, for example, if something throws an exception while we are serializing.
    johnezang committed Mar 23, 2011
Something went wrong with that request. Please try again.