* fixed insert on last char

* saver chararray 2 ansi
This commit is contained in:
peter 1999-04-06 11:23:58 +00:00
parent ee82810a16
commit 29d632520b

View File

@ -266,20 +266,24 @@ end;
Procedure CharArray_To_AnsiStr(var a : ansistring;p : pchar;l:longint);[Public,Alias : 'FPC_CHARARRAY_TO_ANSISTR']; Procedure CharArray_To_AnsiStr(var a : ansistring;p : pchar;l:longint);[Public,Alias : 'FPC_CHARARRAY_TO_ANSISTR'];
var
Var NewLen : Longint; i : longint;
hp : pchar;
begin begin
if p[0]=#0 Then if p[0]=#0 Then
Pointer(a):=nil Pointer(a):=nil
else else
begin begin
NewLen:=strlen(p); Pointer(a):=NewAnsistring(L);
If NewLen>L then hp:=p;
newlen:=L; i:=0;
Pointer(a):=NewAnsistring(NewLen); while (i<l) and (hp^<>#0) do
SetLength(A,NewLen); begin
Move (P[0],Pointer(A)^,NewLen) inc(hp);
inc(i);
end;
SetLength(A,i);
Move (P[0],Pointer(A)^,i)
end; end;
end; end;
@ -748,7 +752,7 @@ begin
If Index>0 then If Index>0 then
move (Pointer(S)^,Pointer(Temp)^,Index); move (Pointer(S)^,Pointer(Temp)^,Index);
Move (Pointer(Source)^,PByte(Temp)[Index],Length(Source)); Move (Pointer(Source)^,PByte(Temp)[Index],Length(Source));
If (LS-Index)>1 then If (LS-Index)>0 then
Move(PByte(Pointer(S))[Index],PByte(temp)[Length(Source)+index],LS-Index); Move(PByte(Pointer(S))[Index],PByte(temp)[Length(Source)+index],LS-Index);
S:=Temp; S:=Temp;
end; end;
@ -756,7 +760,11 @@ end;
{ {
$Log$ $Log$
Revision 1.16 1999-04-06 10:06:51 michael Revision 1.17 1999-04-06 11:23:58 peter
* fixed insert on last char
* saver chararray 2 ansi
Revision 1.16 1999/04/06 10:06:51 michael
* Fixed chararray to ansistring conversion * Fixed chararray to ansistring conversion
Revision 1.15 1999/04/01 22:00:48 peter Revision 1.15 1999/04/01 22:00:48 peter