Subject | Re: UDF & unicode_FSS & delphi widestring ... |
---|---|
Author | mnavahan |
Post date | 2007-12-18T13:18:27Z |
--- In firebird-support@yahoogroups.com, "Svend Meyland Nicolaisen"
Hi
thx of help but some line not understand by me :
Len:=Length(Res)*8;
S:=ib_util_malloc(Len);
why *8 ?
also i do not use ib_util_malloc
i use MakeResultString and in start need one function echo text from
UDF :
function EchoText(ShStr: PChar): PChar;
var
s : string;
begin
WriteDebug('Left() - Enter');
S := String(ShStr);
result := MakeResultString(PChar(s), nil, 0);
end;
function MakeResultString(Source, OptionalDest: PChar; Len: DWORD):
PChar;
begin
result := OptionalDest;
if (Len = 0) then
Len := StrLen(Source) + 1;
if (result = nil) then begin
{$ifdef FREE_IT}
result := malloc(Len);
{$else}
with ThreadLocals do begin
if (FPCharSize < Len) or
(FPCharSize > Len + cSignificantlyLarger) then begin
FPCharSize := 0;
than
while (FPCharSize < Len) do
Inc(FPCharSize, cSignificantlyLarger);
ReallocMem(FPChar, FPCharSize);
end;
result := FPChar;
end;
{$endif}
end;
Hi
thx of help but some line not understand by me :
Len:=Length(Res)*8;
S:=ib_util_malloc(Len);
why *8 ?
also i do not use ib_util_malloc
i use MakeResultString and in start need one function echo text from
UDF :
function EchoText(ShStr: PChar): PChar;
var
s : string;
begin
WriteDebug('Left() - Enter');
S := String(ShStr);
result := MakeResultString(PChar(s), nil, 0);
end;
function MakeResultString(Source, OptionalDest: PChar; Len: DWORD):
PChar;
begin
result := OptionalDest;
if (Len = 0) then
Len := StrLen(Source) + 1;
if (result = nil) then begin
{$ifdef FREE_IT}
result := malloc(Len);
{$else}
with ThreadLocals do begin
if (FPCharSize < Len) or
(FPCharSize > Len + cSignificantlyLarger) then begin
FPCharSize := 0;
than
while (FPCharSize < Len) do
Inc(FPCharSize, cSignificantlyLarger);
ReallocMem(FPChar, FPCharSize);
end;
result := FPChar;
end;
{$endif}
end;