Skip to content

Commit

Permalink
1. Fix ParseObject bug.
Browse files Browse the repository at this point in the history
2. Code formatting of #region.
  • Loading branch information
scottcgi committed Feb 6, 2021
1 parent 5b8fa2f commit a9855bd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
20 changes: 14 additions & 6 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
## C# v1.2.2
_`2020.2.28 UTC+8 10:50`_
* Change the `Data` type from `class` to `struct`, and use `ref` to pass it.
* Use keyword `out` inline to follow the compiler hits.
## v1.2.3
_`2021.2.5 UTC+8 10:13`_
* **The C Code**
* Fix the parse key bug of ParseObject.

* **The C# Code**
* Code formatting of #region.

## v1.2.2
_`2020.2.28 UTC+8 10:50`_
* **The C# Code**
* Change the `Data` type from `class` to `struct`, and use `ref` to pass it.
* Use keyword `out` inline to follow the compiler hits.

## C v1.2.0
_`2020.1.10 UTC+8 11:35`_
* Add the C code implementation.
* **The C Code**
* Add the C code implementation.


## v1.2.0
Expand Down
6 changes: 3 additions & 3 deletions Json.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* GitHub : https://github.com/scottcgi/MojoJson
*
* Since : 2013-5-29
* Update : 2020-1-8
* Update : 2021-2-6
* Author : scott.cgi
* Version: 1.2.0
* Version: 1.2.3
*/


Expand Down Expand Up @@ -798,7 +798,7 @@ static JsonValue* ParseObject(const char** jsonPtr)

const char* strStart;
int keyLen = SkipString(jsonPtr, &strStart);
char key[keyLen];
char key[keyLen + 1];
// make string end
key[keyLen] = '\0';

Expand Down
4 changes: 2 additions & 2 deletions Json.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* GitHub : https://github.com/scottcgi/MojoJson
*
* Since : 2013-1-26
* Update : 2020-1-8
* Update : 2021-2-6
* Author : scott.cgi
* Version: 1.2.0
* Version: 1.2.3
*/


Expand Down
24 changes: 2 additions & 22 deletions MojoJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Since : 2017-9-6
* Update : 2020-2-28
* Author : scott.cgi
* Version: 1.2.2
* Version: 1.2.3
*/

using System.Collections.Generic;
Expand All @@ -26,8 +26,6 @@ public static class Json


#region Parse Json API


/// <summary>
/// Parse json string.
/// </summary>
Expand All @@ -44,14 +42,10 @@ public static void SetEscapeString(bool isEscapeString)
{
Json.isEscapeString = isEscapeString;
}


#endregion


#region Parse Json


/// <summary>
/// Parse the JsonValue.
/// </summary>
Expand Down Expand Up @@ -574,8 +568,6 @@ private static char GetUnicodeCodePoint(ref Data data)
(data.unicode[3] )
);
}


#endregion


Expand Down Expand Up @@ -630,8 +622,6 @@ public JsonValue(JsonType type, float value)


#region JsonObject API


/// <summary>
/// Use JsonValue as JsonObject.
/// </summary>
Expand Down Expand Up @@ -803,14 +793,10 @@ public bool AsObjectGetIsNull(string key)

return false;
}


#endregion


#region JsonArray API


/// <summary>
/// Use JsonValue as JsonArray.
/// </summary>
Expand Down Expand Up @@ -892,14 +878,10 @@ public bool AsArrayGetIsNull(int index)
{
return this.AsArrayGet(index).IsNull();
}


#endregion


#region Other Json value API


#region Other Json Value API
/// <summary>
/// Get JsonValue as string.
/// </summary>
Expand Down Expand Up @@ -947,8 +929,6 @@ public bool IsNull()
{
return this.type == JsonType.Null;
}


#endregion
}

Expand Down

0 comments on commit a9855bd

Please sign in to comment.