瀏覽代碼

* export PathConv(RawByteString) from the system unit and import/use it in
the sysutils unit instead of the ShortString version

git-svn-id: branches/cpstrrtl@25077 -

Jonas Maebe 12 年之前
父節點
當前提交
c0d2ebb682
共有 4 個文件被更改,包括 12 次插入22 次删除
  1. 1 1
      rtl/amiga/sysos.inc
  2. 5 10
      rtl/amiga/sysutils.pp
  3. 1 1
      rtl/morphos/sysos.inc
  4. 5 10
      rtl/morphos/sysutils.pp

+ 1 - 1
rtl/amiga/sysos.inc

@@ -147,7 +147,7 @@ begin
 end;
 
 { Converts an Unix-like path to Amiga-like path }
-function PathConv(const path: rawbytestring): rawbytestring;
+function PathConv(const path: rawbytestring): rawbytestring; alias: 'PATHCONVRBS'; [public];
 var tmppos: longint;
 begin
   { check for short paths }

+ 5 - 10
rtl/amiga/sysutils.pp

@@ -59,6 +59,7 @@ uses dos,sysconst;
 
 { * Followings are implemented in the system unit! * }
 function PathConv(path: shortstring): shortstring; external name 'PATHCONV';
+function PathConv(path: RawByteString): shortstring; external name 'PATHCONVRBS';
 procedure AddToList(var l: Pointer; h: LongInt); external name 'ADDTOLIST';
 function RemoveFromList(var l: Pointer; h: LongInt): boolean; external name 'REMOVEFROMLIST';
 function CheckInList(var l: Pointer; h: LongInt): pointer; external name 'CHECKINLIST';
@@ -112,13 +113,10 @@ function FileOpen(const FileName: rawbytestring; Mode: Integer): LongInt;
 var
   SystemFileName: RawByteString;
   dosResult: LongInt;
-  tmpStr   : array[0..255] of char;
 begin
-  SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
+  SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
   {$WARNING FIX ME! To do: FileOpen Access Modes}
-  {$WARNING FIX ME! PathConv takes a shortstring, which means 255 char truncation and conversion to defaultsystemcodepage, ignoring the defaultfilesystemcodepage setting}
-  tmpStr:=PathConv(SystemFileName)+#0;
-  dosResult:=Open(@tmpStr,MODE_OLDFILE);
+  dosResult:=Open(PChar(SystemFileName),MODE_OLDFILE);
   if dosResult=0 then
     dosResult:=-1
   else
@@ -145,12 +143,9 @@ function FileCreate(const FileName: RawByteString) : LongInt;
 var
   SystemFileName: RawByteString;
   dosResult: LongInt;
-  tmpStr   : array[0..255] of char;
 begin
- SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
- {$WARNING FIX ME! PathConv takes a shortstring, which means 255 char truncation and conversion to defaultsystemcodepage, ignoring the defaultfilesystemcodepage setting}
- tmpStr:=PathConv(FileName)+#0;
- dosResult:=Open(@tmpStr,MODE_NEWFILE);
+ SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
+ dosResult:=Open(PChar(FileName),MODE_NEWFILE);
  if dosResult=0 then
    dosResult:=-1
  else

+ 1 - 1
rtl/morphos/sysos.inc

@@ -138,7 +138,7 @@ end;
 
 
 { Converts an Unix-like path to Amiga-like path }
-function PathConv(const path: rawbytestring): rawbytestring;
+function PathConv(const path: rawbytestring): rawbytestring; alias: 'PATHCONVRBS'; [public];
 var tmppos: longint;
 begin
   { check for short paths }

+ 5 - 10
rtl/morphos/sysutils.pp

@@ -61,6 +61,7 @@ uses dos,sysconst;
 
 { * Followings are implemented in the system unit! * }
 function PathConv(path: shortstring): shortstring; external name 'PATHCONV';
+function PathConv(path: RawByteString): shortstring; external name 'PATHCONVRBS';
 procedure AddToList(var l: Pointer; h: LongInt); external name 'ADDTOLIST';
 function RemoveFromList(var l: Pointer; h: LongInt): boolean; external name 'REMOVEFROMLIST';
 function CheckInList(var l: Pointer; h: LongInt): pointer; external name 'CHECKINLIST';
@@ -133,13 +134,10 @@ function FileOpen(const FileName: rawbytestring; Mode: Integer): LongInt;
 var
   SystemFileName: RawByteString;
   dosResult: LongInt;
-  tmpStr   : array[0..255] of char;
 begin
-  SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
+  SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
   {$WARNING FIX ME! To do: FileOpen Access Modes}
-  {$WARNING FIX ME! PathConv takes a shortstring, which means 255 char truncation and conversion to defaultsystemcodepage, ignoring the defaultfilesystemcodepage setting}
-  tmpStr:=PathConv(SystemFileName)+#0;
-  dosResult:=Open(@tmpStr,MODE_OLDFILE);
+  dosResult:=Open(PChar(SystemFileName),MODE_OLDFILE);
   if dosResult=0 then
     dosResult:=-1
   else
@@ -209,17 +207,14 @@ function FileCreate(const FileName: RawByteString) : LongInt;
 var
   SystemFileName: RawByteString;
   dosResult: LongInt;
-  tmpStr   : array[0..255] of char;
 begin
   dosResult:=-1;
 
   { Open file in MODDE_READWRITE, then truncate it by hand rather than
     opening it in MODE_NEWFILE, because that returns an exclusive lock 
     so some operations might fail with it (KB) }
-  SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  {$WARNING FIX ME! PathConv takes a shortstring, which means 255 char truncation and conversion to defaultsystemcodepage, ignoring the defaultfilesystemcodepage setting}
-  tmpStr:=PathConv(SystemFileName)+#0;
-  dosResult:=Open(@tmpStr,MODE_READWRITE);
+  SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
+  dosResult:=Open(PChar(SystemFileName),MODE_READWRITE);
   if dosResult = 0 then exit;
 
   if SetFileSize(dosResult, 0, OFFSET_BEGINNING) = 0 then