Browse Source

* fixed several warnings and notes about unused variables (mainly) or
uninitialised use of variables/function results (a few)

Jonas Maebe 20 years ago
parent
commit
2426ecafc3

+ 5 - 4
rtl/bsd/system.pp

@@ -85,9 +85,6 @@ var
  execpathstr : shortstring;
  execpathstr : shortstring;
 
 
 function paramstr(l: longint) : string;
 function paramstr(l: longint) : string;
- var
-  s: string;
-  s1: string;
  begin
  begin
    { stricly conforming POSIX applications  }
    { stricly conforming POSIX applications  }
    { have the executing filename as argv[0] }
    { have the executing filename as argv[0] }
@@ -268,7 +265,11 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2005-02-14 17:13:21  peter
+  Revision 1.26  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.25  2005/02/14 17:13:21  peter
     * truncate log
     * truncate log
 
 
   Revision 1.24  2005/02/13 21:47:56  peter
   Revision 1.24  2005/02/13 21:47:56  peter

+ 2 - 2
rtl/darwin/console.pp

@@ -1853,13 +1853,13 @@ end;
 function KEYCHAR(c:longint):longint;
 function KEYCHAR(c:longint):longint;
 
 
 begin
 begin
-  c:=c and $FF;
+  keychar:=c and $FF;
 end;
 end;
 
 
 function KEYFLAGS(c:longint):longint;
 function KEYFLAGS(c:longint):longint;
 
 
 begin
 begin
-  c:=c and NOT $FF;
+  keyflags:=c and NOT $FF;
 end;
 end;
 
 
 function kbio_F(x:longint):longint;
 function kbio_F(x:longint):longint;

+ 5 - 2
rtl/darwin/tthread.inc

@@ -125,7 +125,6 @@ end;
 function ThreadFunc(parameter: Pointer): LongInt;
 function ThreadFunc(parameter: Pointer): LongInt;
 var
 var
   LThread: TThread;
   LThread: TThread;
-  c: char;
 begin
 begin
   WRITE_DEBUG('ThreadFunc is here...');
   WRITE_DEBUG('ThreadFunc is here...');
   LThread := TThread(parameter);
   LThread := TThread(parameter);
@@ -287,7 +286,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2005-03-01 20:38:49  jonas
+  Revision 1.7  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.6  2005/03/01 20:38:49  jonas
     * fixed web bug 3387: if one called resume right after creating a
     * fixed web bug 3387: if one called resume right after creating a
       suspended thread, it was possible that resume was executed before
       suspended thread, it was possible that resume was executed before
       that thread had completed its initialisation in BeginThread ->
       that thread had completed its initialisation in BeginThread ->

+ 5 - 2
rtl/darwin/unxfunc.inc

@@ -48,7 +48,6 @@ Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_
 }
 }
 var
 var
   ret  : longint;
   ret  : longint;
-  errn : cint;
   fdis : array[0..1] of cint;
   fdis : array[0..1] of cint;
 begin
 begin
  fdis[0]:=pipe_in;
  fdis[0]:=pipe_in;
@@ -62,7 +61,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2005-02-14 17:13:22  peter
+  Revision 1.3  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.2  2005/02/14 17:13:22  peter
     * truncate log
     * truncate log
 
 
   Revision 1.1  2005/02/13 21:47:56  peter
   Revision 1.1  2005/02/13 21:47:56  peter

+ 7 - 5
rtl/inc/heap.inc

@@ -962,7 +962,7 @@ end;
 
 
 function SysGetMem_Var(size: ptrint): pointer;
 function SysGetMem_Var(size: ptrint): pointer;
 var
 var
-  pcurr, pcurr_tmp : pmemchunk_var;
+  pcurr : pmemchunk_var;
 {$ifdef BESTMATCH}
 {$ifdef BESTMATCH}
   pbest : pmemchunk_var;
   pbest : pmemchunk_var;
 {$endif}
 {$endif}
@@ -1201,9 +1201,7 @@ function SysTryResizeMem(var p: pointer; size: ptrint): boolean;
 var
 var
   pcurrsize,
   pcurrsize,
   oldsize,
   oldsize,
-  currsize,
-  sizeleft : ptrint;
-  pnew,
+  currsize : ptrint;
   pcurr : pmemchunk_var;
   pcurr : pmemchunk_var;
 begin
 begin
   { fix p to point to the heaprecord }
   { fix p to point to the heaprecord }
@@ -1354,7 +1352,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.49  2005-03-21 16:31:33  peter
+  Revision 1.50  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.49  2005/03/21 16:31:33  peter
     * fix crash under win32 with previous reallocmem fix
     * fix crash under win32 with previous reallocmem fix
 
 
   Revision 1.48  2005/03/20 18:57:29  peter
   Revision 1.48  2005/03/20 18:57:29  peter

+ 7 - 1
rtl/inc/heaptrc.pp

@@ -742,8 +742,10 @@ procedure CheckPointer(p : pointer);{$ifndef NOSAVEREGISTERS}saveregisters;{$end
 var
 var
   i  : ptrint;
   i  : ptrint;
   pp : pheap_mem_info;
   pp : pheap_mem_info;
+{$ifdef go32v2}
   get_ebp,stack_top : longword;
   get_ebp,stack_top : longword;
   data_end : longword;
   data_end : longword;
+{$endif go32v2}
 label
 label
   _exit;
   _exit;
 begin
 begin
@@ -1193,7 +1195,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.42  2005-03-10 20:36:31  florian
+  Revision 1.43  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.42  2005/03/10 20:36:31  florian
     * fixed pointer checking for win32, thx to Martin Schreiber for the patch
     * fixed pointer checking for win32, thx to Martin Schreiber for the patch
 
 
   Revision 1.41  2005/03/04 16:49:34  peter
   Revision 1.41  2005/03/04 16:49:34  peter

+ 5 - 3
rtl/inc/sockets.inc

@@ -321,8 +321,6 @@ const digittab : shortstring = ('0123456789ABCDEF');
 
 
 function lclinttohex (i:integer;digits:longint): ansistring;
 function lclinttohex (i:integer;digits:longint): ansistring;
 
 
-var j,k : integer;
-
 begin
 begin
   SetLength(lclinttohex,4);
   SetLength(lclinttohex,4);
   lclinttohex[4]:=digittab[1+(i and 15)];
   lclinttohex[4]:=digittab[1+(i and 15)];
@@ -402,7 +400,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.17  2005-03-18 10:04:31  marco
+  Revision 1.18  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.17  2005/03/18 10:04:31  marco
    * cosmetic fix in netaddrtostr
    * cosmetic fix in netaddrtostr
 
 
   Revision 1.16  2005/02/14 17:13:26  peter
   Revision 1.16  2005/02/14 17:13:26  peter

+ 5 - 4
rtl/inc/system.inc

@@ -836,7 +836,6 @@ function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint)
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 
 
 var p   : ppchar;
 var p   : ppchar;
-    Res,
     i   : LongInt;
     i   : LongInt;
 begin
 begin
   if High(s)<Low(s) Then Exit(NIL);
   if High(s)<Low(s) Then Exit(NIL);
@@ -871,12 +870,10 @@ var
   i,nr  : longint;
   i,nr  : longint;
   Buf : ^char;
   Buf : ^char;
   p   : ppchar;
   p   : ppchar;
-  InQuote : Boolean;
 
 
 begin
 begin
   buf:=s;
   buf:=s;
   nr:=1;
   nr:=1;
-  InQuote:=false;
   while (buf^<>#0) do                   // count nr of args
   while (buf^<>#0) do                   // count nr of args
    begin
    begin
      while (buf^ in [' ',#9,#10]) do    // Kill separators.
      while (buf^ in [' ',#9,#10]) do    // Kill separators.
@@ -1051,7 +1048,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.77  2005-02-14 17:13:29  peter
+  Revision 1.78  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.77  2005/02/14 17:13:29  peter
     * truncate log
     * truncate log
 
 
   Revision 1.76  2005/02/08 20:25:28  florian
   Revision 1.76  2005/02/08 20:25:28  florian

+ 7 - 3
rtl/objpas/dateutil.inc

@@ -1435,7 +1435,7 @@ end;
 
 
 Function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64): TDateTime;
 Function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64): TDateTime;
 begin
 begin
-  Result:=Result+ANumberOfMinutes / MinsPerDay;
+  Result:=AValue+ANumberOfMinutes / MinsPerDay;
 end;
 end;
 
 
 
 
@@ -1637,7 +1637,7 @@ Procedure DecodeDateMonthWeek(const AValue: TDateTime; var AYear, AMonth, AWeekO
 
 
 Var
 Var
   D,SDOM,EDOM : Word;
   D,SDOM,EDOM : Word;
-  SOM,EOM : TdateTime;
+  SOM : TdateTime;
   DOM : Integer;
   DOM : Integer;
 begin
 begin
   DecodeDate(AValue,AYear,AMonth,D);
   DecodeDate(AValue,AYear,AMonth,D);
@@ -2022,7 +2022,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2005-02-14 17:13:31  peter
+  Revision 1.12  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.11  2005/02/14 17:13:31  peter
     * truncate log
     * truncate log
 
 
 }
 }

+ 6 - 2
rtl/objpas/strutils.pp

@@ -343,7 +343,7 @@ end;
 
 
 Function ReverseString(const AText: string): string;
 Function ReverseString(const AText: string): string;
 
 
-var c: char;
+var 
     i,j:longint;
     i,j:longint;
 
 
 begin
 begin
@@ -1679,7 +1679,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2005-02-14 17:13:31  peter
+  Revision 1.15  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.14  2005/02/14 17:13:31  peter
     * truncate log
     * truncate log
 
 
   Revision 1.13  2005/02/03 21:38:17  marco
   Revision 1.13  2005/02/03 21:38:17  marco

+ 6 - 1
rtl/objpas/sysutils/dati.inc

@@ -582,6 +582,7 @@ var
       P := P + 1;
       P := P + 1;
       end ;
       end ;
    token:=#255;
    token:=#255;
+   lastformattoken:=' ';
    while FormatCurrent < FormatEnd do 
    while FormatCurrent < FormatEnd do 
      begin
      begin
       Token := UpCase(FormatCurrent^);
       Token := UpCase(FormatCurrent^);
@@ -754,7 +755,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2005-03-17 15:21:10  marco
+  Revision 1.9  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.8  2005/03/17 15:21:10  marco
    * fixed incmonths default param. Thnks nldelphi
    * fixed incmonths default param. Thnks nldelphi
 
 
   Revision 1.7  2005/03/10 19:48:27  florian
   Revision 1.7  2005/03/10 19:48:27  florian

+ 2 - 0
rtl/objpas/sysutils/sysformt.inc

@@ -119,8 +119,10 @@ var Code: word;
 {$endif}
 {$endif}
     end;
     end;
 
 
+{$ifdef INWIDEFORMAT}
   var
   var
     FormatChar : TFormatChar;
     FormatChar : TFormatChar;
+{$endif INWIDEFORMAT}
 
 
   begin
   begin
 {$ifdef fmtdebug}
 {$ifdef fmtdebug}

+ 7 - 6
rtl/objpas/sysutils/sysstr.inc

@@ -566,7 +566,8 @@ end ;
 
 
 
 
 function AnsiExtractQuotedStr(var  Src: PChar; Quote: Char): string;
 function AnsiExtractQuotedStr(var  Src: PChar; Quote: Char): string;
-var i: integer; P, Q,R: PChar;
+var
+  P,Q,R: PChar;
 begin
 begin
  P := Src;
  P := Src;
  Q := StrEnd(P);
  Q := StrEnd(P);
@@ -577,7 +578,6 @@ begin
 
 
  setlength(result,(Q-P)+1);
  setlength(result,(Q-P)+1);
  R:=@Result[1];
  R:=@Result[1];
- i := 0;
  while P <> Q do
  while P <> Q do
    begin
    begin
      R^:=P^;
      R^:=P^;
@@ -956,8 +956,6 @@ Function TextToFloat(Buffer: PChar; Var Value; ValueType: TFloatValue): Boolean;
 Var
 Var
   E,P : Integer;
   E,P : Integer;
   S : String;
   S : String;
-  C : Currency;
-  Ext : Extended;
 
 
 Begin
 Begin
   S:=StrPas(Buffer);
   S:=StrPas(Buffer);
@@ -1786,7 +1784,6 @@ End;
 Function FormatFloat(Const format: String; Value: Extended): String;
 Function FormatFloat(Const format: String; Value: Extended): String;
 
 
 Var
 Var
-  Temp: ShortString;
   buf : Array[0..1024] of char;
   buf : Array[0..1024] of char;
 
 
 Begin
 Begin
@@ -2097,7 +2094,11 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.34  2005-03-13 14:30:24  marco
+  Revision 1.35  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.34  2005/03/13 14:30:24  marco
    * some 1.0.x fixes
    * some 1.0.x fixes
 
 
   Revision 1.33  2005/03/12 14:56:22  florian
   Revision 1.33  2005/03/12 14:56:22  florian

+ 5 - 4
rtl/unix/sysutils.pp

@@ -237,7 +237,6 @@ end;
 Function FileAge (Const FileName : String): Longint;
 Function FileAge (Const FileName : String): Longint;
 
 
 Var Info : Stat;
 Var Info : Stat;
-    Y,M,D,hh,mm,ss : word;
 
 
 begin
 begin
   If  fpstat (FileName,Info)<0 then
   If  fpstat (FileName,Info)<0 then
@@ -893,7 +892,6 @@ end;
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
 var
 var
   pid    : longint;
   pid    : longint;
-  err    : longint;
   e      : EOSError;
   e      : EOSError;
   CommandLine: AnsiString;
   CommandLine: AnsiString;
   cmdline2 : ppchar;
   cmdline2 : ppchar;
@@ -960,7 +958,6 @@ function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array Of AnsiStri
 
 
 var
 var
   pid    : longint;
   pid    : longint;
-  err    : longint;
   e : EOSError;
   e : EOSError;
 
 
 Begin
 Begin
@@ -1106,7 +1103,11 @@ end.
 {
 {
 
 
   $Log$
   $Log$
-  Revision 1.58  2005-02-26 14:38:14  florian
+  Revision 1.59  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.58  2005/02/26 14:38:14  florian
     + SysLocale
     + SysLocale
 
 
   Revision 1.57  2005/02/14 17:13:31  peter
   Revision 1.57  2005/02/14 17:13:31  peter

+ 11 - 4
rtl/unix/unix.pp

@@ -227,7 +227,8 @@ Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
 
 
 { Most calls of WaitPID do not handle the result correctly, this funktion treats errors more correctly }
 { Most calls of WaitPID do not handle the result correctly, this funktion treats errors more correctly }
 Function  WaitProcess(Pid:cint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
 Function  WaitProcess(Pid:cint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
-var     ret,r,s     : cint;
+var
+  r,s     : cint;
 begin
 begin
   s:=$7F00;
   s:=$7F00;
 
 
@@ -257,8 +258,6 @@ function intFpExecVEMaybeP (Const PathName:AnsiString;Args,MyEnv:ppchar;SearchPa
 Var
 Var
   NewCmd  : ansistring;
   NewCmd  : ansistring;
   ThePath : AnsiString;
   ThePath : AnsiString;
-  Error   : cint;
-  NrParam : longint;
 
 
 Begin
 Begin
   If SearchPath and (pos('/',pathname)=0) Then
   If SearchPath and (pos('/',pathname)=0) Then
@@ -749,7 +748,9 @@ var
   pipo : text;
   pipo : text;
   pid  : pid_t;
   pid  : pid_t;
   pl   : ^cint;
   pl   : ^cint;
+{$ifndef FPC_USE_FPEXEC}
   pp   : ppchar;
   pp   : ppchar;
+{$endif not FPC_USE_FPEXEC}
   ret  : cint;
   ret  : cint;
 begin
 begin
   rw:=upcase(rw);
   rw:=upcase(rw);
@@ -830,8 +831,10 @@ var
   pipo : file;
   pipo : file;
   pid  : cint;
   pid  : cint;
   pl   : ^cint;
   pl   : ^cint;
+{$ifndef FPC_USE_FPEXEC}
   p,pp : ppchar;
   p,pp : ppchar;
   temp : string[255];
   temp : string[255];
+{$endif not FPC_USE_FPEXEC}
   ret  : cint;
   ret  : cint;
 begin
 begin
   rw:=upcase(rw);
   rw:=upcase(rw);
@@ -1217,7 +1220,11 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.84  2005-02-14 17:13:31  peter
+  Revision 1.85  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.84  2005/02/14 17:13:31  peter
     * truncate log
     * truncate log
 
 
   Revision 1.83  2005/02/13 21:47:56  peter
   Revision 1.83  2005/02/13 21:47:56  peter

+ 5 - 4
rtl/unix/unixutil.pp

@@ -53,7 +53,6 @@ function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint)
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 
 
 var p   : ppchar;
 var p   : ppchar;
-    Res,
     i   : LongInt;
     i   : LongInt;
 begin
 begin
   if High(s)<Low(s) Then Exit(NIL);
   if High(s)<Low(s) Then Exit(NIL);
@@ -141,12 +140,10 @@ var
   i,nr  : longint;
   i,nr  : longint;
   Buf : ^char;
   Buf : ^char;
   p   : ppchar;
   p   : ppchar;
-  InQuote : Boolean;
 
 
 begin
 begin
   buf:=s;
   buf:=s;
   nr:=1;
   nr:=1;
-  InQuote:=false;
   while (buf^<>#0) do                   // count nr of args
   while (buf^<>#0) do                   // count nr of args
    begin
    begin
      while (buf^ in [' ',#9,#10]) do    // Kill separators.
      while (buf^ in [' ',#9,#10]) do    // Kill separators.
@@ -410,7 +407,11 @@ End;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2005-02-14 17:13:31  peter
+  Revision 1.8  2005-03-25 22:53:39  jonas
+    * fixed several warnings and notes about unused variables (mainly) or
+      uninitialised use of variables/function results (a few)
+
+  Revision 1.7  2005/02/14 17:13:31  peter
     * truncate log
     * truncate log
 
 
 }
 }