mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:29:33 +02:00
* Promoted result type of FPC_PCHAR_LENGTH and FPC_PWIDECHAR_LENGTH to SizeInt.
+ Check for nil pointer in FPC_PWIDECHAR_LENGTH git-svn-id: trunk@17733 -
This commit is contained in:
parent
0d71ef61fc
commit
4ebc34c5e7
@ -506,7 +506,7 @@ end;
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
function fpc_Pchar_length(p:Pchar):longint;assembler;nostackframe;[public,alias:'FPC_PCHAR_LENGTH'];compilerproc;
|
||||
function fpc_Pchar_length(p:Pchar):sizeint;assembler;nostackframe;[public,alias:'FPC_PCHAR_LENGTH'];compilerproc;
|
||||
|
||||
asm
|
||||
cmp r0,#0
|
||||
|
@ -461,7 +461,7 @@ end;
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
function fpc_Pchar_length(p:Pchar):longint;assembler;nostackframe;[public,alias:'FPC_PCHAR_LENGTH'];compilerproc;
|
||||
function fpc_Pchar_length(p:Pchar):sizeint;assembler;nostackframe;[public,alias:'FPC_PCHAR_LENGTH'];compilerproc;
|
||||
|
||||
asm
|
||||
cmp r0,#0
|
||||
|
@ -1144,7 +1144,7 @@ end;
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
function fpc_pchar_length(p:pchar):longint;assembler;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
function fpc_pchar_length(p:pchar):sizeint;assembler;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
|
||||
var
|
||||
saveedi : longint;
|
||||
|
@ -110,7 +110,7 @@ end;
|
||||
|
||||
function libc_pchar_length(p:pchar):size_t; cdecl; external 'c' name 'strlen';
|
||||
|
||||
function fpc_pchar_length(p:pchar):longint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
function fpc_pchar_length(p:pchar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
begin
|
||||
if assigned(p) then
|
||||
fpc_pchar_length:=libc_pchar_length(p)
|
||||
|
@ -67,8 +67,8 @@ function fpc_pchar_to_shortstr(p:pchar):shortstring; compilerproc;
|
||||
procedure fpc_pchar_to_shortstr(out res : shortstring;p:pchar); compilerproc;
|
||||
{$endif FPC_STRTOSHORTSTRINGPROC}
|
||||
|
||||
function fpc_pchar_length(p:pchar):longint; compilerproc;
|
||||
function fpc_pwidechar_length(p:pwidechar):longint; compilerproc;
|
||||
function fpc_pchar_length(p:pchar):sizeint; compilerproc;
|
||||
function fpc_pwidechar_length(p:pwidechar):sizeint; compilerproc;
|
||||
|
||||
{$ifndef FPC_STRTOSHORTSTRINGPROC}
|
||||
function fpc_chararray_to_shortstr(const arr: array of char; zerobased: boolean = true):shortstring; compilerproc;
|
||||
|
@ -1243,8 +1243,8 @@ end;
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
|
||||
function fpc_pchar_length(p:pchar):longint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
var i : longint;
|
||||
function fpc_pchar_length(p:pchar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
var i : sizeint;
|
||||
begin
|
||||
i:=0;
|
||||
if assigned(p) then
|
||||
@ -1257,11 +1257,13 @@ end;
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PWIDECHAR_LENGTH}
|
||||
|
||||
function fpc_pwidechar_length(p:pwidechar):longint;[public,alias:'FPC_PWIDECHAR_LENGTH']; compilerproc;
|
||||
var i : longint;
|
||||
function fpc_pwidechar_length(p:pwidechar):sizeint;[public,alias:'FPC_PWIDECHAR_LENGTH']; compilerproc;
|
||||
var i : sizeint;
|
||||
begin
|
||||
i:=0;
|
||||
while p[i]<>#0 do inc(i);
|
||||
if assigned(p) then
|
||||
while p[i]<>#0 do
|
||||
inc(i);
|
||||
exit(i);
|
||||
end;
|
||||
|
||||
|
@ -812,7 +812,7 @@ Function Sseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
****************************************************************************}
|
||||
|
||||
function strpas(p:pchar):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
function strlen(p:pchar):longint;external name 'FPC_PCHAR_LENGTH';
|
||||
function strlen(p:pchar):sizeint;external name 'FPC_PCHAR_LENGTH';
|
||||
|
||||
{ Shortstring functions }
|
||||
Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
|
||||
|
@ -100,7 +100,7 @@ implementation
|
||||
{ include system independent routines }
|
||||
{$I system.inc}
|
||||
|
||||
function fpc_pwidechar_length(p: PWideChar): LongInt; external name 'FPC_PWIDECHAR_LENGTH';
|
||||
function fpc_pwidechar_length(p: PWideChar): SizeInt; external name 'FPC_PWIDECHAR_LENGTH';
|
||||
|
||||
{ based on setup_arguments from Win32 RTL }
|
||||
procedure setup_arguments;
|
||||
|
@ -673,7 +673,7 @@ end;
|
||||
Initialization code
|
||||
****************************************************************************}
|
||||
|
||||
function wstrlen(p: PWideChar): LongInt; external name 'FPC_PWIDECHAR_LENGTH';
|
||||
function wstrlen(p: PWideChar): SizeInt; external name 'FPC_PWIDECHAR_LENGTH';
|
||||
|
||||
function GetEnvironmentVariable(const EnvVar: String): String;
|
||||
var
|
||||
|
@ -1005,7 +1005,7 @@ procedure fpc_pchar_to_shortstr(out res : shortstring;p:pchar);assembler;[public
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
function fpc_pchar_length(p:pchar):longint;assembler;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc; nostackframe;
|
||||
function fpc_pchar_length(p:pchar):sizeint;assembler;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc; nostackframe;
|
||||
{$include strlen.inc}
|
||||
{$endif FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user