@@ -198,7 +198,7 @@ methodmap YYJSON < Handle
198198 * @param maxlength Maximum length of the string buffer
199199 * @param flag The JSON write options
200200 *
201- * @return Number of characters written to the buffer, including the null terminator. 0 on failure
201+ * @return Number of characters written to the buffer ( including null terminator) or 0 on failure
202202 */
203203 public native int ToString (char [] buffer , int maxlength , YYJSON_WRITE_FLAG flag = YYJSON_WRITE_NOFLAG );
204204
@@ -278,7 +278,7 @@ methodmap YYJSON < Handle
278278 public static native YYJSON CreateFloat (float value );
279279
280280 /* *
281- * Creates and returns a int value
281+ * Creates and returns an int value
282282 *
283283 * @note Needs to be freed using delete or CloseHandle()
284284 *
@@ -289,11 +289,11 @@ methodmap YYJSON < Handle
289289 public static native YYJSON CreateInt (int value );
290290
291291 /* *
292- * Creates and returns a intger64 value
292+ * Creates and returns an integer64 value
293293 *
294294 * @note Needs to be freed using delete or CloseHandle()
295295 *
296- * @param value The intger64 value to be set
296+ * @param value The integer64 value to be set
297297 *
298298 * @return JSON handle, NULL on error
299299 */
@@ -347,7 +347,7 @@ methodmap YYJSON < Handle
347347 public static native int GetInt (const YYJSON value );
348348
349349 /* *
350- * Get intger64 value by a JSON Handle
350+ * Get integer64 value by a JSON Handle
351351 *
352352 * @param value JSON handle
353353 * @param buffer Buffer to copy to
@@ -369,12 +369,17 @@ methodmap YYJSON < Handle
369369 public static native bool GetString (const YYJSON value , char [] buffer , int maxlength );
370370
371371 /* *
372- * Get JSON Handle serialized size in bytes (including null-terminator)
373- *
374- * @param flag The JSON write options
375- *
376- * @return serialized size
377- */
372+ * Get JSON Handle serialized size in bytes (including null-terminator)
373+ *
374+ * @param flag The JSON write options
375+ *
376+ * @return Size in bytes (including null terminator)
377+ *
378+ * @note The returned size depends on the flag parameter.
379+ * You MUST use the same flags when calling both GetSerializedSize()
380+ * and ToString(). Using different flags will return different sizes
381+ * and may cause buffer overflow.
382+ */
378383 public native int GetSerializedSize (YYJSON_WRITE_FLAG flag = YYJSON_WRITE_NOFLAG );
379384
380385 /* *
@@ -435,7 +440,7 @@ methodmap YYJSON < Handle
435440 *
436441 * @return True on success, false on failure
437442 */
438- public native bool PtrGetString (const char [] path , char [] buffer , int maxlength )
443+ public native bool PtrGetString (const char [] path , char [] buffer , int maxlength );
439444
440445 /* *
441446 * Get value is null by a JSON Pointer
@@ -444,26 +449,28 @@ methodmap YYJSON < Handle
444449 *
445450 * @return True if the value is null, false otherwise
446451 */
447- public native bool PtrGetIsNull (const char [] path )
452+ public native bool PtrGetIsNull (const char [] path );
448453
449454 /* *
450455 * Get JSON content length (string length, array size, object size)
451- * Returns 0 if val is NULL or type is not string/array/object
452- * if str including null-terminator
456+ *
457+ * @note For strings: returns string length including null-terminator
458+ * @note For arrays/objects: returns number of elements
459+ * @note Returns 0 if value is NULL or type is not string/array/object
453460 *
454461 * @param path The JSON pointer string
455462 *
456463 * @return JSON content length
457464 */
458- public native int PtrGetLength (const char [] path )
465+ public native int PtrGetLength (const char [] path );
459466
460467 /* *
461468 * Set value by a JSON Pointer
462469 *
463470 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
464471 *
465472 * @param path The JSON pointer string
466- * @param value The value to be set, pass NULL to remove
473+ * @param value The value to be set
467474 *
468475 * @return true if JSON pointer is valid and new value is set, false otherwise
469476 */
@@ -475,7 +482,7 @@ methodmap YYJSON < Handle
475482 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
476483 *
477484 * @param path The JSON pointer string
478- * @param value The boolean value to be set, pass NULL to remove
485+ * @param value The boolean value to be set
479486 *
480487 * @return true if JSON pointer is valid and new value is set, false otherwise
481488 */
@@ -487,7 +494,7 @@ methodmap YYJSON < Handle
487494 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
488495 *
489496 * @param path The JSON pointer string
490- * @param value The float value to be set, pass NULL to remove
497+ * @param value The float value to be set
491498 *
492499 * @return true if JSON pointer is valid and new value is set, false otherwise
493500 */
@@ -499,19 +506,19 @@ methodmap YYJSON < Handle
499506 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
500507 *
501508 * @param path The JSON pointer string
502- * @param value The integer value to be set, pass NULL to remove
509+ * @param value The integer value to be set
503510 *
504511 * @return true if JSON pointer is valid and new value is set, false otherwise
505512 */
506513 public native bool PtrSetInt (const char [] path , int value );
507514
508515 /* *
509- * Set intger64 value by a JSON Pointer
516+ * Set integer64 value by a JSON Pointer
510517 *
511518 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
512519 *
513520 * @param path The JSON pointer string
514- * @param value The intger64 value to be set, pass NULL to remove
521+ * @param value The integer64 value to be set
515522 *
516523 * @return true if JSON pointer is valid and new value is set, false otherwise
517524 */
@@ -523,7 +530,7 @@ methodmap YYJSON < Handle
523530 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
524531 *
525532 * @param path The JSON pointer string
526- * @param value The string value to be set, pass NULL to remove
533+ * @param value The string value to be set
527534 *
528535 * @return true if JSON pointer is valid and new value is set, false otherwise
529536 */
@@ -535,7 +542,6 @@ methodmap YYJSON < Handle
535542 * @note The parent nodes will be created if they do not exist. If the target value already exists, it will be replaced by the new value
536543 *
537544 * @param path The JSON pointer string
538- * @param value The null value to be set, pass NULL to remove
539545 *
540546 * @return true if JSON pointer is valid and new value is set, false otherwise
541547 */
@@ -585,7 +591,7 @@ methodmap YYJSON < Handle
585591 * Add (insert) integer64 value by a JSON pointer
586592 *
587593 * @param path The JSON pointer string
588- * @param value The intger64 value to be added
594+ * @param value The integer64 value to be added
589595 *
590596 * @return true if JSON pointer is valid and new value is set, false otherwise
591597 */
@@ -617,7 +623,7 @@ methodmap YYJSON < Handle
617623 *
618624 * @return true if removed value, false otherwise
619625 */
620- public native bool PtrRemove (const char [] path )
626+ public native bool PtrRemove (const char [] path );
621627
622628 /* *
623629 * Try to get value by a JSON Pointer
@@ -801,14 +807,16 @@ methodmap YYJSON < Handle
801807 }
802808
803809 /* *
804- * Retrieves read size of the JSON data
810+ * Retrieves the size of the JSON data as it was originally read from parsing
805811 *
806- * @note This value reflects the size of the JSON data as read from the document
807- * - It does not auto update if the document is modified
808- * - For modified document, use GetSerializedSize to obtain the current size
812+ * @return Size in bytes (including null terminator) or 0 if not from parsing
809813 *
814+ * @note This value only applies to documents created from parsing (Parse, FromString, FromFile)
815+ * @note Manually created documents (new YYJSONObject(), YYJSON.CreateBool(), etc.) will return 0
816+ * @note This value does not auto-update if the document is modified
817+ * @note For modified documents, use GetSerializedSize() to obtain the current size
810818 */
811- property bool ReadSize {
819+ property int ReadSize {
812820 public native get ();
813821 }
814822};
@@ -1219,7 +1227,7 @@ methodmap YYJSONArray < YYJSON
12191227 public native bool SetFloat (int index , float value );
12201228
12211229 /* *
1222- * Replaces a integer value at index
1230+ * Replaces an integer value at index
12231231 *
12241232 * @param index The index to which to replace the value
12251233 * @param value The new int value to replace
@@ -1229,10 +1237,10 @@ methodmap YYJSONArray < YYJSON
12291237 public native bool SetInt (int index , int value );
12301238
12311239 /* *
1232- * Replaces a intger64 value at index
1240+ * Replaces an integer64 value at index
12331241 *
12341242 * @param index The index to which to replace the value
1235- * @param value The new intger64 value to replace
1243+ * @param value The new integer64 value to replace
12361244 *
12371245 * @return True if succeed, false otherwise
12381246 */
@@ -1285,7 +1293,7 @@ methodmap YYJSONArray < YYJSON
12851293 public native bool PushFloat (float value );
12861294
12871295 /* *
1288- * Inserts a integer value at the end of the array
1296+ * Inserts an integer value at the end of the array
12891297 *
12901298 * @param value integer to set
12911299 *
@@ -1294,9 +1302,9 @@ methodmap YYJSONArray < YYJSON
12941302 public native bool PushInt (int value );
12951303
12961304 /* *
1297- * Inserts a intger64 value at the end of the array
1305+ * Inserts an integer64 value at the end of the array
12981306 *
1299- * @param value intger64 value
1307+ * @param value integer64 value
13001308 *
13011309 * @return The value to be inserted. Returns false if it is NULL
13021310 */
0 commit comments