Skip to content

Commit 02de01d

Browse files
author
1138-4EB
committed
add C_JSON_INDEX_MAX and C_JSONFILE_INDEX_MAX
1 parent 54cdc39 commit 02de01d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

vhdl/JSON.pkg.vhdl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ package JSON is
6363
type T_JSON_INDEX is array(NATURAL range <>) of T_JSON_INDEX_ELEMENT;
6464

6565
constant C_JSON_ERROR_MESSAGE_LENGTH : NATURAL := 64;
66+
constant C_JSON_INDEX_MAX : T_UINT16 := 1023;
67+
constant C_JSONFILE_INDEX_MAX : T_UINT16 := 4*C_JSON_INDEX_MAX;
6668

6769
type T_JSON is record
6870
Content : STRING(1 to T_UINT16'high);
6971
ContentCount : T_UINT16;
70-
Index : T_JSON_INDEX(0 to 1023);
72+
Index : T_JSON_INDEX(0 to C_JSON_INDEX_MAX);
7173
IndexCount : T_UINT16;
7274
Error : STRING(1 to C_JSON_ERROR_MESSAGE_LENGTH);
7375
end record;
@@ -270,11 +272,10 @@ package body JSON is
270272
end procedure;
271273

272274
impure function jsonLoad(Stream : STRING) return T_JSON is
273-
variable Result : T_JSON; -- TODO: this is only required in order to use Result.Index'high
274275
begin
275276
if ( ".json" = Stream(Stream'length-4 to Stream'length) ) then
276277
report "jsonLoad: Filename " & Stream severity NOTE;
277-
return jsonParseStream( jsonReadFile(Stream, 4*Result.Index'high) );
278+
return jsonParseStream( jsonReadFile(Stream, C_JSONFILE_INDEX_MAX) );
278279
else
279280
report "jsonLoad: Stream" severity NOTE;
280281
return jsonParseStream(Stream);

0 commit comments

Comments
 (0)