From e98d90bd3fc77b4abe830e20aae98534498d5f3d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 15 Jun 2001 04:05:31 +0000 Subject: [PATCH] * choose.cc (isinstalled): Eliminate special download only test. (set_action): Don't move to next state if in ACTION_SAME range and not incrementing. (choose_caption): Display "Retrieve" rather than "Reinstall" when just downloading. (do_choose): Sort packages after all packages have been read. Accomodate the fact that first element in trust array is empty so that log files don't report the wrong trust value. * iniparse.y (new_package): Malloc space for package name or suffer memory corruption. --- ChangeLog | 13 +++++++++++++ choose.cc | 23 +++++++++++++---------- iniparse.y | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index bec1e76c..bdcd6fd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Jun 15 00:01:51 2001 Christopher Faylor + + * choose.cc (isinstalled): Eliminate special download only test. + (set_action): Don't move to next state if in ACTION_SAME range and not + incrementing. + (choose_caption): Display "Retrieve" rather than "Reinstall" when just + downloading. + (do_choose): Sort packages after all packages have been read. + Accomodate the fact that first element in trust array is empty so that + log files don't report the wrong trust value. + * iniparse.y (new_package): Malloc space for package name or suffer + memory corruption. + Thu Jun 14 22:43:59 2001 Robert Collins * ini.h (Dependency): New structure. Declare new function. diff --git a/choose.cc b/choose.cc index 39747655..46690d4c 100644 --- a/choose.cc +++ b/choose.cc @@ -92,11 +92,8 @@ int *package_indexes, nindexes; static bool isinstalled (Package *pkg, int trust) { - if (source == IDC_SOURCE_DOWNLOAD) - return pkg->info[pkg->installed_ix].install_exists < 0; - else - return pkg->installed && pkg->info[trust].version && - strcmp (pkg->installed->version, pkg->info[trust].version) == 0; + return pkg->installed && pkg->info[trust].version && + strcmp (pkg->installed->version, pkg->info[trust].version) == 0; } /* Set the next action given a current action. */ @@ -136,9 +133,13 @@ set_action (Package *pkg, bool preinc) as the given action. */ case ACTION_SAME_CURR: case ACTION_SAME_TEST: + if (!preinc) /* Previously set to this value */ + return; (int) pkg->action -= ACTION_SAME + 1; /* revert to ACTION_CURR, etc. */ break; case ACTION_SAME_PREV: + if (!preinc) /* Previously set to this value */ + return; pkg->action = ACTION_UNINSTALL; /* Fall through intentionally */ case ACTION_UNINSTALL: @@ -183,7 +184,7 @@ choose_caption (Package *pkg) case ACTION_UNINSTALL: return "Uninstall"; case ACTION_REDO: - return "Reinstall"; + return source == IDC_SOURCE_DOWNLOAD ? "Retrieve" : "Reinstall"; case ACTION_SRC_ONLY: if (pkg->installed && pkg->installed->source_exists) return "Redo Source"; @@ -890,6 +891,8 @@ read_installed_db () pkg->info[TRUST_CURR].source_size = srcsz; } pkg->installed_ix = TRUST_CURR; + /* Exists on local system but not on download system */ + pkg->exclude = EXCLUDE_NOT_FOUND; } pkg->installed = new Info (inst, f.ver, instsz); @@ -918,8 +921,6 @@ do_choose (HINSTANCE h) { int rv; - qsort (package, npackages, sizeof (package[0]), package_sort); - nextbutton = 0; bm_spin = LoadImage (h, MAKEINTRESOURCE (IDB_SPIN), IMAGE_BITMAP, 0, 0, 0); bm_rtarrow = LoadImage (h, MAKEINTRESOURCE (IDB_RTARROW), IMAGE_BITMAP, 0, 0, 0); @@ -936,6 +937,8 @@ do_choose (HINSTANCE h) read_installed_db (); set_existence (); + qsort (package, npackages, sizeof (package[0]), package_sort); + rv = DialogBox (h, MAKEINTRESOURCE (IDD_CHOOSE), 0, dialog_proc); if (rv == -1) fatal (IDS_DIALOG_FAILED); @@ -943,7 +946,7 @@ do_choose (HINSTANCE h) log (LOG_BABBLE, "Chooser results..."); for (Package *pkg = package; pkg->name; pkg++) { - static char *infos[] = {"prev", "curr", "test"}; + static char *infos[] = {"nada", "prev", "curr", "test"}; const char *trust = ((pkg->trust == TRUST_PREV) ? "prev" : (pkg->trust == TRUST_CURR) ? "curr" : (pkg->trust == TRUST_TEST) ? "test" @@ -969,7 +972,7 @@ do_choose (HINSTANCE h) pkg->info[t].version ?: "(none)", pkg->info[t].install ?: "(none)", pkg->info[t].install_size, - (pkg->info[t].install_exists == 1) ? "yes":"no", + (pkg->info[t].install_exists) ? "yes":"no", pkg->info[t].source ?: "(none)", pkg->info[t].source_size, (pkg->info[t].source_exists == 1) ? "yes":"no"); diff --git a/iniparse.y b/iniparse.y index 76ccf354..5b3c2faf 100644 --- a/iniparse.y +++ b/iniparse.y @@ -141,7 +141,7 @@ new_package (char *name) { cp = package + npackages; npackages++; - cp->name = name; + cp->name = strdup (name); trust = TRUST_CURR; } -- 2.43.5