This is the mail archive of the cygwin-apps@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]
Other format: [Raw text]

[setup PATCH] next_dialog micropatch (2)


Another cleanup patch. The remaining user of next_dialog, do_fromcwd,
requires slightly more invasive refactoring, hence is not included with
these changes.

2003-07-25  Max Bowsher  <maxb@ukf.net>

 Based on a patch by Gary R. Van Sickle.
 * download.cc (do_download_thread): Return int.
 (do_download_reflector): Use return value, not global variable
 next_dialog in PostMessage.
 * ini.cc (do_ini_thread): Return int.
 Return a value, instead of setting next_dialog.
 (do_ini_thread_reflector): Use return value, not global variable
 next_dialog in PostMessage.

Index: download.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/download.cc,v
retrieving revision 2.37
diff -u -p -r2.37 download.cc
--- download.cc 7 Apr 2003 12:46:55 -0000 2.37
+++ download.cc 26 Jul 2003 10:00:44 -0000
@@ -221,12 +221,13 @@ download_one (packagesource & pkgsource,
   return 1;
 }

-static void
+static int
 do_download_thread (HINSTANCE h, HWND owner)
 {
   int errors = 0;
   total_download_bytes = 0;
   total_download_bytes_sofar = 0;
+  int next_dialog;

   packagedb db;
   /* calculate the amount needed */
@@ -307,7 +308,7 @@ do_download_thread (HINSTANCE h, HWND ow
       if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES)
  {
    next_dialog = IDD_SITE;
-   return;
+   return next_dialog;
  }
     }

@@ -321,15 +322,14 @@ do_download_thread (HINSTANCE h, HWND ow
     }
   else
     next_dialog = IDD_S_INSTALL;
+
+  return next_dialog;
 }

 static DWORD WINAPI
 do_download_reflector (void *p)
 {
   HANDLE *context;
   context = (HANDLE *) p;

-  do_download_thread ((HINSTANCE) context[0], (HWND) context[1]);
+  int next_dialog = do_download_thread ((HINSTANCE) context[0], (HWND)
context[1]);

   // Tell the progress page that we're done downloading
   Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0, next_dialog);
Index: ini.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/ini.cc,v
retrieving revision 2.35
diff -u -p -r2.35 ini.cc
--- ini.cc 5 Jul 2002 05:17:21 -0000 2.35
+++ ini.cc 26 Jul 2003 10:00:44 -0000
@@ -203,8 +203,8 @@ do_remote_ini (HWND owner)
   return ini_count;
 }

-static void
+static int
 do_ini_thread (HINSTANCE h, HWND owner)
 {
   size_t ini_count = 0;
   if (source == IDC_SOURCE_CWD)
@@ -214,8 +214,7 @@ do_ini_thread (HINSTANCE h, HWND owner)

   if (ini_count == 0)
     {
-      next_dialog = source == IDC_SOURCE_CWD ? IDD_S_FROM_CWD : IDD_SITE;
-      return;
+      return ((source == IDC_SOURCE_CWD) ? IDD_S_FROM_CWD : IDD_SITE);
     }

   if (get_root_dir ().cstr_oneuse())
@@ -266,16 +265,13 @@ do_ini_thread (HINSTANCE h, HWND owner)
  note (owner, IDS_OLD_SETUP_VERSION, version, setup_version.cstr_oneuse());
     }

-  next_dialog = IDD_CHOOSE;
+  return IDD_CHOOSE;
 }

 static DWORD WINAPI
 do_ini_thread_reflector(void* p)
 {
  HANDLE *context;
  context = (HANDLE*)p;

- do_ini_thread((HINSTANCE)context[0], (HWND)context[1]);
+ int next_dialog = do_ini_thread((HINSTANCE)context[0], (HWND)context[1]);

  // Tell the progress page that we're done downloading
  Progress.PostMessage(WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, next_dialog);


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