Bläddra i källkod

Always write filename, truncate directory part if needed

git-svn-id: trunk@34362 -
pierre 9 år sedan
förälder
incheckning
eefdf135a5
1 ändrade filer med 17 tillägg och 1 borttagningar
  1. 17 1
      compiler/ppheap.pas

+ 17 - 1
compiler/ppheap.pas

@@ -44,6 +44,9 @@ implementation
                             Filename registration
                             Filename registration
 *****************************************************************************}
 *****************************************************************************}
 
 
+
+    { We need to avoid using memory allocation here
+      and thus use a fixed size static array }
     const
     const
       MaxFiles = 1024;
       MaxFiles = 1024;
       MaxNameLength = 39;
       MaxNameLength = 39;
@@ -62,11 +65,24 @@ implementation
 
 
 
 
     procedure ppheap_register_file(name : string;index : longint);
     procedure ppheap_register_file(name : string;index : longint);
+      var
+        len,pos : longint;
       begin
       begin
         inc(last_index);
         inc(last_index);
         if last_index <= MaxFiles then
         if last_index <= MaxFiles then
           begin
           begin
-            fileinfoarray[last_index].name:=copy(name,1,MaxNameLength);
+            { Keep last part of name if too long }
+            len:=length(name);
+            if len>MaxNameLength then
+              begin
+                pos:=len-MaxNameLength+4;
+                fileinfoarray[last_index].name:='...'+copy(name,pos,MaxNameLength);
+              end
+            else
+              begin
+                pos:=1;
+                fileinfoarray[last_index].name:=copy(name,pos,MaxNameLength);
+              end;
             fileinfoarray[last_index].index:=index;
             fileinfoarray[last_index].index:=index;
           end
           end
         else
         else