Bladeren bron

Merged revisions 11884,11979,12035,12054,12056,12060,12066 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r11884 | marco | 2008-10-12 12:02:18 +0200 (Sun, 12 Oct 2008) | 2 lines

* avoid double free when reusing chmsitemap objects
........
r11979 | marco | 2008-10-26 23:15:47 +0100 (Sun, 26 Oct 2008) | 2 lines

* removed some 1.0 defines
........
r12035 | marco | 2008-11-08 14:58:46 +0100 (Sat, 08 Nov 2008) | 2 lines

* splitting of long lines when copying a TStringlist to a dos (shortstring) eq.
........
r12054 | marco | 2008-11-12 18:38:18 +0100 (Wed, 12 Nov 2008) | 2 lines

* fix for win32 chm use.
........
r12056 | marco | 2008-11-12 18:53:13 +0100 (Wed, 12 Nov 2008) | 2 lines

* Fixing result, no mode Delphi.
........
r12060 | marco | 2008-11-12 21:16:59 +0100 (Wed, 12 Nov 2008) | 1 line

* fixed another whtmlhlp
........
r12066 | marco | 2008-11-13 09:53:50 +0100 (Thu, 13 Nov 2008) | 1 line

* fix for 12619, security_descriptor_min_length now a sizeof as in the winsdk headers. (win64)
........

git-svn-id: branches/fixes_2_2@12116 -

marco 17 jaren geleden
bovenliggende
commit
49585bd73d

+ 0 - 2
ide/globdir.inc

@@ -129,10 +129,8 @@
 {$define HASOUTLINE}
 
 { Use inlining for small functions }
-{$ifndef VER1_0}
   {$inline on}
   {.$define USEINLINE}
-{$endif}
 
 {$define TEST_PARTIAL_SYNTAX}
 { $ undef UNDO}

+ 44 - 1
ide/wchmhwrap.pas

@@ -144,6 +144,44 @@ begin
   result:=true;
 end;
 
+procedure splitline(idestream:PMemoryTextFile;s:ansistring);
+
+function scanvalue:integer; // searches for a possible breaking point left of char 255.
+var n,i  : integer;
+    lastpoint:integer;
+    inquote : boolean;
+begin
+  lastpoint:=-1;
+  n:=length(s);
+  if n>250 then n:=250;
+  i:=1; inquote:=false;
+  while (i<=n) do
+    begin
+      while (s[i]<>' ') and (s[i]<>'"') and (i<=n) do inc(i);
+      if (s[i]=' ') and not inquote then lastpoint:=i;
+      if (s[i]='"') then inquote:=not inquote;
+      inc(i);
+    end;  
+  scanvalue:=lastpoint;
+end;
+
+var position : longint;
+
+begin
+  position:=0;
+  while (length(s)>250) and (position<>-1) do
+    begin
+      position:=scanvalue;
+      if position<>-1 then
+        begin
+          idestream.addline(copy(s,1,position-1));
+          delete(s,1,position);
+        end;
+    end;
+  if length(s)<>0 then
+    idestream.addline(s);
+end;
+
 function   TChmWrapper.GetTopic(name:string):PMemoryTextFile;
 
 var
@@ -170,7 +208,12 @@ begin
     linedata.loadfromstream(m);
     result:=new(PMemoryTextFile,Init);
     for i:=0 to linedata.count-1 do
-       result.addline(linedata[i]);
+       begin
+         if length(linedata[i])>250 Then
+             splitline(result,linedata[i])
+         else
+           result.addline(linedata[i]);
+       end;
   finally
     m.free;
     linedata.free;

+ 16 - 3
ide/whtmlhlp.pas

@@ -159,6 +159,7 @@ type
       function    GetTopicInfo(T: PTopic) : string; virtual;
       function    SearchTopic(HelpCtx: THelpCtx): PTopic; virtual;
       function    ReadTopic(T: PTopic): boolean; virtual;
+      function    FormatLink(const s:String):string; virtual;
     private
       DefaultFileName: string;
       CurFileName: string;
@@ -183,6 +184,7 @@ type
       function    ReadTopic(T: PTopic): boolean; virtual;
       function    GetTopicInfo(T: PTopic) : string; virtual;
       function    SearchTopic(HelpCtx: THelpCtx): PTopic; virtual;
+      function    FormatLink(const s:String):string; virtual;
     private
       Chmw: TCHMWrapper;
     end;
@@ -1362,6 +1364,11 @@ begin
   SearchTopic:=P;
 end;
 
+function TCustomHTMLHelpFile.FormatLink(const s:String):string;
+begin
+ formatlink:=formatpath(s);
+end;
+
 function TCustomHTMLHelpFile.GetTopicInfo(T: PTopic) : string;
 var OK: boolean;
     Name: string;
@@ -1384,7 +1391,7 @@ begin
           DebugMessageS({$i %file%},'(Topicinfo) Link before formatpath "'+link+'"',{$i %line%},'1',0,0);
 {$ENDIF WDEBUG}
           
-          Link:=FormatPath(Link);
+          Link:=FormatLink(Link);
 {$IFDEF WDEBUG}
           DebugMessageS({$i %file%},'(Topicinfo) Link after formatpath "'+link+'"',{$i %line%},'1',0,0);
 {$ENDIF WDEBUG}
@@ -1598,6 +1605,12 @@ begin
     loadindex:=chmw.loadindex(id,TopicLinks,IndexEntries,helpfacility);
 end;
 
+function TCHMHelpFile.FormatLink(const s:String):string;
+// do not reformat for chms, we assume them internally consistent.
+begin
+ formatlink:=s;
+end;
+
 function TChmHelpFile.SearchTopic(HelpCtx: THelpCtx): PTopic;
 function MatchCtx(P: PTopic): boolean;
 begin
@@ -1683,9 +1696,9 @@ begin
 {$IFDEF WDEBUG}
           DebugMessageS({$i %file%},' Looking for  "'+Link+'"',{$i %line%},'1',0,0);
 {$endif WDEBUG}
-          Link:=FormatPath(Link);
+          Link:=FormatLink(Link);
 {$IFDEF WDEBUG}
-          DebugMessageS({$i %file%},' Looking for (after formatpath)  "'+Link+'"',{$i %line%},'1',0,0);
+          DebugMessageS({$i %file%},' Looking for (after formatlink)  "'+Link+'"',{$i %line%},'1',0,0);
 {$endif WDEBUG}
           P:=Pos('#',Link);
           if P>0 then

+ 3 - 2
packages/chm/src/chmsitemap.pas

@@ -277,6 +277,7 @@ begin
   FSiteMapType := AType;
   FSiteMapTags := [smtNone];
   FSiteMapBodyTags := [smbtNone];
+  FHTMLParser:=nil;
   FItems := TChmSiteMapItems.Create(Self, nil);  ;
 end;
 
@@ -302,7 +303,7 @@ begin
   FHTMLParser.OnFoundTag := @FoundTag;
   FHTMLParser.OnFoundText := @FoundText;
   FHTMLParser.Exec;
-  FHTMLParser.Free;
+  FreeAndNil(FHTMLParser);
 end;
 
 procedure TChmSiteMap.LoadFromStream(AStream: TStream);
@@ -316,7 +317,7 @@ begin
     FHTMLParser.OnFoundTag := @FoundTag;
     FHTMLParser.OnFoundText := @FoundText;
     FHTMLParser.Exec;
-    FHTMLParser.Free;
+    FreeAndNil(FHTMLParser);
   end;
 end;
 

+ 1 - 11
packages/fv/src/drivers.pas

@@ -83,11 +83,7 @@ USES
    {$ENDIF}
 
    {$IFDEF OS_UNIX}
-     {$ifdef VER1_0}
-       linux,
-     {$else}
        baseunix,unix,
-     {$endif}
    {$ENDIF}
 
    {$IFDEF OS_NETWARE_LIBC}
@@ -733,14 +729,8 @@ Function GetDosTicks:longint; { returns ticks at 18.2 Hz, just like DOS }
      tv : TimeVal;
   {  tz : TimeZone;}
   begin
-    {$ifdef ver1_0}
-    GetTimeOfDay(tv{,tz});
-    GetDosTicks:=((tv.Sec mod 86400) div 60)*1092+((tv.Sec mod 60)*1000000+tv.USec) div 54945;
-    {$else}
     FPGetTimeOfDay(@tv,nil{,tz});
     GetDosTicks:=((tv.tv_Sec mod 86400) div 60)*1092+((tv.tv_Sec mod 60)*1000000+tv.tv_USec) div 54945;
-
-    {$endif}
   end;
 {$ENDIF OS_UNIX}
 {$IFDEF OS_WINDOWS}
@@ -784,7 +774,7 @@ end;
 begin
   req.tv_sec:=0;
   req.tv_nsec:=10000000;{ 10 ms }
-  {$ifdef ver1_0}nanosleep(req,rem){$else}fpnanosleep(@req,@rem){$endif};
+  fpnanosleep(@req,@rem);
 end;
 {$ENDIF}
 {$IFDEF OS_OS2}

+ 0 - 12
packages/fv/src/unixsmsg.inc

@@ -24,11 +24,7 @@
   it should use ioctl to get information about resizing of windows }
 
 uses
-{$ifdef VER1_0}
-  linux;
-{$else}
   BaseUnix,termio;
-{$endif}
 
 Const
   SystemEventActive : Boolean = false;
@@ -48,11 +44,7 @@ begin
   PendingSystemEvents:=0;
   FillChar(LastSystemEvent,sizeof(TSystemEvent),0);
   FillChar(WinSize,sizeof(WinSize),0);
-{$ifdef VER1_0}
-  ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
-{$else}
   fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
-{$endif}
   LastXSize:=WinSize.ws_row;
   LastYSize:=WinSize.ws_col;
   If LastXSize=0 then
@@ -103,11 +95,7 @@ begin
   else
    begin
      FillChar(WinSize,sizeof(WinSize),0);
-{$ifdef VER1_0}
-     ioctl(stdinputhandle,TIOCGWINSZ,@winsize);
-{$else}
      fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
-{$endif}
      if (winsize.ws_col<>0) and (winsize.ws_row<>0) and
         ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
        begin

+ 12 - 13
rtl/win/wininc/defines.inc

@@ -893,7 +893,7 @@
      DC_EXTRA = 9;
      DC_FIELDS = 1;
      DC_FILEDEPENDENCIES = 14;
-      
+
      DC_MAXEXTENT = 5;
      DC_MINEXTENT = 4;
      DC_ORIENTATION = 17;
@@ -1136,7 +1136,7 @@
   { EnumCalendarInfo  }
      ENUM_ALL_CALENDARS     = dword(-1);
      ENUM_CURRENT_SETTINGS  = dword(-1);
-     ENUM_REGISTRY_SETTINGS = dword(-2);     
+     ENUM_REGISTRY_SETTINGS = dword(-2);
   { EnumDateFormats  }
      DATE_SHORTDATE = 1;
      DATE_LONGDATE = 2;
@@ -2539,7 +2539,7 @@ Type
      OCR_SIZEWE = 32644;
      OCR_SIZENS = 32645;
      OCR_SIZEALL = 32646;
-     OCR_ICOCUR  =  32647;   // OBSOLETE: use OIC_WINLOGO 
+     OCR_ICOCUR  =  32647;   // OBSOLETE: use OIC_WINLOGO
      OCR_NO = 32648;
      OCR_APPSTARTING = 32650;
      OCR_HAND = 32649;
@@ -4347,7 +4347,6 @@ Type
      FAILED_ACCESS_ACE_FLAG = $80;
   { SECURITY_DESCRIPTOR_CONTROL  }
      {SECURITY_DESCRIPTOR_REVISION = 1;already defined above }
-     SECURITY_DESCRIPTOR_MIN_LENGTH = 20;
      SE_OWNER_DEFAULTED = 1;
      SE_GROUP_DEFAULTED = 2;
      SE_DACL_PRESENT = 4;
@@ -4361,11 +4360,11 @@ Type
      SE_PRIVILEGE_USED_FOR_ACCESS = $80000000;
      PRIVILEGE_SET_ALL_NECESSARY = $1;
   { OPENFILENAME structure  }
-     
-     
+
+
      OFN_READONLY                 = $1;
      OFN_OVERWRITEPROMPT          = $2;
-     OFN_HIDEREADONLY             = $4;	 
+     OFN_HIDEREADONLY             = $4;	
      OFN_NOCHANGEDIR              = $8;
      OFN_SHOWHELP                 = $10;
      OFN_ENABLEHOOK               = $20;
@@ -4382,19 +4381,19 @@ Type
      OFN_NOTESTFILECREATE         =    $10000;
      OFN_NONETWORKBUTTON          =    $20000;
      OFN_NOLONGNAMES              =    $40000;
-     OFN_EXPLORER                 =    $80000;     
+     OFN_EXPLORER                 =    $80000;
      OFN_NODEREFERENCELINKS       =   $100000;
      OFN_LONGNAMES                =   $200000;
      OFN_ENABLEINCLUDENOTIFY      = $00400000;
      OFN_ENABLESIZING             = $00800000;
      OFN_DONTADDTORECENT          = $02000000;
-     OFN_FORCESHOWHIDDEN          = $10000000;    
-          
+     OFN_FORCESHOWHIDDEN          = $10000000;
+
   { SHAREVISTRING message  }
      OFN_SHAREFALLTHROUGH = $2;
      OFN_SHARENOWARN = $1;
      OFN_SHAREWARN = 0;
-	 
+	
      OFN_EX_NOPLACESBAR         = $00000001;
   { Open/Save notifications  }
      CDN_INITDONE = $fffffda7;
@@ -5627,8 +5626,8 @@ const
   GA_ROOT       = 2;  { The window's root window }
   GA_ROOTOWNER  = 3;  { The window's owner }
 
-  AC_SRC_OVER = $00;     
-  AC_SRC_ALPHA = $01;     
+  AC_SRC_OVER = $00;
+  AC_SRC_ALPHA = $01;
 
   DMDO_DEFAULT    = 0;
   DMDO_90         = 1;

+ 3 - 0
rtl/win/wininc/struct.inc

@@ -7421,6 +7421,9 @@ type
   PGRADIENT_RECT = ^_GRADIENT_RECT;
   LPGRADIENT_RECT = PGRADIENT_RECT;
 
+const 
+  SECURITY_DESCRIPTOR_MIN_LENGTH = SIZEOF(SECURITY_DESCRIPTOR);
+
 {$endif read_interface}