コード例 #1
0
ファイル: SimdJson.cs プロジェクト: billwillman/SimdJsonSharp
        public static ParsedJson ParseJson(byte *jsonData, int length, bool reallocIfNeeded = true)
        {
            var  pj = new ParsedJson();
            bool ok = pj.AllocateCapacity((ulong)length);

            if (ok)
            {
                JsonParse(jsonData, (ulong)length, pj, reallocIfNeeded);
            }
            else
            {
                throw new InvalidOperationException("failure during memory allocation");
            }
            return(pj);
        }
コード例 #2
0
ファイル: SimdJson.cs プロジェクト: zsybupt/SimdJsonSharp
        public static ParsedJson ParseJson(byte *jsonData, ulong length, bool reallocIfNeeded = true)
        {
            var  pj = new ParsedJson();
            bool ok = pj.AllocateCapacity(length);

            if (ok)
            {
                JsonParse(jsonData, length, pj, reallocIfNeeded);
            }
            else
            {
                pj.isvalid   = false;
                pj.ErrorCode = JsonParseError.CAPACITY;
            }
            return(pj);
        }