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,8 +1325,8 @@ var
sign : valreal;
esign,
exponent,
decpoint,i : SizeInt;
flags : byte;
decpoint : SizeInt;
flags : byte;
begin
fpc_Val_Real_ShortStr:=0.0;
code:=1;

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,45 +1201,44 @@ 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
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
if length(S)>255 then
begin
fpc_Val_Currency_UnicodeStr:=0;
code := 256;
code:=256;
end
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Currency_UnicodeStr,code);
end;
end;
@ -1247,14 +1246,14 @@ end;
Function fpc_Val_UInt_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_UNICODESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_UInt_UnicodeStr := 0;
if length(S) > 255 then
code := 256
fpc_Val_UInt_UnicodeStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_UInt_UnicodeStr,code);
end;
end;
@ -1262,14 +1261,14 @@ end;
Function fpc_Val_SInt_UnicodeStr (DestSize: SizeInt; Const S : UnicodeString; out Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_UNICODESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_SInt_UnicodeStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
fpc_Val_SInt_UnicodeStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
end;
end;
@ -1279,14 +1278,14 @@ end;
Function fpc_Val_qword_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): qword; [public, alias:'FPC_VAL_QWORD_UNICODESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_qword_UnicodeStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_qword_UnicodeStr,Code);
end;
end;
@ -1294,14 +1293,14 @@ end;
Function fpc_Val_int64_UnicodeStr (Const S : UnicodeString; out Code : ValSInt): Int64; [public, alias:'FPC_VAL_INT64_UNICODESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_int64_UnicodeStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_int64_UnicodeStr,Code);
end;
end;
@ -1312,56 +1311,54 @@ end;
{$ifndef FPUNONE}
procedure fpc_UnicodeStr_Float(d : ValReal;len,fr,rt : SizeInt;out s : UnicodeString);compilerproc;
var
ss : shortstring;
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}
procedure fpc_UnicodeStr_Currency(c : Currency;len,fr : SizeInt;out s : UnicodeString);compilerproc;
var
ss : shortstring;
ss: shortstring;
begin
str(c:len:fr,ss);
s:=ss;
s:=UnicodeString(ss);
end;
{$endif FPC_HAS_STR_CURRENCY}
Procedure fpc_UnicodeStr_SInt(v : ValSint; Len : SizeInt; out S : UnicodeString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
Procedure fpc_UnicodeStr_UInt(v : ValUInt;Len : SizeInt; out S : UnicodeString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
@ -1369,19 +1366,19 @@ end;
Procedure fpc_UnicodeStr_Int64(v : Int64; Len : SizeInt; out S : UnicodeString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=UnicodeString(SS);
end;
Procedure fpc_UnicodeStr_Qword(v : Qword;Len : SizeInt; out S : UnicodeString);compilerproc;
Var
SS : ShortString;
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,45 +762,44 @@ 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
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
if length(S)>255 then
begin
fpc_Val_Currency_WideStr:=0;
code := 256;
code:=256;
end
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_Currency_WideStr,code);
end;
end;
@ -808,14 +807,14 @@ end;
Function fpc_Val_UInt_WideStr (Const S : WideString; out Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_WIDESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_UInt_WideStr := 0;
if length(S) > 255 then
code := 256
fpc_Val_UInt_WideStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_UInt_WideStr,code);
end;
end;
@ -823,14 +822,14 @@ end;
Function fpc_Val_SInt_WideStr (DestSize: SizeInt; Const S : WideString; out Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_WIDESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_SInt_WideStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
fpc_Val_SInt_WideStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
end;
end;
@ -840,14 +839,14 @@ end;
Function fpc_Val_qword_WideStr (Const S : WideString; out Code : ValSInt): qword; [public, alias:'FPC_VAL_QWORD_WIDESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_qword_WideStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_qword_WideStr,Code);
end;
end;
@ -855,14 +854,14 @@ end;
Function fpc_Val_int64_WideStr (Const S : WideString; out Code : ValSInt): Int64; [public, alias:'FPC_VAL_INT64_WIDESTR']; compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
fpc_Val_int64_WideStr:=0;
if length(S)>255 then
code:=256
else
begin
SS := S;
SS:=ShortString(S);
Val(SS,fpc_Val_int64_WideStr,Code);
end;
end;
@ -873,56 +872,54 @@ 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}
Procedure fpc_WideStr_SInt(v : ValSint; Len : SizeInt; out S : WideString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
Procedure fpc_WideStr_UInt(v : ValUInt;Len : SizeInt; out S : WideString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
@ -930,19 +927,19 @@ end;
Procedure fpc_WideStr_Int64(v : Int64; Len : SizeInt; out S : WideString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
Str (v:Len,SS);
S:=SS;
Str(v:Len,SS);
S:=WideString(SS);
end;
Procedure fpc_WideStr_Qword(v : Qword;Len : SizeInt; out S : WideString);compilerproc;
Var
SS : ShortString;
SS: ShortString;
begin
str(v:Len,SS);
S:=SS;
S:=WideString(SS);
end;
{$endif CPU64}