From 1f4bac4fd065b7ff7f3638816af21d00d7dc9c06 Mon Sep 17 00:00:00 2001
From: peter <peter@freepascal.org>
Date: Sun, 2 Sep 2001 21:16:25 +0000
Subject: [PATCH]   * delphi fixes

---
 compiler/dmisc.pas    | 23 ++++++++++++++++++-----
 compiler/mdppc386.bat |  2 +-
 compiler/widestr.pas  | 14 +++++++++-----
 3 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/compiler/dmisc.pas b/compiler/dmisc.pas
index 381fe5dcfa..0a46e6e2c5 100644
--- a/compiler/dmisc.pas
+++ b/compiler/dmisc.pas
@@ -26,6 +26,10 @@ unit dmisc;
 
 interface
 
+{$ifndef linux}
+   {$define MSWindows}
+{$endif}
+
 uses
 {$ifdef linux}
   Libc,
@@ -244,7 +248,9 @@ end;
 
 procedure getdate(var year,month,mday,wday : word);
 begin
-  DecodeDateFully(Now,Year,Month,MDay,WDay);
+  DecodeDate(Now,Year,Month,MDay);
+  WDay:=0;
+//  DecodeDateFully(Now,Year,Month,MDay,WDay);
 end;
 
 
@@ -654,7 +660,11 @@ end;
 
 procedure setftime(var f;time : longint);
 begin
+{$ifdef linux}
   FileSetDate(filerec(f).name,Time);
+{$else}
+  FileSetDate(filerec(f).handle,Time);
+{$endif}
 end;
 
 
@@ -687,7 +697,7 @@ procedure getfattr(var f;var attr : word);
 var
    l : longint;
 begin
-  l:=FileGetAttr(filerec(f).handle);
+  l:=FileGetAttr(filerec(f).name);
   attr:=l;
 end;
 {$endif}
@@ -695,8 +705,8 @@ end;
 
 procedure setfattr(var f;attr : word);
 begin
-{$ifndef linux}
-  FileSetAttr(filerec(f).handle,attr);
+{$ifdef MSWindows}
+  FileSetAttr(filerec(f).name,attr);
 {$endif}
 end;
 
@@ -826,7 +836,10 @@ End;
 end.
 {
   $Log$
-  Revision 1.5  2001-06-03 20:21:08  peter
+  Revision 1.6  2001-09-02 21:16:25  peter
+    * delphi fixes
+
+  Revision 1.5  2001/06/03 20:21:08  peter
     * Kylix fixes, mostly case names of units
 
   Revision 1.4  2000/09/24 21:19:50  peter
diff --git a/compiler/mdppc386.bat b/compiler/mdppc386.bat
index 3e06ae818a..a47a491a3a 100644
--- a/compiler/mdppc386.bat
+++ b/compiler/mdppc386.bat
@@ -1,2 +1,2 @@
-dcc32 -Di386 -DGDB -Ddelphi -CC -Ui386 -Utargets -E. -N. -$O+ ppc.dpr %1 %2 %3 %4 %5 %6 %7 %8 %9
+dcc32 -Di386 -DGDB -Ddelphi -CC -Ui386 -Utargets -E. -N. -$O- ppc.dpr %1 %2 %3 %4 %5 %6 %7 %8 %9
 
diff --git a/compiler/widestr.pas b/compiler/widestr.pas
index 21a182bef7..52a97813be 100644
--- a/compiler/widestr.pas
+++ b/compiler/widestr.pas
@@ -32,6 +32,7 @@ unit widestr;
 
     type
        tcompilerwidechar = word;
+       tcompilerwidecharptr = ^tcompilerwidechar;
 {$ifdef delphi}
        { delphi doesn't allow pointer accessing as array }
        tcompilerwidechararray = array[0..0] of tcompilerwidechar;
@@ -188,13 +189,13 @@ unit widestr;
 *)
       var
         source : pchar;
-        dest   : pcompilerwidechar;
+        dest   : tcompilerwidecharptr;
         i      : longint;
       begin
         setlengthwidestring(r,l);
         source:=p;
         r^.len:=l;
-        dest:=r^.data;
+        dest:=tcompilerwidecharptr(r^.data);
         for i:=1 to l do
          begin
            if byte(source^)<128 then
@@ -224,11 +225,11 @@ unit widestr;
       end;
 *)
       var
-        source : pcompilerwidechar;
+        source : tcompilerwidecharptr;
         dest   : pchar;
         i      : longint;
       begin
-        source:=r^.data;
+        source:=tcompilerwidecharptr(r^.data);
         dest:=p;
         for i:=1 to r^.len do
          begin
@@ -256,7 +257,10 @@ unit widestr;
 end.
 {
   $Log$
-  Revision 1.6  2001-07-08 21:00:16  peter
+  Revision 1.7  2001-09-02 21:16:25  peter
+    * delphi fixes
+
+  Revision 1.6  2001/07/08 21:00:16  peter
     * various widestring updates, it works now mostly without charset
       mapping supported