This is the mail archive of the cygwin-patches@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 compiler warning patch pt2


Now for the explanation:
This patch and the set of new files does 2 things:
1, turns up the warnings on sources a lot, and for most files will stop
on any warning.
2. has my sandbox state for io streams - Warren, you might like to
comment.

The streams stuff is not complete. What is done so far is
about 6-7 source files have been converted to use the new class's.
The archive_gz class is complete.
bz2 I am just starting on.

The archive_gz class can decompress directly from any stream or to any
stream, no disk file is required. The neat thing here is that we can
potentially (say for intranets) not cache the install files at all, and
just stream them down off the net.

When I've completed bz2, I'll be able to tackle tar, and _then_ we'll
find out if the class hierarchy really works.

Oh, and I just realised. (doh), that archive_* is misnamed, it should be
compressed_* for the files and classes. Oh well, gee I'm glad I haven't
put anything in CVS yet :}.

Rob

/* This part of the code must be in C because the C++ interface to COM
doesn't work. */

#ifdef __cplusplus
extern "C" {
#endif
void
make_link_2 (char *exepath, char *args, char *icon, char *lname);
#ifdef __cplusplus
};
#endif
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v
retrieving revision 2.24
diff -u -p -r2.24 Makefile.in
--- Makefile.in	2001/11/02 04:03:55	2.24
+++ Makefile.in	2001/11/05 14:33:04
@@ -35,7 +35,9 @@ CC		:= @CC@
 CC_FOR_TARGET	:= $(CC)
 CXX		:= @CXX@
 
-CFLAGS		:= @CFLAGS@
+CFLAGS		:= @CFLAGS@ -Werror -Winline -Wall -Wpointer-arith -Wcast-align\
+	-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+	-Wmissing-declarations -Wcomments
 CXXFLAGS	:= @CXXFLAGS@ $(CFLAGS) -fno-exceptions -fno-rtti
 CXX		:= @CXX@
 
@@ -44,10 +46,15 @@ OBJCOPY		:= @OBJCOPY@
 
 include $(srcdir)/../Makefile.common
 
-MINGW_INCLUDES	:= -I. -I$(srcdir) -I$(mingw_source)/include $(w32api_include) -I$(updir)/bz2lib
+MINGW_INCLUDES	:= -I. -I$(srcdir) -I$(mingw_source)/include -I$(w32api_include) -I$(updir)/bz2lib
 
 MINGW_CXXFLAGS	:= -MMD $(CXXFLAGS) -mno-cygwin $(MINGW_INCLUDES) -mwindows
 MINGW_CFLAGS	:= -MMD $(CFLAGS) -mno-cygwin $(MINGW_INCLUDES) -mwindows
+# to avoid false errors that assembly generates
+WARNONLY_CFLAGS := -MMD @CFLAGS@ -Winline -Wall -Wpointer-arith -Wcast-align \
+	-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+	-Wmissing-declarations -Wcomments \
+	 -mno-cygwin $(MINGW_INCLUDES) -mwindows
 
 ZLIB		:= zlib/libzcygw.a
 BZ2LIB		:= $(bupdir)/bz2lib/libbz2.a
@@ -73,6 +80,9 @@ ALL_LDFLAGS	:= ${filter-out -I%, \
 PROGS	:= setup$(EXEEXT)
 
 OBJS = \
+        archive.o \
+	archive_bz.o \
+	archive_gz.o \
 	autoload.o \
 	choose.o \
 	concat.o \
@@ -88,6 +98,9 @@ OBJS = \
 	inilex.o \
 	iniparse.o \
 	install.o \
+	io_stream.o \
+	io_stream_cygfile.o \
+	io_stream_file.o \
 	localdir.o \
 	log.o \
 	main.o \
@@ -166,8 +179,7 @@ version.c : $(srcdir)/ChangeLog Makefile
 	V=`grep '^\$$Revision.*' $(srcdir)/ChangeLog \
 	| sed -e 's/\$$Revision:* *//' \
 	  -e 's/ *$$.*//'` ;\
-	echo "char *version = \"$$V\";" > version.tmp ;\
-	echo "static char *id = \"\\n%%% setup-version $$V\\n\";" >> version.tmp
+	echo "char version[] = \"$$V\";" > version.tmp ;\
 	mv version.tmp version.c
 
 %.o: %.rc
@@ -196,11 +208,29 @@ endif
 
 autoload.o: autoload.c
 ifdef VERBOSE
-	$(CC) $(MINGW_CFLAGS) -c -o $@ $< -fno-inline-functions
+	$(CC) $(WARNONLY_CFLAGS) -c -o $@ $< -fno-inline-functions
 else
-	@echo $(CC) -c $(CFLAGS) ... $(<F) -fno-inline-functions
-	@$(CC) $(MINGW_CFLAGS) -c -o $@ $< -fno-inline-functions
+	@echo $(CC) -c $(WARNONLY_CFLAGS) ... $(<F) -fno-inline-functions
+	@$(CC) $(WARNONLY_CFLAGS) -c -o $@ $< -fno-inline-functions
 endif
+
+inilex.o: inilex.c
+ifdef VERBOSE
+	$(CC) $(WARNONLY_CFLAGS) -c -o $@ $<
+else
+	@echo $(CC) -c $(WARNONLY_CFLAGS) ... $(<F)
+	@$(CC) $(WARNONLY_CFLAGS) -c -o $@ $< 
+endif
+
+iniparse.o: iniparse.cc
+ifdef VERBOSE
+	$(CXX) @CXXFLAGS@ $(WARNONLY_CFLAGS) -fno-exceptions -fno-rtti -c -o $@ $< 
+else
+	@echo $(CXX) -c @CXXFLAGS@ $(WARNONLY_CFLAGS) ... $(<F) -fno-exceptions -fno-rtti
+	@$(CXX) @CXXFLAGS@ $(WARNONLY_CFLAGS) -c -o $@ $< -fno-exceptions -fno-rtti
+endif
+
+
 
 iniparse.cc iniparse.h : iniparse.y
 	bison -d -o iniparse.cc $(srcdir)/iniparse.y
Index: autoload.c
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/autoload.c,v
retrieving revision 2.2
diff -u -p -r2.2 autoload.c
--- autoload.c	2001/08/07 08:00:58	2.2
+++ autoload.c	2001/11/05 14:33:04
@@ -12,8 +12,9 @@
  * Written by DJ Delorie <dj@cygnus.com>
  *
  */
-
-static char *cvsid = "\n%%% $Id: autoload.c,v 2.2 2001/08/07 08:00:58 corinna Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: autoload.c,v 2.2 2001/08/07 08:00:58 corinna Exp $\n";
+#endif
 
 #include "win32.h"
 
Index: choose.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/choose.cc,v
retrieving revision 2.61
diff -u -p -r2.61 choose.cc
--- choose.cc	2001/11/02 08:11:52	2.61
+++ choose.cc	2001/11/05 14:33:06
@@ -25,9 +25,11 @@
    install packages, or to install packages that aren't installed by
    default. */
 
+#if 0
 static char *cvsid =
   "\n%%% $Id: choose.cc,v 2.61 2001/11/02 08:11:52 rbcollins Exp $\n";
-
+#endif
+  
 #include "win32.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -43,7 +45,7 @@ static char *cvsid =
 #include "log.h"
 #include "find.h"
 #include "filemanip.h"
-#include "mount.h"
+#include "io_stream.h"
 #include "choose.h"
 
 #include "port.h"
@@ -196,7 +198,6 @@ add_required (Package * pkg)
 {
   Dependency *dp;
   Package *required;
-  int c;
   int changed = 0;
   dp = pkg->required;
   switch (pkg->action)
@@ -283,8 +284,9 @@ choose_caption (Package * pkg)
 	return "Source";
     case ACTION_SKIP:
       return "Skip";
+    default:
+      return "???";
     }
-  return "???";
 }
 
 static void
@@ -292,7 +294,7 @@ paint (HWND hwnd)
 {
   HDC hdc;
   PAINTSTRUCT ps;
-  int x, y, i, j, ii;
+  int x, y, i, ii;
 
   hdc = BeginPaint (hwnd, &ps);
 
@@ -328,7 +330,7 @@ paint (HWND hwnd)
 
   if (chooser->nlines == 0)
     {
-      static char *msg = "Nothing to Install/Update";
+      static const char *msg = "Nothing to Install/Update";
       if (source == IDC_SOURCE_DOWNLOAD)
 	msg = "Nothing to Download";
       TextOut (hdc, HMARGIN, header_height, msg, strlen (msg));
@@ -340,8 +342,6 @@ paint (HWND hwnd)
 static void
 scroll_common (HWND hwnd, int which, int *var, int code)
 {
-  int v = *var;
-
   SCROLLINFO si;
   si.cbSize = sizeof (si);
   si.fMask = SIF_ALL;
@@ -376,7 +376,7 @@ scroll_common (HWND hwnd, int which, int
 
   if ((int) si.nPos < 0)
     si.nPos = 0;
-  if (si.nPos + si.nPage > si.nMax)
+  if (si.nPos + si.nPage > (unsigned int) si.nMax)
     si.nPos = si.nMax - si.nPage;
 
   si.fMask = SIF_POS;
@@ -446,7 +446,7 @@ list_click (HWND hwnd, BOOL dblclk, int 
       /* if we are under the minimum display count ,
        * set the offset to 0
        */
-      if (si.nMax <= si.nPage)
+      if ((unsigned int) si.nMax <= si.nPage)
 	scroll_ulc_y = 0;
       si.nPos = scroll_ulc_y;
 
@@ -510,7 +510,7 @@ register_windows (HINSTANCE hinst)
 }
 
 static void
-note_width (struct _header *hdrs, HDC dc, char *string, int addend,
+note_width (struct _header *hdrs, HDC dc, const char *string, int addend,
 	    int column)
 {
   if (!string)
@@ -579,8 +579,6 @@ keep_or_skip (Package * pkg)
 static void
 default_trust (HWND h, trusts trust)
 {
-  int i, t, c;
-
   deftrust = trust;
   for (Package * pkg = package; pkg->name; pkg++)
     if (!pkg->exclude)
@@ -725,7 +723,7 @@ _view::set_view_mode (views _mode)
   set_headers ();
 }
 
-char *
+const char *
 _view::mode_caption ()
 {
   switch (view_mode)
@@ -1075,7 +1073,6 @@ _view::click (int row, int x)
 static void
 set_view_mode (HWND h, views mode)
 {
-  int i;
   chooser->set_view_mode (mode);
 
   chooser->clear_view ();
@@ -1132,7 +1129,6 @@ set_view_mode (HWND h, views mode)
 static void
 create_listview (HWND dlg, RECT * r)
 {
-  int i, t;
   lv = CreateWindowEx (WS_EX_CLIENTEDGE,
 		       "listview",
 		       "listviewwindow",
@@ -1161,7 +1157,7 @@ create_listview (HWND dlg, RECT * r)
   default_trust (lv, TRUST_CURR);
   set_view_mode (lv, VIEW_CATEGORY);
   if (!SetDlgItemText (dlg, IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ()))
-    log (LOG_BABBLE, "Failed to set View button caption %d", GetLastError ());
+    log (LOG_BABBLE, "Failed to set View button caption %lu", GetLastError ());
   for (Package * foo = package; foo->name; foo++)
     add_required (foo);
   static int ta[] = { IDC_CHOOSE_CURR, 0 };
@@ -1197,7 +1193,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       set_view_mode (lv, viewsplusplus (chooser->get_view_mode ()));
       if (!SetDlgItemText
 	  (h, IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ()))
-	log (LOG_BABBLE, "Failed to set View button caption %d",
+	log (LOG_BABBLE, "Failed to set View button caption %lu",
 	     GetLastError ());
       break;
 
@@ -1220,6 +1216,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static void
@@ -1242,7 +1239,6 @@ GetParentRect (HWND parent, HWND child, 
 static BOOL CALLBACK
 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
 {
-  int i, j;
   HWND frame;
   RECT r;
   switch (message)
@@ -1523,18 +1519,14 @@ _Info::_Info (const char *_install, cons
 static void
 read_installed_db ()
 {
-  int i;
-  if (!get_root_dir ())
-    return;
-
   char line[1000], pkgname[1000], inst[1000], src[1000];
   int instsz, srcsz;
 
-  FILE *db = fopen (cygpath ("/etc/setup/installed.db", 0), "rt");
+  io_stream *db = io_stream::open (concat ("cygfile://", "/etc/setup/installed.db", 0), "rt");
   if (!db)
     return;
 
-  while (fgets (line, 1000, db))
+  while (db->gets (line, 1000))
     {
       int parseable;
       src[0] = 0;
@@ -1574,7 +1566,7 @@ read_installed_db ()
 	      break;
 	    }
     }
-  fclose (db);
+  delete db;
 }
 
 int
@@ -1620,7 +1612,7 @@ do_choose (HINSTANCE h)
   log (LOG_BABBLE, "Chooser results...");
   for (Package * pkg = package; pkg->name; pkg++)
     {
-      static char *infos[] = { "nada", "prev", "curr", "test" };
+      static const char *infos[] = { "nada", "prev", "curr", "test" };
       const char *trust = ((pkg->trust == TRUST_PREV) ? "prev"
 			   : (pkg->trust == TRUST_CURR) ? "curr"
 			   : (pkg->trust == TRUST_TEST) ? "test" : "unknown");
@@ -1639,7 +1631,6 @@ do_choose (HINSTANCE h)
       if (pkg->category)
 	{
 	  /* List categories the package belongs to */
-	  char *categories = "";
 	  int categories_len = 0;
 	  Category *cp;
 	  for (cp = pkg->category; cp; cp = cp->next)
@@ -1648,7 +1639,7 @@ do_choose (HINSTANCE h)
 
 	  if (categories_len > 0)
 	    {
-	      categories = (char *) malloc (categories_len);
+	      char * categories = (char *) malloc (categories_len);
 	      strcpy (categories, pkg->category->name);
 	      for (cp = pkg->category->next; cp; cp = cp->next)
 		if (cp->name)
@@ -1663,7 +1654,6 @@ do_choose (HINSTANCE h)
       if (pkg->required)
 	{
 	  /* List other packages this package depends on */
-	  char *requires = "";
 	  int requires_len = 0;
 	  Dependency *dp;
 	  for (dp = pkg->required; dp; dp = dp->next)
@@ -1672,7 +1662,7 @@ do_choose (HINSTANCE h)
 
 	  if (requires_len > 0)
 	    {
-	      requires = (char *) malloc (requires_len);
+	      char * requires = (char *) malloc (requires_len);
 	      strcpy (requires, pkg->required->package);
 	      for (dp = pkg->required->next; dp; dp = dp->next)
 		if (dp->package)
Index: choose.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/choose.h,v
retrieving revision 2.1
diff -u -p -r2.1 choose.h
--- choose.h	2001/06/30 01:37:55	2.1
+++ choose.h	2001/11/05 14:33:06
@@ -24,7 +24,7 @@
 
 struct _header
 {
-  char *text;
+  const char *text;
   int slen;
   int width;
   int x;
@@ -54,7 +54,7 @@ class _view
     void set_view_mode(views _mode);
     struct _header *headers;
     _view (views mode, HDC dc);
-    char *mode_caption ();
+    const char *mode_caption ();
     void insert_pkg (Package *);
     void insert_category (Category *, int);
     void clear_view (void);
Index: concat.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/concat.cc,v
retrieving revision 2.2
diff -u -p -r2.2 concat.cc
--- concat.cc	2001/05/27 07:05:09	2.2
+++ concat.cc	2001/11/05 14:33:06
@@ -16,7 +16,10 @@
 /* See concat.h.  Note that we canonicalize the result, this avoids
    multiple slashes being interpreted as UNCs. */
 
-static char *cvsid = "\n%%% $Id: concat.cc,v 2.2 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: concat.cc,v 2.2 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
+
 
 #include <stdarg.h>
 #include <stdlib.h>
Index: desktop.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/desktop.cc,v
retrieving revision 2.13
diff -u -p -r2.13 desktop.cc
--- desktop.cc	2001/10/27 15:56:46	2.13
+++ desktop.cc	2001/11/05 14:33:06
@@ -18,7 +18,9 @@
    that unlike other do_* functions, this one is called directly from
    install.cc */
 
-static char *cvsid = "\n%%% $Id: desktop.cc,v 2.13 2001/10/27 15:56:46 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: desktop.cc,v 2.13 2001/10/27 15:56:46 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <shlobj.h>
@@ -39,9 +41,7 @@ static char *cvsid = "\n%%% $Id: desktop
 
 #include "port.h"
 
-extern "C" {
-  void make_link_2 (char *exepath, char *args, char *icon, char *lname);
-};
+#include "mklink2.h"
 
 static OSVERSIONINFO verinfo;
 
@@ -53,7 +53,7 @@ static OSVERSIONINFO verinfo;
 	@*
    */
 
-static char *etc_profile[] = {
+static const char *etc_profile[] = {
   "PATH=\"/usr/local/bin:/usr/bin:/bin:$PATH\"",
   "",
   "USER=\"`id -un`\"",
@@ -93,7 +93,7 @@ static char *batname;
 static char *iconname;
 
 static void
-make_link (char *linkpath, char *title, char *target)
+make_link (const char *linkpath, const char *title, const char *target)
 {
   char argbuf[_MAX_PATH];
   char *fname = concat (linkpath, "/", title, ".lnk", 0);
@@ -105,31 +105,29 @@ make_link (char *linkpath, char *title, 
 
   mkdir_p (0, fname);
 
-  char *exepath, *args;
+  char *exepath;
 
   /* If we are running Win9x, build a command line. */
   if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
     {
-      exepath = target;
-      args = "";
+      exepath = concat (target, 0);
+      sprintf (argbuf, " ");
     }
   else
     {
-      char *pccmd;
       char windir[MAX_PATH];
 
       GetWindowsDirectory (windir, sizeof (windir));
       exepath = concat (windir, COMMAND9XEXE, 0);
       sprintf (argbuf, "%s %s", COMMAND9XARGS, target);
-      args = argbuf;
     }
 
-  msg ("make_link_2 (%s, %s, %s, %s)", exepath, args, iconname, fname);
-  make_link_2 (exepath, args, iconname, fname);
+  msg ("make_link_2 (%s, %s, %s, %s)", exepath, argbuf, iconname, fname);
+  make_link_2 (exepath, argbuf, iconname, fname);
 }
 
 static void
-start_menu (char *title, char *target)
+start_menu (const char *title, const char *target)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -150,7 +148,7 @@ start_menu (char *title, char *target)
 }
 
 static void
-desktop_icon (char *title, char *target)
+desktop_icon (const char *title, const char *target)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -231,7 +229,7 @@ make_etc_profile ()
 	{
 	  allow = 0;
 	  msg ("profile: %s", etc_profile[i]);
-	  for (char *cp = etc_profile[i]+1; *cp; cp++)
+	  for (const char *cp = etc_profile[i]+1; *cp; cp++)
 	    if (*cp == os || *cp == '*')
 	      allow = 1;
 	  msg ("allow is %d\n", allow);
@@ -244,7 +242,7 @@ make_etc_profile ()
 }
 
 static int
-uexists (char *path)
+uexists (const char *path)
 {
   char *f = cygpath (path, 0);
   int a = _access (f, 0);
@@ -346,7 +344,7 @@ load_dialog (HWND h)
   check_if_enable_next (h);
 }
 
-static int check_desktop (char *title, char *target)
+static int check_desktop (const char *title, const char *target)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -375,7 +373,7 @@ static int check_desktop (char *title, c
   return IDC_ROOT_DESKTOP;
 }
 
-static int check_startmenu (char *title, char *target)
+static int check_startmenu (const char *title, const char *target)
 {
   char path[_MAX_PATH];
   LPITEMIDLIST id;
@@ -439,6 +437,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: dialog.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/dialog.cc,v
retrieving revision 2.3
diff -u -p -r2.3 dialog.cc
--- dialog.cc	2001/05/27 07:05:09	2.3
+++ dialog.cc	2001/11/05 14:33:06
@@ -16,7 +16,9 @@
 /* The purpose of this file is to provide common functionality for
    all the dialogs in the program. */
 
-static char *cvsid = "\n%%% $Id: dialog.cc,v 2.3 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: dialog.cc,v 2.3 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -82,7 +84,7 @@ rbset (HWND h, int *ids, int id)
 }
 
 void
-fatal (char *msg)
+fatal (const char *msg)
 {
   DWORD e = GetLastError ();
   char *buf;
Index: dialog.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/dialog.h,v
retrieving revision 2.3
diff -u -p -r2.3 dialog.h
--- dialog.h	2001/05/27 07:05:09	2.3
+++ dialog.h	2001/11/05 14:33:06
@@ -69,4 +69,4 @@ void  rbset (HWND h, int *ids, int id);
 /* *This* version of fatal (compare with msg.h) uses GetLastError() to
    format a suitable error message.  Similar to perror() */
 
-void fatal (char *msg);
+void fatal (const char *msg);
Index: diskfull.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/diskfull.cc,v
retrieving revision 2.1
diff -u -p -r2.1 diskfull.cc
--- diskfull.cc	2001/05/27 07:05:09	2.1
+++ diskfull.cc	2001/11/05 14:33:06
@@ -18,7 +18,9 @@
    handle disks bigger than 2G, and a new API that isn't always
    available. */
 
-static char *cvsid = "\n%%% $Id: diskfull.cc,v 2.1 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: diskfull.cc,v 2.1 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 
Index: download.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/download.cc,v
retrieving revision 2.12
diff -u -p -r2.12 download.cc
--- download.cc	2001/06/13 16:11:01	2.12
+++ download.cc	2001/11/05 14:33:06
@@ -16,7 +16,9 @@
 /* The purpose of this file is to download all the files we need to
    do the installation. */
 
-static char *cvsid = "\n%%% $Id: download.cc,v 2.12 2001/06/13 16:11:01 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: download.cc,v 2.12 2001/06/13 16:11:01 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 
@@ -52,10 +54,9 @@ get_file_size (const char *name)
 }
 
 static int
-download_one (char *name, int expected_size, int action)
+download_one (char *name, unsigned int expected_size, int action)
 {
   char *local = name;
-  int errors = 0;
 
   DWORD size;
   if ((size = get_file_size (local)) > 0)
@@ -84,7 +85,7 @@ download_one (char *name, int expected_s
 	}
       else
 	{
-	  log (0, "Download %s wrong size (%d actual vs %d expected)",
+	  log (0, "Download %s wrong size (%ld actual vs %d expected)",
 	       local, size, expected_size);
 	  note (IDS_DOWNLOAD_SHORT, local, size, expected_size);
 	  return 1;
@@ -97,7 +98,6 @@ download_one (char *name, int expected_s
 void
 do_download (HINSTANCE h)
 {
-  int i;
   int errors = 0;
   total_download_bytes = 0;
   total_download_bytes_sofar = 0;
Index: find.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/find.cc,v
retrieving revision 2.1
diff -u -p -r2.1 find.cc
--- find.cc	2001/04/18 20:11:58	2.1
+++ find.cc	2001/11/05 14:33:06
@@ -16,7 +16,9 @@
 /* The purpose of this file is to doa recursive find on a given
    directory, calling a given function for each file found. */
 
-static char *cvsid = "\n%%% $Id: find.cc,v 2.1 2001/04/18 20:11:58 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: find.cc,v 2.1 2001/04/18 20:11:58 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -65,7 +67,7 @@ find_sub ()
 }
 
 int
-find (char *starting_dir, void (*_for_each)(char *, unsigned int))
+find (const char *starting_dir, void (*_for_each)(char *, unsigned int))
 {
   strcpy (dir, starting_dir);
   for_each = _for_each;
Index: find.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/find.h,v
retrieving revision 2.0
diff -u -p -r2.0 find.h
--- find.h	2000/08/08 00:27:54	2.0
+++ find.h	2001/11/05 14:33:06
@@ -19,4 +19,4 @@
    (bytes).  find() returns the number of files found.  Directories
    are scanned but not included in the "found" files. */
 
-extern int find (char *starting_dir, void (*for_each)(char *, unsigned int));
+extern int find (const char *starting_dir, void (*for_each)(char *, unsigned int));
Index: geturl.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/geturl.cc,v
retrieving revision 2.10
diff -u -p -r2.10 geturl.cc
--- geturl.cc	2001/11/02 00:50:19	2.10
+++ geturl.cc	2001/11/05 14:33:06
@@ -17,7 +17,9 @@
    netio.cc.  We add a progress dialog and some convenience functions
    (like collect to string or file */
 
-static char *cvsid = "\n%%% $Id: geturl.cc,v 2.10 2001/11/02 00:50:19 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: geturl.cc,v 2.10 2001/11/02 00:50:19 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include "commctrl.h"
@@ -60,13 +62,12 @@ dialog_cmd (HWND h, int id, HWND hwndctl
     case IDCANCEL:
       exit_setup (0);
     }
+  return 0;
 }
 
 static BOOL CALLBACK
 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
 {
-  int i, j;
-  HWND listbox;
   switch (message)
     {
     case WM_INITDIALOG:
@@ -90,7 +91,6 @@ dialog_proc (HWND h, UINT message, WPARA
 static WINAPI DWORD
 dialog (void *)
 {
-  int rv = 0;
   MSG m;
   HWND local_gw_dialog = CreateDialog (hinstance, MAKEINTRESOURCE (IDD_DLSTATUS),
 				   0, dialog_proc);
@@ -100,6 +100,7 @@ dialog (void *)
     TranslateMessage (&m);
     DispatchMessage (&m);
   }
+  return 0;
 }
 
 static DWORD start_tics;
@@ -274,7 +275,7 @@ get_url_to_file (char *_url, char *_file
   FILE *f = fopen (_filename, "wb");
   if (!f)
     {
-      char *err = strerror (errno);
+      const char *err = strerror (errno);
       if (!err)
 	err = "(unknown error)";
       fatal (IDS_ERR_OPEN_WRITE, _filename, err);
Index: hash.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/hash.cc,v
retrieving revision 2.2
diff -u -p -r2.2 hash.cc
--- hash.cc	2000/08/30 01:07:51	2.2
+++ hash.cc	2001/11/05 14:33:06
@@ -15,7 +15,9 @@
 
 /* Simple hash class for install.cc */
 
-static char *cvsid = "\n%%% $Id: hash.cc,v 2.2 2000/08/30 01:07:51 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: hash.cc,v 2.2 2000/08/30 01:07:51 dj Exp $\n";
+#endif
 
 #include <stdlib.h>
 #include <string.h>
Index: ini.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/ini.cc,v
retrieving revision 2.9
diff -u -p -r2.9 ini.cc
--- ini.cc	2001/06/13 16:11:01	2.9
+++ ini.cc	2001/11/05 14:33:06
@@ -18,7 +18,9 @@
    flex parsers are provided also.  We check to see if this setup.ini
    is older than the one we used last time, and if so, warn the user. */
 
-static char *cvsid = "\n%%% $Id: ini.cc,v 2.9 2001/06/13 16:11:01 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: ini.cc,v 2.9 2001/06/13 16:11:01 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 
@@ -33,11 +35,12 @@ static char *cvsid = "\n%%% $Id: ini.cc,
 #include "geturl.h"
 #include "dialog.h"
 #include "msg.h"
-#include "mkdir.h"
 #include "log.h"
 #include "version.h"
 #include "mount.h"
 
+#include "io_stream.h"
+
 unsigned int setup_timestamp = 0;
 char *setup_version = 0;
 
@@ -80,24 +83,27 @@ do_ini (HINSTANCE h)
   else
     {
       /* save known-good setup.ini locally */
-      FILE *inif = fopen ("setup.ini", "wb");
-      if (inif)
+      io_stream * inistream = io_stream::open ("file://setup.ini", "wb");
+      if (inistream)
 	{
-	  fwrite (ini_file, 1, strlen (ini_file), inif);
-	  fclose (inif);
+	  inistream->write (ini_file, strlen (ini_file));
+	  delete inistream;
 	}
     }
 
   if (get_root_dir ())
     {
-      mkdir_p (1, cygpath ("/etc/setup", 0));
+      io_stream::mkpath_p (PATH_TO_DIR, "cygfile:///etc/setup");
 
       unsigned int old_timestamp = 0;
-      FILE *ots = fopen (cygpath ("/etc/setup/timestamp", 0), "rt");
+      io_stream * ots = io_stream::open ("cygfile:///etc/setup/timestamp", "rt");
       if (ots)
 	{
-	  fscanf (ots, "%u", &old_timestamp);
-	  fclose (ots);
+	  char temp[20];
+	  memset (temp, '\0', 20);
+	  if (ots->read (temp, 19))
+	    sscanf (temp, "%u", &old_timestamp);
+	  delete ots;
 	  if (old_timestamp && setup_timestamp
 	      && (old_timestamp > setup_timestamp))
 	    {
@@ -108,11 +114,13 @@ do_ini (HINSTANCE h)
 	}
       if (setup_timestamp)
 	{
-	  FILE *nts = fopen (cygpath ("/etc/setup/timestamp", 0), "wt");
+	  io_stream * nts = io_stream::open ("cygfile:///etc/setup/timestamp", "wt");
 	  if (nts)
 	    {
-	      fprintf (nts, "%u", setup_timestamp);
-	      fclose (nts);
+	      char temp[20];
+	      sprintf (temp, "%u", setup_timestamp);
+	      nts->write (temp, strlen (temp));
+	      delete nts;
 	    }
 	}
     }
@@ -154,6 +162,8 @@ extern "C" int yyerror (char *s, ...)
       strcpy (error_buf, buf);
     }
   error_count++;
+  /* TODO: is return 0 correct? */
+  return 0;
 }
 
 extern "C" int fprintf (FILE *f, const char *s, ...);
Index: ini.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/ini.h,v
retrieving revision 2.17
diff -u -p -r2.17 ini.h
--- ini.h	2001/08/05 01:38:46	2.17
+++ ini.h	2001/11/05 14:33:07
@@ -101,12 +101,12 @@ typedef struct _Info
 {
   char *version;	/* version part of filename */
   char *install;	/* file name to install */
-  int install_size;	/* in bytes */
+  unsigned int install_size;	/* in bytes */
   int install_exists;	/* install file exists on disk */
   int derived;		/* True if we "figured out" that this version should
 			   go here but it was not in setup.ini */
   char *source;		/* sources for installed binaries */
-  int source_size;	/* in bytes */
+  unsigned int source_size;	/* in bytes */
   int source_exists;	/* source file exists on disk */
 #ifdef __cplusplus
   _Info (const char *_install, const char *_version,
@@ -173,7 +173,7 @@ Package *getpkgbyname (const char *pkgna
 void    new_requirement (Package *package, char *dependson);
 Category *getcategorybyname (const char *categoryname);
 Category *getpackagecategorybyname (Package *pkg, const char *categoryname); 
-Category *register_category (char *name);
+Category *register_category (const char *name);
 void    add_category (Package *package, Category *cat);
 
 #ifdef __cplusplus
Index: inilex.l
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/inilex.l,v
retrieving revision 2.5
diff -u -p -r2.5 inilex.l
--- inilex.l	2001/09/21 17:57:52	2.5
+++ inilex.l	2001/11/05 14:33:07
@@ -27,7 +27,7 @@
 #define YY_INPUT(buf,result,max_size) { result = ini_getchar(buf, max_size); }
 
 static int ini_getchar(char *buf, int max_size);
-static void ignore_line ();
+static void ignore_line (void);
 
 %}
 
@@ -119,7 +119,7 @@ static void
 ignore_line ()
 {
   char c;
-  while (c = input ())
+  while ((c = input ()))
     {
       if (c == EOF)
 	return;
Index: iniparse.y
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/iniparse.y,v
retrieving revision 2.12
diff -u -p -r2.12 iniparse.y
--- iniparse.y	2001/09/26 21:44:57	2.12
+++ iniparse.y	2001/11/05 14:33:07
@@ -169,7 +169,7 @@ new_requirement (Package *package, char 
 }
 
 Category *
-register_category (char *name)
+register_category (const char *name)
 {
   Category *tempcat;
   if (category == NULL)
Index: install.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/install.cc,v
retrieving revision 2.21
diff -u -p -r2.21 install.cc
--- install.cc	2001/11/02 00:50:19	2.21
+++ install.cc	2001/11/05 14:33:07
@@ -17,9 +17,11 @@
    the install list (in ini.h).  Note that we use a separate thread to
    maintain the progress dialog, so we avoid the complexity of
    handling two tasks in one thread.  We also create or update all the
-   files in /etc/setup/* and create the mount points. */
+   files in /etc/setup/\* and create the mount points. */
 
-static char *cvsid = "\n%%% $Id: install.cc,v 2.21 2001/11/02 00:50:19 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: install.cc,v 2.21 2001/11/02 00:50:19 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include "commctrl.h"
@@ -47,6 +49,9 @@ static char *cvsid = "\n%%% $Id: install
 #include "hash.h"
 #include "mount.h"
 #include "filemanip.h"
+#include "io_stream.h"
+#include "archive.h"
+#include "archive_gz.h"
 
 #include "port.h"
 
@@ -71,13 +76,12 @@ dialog_cmd (HWND h, int id, HWND hwndctl
     case IDCANCEL:
       exit_setup (1);
     }
+  return 0;
 }
 
 static BOOL CALLBACK
 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
 {
-  int i, j;
-  HWND listbox;
   switch (message)
     {
     case WM_INITDIALOG:
@@ -111,10 +115,9 @@ dialog (void *)
     TranslateMessage (&m);
     DispatchMessage (&m);
   }
+  return rv;
 }
 
-static DWORD start_tics;
-
 static void
 init_dialog ()
 {
@@ -160,14 +163,13 @@ progress (int bytes)
 static void
 badrename (char *o, char *n)
 {
-  char buf[1000];
-  char *err = strerror (errno);
+  const char *err = strerror (errno);
   if (!err)
     err = "(unknown error)";
   note (IDS_ERR_RENAME, o, n, err);
 }
 
-static char *standard_dirs[] = {
+static const char *standard_dirs[] = {
   "/bin",
   "/etc",
   "/lib",
@@ -225,8 +227,9 @@ uninstall_one (Package *pkg, bool src)
   hash dirs;
   char line[_MAX_PATH];
 
-  gzFile lst = gzopen (cygpath ("/etc/setup/", pkg->name,
-				(src ? "-src.lst.gz" : ".lst.gz"), 0), "rb");
+  io_stream *tmp = io_stream::open (concat ("cygfile:///etc/setup/", pkg->name,
+					    (src ? "-src.lst.gz" : ".lst.gz"), 0), "rb");
+  io_stream *lst = archive::decompress (tmp);
   if (lst)
     {
       SetWindowText (ins_pkgname, pkg->name);
@@ -236,7 +239,7 @@ uninstall_one (Package *pkg, bool src)
       else
 	log (0, "Uninstalling old %s", pkg->name);
 
-      while (gzgets (lst, line, sizeof (line)))
+      while (lst->gets (line, sizeof (line)))
 	{
 	  if (line[strlen(line)-1] == '\n')
 	    line[strlen(line)-1] = 0;
@@ -251,7 +254,7 @@ uninstall_one (Package *pkg, bool src)
 	      DeleteFile (d);
 	    }
 	}
-      gzclose (lst);
+      delete lst;
 
       remove (cygpath ("/etc/setup/", pkg->name, ".lst.gz", 0));
 
@@ -278,7 +281,7 @@ static int
 install_one (Package *pkg, bool isSrc)
 {
   int errors = 0;
-  char *extra;
+  const char *extra;
   const char *file;
   int file_size;
   Info *pi = pkg->info + pkg->trust;
@@ -312,9 +315,14 @@ install_one (Package *pkg, bool isSrc)
       return 1;
     }
 
-  gzFile lst = gzopen (cygpath ("/etc/setup/", name, ".lst.gz", 0),
-		       "wb9");
-
+  io_stream * tmp = io_stream::open (concat ("cygfile:///etc/setup/", name, ".lst.gz", 0), "wb");
+  io_stream * lst = new archive_gz (tmp, "w9");
+  if (lst->error ())
+    {
+      delete lst;
+      lst = NULL;
+    }
+  
   package_bytes = file_size;
 
   char msg[64];
@@ -342,6 +350,9 @@ install_one (Package *pkg, bool isSrc)
     case ACTION_TEST:
       strcat (msg, " test version...");
       break;
+    default:
+      /* FIXME: log this somehow */
+      break;
     }
 
   SetWindowText (ins_action, msg);
@@ -349,12 +360,12 @@ install_one (Package *pkg, bool isSrc)
   tar_open (file);
 
   char *fn;
-  while (fn = tar_next_file ())
+  while ((fn = tar_next_file ()))
     {
       char *dest_file;
 
       if (lst)
-	gzprintf (lst, "%s\n", fn);
+	  lst->write (concat (fn, "\n", 0), strlen (fn) +1);
 
       dest_file = cygpath (isSrc ? "/usr/src/" : "/", fn, NULL);
 
@@ -379,7 +390,7 @@ install_one (Package *pkg, bool isSrc)
   SendMessage (ins_diskfull, PBM_SETPOS, (WPARAM) df, 0);
 
   if (lst)
-    gzclose (lst);
+      delete lst;
 
   if (!errors)
     {
@@ -445,11 +456,8 @@ do_install (HINSTANCE h)
     }
 
   /* Create /var/run/utmp */
-  char *utmp = cygpath ("/var/run/utmp", 0);
-  FILE *ufp = fopen (utmp, "wb");
-  if (ufp)
-    fclose (ufp);
-  free (utmp);
+  io_stream * utmp = io_stream::open ("cygfile:///var/run/utmp", "wb");
+  delete utmp;
 
   dismiss_url_status_dialog ();
 
@@ -514,7 +522,7 @@ do_install (HINSTANCE h)
 
   if (!ndb)
     {
-      char *err = strerror (errno);
+      const char *err = strerror (errno);
       if (!err)
 	err = "(unknown error)";
       fatal (IDS_ERR_OPEN_WRITE, ndb, err);
@@ -523,7 +531,6 @@ do_install (HINSTANCE h)
   if (odb)
     {
       char line[1000], pkgname[1000];
-      int printit;
       while (fgets (line, 1000, odb))
 	{
 	  sscanf (line, "%s", pkgname);
Index: localdir.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/localdir.cc,v
retrieving revision 2.2
diff -u -p -r2.2 localdir.cc
--- localdir.cc	2001/11/01 13:22:46	2.2
+++ localdir.cc	2001/11/05 14:33:07
@@ -15,12 +15,14 @@
  */
 
 /* The purpose of this file is to ask the user where they want the
-   root of the installation to be, and to ask whether the user prefers
-   text or binary mounts. */
+ * locally downloaded package files to be cached
+ */
 
-static char *cvsid =
+#if 0
+static const char *cvsid =
   "\n%%% $Id: localdir.cc,v 2.2 2001/11/01 13:22:46 rbcollins Exp $\n";
-
+#endif
+  
 #include "win32.h"
 #include <shlobj.h>
 #include <stdio.h>
@@ -35,34 +37,23 @@ static char *cvsid =
 #include "concat.h"
 #include "log.h"
 #include "mkdir.h"
-
-static void
-get_root_dir_now ()
-{
-  int istext;
-  int issystem;
-  if (get_root_dir ())
-    return;
-  read_mounts ();
-}
+#include "io_stream.h"
 
 void
 save_local_dir ()
 {
-  get_root_dir_now ();
-  if (!get_root_dir ())
-    return;
-
   mkdir_p (1, local_dir);
 
-  FILE *f = fopen (cygpath ("/etc/setup/last-cache", 0), "wb");
-  if (!f)
-    return;
-  fprintf (f, "%s", local_dir);
-  fclose (f);
+  io_stream *f = io_stream::open ("cygfile:///etc/setup/last-cache", "wb");
+  if (f)
+    {
+      char temp[1000];
+      sprintf (temp, "%s", local_dir);
+      f->write (temp, strlen (temp));
+      delete f;
+    }
 }
 
-
 static void
 check_if_enable_next (HWND h)
 {
@@ -116,8 +107,7 @@ browse (HWND h)
     }
 }
 
-
-static BOOL
+  static BOOL
 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
 {
   switch (id)
@@ -178,6 +168,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
@@ -202,13 +193,12 @@ do_local_dir (HINSTANCE h)
   static int inited = 0;
   if (!inited)
     {
-      FILE *f = fopen (cygpath ("/etc/setup/last-cache", 0), "rt");
+      io_stream *f = io_stream::open ("cygfile:///etc/setup/last-cache", "rt");
       if (f)
 	{
 	  char localdir[1000];
-	  localdir[0] = '\0';
-	  char *fg_ret = fgets (localdir, 1000, f);
-	  fclose (f);
+	  char *fg_ret = f->gets (localdir, 1000);
+	  delete f;
 	  if (fg_ret)
 	    {
 	      free (local_dir);
Index: log.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/log.cc,v
retrieving revision 2.4
diff -u -p -r2.4 log.cc
--- log.cc	2001/05/27 07:05:09	2.4
+++ log.cc	2001/11/05 14:33:07
@@ -15,7 +15,9 @@
 
 /* The purpose of this file is to centralize all the logging functions. */
 
-static char *cvsid = "\n%%% $Id: log.cc,v 2.4 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: log.cc,v 2.4 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -43,7 +45,7 @@ static LogEnt *first_logent = 0;
 static LogEnt **next_logent = &first_logent;
 
 void
-log (int flags, char *fmt, ...)
+log (int flags, const char *fmt, ...)
 {
   char buf[1000];
   va_list args;
@@ -70,7 +72,7 @@ log (int flags, char *fmt, ...)
 }
 
 void
-log_save (int babble, char *filename, int append)
+log_save (int babble, const char *filename, int append)
 {
   static int been_here = 0;
   if (been_here)
Index: log.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/log.h,v
retrieving revision 2.1
diff -u -p -r2.1 log.h
--- log.h	2000/08/25 01:32:08	2.1
+++ log.h	2001/11/05 14:33:07
@@ -20,12 +20,12 @@
 #define LOG_BABBLE	1
 #define LOG_TIMESTAMP	2
 
-void log (int flags, char *fmt, ...);
+void log (int flags, const char *fmt, ...)  __attribute__ ((format (printf, 2, 3)));
 
 /* Here, "babble" means to write out the babble also.  If "append" is
    nonzero, the log is appended to any existing file. */
 
-void log_save (int babble, char *filename, int append);
+void log_save (int babble, const char *filename, int append);
 
 /* This is the only legal way to exit.  It writes out all the logs and things */
 
Index: main.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/main.cc,v
retrieving revision 2.8
diff -u -p -r2.8 main.cc
--- main.cc	2001/11/01 01:58:19	2.8
+++ main.cc	2001/11/05 14:33:07
@@ -23,7 +23,9 @@
    those don't count, although they could).  Replace the IDD_S_* with
    IDD_* if you create a real dialog for those steps. */
 
-static char *cvsid = "\n%%% $Id: main.cc,v 2.8 2001/11/01 01:58:19 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: main.cc,v 2.8 2001/11/01 01:58:19 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 
@@ -176,4 +178,6 @@ WinMain (HINSTANCE h,
     }
 
   exit_setup (0);
+  /* Keep gcc happy :} */
+  return 0;
 }
Index: mkdir.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mkdir.cc,v
retrieving revision 2.2
diff -u -p -r2.2 mkdir.cc
--- mkdir.cc	2001/05/27 07:05:09	2.2
+++ mkdir.cc	2001/11/05 14:33:07
@@ -15,7 +15,9 @@
 
 /* see mkdir.h */
 
-static char *cvsid = "\n%%% $Id: mkdir.cc,v 2.2 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: mkdir.cc,v 2.2 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 
Index: mklink2.c
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mklink2.c,v
retrieving revision 2.0
diff -u -p -r2.0 mklink2.c
--- mklink2.c	2000/08/08 00:27:54	2.0
+++ mklink2.c	2001/11/05 14:33:07
@@ -1,7 +1,10 @@
 #include "win32.h"
 #include "shlobj.h"
+#include "mklink2.h"
 
-static char *cvsid = "\n%%% $Id: mklink2.c,v 2.0 2000/08/08 00:27:54 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: mklink2.c,v 2.0 2000/08/08 00:27:54 dj Exp $\n";
+#endif
 
 /* This part of the code must be in C because the C++ interface to COM
 doesn't work. */
Index: mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/mount.cc,v
retrieving revision 2.6
diff -u -p -r2.6 mount.cc
--- mount.cc	2001/10/31 13:15:05	2.6
+++ mount.cc	2001/11/05 14:33:08
@@ -17,7 +17,9 @@
    Cygwin's mount table.  If the format or location of the mount table
    changes, this is the file to change to match it. */
 
-static char *cvsid = "\n%%% $Id: mount.cc,v 2.6 2001/10/31 13:15:05 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: mount.cc,v 2.6 2001/10/31 13:15:05 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 
@@ -45,7 +47,6 @@ struct mnt *root_here = NULL;
 static char *
 find2 (HKEY rkey, int *istext, char *what)
 {
-  char buf[1000];
   char *retval = 0;
   DWORD retvallen = 0;
   DWORD flags = 0;
@@ -82,9 +83,8 @@ void
 create_mount (const char *posix, const char *win32, int istext, int issystem)
 {
   char buf[1000];
-  char *retval = 0;
   HKEY key;
-  DWORD retvallen = 0, disposition;
+  DWORD disposition;
   DWORD flags;
 
   remove_mount (posix);
@@ -96,7 +96,7 @@ create_mount (const char *posix, const c
 	   posix);
 
   HKEY kr = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-  if (RegCreateKeyEx (kr, buf, 0, "Cygwin", 0, KEY_ALL_ACCESS,
+  if (RegCreateKeyEx (kr, buf, 0, (char *) "Cygwin", 0, KEY_ALL_ACCESS,
 		      0, &key, &disposition) != ERROR_SUCCESS)
     fatal ("mount");
 
@@ -313,7 +313,7 @@ read_mounts ()
 	       CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
 
       HKEY key = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-      if (RegCreateKeyEx (key, buf, 0, "Cygwin", 0, KEY_ALL_ACCESS,
+      if (RegCreateKeyEx (key, buf, 0, (char *) "Cygwin", 0, KEY_ALL_ACCESS,
 			  0, &key, &disposition) != ERROR_SUCCESS)
 	break;
       for (int i = 0; ;i++, m++)
@@ -425,7 +425,7 @@ char *
 cygpath (const char *s, ...)
 {
   va_list v;
-  int i, max_len = -1;
+  int max_len = -1;
   struct mnt *m, *match;
 
   va_start (v, s);
@@ -445,7 +445,7 @@ cygpath (const char *s, ...)
     }
 
   char *native;
-  if (max_len == strlen (path))
+  if (max_len == (int) strlen (path))
     native = strdup (match->native);
   else
     native = concat (match->native, "/", path + max_len, NULL);
Index: msg.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/msg.cc,v
retrieving revision 2.1
diff -u -p -r2.1 msg.cc
--- msg.cc	2000/08/25 01:32:08	2.1
+++ msg.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* The purpose of this file is to centralize all the message
    functions. */
 
-static char *cvsid = "\n%%% $Id: msg.cc,v 2.1 2000/08/25 01:32:08 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: msg.cc,v 2.1 2000/08/25 01:32:08 dj Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -25,7 +27,7 @@ static char *cvsid = "\n%%% $Id: msg.cc,
 #include "log.h"
 
 void
-msg (char *fmt, ...)
+msg (const char *fmt, ...)
 {
   char buf[1000];
   va_list args;
@@ -35,7 +37,7 @@ msg (char *fmt, ...)
 }
 
 static int
-mbox (char *name, int type, int id, va_list args)
+mbox (const char *name, int type, int id, va_list args)
 {
   char buf[1000], fmt[1000];
 
Index: msg.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/msg.h,v
retrieving revision 2.0
diff -u -p -r2.0 msg.h
--- msg.h	2000/08/08 00:27:54	2.0
+++ msg.h	2001/11/05 14:33:08
@@ -17,7 +17,7 @@
    OutputDebugString, which can be seen while debugging under GDB or
    via a debug message monitor. */
 
-void msg(char *fmt, ...);
+void msg(const char *fmt, ...);
 
 /* This pops up a dialog with text from the string table ("id"), which
    is interpreted like printf.  The program exits when the user
Index: net.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/net.cc,v
retrieving revision 2.6
diff -u -p -r2.6 net.cc
--- net.cc	2001/11/01 13:22:46	2.6
+++ net.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* The purpose of this file is to get the network configuration
    information from the user. */
 
-static char *cvsid = "\n%%% $Id: net.cc,v 2.6 2001/11/01 13:22:46 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: net.cc,v 2.6 2001/11/01 13:22:46 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -108,6 +110,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: netio.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/netio.cc,v
retrieving revision 2.3
diff -u -p -r2.3 netio.cc
--- netio.cc	2001/05/28 08:31:02	2.3
+++ netio.cc	2001/11/05 14:33:08
@@ -17,7 +17,9 @@
    methods known to setup.  To add a new method, create a pair of
    nio-*.[ch] files and add the logic to NetIO::open here */
 
-static char *cvsid = "\n%%% $Id: netio.cc,v 2.3 2001/05/28 08:31:02 corinna Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: netio.cc,v 2.3 2001/05/28 08:31:02 corinna Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -136,6 +138,9 @@ NetIO::open (char *url, BOOL allow_ftp_a
 	case ftp:
 	  rv = new NetIO_FTP (url, allow_ftp_auth);
 	  break;
+	case file:
+	  rv = new NetIO_File (url);
+	  break;
 	}
     }
 
@@ -203,6 +208,7 @@ auth_cmd (HWND h, int id, HWND hwndctl, 
       exit_setup (1);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: nio-file.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/nio-file.cc,v
retrieving revision 2.2
diff -u -p -r2.2 nio-file.cc
--- nio-file.cc	2001/06/13 16:11:01	2.2
+++ nio-file.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* The purpose of this file is to manage access to files stored on the
    local disk (i.e. "downloading" setup.ini).  Called from netio.cc */
 
-static char *cvsid = "\n%%% $Id: nio-file.cc,v 2.2 2001/06/13 16:11:01 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: nio-file.cc,v 2.2 2001/06/13 16:11:01 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -32,7 +34,6 @@ static char *cvsid = "\n%%% $Id: nio-fil
 NetIO_File::NetIO_File (char *Purl)
   : NetIO (Purl)
 {
-  struct stat s;
   fd = fopen (path, "rb");
   if (fd)
     {
@@ -40,7 +41,7 @@ NetIO_File::NetIO_File (char *Purl)
     }
   else
     {
-      char *err = strerror (errno);
+      const char *err = strerror (errno);
       if (!err)
 	err = "(unknown error)";
       note (IDS_ERR_OPEN_READ, path, err);
Index: nio-ftp.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/nio-ftp.cc,v
retrieving revision 2.4
diff -u -p -r2.4 nio-ftp.cc
--- nio-ftp.cc	2001/05/28 08:31:02	2.4
+++ nio-ftp.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* This file is responsible for implementing all direct FTP protocol
    channels.  It is intentionally simplistic. */
 
-static char *cvsid = "\n%%% $Id: nio-ftp.cc,v 2.4 2001/05/28 08:31:02 corinna Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: nio-ftp.cc,v 2.4 2001/05/28 08:31:02 corinna Exp $\n";
+#endif
 
 #include "win32.h"
 #include "winsock.h"
@@ -70,7 +72,6 @@ NetIO_FTP::NetIO_FTP (char *Purl, BOOL a
   if (cmd == 0)
     {
       SimpleSocket *c = new SimpleSocket (host, port);
-      int done = 0;
       code = ftp_line (c);
 
 auth_retry:
Index: nio-http.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/nio-http.cc,v
retrieving revision 2.4
diff -u -p -r2.4 nio-http.cc
--- nio-http.cc	2001/10/31 13:15:06	2.4
+++ nio-http.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* This file is responsible for implementing all direct HTTP protocol
    channels.  It is intentionally simplistic. */
 
-static char *cvsid = "\n%%% $Id: nio-http.cc,v 2.4 2001/10/31 13:15:06 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: nio-http.cc,v 2.4 2001/10/31 13:15:06 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include "winsock.h"
Index: nio-ie5.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/nio-ie5.cc,v
retrieving revision 2.2
diff -u -p -r2.2 nio-ie5.cc
--- nio-ie5.cc	2000/08/30 01:05:42	2.2
+++ nio-ie5.cc	2001/11/05 14:33:08
@@ -18,7 +18,9 @@
    must already have installed and configured IE5.  This module is
    called from netio.cc, which is called from geturl.cc */
 
-static char *cvsid = "\n%%% $Id: nio-ie5.cc,v 2.2 2000/08/30 01:05:42 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: nio-ie5.cc,v 2.2 2000/08/30 01:05:42 dj Exp $\n";
+#endif
 
 #include "win32.h"
 
Index: other.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/other.cc,v
retrieving revision 2.1
diff -u -p -r2.1 other.cc
--- other.cc	2000/08/25 01:32:08	2.1
+++ other.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* This handles the "other URL" option from the mirror site
    selection. */
 
-static char *cvsid = "\n%%% $Id: other.cc,v 2.1 2000/08/25 01:32:08 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: other.cc,v 2.1 2000/08/25 01:32:08 dj Exp $\n";
+#endif
 
 #include "win32.h"
 #include <shlobj.h>
@@ -76,6 +78,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: port.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/port.h,v
retrieving revision 2.0
diff -u -p -r2.0 port.h
--- port.h	2000/08/08 00:27:54	2.0
+++ port.h	2001/11/05 14:33:08
@@ -24,5 +24,4 @@
 
 #define _access access
 #define _strdup strdup
-
 #endif
Index: postinstall.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/postinstall.cc,v
retrieving revision 2.3
diff -u -p -r2.3 postinstall.cc
--- postinstall.cc	2001/10/27 15:56:47	2.3
+++ postinstall.cc	2001/11/05 14:33:08
@@ -16,7 +16,9 @@
 /* The purpose of this file is to run all the post-install scripts
    in their various forms. */
 
-static char *cvsid = "\n%%% $Id: postinstall.cc,v 2.3 2001/10/27 15:56:47 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: postinstall.cc,v 2.3 2001/10/27 15:56:47 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 
@@ -32,11 +34,11 @@ static char *cvsid = "\n%%% $Id: postins
 #include "port.h"
 
 static char *sh = 0;
-static char *cmd = 0;
+static const char *cmd = 0;
 static OSVERSIONINFO verinfo;
 
 static void
-run (char *sh, char *args, char *file)
+run (const char *sh, const char *args, const char *file)
 {
   BOOL b;
   char cmdline [_MAX_PATH];
@@ -47,7 +49,7 @@ run (char *sh, char *args, char *file)
   memset (&pi, 0, sizeof (pi));
   memset (&si, 0, sizeof (si));
   si.cb = sizeof (si);
-  si.lpTitle = "Cygwin Setup Post-Install Script";
+  si.lpTitle = (char *)"Cygwin Setup Post-Install Script";
   si.dwFlags = STARTF_USEPOSITION;
 
   b = CreateProcess (0, cmdline, 0, 0, 0,
@@ -86,7 +88,7 @@ each (char *fname, unsigned int size)
 	  cygpath ("/etc/postinstall/", fname, ".done", 0));
 }
 
-static char *shells [] = {
+static const char *shells [] = {
   "/bin/sh.exe",
   "/usr/bin/sh.exe",
   "/bin/bash.exe",
Index: root.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/root.cc,v
retrieving revision 2.6
diff -u -p -r2.6 root.cc
--- root.cc	2001/11/01 13:22:46	2.6
+++ root.cc	2001/11/05 14:33:08
@@ -17,7 +17,9 @@
    root of the installation to be, and to ask whether the user prefers
    text or binary mounts. */
 
-static char *cvsid = "\n%%% $Id: root.cc,v 2.6 2001/11/01 13:22:46 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: root.cc,v 2.6 2001/11/01 13:22:46 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include <shlobj.h>
@@ -169,6 +171,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: simpsock.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/simpsock.cc,v
retrieving revision 2.2
diff -u -p -r2.2 simpsock.cc
--- simpsock.cc	2000/08/30 01:07:51	2.2
+++ simpsock.cc	2001/11/05 14:33:08
@@ -15,7 +15,9 @@
 
 /* Simplified socket access functions */
 
-static char *cvsid = "\n%%% $Id: simpsock.cc,v 2.2 2000/08/30 01:07:51 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: simpsock.cc,v 2.2 2000/08/30 01:07:51 dj Exp $\n";
+#endif
 
 #include "win32.h"
 #include <winsock.h>
@@ -28,7 +30,7 @@ static char *cvsid = "\n%%% $Id: simpsoc
 
 #define SSBUFSZ 1024
 
-SimpleSocket::SimpleSocket (char *hostname, int port)
+SimpleSocket::SimpleSocket (const char *hostname, int port)
 {
   static int initted = 0;
   if (!initted)
@@ -108,7 +110,7 @@ SimpleSocket::ok ()
 }
 
 int
-SimpleSocket::printf (char *fmt, ...)
+SimpleSocket::printf (const char *fmt, ...)
 {
   char buf[SSBUFSZ];
   va_list args;
@@ -118,7 +120,7 @@ SimpleSocket::printf (char *fmt, ...)
 }
 
 int
-SimpleSocket::write (char *buf, int len)
+SimpleSocket::write (const char *buf, int len)
 {
   return send (s, buf, len, 0);
 }
Index: simpsock.h
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/simpsock.h,v
retrieving revision 2.1
diff -u -p -r2.1 simpsock.h
--- simpsock.h	2000/08/30 01:05:42	2.1
+++ simpsock.h	2001/11/05 14:33:08
@@ -23,13 +23,13 @@ class SimpleSocket {
   int fill ();
 
  public:
-  SimpleSocket (char *hostname, int port);
+  SimpleSocket (const char *hostname, int port);
   ~SimpleSocket ();
 
   int ok ();
 
-  int printf (char *fmt, ...);
-  int write (char *buf, int len);
+  int printf (const char *fmt, ...);
+  int write (const char *buf, int len);
 
   char *gets ();
   int	read (char *buf, int len);
Index: site.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/site.cc,v
retrieving revision 2.7
diff -u -p -r2.7 site.cc
--- site.cc	2001/05/27 07:05:09	2.7
+++ site.cc	2001/11/05 14:33:09
@@ -16,7 +16,9 @@
 /* The purpose of this file is to get the list of mirror sites and ask
    the user which mirror site they want to download from. */
 
-static char *cvsid = "\n%%% $Id: site.cc,v 2.7 2001/05/27 07:05:09 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: site.cc,v 2.7 2001/05/27 07:05:09 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -29,8 +31,8 @@ static char *cvsid = "\n%%% $Id: site.cc
 #include "geturl.h"
 #include "msg.h"
 #include "concat.h"
-#include "mount.h"
 #include "log.h"
+#include "io_stream.h"
 
 #include "port.h"
 
@@ -82,31 +84,21 @@ save_dialog (HWND h)
     }
 }
 
-static void
-get_root_dir_now ()
-{
-  int istext;
-  int issystem;
-  if (get_root_dir ())
-    return;
-  read_mounts ();
-}
-
 void
 save_site_url ()
 {
   if (! MIRROR_SITE)
     return;
-
-  get_root_dir_now ();
-  if (!get_root_dir ())
-    return;
 
-  FILE *f = fopen (cygpath ("/etc/setup/last-mirror", 0), "wb");
-  if (!f)
-    return;
-  fprintf (f, "%s\n", MIRROR_SITE);
-  fclose (f);
+  io_stream *f = io_stream::open ("cygfile:///etc/setup/last-mirror", "wb");
+  if (f)
+    {
+      char temp[_MAX_PATH];
+      /* TODO: potential buffer overflow. we need snprintf asap. */
+      sprintf(temp, "%s\n", MIRROR_SITE);
+      f->write (temp, strlen (temp));
+      delete f;
+    }
 }
 
 static BOOL
@@ -141,6 +133,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
@@ -269,19 +262,14 @@ get_site_list (HINSTANCE h)
 static void
 get_initial_list_idx ()
 {
-  get_root_dir_now ();
-  if (!get_root_dir ())
-    return;
-
-  FILE *f = fopen (cygpath ("/etc/setup/last-mirror", 0), "rt");
+  io_stream *f= io_stream::open ("cygfile:///etc/setup/last-mirror", "rt");
   if (!f)
     return;
 
   char site[1000];
-  site[0]='\0';
-  char * fg_ret = fgets (site, 1000, f);
-  fclose (f);
-  if (! fg_ret)
+  char * fg_ret = f->gets (site, 1000);
+  delete f;
+  if (!fg_ret)
     return;
 
   char *eos = site + strlen (site) - 1;
Index: source.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/source.cc,v
retrieving revision 2.5
diff -u -p -r2.5 source.cc
--- source.cc	2001/11/01 13:22:46	2.5
+++ source.cc	2001/11/05 14:33:09
@@ -17,7 +17,9 @@
    user choose the source of the install - from the net, from the
    current directory, or to just download files. */
 
-static char *cvsid = "\n%%% $Id: source.cc,v 2.5 2001/11/01 13:22:46 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: source.cc,v 2.5 2001/11/01 13:22:46 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -30,22 +32,14 @@ static char *cvsid = "\n%%% $Id: source.
 static int rb[] = { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 };
 
 static void
-check_if_enable_next (HWND h)
-{
-  EnableWindow (GetDlgItem (h, IDOK), source ? 1 : 0);
-}
-
-static void
 load_dialog (HWND h)
 {
-  int i;
   rbset (h, rb, source);
 }
 
 static void
 save_dialog (HWND h)
 {
-  int i;
   source = rbget (h, rb);
 }
 
@@ -86,6 +80,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
     default:
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: splash.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/splash.cc,v
retrieving revision 2.5
diff -u -p -r2.5 splash.cc
--- splash.cc	2001/11/02 00:52:06	2.5
+++ splash.cc	2001/11/05 14:33:09
@@ -16,7 +16,9 @@
 /* The purpose of this file is to display the program name, version,
    copyright notice, and project URL. */
 
-static char *cvsid = "\n%%% $Id: splash.cc,v 2.5 2001/11/02 00:52:06 rbcollins Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: splash.cc,v 2.5 2001/11/02 00:52:06 rbcollins Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -49,6 +51,7 @@ dialog_cmd (HWND h, int id, HWND hwndctl
       NEXT (0);
       break;
     }
+  return 0;
 }
 
 static BOOL CALLBACK
Index: state.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/state.cc,v
retrieving revision 2.0
diff -u -p -r2.0 state.cc
--- state.cc	2000/08/08 00:59:08	2.0
+++ state.cc	2001/11/05 14:33:09
@@ -15,7 +15,9 @@
 
 /* All we do here is instantiate the extern'd variables from state.h */
 
-static char *cvsid = "\n%%% $Id: state.cc,v 2.0 2000/08/08 00:59:08 dj Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: state.cc,v 2.0 2000/08/08 00:59:08 dj Exp $\n";
+#endif
 
 #define extern
 #include "state.h"
Index: tar.cc
===================================================================
RCS file: /cvs/src/src/winsup/cinstall/tar.cc,v
retrieving revision 2.5
diff -u -p -r2.5 tar.cc
--- tar.cc	2001/06/13 16:11:01	2.5
+++ tar.cc	2001/11/05 14:33:09
@@ -15,7 +15,9 @@
 
 /* Built-in tar functionality.  See tar.h for usage. */
 
-static char *cvsid = "\n%%% $Id: tar.cc,v 2.5 2001/06/13 16:11:01 cgf Exp $\n";
+#if 0
+static const char *cvsid = "\n%%% $Id: tar.cc,v 2.5 2001/06/13 16:11:01 cgf Exp $\n";
+#endif
 
 #include "win32.h"
 #include <stdio.h>
@@ -28,6 +30,9 @@ static char *cvsid = "\n%%% $Id: tar.cc,
 #include "mkdir.h"
 #include "log.h"
 #include "filemanip.h"
+#include "concat.h"
+#include "io_stream.h"
+#include "archive.h"
 
 #include "port.h"
 #undef _WIN32
@@ -85,14 +90,14 @@ class gzbz
  protected:
   union
   {
-    gzFile g;
+    io_stream *g;
     BZFILE *b;
   };
   int fd;
 public:
-  virtual int read (void *buf, int len) {};
-  virtual int close () {};
-  virtual off_t tell () {};
+  virtual int read (void *buf, int len) = 0 ;
+  virtual int close () = 0 ;
+  virtual off_t tell () = 0;
   operator int () {return (int) g;}
 };
 
@@ -101,18 +106,22 @@ class gz: public gzbz
  public:
   gz (const char *pathname)
   {
-    g = gzopen (pathname, "rb");
+    io_stream *tmp = io_stream::open (concat("file://", pathname, 0), "rb");
+    g = archive::decompress (tmp);
+    if (!g)
+      delete tmp;
   }
   int read (void *buf, int len)
   {
-    return gzread (g, buf, len);
+    return g->read (buf, len);
   }
   int close ()
   {
-    return gzclose (g);
+    delete g;
+    return 0;
   }
-  off_t tell () {return gzctell (g);}
-  ~gz () {close ();}
+  off_t tell () {return g->tell ();}
+  virtual ~gz () {if (g) delete g;}
 };
 
 class bz: public gzbz
@@ -136,7 +145,7 @@ class bz: public gzbz
     return 0;
   }
   off_t tell () {return ::tell (fd);}
-  ~bz () {close ();}
+  virtual ~bz () {close ();}
 };
 
 gzbz *z = NULL;
@@ -352,7 +361,7 @@ tar_read_file (char *path)
 {
   FILE *out, *copy;
   HANDLE h;
-  DWORD w, startticks;
+  DWORD w;
   int got;
   tar_map_result_type *tmr;
 
@@ -473,6 +482,8 @@ tar_read_file (char *path)
       fprintf (stderr, "error: unable to write symlink \"%s\"\n", path);
       DeleteFileA (path);
       return 1;
+    default:
+      return 0;
     }
 }
 
@@ -538,7 +549,7 @@ tar_auto (char *pathname, char **maplist
 
   if (tar_open (pathname))
     return 1;
-  while (c = tar_next_file ())
+  while ((c = tar_next_file ()) != NULL)
     {
       int l = strlen (c);
       for (i=0; i<nmaps; i++)

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