mirror of
https://github.com/CloudDelphi/Virtual-File-System
synced 2025-12-19 18:03:49 +01:00
Fixed Externalize functions to always return allocated buffer, even if source is empty string
This commit is contained in:
parent
420ddd7c15
commit
84c569935d
@ -26,22 +26,14 @@ exports
|
|||||||
|
|
||||||
function Externalize (const Str: AnsiString): {O} pointer; overload;
|
function Externalize (const Str: AnsiString): {O} pointer; overload;
|
||||||
begin
|
begin
|
||||||
result := nil;
|
|
||||||
|
|
||||||
if Str <> '' then begin
|
|
||||||
GetMem(result, Length(Str) + 1);
|
GetMem(result, Length(Str) + 1);
|
||||||
Utils.CopyMem(Length(Str) + 1, pointer(Str), result);
|
Utils.CopyMem(Length(Str) + 1, pchar(Str), result);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Externalize (const Str: WideString): {O} pointer; overload;
|
function Externalize (const Str: WideString): {O} pointer; overload;
|
||||||
begin
|
begin
|
||||||
result := nil;
|
|
||||||
|
|
||||||
if Str <> '' then begin
|
|
||||||
GetMem(result, (Length(Str) + 1) * sizeof(WideChar));
|
GetMem(result, (Length(Str) + 1) * sizeof(WideChar));
|
||||||
Utils.CopyMem((Length(Str) + 1) * sizeof(WideChar), pointer(Str), result);
|
Utils.CopyMem((Length(Str) + 1) * sizeof(WideChar), PWideChar(Str), result);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MapDir (const VirtPath, RealPath: PWideChar; OverwriteExisting: boolean; Flags: integer = 0): LONGBOOL; stdcall;
|
function MapDir (const VirtPath, RealPath: PWideChar; OverwriteExisting: boolean; Flags: integer = 0): LONGBOOL; stdcall;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user