rtl: reduce amount of warnings regards implicit string conversions + little formatting

git-svn-id: trunk@20925 -
This commit is contained in:
paul 2012-04-19 01:33:47 +00:00
parent 901eb84b3d
commit 19d1cf9470
4 changed files with 90 additions and 96 deletions

View File

@ -376,7 +376,7 @@ begin
end
else
begin
temp:=S;
temp:=UnicodeString(S);
Size:=Length(temp);
widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(temp)),result,cp,Size);
end;

View File

@ -1325,7 +1325,7 @@ var
sign : valreal;
esign,
exponent,
decpoint,i : SizeInt;
decpoint : SizeInt;
flags : byte;
begin
fpc_Val_Real_ShortStr:=0.0;

View File

@ -941,13 +941,13 @@ procedure UnicodeCharLenToStrVar(Src : PUnicodeChar;Len : SizeInt;out Dest : Uni
procedure UnicodeCharLenToStrVar(Src : PUnicodeChar;Len : SizeInt;out Dest : AnsiString);
begin
Dest:=UnicodeCharLenToString(Src,Len);
Dest:=AnsiString(UnicodeCharLenToString(Src,Len));
end;
procedure UnicodeCharToStrVar(S : PUnicodeChar;out Dest : AnsiString);
begin
Dest:=UnicodeCharToString(S);
Dest:=AnsiString(UnicodeCharToString(S));
end;
@ -966,7 +966,7 @@ procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;out Dest : UnicodeSt
procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;out Dest : AnsiString);
begin
Dest:=WideCharLenToString(Src,Len);
Dest:=AnsiString(WideCharLenToString(Src,Len));
end;
@ -978,7 +978,7 @@ procedure WideCharToStrVar(S : PWideChar;out Dest : UnicodeString);
procedure WideCharToStrVar(S : PWideChar;out Dest : AnsiString);
begin
Dest:=WideCharToString(S);
Dest:=AnsiString(WideCharToString(S));
end;
@ -1201,36 +1201,35 @@ end;
{$ifndef FPUNONE}
Function fpc_Val_Real_UnicodeStr(Const S : UnicodeString; out Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_UNICODESTR']; compilerproc;
Var
SS : String;
SS: ShortString;
begin
fpc_Val_Real_UnicodeStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Real_UnicodeStr,code);
end;
end;
{$endif}
function fpc_val_enum_unicodestr(str2ordindex:pointer;const s:unicodestring;out code:valsint):longint;compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
if length(s)>255 then
code:=256
else
begin
ss:=s;
ss:=ShortString(s);
val(ss,fpc_val_enum_unicodestr,code);
end;
end;
Function fpc_Val_Currency_UnicodeStr(Const S : UnicodeString; out Code : ValSInt): Currency; [public, alias:'FPC_VAL_CURRENCY_UNICODESTR']; compilerproc;
Var
SS : String;
SS: ShortString;
begin
if length(S)>255 then
begin
@ -1239,7 +1238,7 @@ begin
end
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Currency_UnicodeStr,code);
end;
end;
@ -1254,7 +1253,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_UInt_UnicodeStr,code);
end;
end;
@ -1269,7 +1268,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
fpc_Val_SInt_UnicodeStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
end;
end;
@ -1286,7 +1285,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_qword_UnicodeStr,Code);
end;
end;
@ -1301,7 +1300,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_int64_UnicodeStr,Code);
end;
end;
@ -1315,26 +1314,24 @@ var
ss: shortstring;
begin
str_real(len,fr,d,treal_type(rt),ss);
s:=ss;
s:=UnicodeString(ss);
end;
{$endif}
procedure fpc_unicodestr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:unicodestring);compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
s:=ss;
s:=UnicodeString(ss);
end;
procedure fpc_unicodestr_bool(b : boolean;len:sizeint;out s:unicodestring);compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
fpc_shortstr_bool(b,len,ss);
s:=ss;
s:=UnicodeString(ss);
end;
{$ifdef FPC_HAS_STR_CURRENCY}
@ -1343,7 +1340,7 @@ var
ss: shortstring;
begin
str(c:len:fr,ss);
s:=ss;
s:=UnicodeString(ss);
end;
{$endif FPC_HAS_STR_CURRENCY}
@ -1352,7 +1349,7 @@ Var
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
@ -1361,7 +1358,7 @@ Var
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
@ -1372,7 +1369,7 @@ Var
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
@ -1381,7 +1378,7 @@ Var
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
{$endif CPU64}
@ -1832,7 +1829,7 @@ function AnsiToUtf8(const s : RawByteString): RawByteString;{$ifdef SYSTEMINLINE
function Utf8ToAnsi(const s : RawByteString) : RawByteString;{$ifdef SYSTEMINLINE}inline;{$endif}
begin
Result:=Utf8Decode(s);
Result:=RawByteString(Utf8Decode(s));
end;

View File

@ -762,36 +762,35 @@ end;
{$ifndef FPUNONE}
Function fpc_Val_Real_WideStr(Const S : WideString; out Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_WIDESTR']; compilerproc;
Var
SS : String;
SS: ShortString;
begin
fpc_Val_Real_WideStr := 0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Real_WideStr,code);
end;
end;
{$endif}
function fpc_val_enum_widestr(str2ordindex:pointer;const s:widestring;out code:valsint):longint;compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
if length(s)>255 then
code:=256
else
begin
ss:=s;
ss:=ShortString(s);
val(ss,fpc_val_enum_widestr,code);
end;
end;
Function fpc_Val_Currency_WideStr(Const S : WideString; out Code : ValSInt): Currency; [public, alias:'FPC_VAL_CURRENCY_WIDESTR']; compilerproc;
Var
SS : String;
SS: ShortString;
begin
if length(S)>255 then
begin
@ -800,7 +799,7 @@ begin
end
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Currency_WideStr,code);
end;
end;
@ -815,7 +814,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_UInt_WideStr,code);
end;
end;
@ -830,7 +829,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
fpc_Val_SInt_WideStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
end;
end;
@ -847,7 +846,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_qword_WideStr,Code);
end;
end;
@ -862,7 +861,7 @@ begin
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_int64_WideStr,Code);
end;
end;
@ -873,38 +872,36 @@ end;
{$ifndef FPUNONE}
procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : WideString);compilerproc;
var
ss : shortstring;
ss: ShortString;
begin
str_real(len,fr,d,treal_type(rt),ss);
s:=ss;
s:=WideString(ss);
end;
{$endif}
procedure fpc_widestr_enum(ordinal,len:sizeint;typinfo,ord2strindex:pointer;out s:widestring);compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
fpc_shortstr_enum(ordinal,len,typinfo,ord2strindex,ss);
s:=ss;
s:=WideString(ss);
end;
procedure fpc_widestr_bool(b : boolean;len:sizeint;out s:widestring);compilerproc;
var ss:shortstring;
var
ss: ShortString;
begin
fpc_shortstr_bool(b,len,ss);
s:=ss;
s:=WideString(ss);
end;
{$ifdef FPC_HAS_STR_CURRENCY}
procedure fpc_WideStr_Currency(c : Currency;len,fr : SizeInt;out s : WideString);compilerproc;
var
ss : shortstring;
ss: ShortString;
begin
str(c:len:fr,ss);
s:=ss;
s:=WideString(ss);
end;
{$endif FPC_HAS_STR_CURRENCY}
@ -913,7 +910,7 @@ Var
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
@ -922,7 +919,7 @@ Var
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
@ -933,7 +930,7 @@ Var
SS: ShortString;
begin
Str(v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
@ -942,7 +939,7 @@ Var
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
{$endif CPU64}