This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cinstall patch


2001-10-27  Matt Hargett  <matt@use.net>

	* geturl.cc (progress): Change int to unsigned int to eliminate
	lint warnings.

	* (get_url_to_string): Check for NULL pointer.

	* mount.cc (find2): Use free instead of delete for malloc'd
	memory.

	* nio-http.cc (NetIO_HTTP::NetIO_HTTP): Fix memory leak.



There were a few lint wanrings I wasn't sure what to do about. The warning
and my question:

geturl.cc(95) : Warning 578: Declaration of symbol 'gw_dialog' hides
symbol
    'gw_dialog' (line 40)

Is this intentional?

----
choose.cc(448) : Warning 533: function 'list_click(struct HWND__ *, int,
int,
    int, unsigned int)' should return a value (see line 402)

what should the return value be at the end of the function?

-----
choose.cc(911) : Warning 644: Variable 'n' (line 891) may not have been
    initialized

what should initial value for n be?

----
          if (src && srcsz)
choose.cc(1488) : Warning 506: Constant value Boolean

Should this be *src && *srcsz?




--
http://www.clock.org/~matt
? cygwin.diff
Index: cinstall/geturl.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/geturl.cc,v
retrieving revision 2.7
diff -u -p -r2.7 geturl.cc
--- geturl.cc	2001/05/28 08:31:02	2.7
+++ geturl.cc	2001/10/28 02:44:37
@@ -160,7 +160,7 @@ progress (int bytes)
 {
   static char buf[100];
   int kbps;
-  static int last_tics = 0;
+  static unsigned int last_tics = 0;
   DWORD tics = GetTickCount ();
   if (tics == start_tics) // to prevent division by zero
     return;
@@ -232,6 +232,12 @@ get_url_to_string (char *_url)
     }
 
   char *rv = (char *) malloc (total_bytes);
+  if (NULL == rv)
+    {
+      log (LOG_BABBLE, "get_url_to_string(): malloc failed for rv!");
+      return 0;
+    }
+
   char *rvp = rv;
   while (bufs && bufs->count > 0)
     {
Index: cinstall/mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mount.cc,v
retrieving revision 2.5
diff -u -p -r2.5 mount.cc
--- mount.cc	2001/05/27 19:43:52	2.5
+++ mount.cc	2001/10/28 02:44:39
@@ -62,7 +62,7 @@ find2 (HKEY rkey, int *istext, char *wha
       if (RegQueryValueEx (key, "native", 0, &type, (BYTE *) retval, &retvallen)
 	  != ERROR_SUCCESS)
 	{
-	  delete retval;
+	  free (retval);
 	  retval = 0;
 	}
     }
Index: cinstall/nio-http.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/nio-http.cc,v
retrieving revision 2.3
diff -u -p -r2.3 nio-http.cc
--- nio-http.cc	2001/05/28 08:31:02	2.3
+++ nio-http.cc	2001/10/28 02:44:39
@@ -98,6 +98,7 @@ NetIO_HTTP::NetIO_HTTP (char *Purl, BOOL
 
   if (!s->ok())
     {
+      delete s;
       s = 0;
       return;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]