THRIFT-3524 dcc32 warning "W1000 Symbol 'IsLowSurrogate' is deprecated: 'Use TCharHelper'" in Thrift.Protocol.JSON.pas
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Protocol.JSON.pas b/lib/delphi/src/Thrift.Protocol.JSON.pas
index 36c3d72..896dfcc 100644
--- a/lib/delphi/src/Thrift.Protocol.JSON.pas
+++ b/lib/delphi/src/Thrift.Protocol.JSON.pas
@@ -868,12 +868,12 @@
+ HexVal(tmp[3]);
// we need to make UTF8 bytes from it, to be decoded later
- if Character.IsHighSurrogate(char(wch)) then begin
+ if CharUtils.IsHighSurrogate(char(wch)) then begin
if highSurogate <> #0
then raise TProtocolException.Create( TProtocolException.INVALID_DATA, 'Expected low surrogate char');
highSurogate := char(wch);
end
- else if Character.IsLowSurrogate(char(wch)) then begin
+ else if CharUtils.IsLowSurrogate(char(wch)) then begin
if highSurogate = #0
then TProtocolException.Create( TProtocolException.INVALID_DATA, 'Expected high surrogate char');
surrogatePairs[0] := highSurogate;
diff --git a/lib/delphi/src/Thrift.Utils.pas b/lib/delphi/src/Thrift.Utils.pas
index 15ea36f..17131ef 100644
--- a/lib/delphi/src/Thrift.Utils.pas
+++ b/lib/delphi/src/Thrift.Utils.pas
@@ -22,7 +22,7 @@
interface
uses
- Classes, Windows, SysUtils, SyncObjs;
+ Classes, Windows, SysUtils, Character, SyncObjs;
type
IOverlappedHelper = interface
@@ -56,6 +56,14 @@
end;
+ CharUtils = class sealed
+ public
+ class function IsHighSurrogate( const c : Char) : Boolean; static; inline;
+ class function IsLowSurrogate( const c : Char) : Boolean; static; inline;
+ end;
+
+
+
implementation
{ TOverlappedHelperImpl }
@@ -186,4 +194,26 @@
end;
+class function CharUtils.IsHighSurrogate( const c : Char) : Boolean;
+begin
+ {$IF RTLVersion >= 28.0} // XE7+
+ result := c.IsHighSurrogate();
+ {$ELSE}
+ result := Character.IsHighSurrogate( c);
+ {$IFEND}
+end;
+
+
+class function CharUtils.IsLowSurrogate( const c : Char) : Boolean;
+begin
+ {$IF RTLVersion >= 28.0} // XE7+
+ result := c.IsLowSurrogate();
+ {$ELSE}
+ result := Character.IsLowSurrogate( c);
+ {$IFEND}
+end;
+
+
+
+
end.