1
- { superobject.pas } // version: 2020.1213.1945
1
+ { superobject.pas } // version: 2020.1213.1955
2
2
(*
3
3
* Super Object Toolkit
4
4
*
@@ -2258,7 +2258,14 @@ function serialtoguid(ctx: TSuperRttiContext; var value: TValue; const index: IS
2258
2258
function serialfromboolean (ctx: TSuperRttiContext; const obj: ISuperObject; var Value : TValue): Boolean;
2259
2259
var
2260
2260
o: ISuperObject;
2261
+ S: string;
2261
2262
begin
2263
+ if obj = nil then // https://github.com/hgourvest/superobject/pull/46
2264
+ begin
2265
+ TValueData(Value ).FAsSLong := Ord(False);
2266
+ Result := True;
2267
+ Exit;
2268
+ end ;
2262
2269
case ObjectGetType(obj) of
2263
2270
stBoolean:
2264
2271
begin
@@ -2275,7 +2282,20 @@ function serialfromboolean(ctx: TSuperRttiContext; const obj: ISuperObject; var
2275
2282
o := SO(obj.AsString);
2276
2283
if not ObjectIsType(o, stString) then
2277
2284
Result := serialfromboolean(ctx, SO(obj.AsString), Value ) else
2278
- Result := False;
2285
+ begin // https://github.com/hgourvest/superobject/pull/46
2286
+ S := obj.AsString;
2287
+ if (S = ' 1' ) or (S = ' -1' ) or SameText(S, ' True' ) then
2288
+ begin
2289
+ TValueData(Value ).FAsSLong := Ord(True);
2290
+ Result := True;
2291
+ end
2292
+ else if (S = ' 0' ) or SameText(S, ' False' ) then
2293
+ begin
2294
+ TValueData(Value ).FAsSLong := Ord(False);
2295
+ Result := True;
2296
+ end else
2297
+ Result := False;
2298
+ end ;
2279
2299
end ;
2280
2300
else
2281
2301
Result := False;
@@ -6709,9 +6729,7 @@ procedure TSuperArray.Insert(index: Integer; const value: ISuperObject);
6709
6729
if (index < FLength) then
6710
6730
begin
6711
6731
if FLength = FSize then
6712
- { +}
6713
6732
Expand(FLength+1 ); // https://github.com/hgourvest/superobject/pull/16
6714
- { +.}
6715
6733
if Index < FLength then
6716
6734
Move(FArray^[index], FArray^[index + 1 ],
6717
6735
(FLength - index) * SizeOf(Pointer));
0 commit comments