Here this is again, but with the modifications to threebar.cc/res.rc
split off into a separate patch (See
<n2m-g.dr1l0a.3vva69r.1<at>buzzy-box.bavag>).


ChangeLog-entry: (Please fix the <at>.)

2006-01-23  Bas van Gompel  <patch-cygsup.buzz<at>bavag.tmfweb.nl>

        * geturl.h: Replace String with std::string throughout.
        * geturl.cc: Ditto.
        (init_dialog): Tell where file is downloaded from.


L8r,

Buzz.
-- 
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re
Index: setup/geturl.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/geturl.cc,v
retrieving revision 2.25
diff -u -p -r2.25 geturl.cc
--- setup/geturl.cc     5 May 2005 22:48:35 -0000       2.25
+++ setup/geturl.cc     22 Jan 2006 20:27:41 -0000
@@ -61,18 +61,17 @@ int total_download_bytes_sofar = 0;
 static DWORD start_tics;
 
 static void
-init_dialog (String const &url, int length, HWND owner)
+init_dialog (std::string const &url, int length, HWND owner)
 {
   if (is_local_install)
     return;
 
-  char const *last_component = url.c_str();
-  for (const char *ch = last_component; *ch; ch++)
-    if (*ch == '/' || *ch == '\\' || *ch == ':')
-      last_component = ch + 1;
+  int p_slash = url.find_last_of ('/');
+
   max_bytes = length;
   Progress.SetText1("Downloading...");
-  Progress.SetText2(last_component);
+  Progress.SetText2((url.substr(p_slash + 1) + " from "
+                    + url.substr(0, p_slash)).c_str());
   Progress.SetText3("Connecting...");
   Progress.SetBar1(0);
   start_tics = GetTickCount ();
@@ -112,7 +111,7 @@ progress (int bytes)
 }
 
 static void
-getUrlToStream (String const &_url, HWND owner, io_stream *output)
+getUrlToStream (std::string const &_url, HWND owner, io_stream *output)
 {
   log (LOG_BABBLE) << "getUrlToStream " << _url << endLog;
   is_local_install = (source == IDC_SOURCE_CWD);
@@ -153,7 +152,7 @@ getUrlToStream (String const &_url, HWND
 }
 
 io_stream *
-get_url_to_membuf (String const &_url, HWND owner)
+get_url_to_membuf (std::string const &_url, HWND owner)
 {
   io_stream_memory *membuf = new io_stream_memory ();
   try 
@@ -181,31 +180,31 @@ get_url_to_membuf (String const &_url, H
 }
 
 // predicate: url has no '\0''s in it.
-String
-get_url_to_string (String const &_url, HWND owner)
+std::string
+get_url_to_string (std::string const &_url, HWND owner)
 {
   io_stream *stream = get_url_to_membuf (_url, owner);
   if (!stream)
-    return String();
+    return std::string();
   size_t bytes = stream->get_size ();
   if (!bytes)
     {
       /* zero length, or error retrieving length */
       delete stream;
       log (LOG_BABBLE) << "get_url_to_string(): couldn't retrieve buffer size, 
or zero length buffer" << endLog;
-      return String();
+      return std::string();
     }
   char temp [bytes + 1];
   /* membufs are quite safe */
   stream->read (temp, bytes);
   temp [bytes] = '\0';
   delete stream;
-  return String(temp);
+  return std::string(temp);
 }
 
 int
-get_url_to_file (String const &_url,
-                 String const &_filename,
+get_url_to_file (std::string const &_url,
+                 std::string const &_filename,
                  int expected_length,
                 HWND owner)
 {
Index: setup/geturl.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/geturl.h,v
retrieving revision 2.10
diff -u -p -r2.10 geturl.h
--- setup/geturl.h      23 Dec 2004 18:12:12 -0000      2.10
+++ setup/geturl.h      22 Jan 2006 20:27:41 -0000
@@ -23,11 +23,10 @@ extern int total_download_bytes;
 extern int total_download_bytes_sofar;
 
 class io_stream;
-class String;
 
-io_stream *get_url_to_membuf (String const &, HWND owner);
-String get_url_to_string (String const&, HWND owner);
-int get_url_to_file (String const &_url, String const &_filename,
+io_stream *get_url_to_membuf (std::string const &, HWND owner);
+std::string get_url_to_string (std::string const&, HWND owner);
+int get_url_to_file (std::string const &_url, std::string const &_filename,
                      int expected_size, HWND owner);
 
 #endif /* SETUP_GETURL_H */

Reply via email to