]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
* choose.cc (do_choose): Fix incorrect assignment of trust setting to use when cygwin-1-3-2
authorChristopher Faylor <me@cgf.cx>
Fri, 18 May 2001 14:56:22 +0000 (14:56 +0000)
committerChristopher Faylor <me@cgf.cx>
Fri, 18 May 2001 14:56:22 +0000 (14:56 +0000)
Redownload or Sources Only selected.

ChangeLog
choose.cc

index 6bfc888023f49650f038ab1c206ffebe619b6f90..22634ea494e7b0f02f6f655395ca7b1c8fa7f64b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-07  Brian Keener <bkeener@thesoftwaresource.com>
+
+       * choose.cc (do_choose): Fix incorrect assignment of trust setting to
+       use when Redownload or Sources Only selected.
+
 Thu May 10 22:35:59 2001  Christopher Faylor <cgf@cygnus.com>
 
        Reformat file after botched patch formatting.
index caaac0a4ee4dbff855ea0de59e6e4e6327f97c89..0f7c9040dfada199f630d2d881756b5593e5997b 100644 (file)
--- a/choose.cc
+++ b/choose.cc
@@ -107,9 +107,9 @@ struct ExtraPackageInfo
 
     struct
       {
-        int src_avail;
-        int trust;             /* may be keep or uninstall */
-        char *caption; /* ==0 at EOL */
+       int src_avail;
+       int trust;              /* may be keep or uninstall */
+       char *caption;  /* ==0 at EOL */
       }
     chooser[NTRUST + 3];       /* one extra for NULL above */
   };
@@ -152,50 +152,50 @@ paint (HWND hwnd)
       int r = y + ii * row_height;
       int by = r + tm.tmHeight - 11;
       if (extra[i].installed_ver && extra[i].installed_ver[0])
-        {
-          TextOut (hdc, x + headers[CURRENT_COL].x, r,
-                   extra[i].installed_ver, strlen (extra[i].installed_ver));
-          SelectObject (bitmap_dc, bm_rtarrow);
-          BitBlt (hdc, x + headers[CURRENT_COL].x + headers[0].width + ICON_MARGIN/2 + HMARGIN/2, by,
-                  11, 11, bitmap_dc, 0, 0, SRCCOPY);
-        }
+       {
+         TextOut (hdc, x + headers[CURRENT_COL].x, r,
+                  extra[i].installed_ver, strlen (extra[i].installed_ver));
+         SelectObject (bitmap_dc, bm_rtarrow);
+         BitBlt (hdc, x + headers[CURRENT_COL].x + headers[0].width + ICON_MARGIN/2 + HMARGIN/2, by,
+                 11, 11, bitmap_dc, 0, 0, SRCCOPY);
+       }
 
       char *s = extra[i].chooser[extra[i].pick].caption;
       if (s)
-        {
-          TextOut (hdc, x + headers[NEW_COL].x + 11 + ICON_MARGIN, r,
-                   s, strlen (s));
-          if (extra[i].npick > 1)
-            {
-              SelectObject (bitmap_dc, bm_spin);
-              BitBlt (hdc, x + headers[NEW_COL].x, by, 11, 11,
-                      bitmap_dc, 0, 0, SRCCOPY);
-            }
-        }
+       {
+         TextOut (hdc, x + headers[NEW_COL].x + 11 + ICON_MARGIN, r,
+                  s, strlen (s));
+         if (extra[i].npick > 1)
+           {
+             SelectObject (bitmap_dc, bm_spin);
+             BitBlt (hdc, x + headers[NEW_COL].x, by, 11, 11,
+                     bitmap_dc, 0, 0, SRCCOPY);
+           }
+       }
 
       HANDLE check_bm = bm_checkna;
       if (extra[i].chooser[extra[i].pick].src_avail)
-        {
-          if (package[i].srcaction == SRCACTION_NO &&
-              extra[i].chooser[extra[i].pick].trust != TRUST_SRC_ONLY)
-            check_bm = bm_checkno;
-          else if (package[i].srcaction == SRCACTION_YES ||
-                   extra[i].chooser[extra[i].pick].trust == TRUST_SRC_ONLY)
-            check_bm = bm_checkyes;
-        }
+       {
+         if (package[i].srcaction == SRCACTION_NO &&
+             extra[i].chooser[extra[i].pick].trust != TRUST_SRC_ONLY)
+           check_bm = bm_checkno;
+         else if (package[i].srcaction == SRCACTION_YES ||
+                  extra[i].chooser[extra[i].pick].trust == TRUST_SRC_ONLY)
+           check_bm = bm_checkyes;
+       }
       SelectObject (bitmap_dc, check_bm);
       BitBlt (hdc, x + headers[SRC_COL].x, by, 11, 11,
-              bitmap_dc, 0, 0, SRCCOPY);
+             bitmap_dc, 0, 0, SRCCOPY);
 
       if (package[i].name)
-        TextOut (hdc, x + headers[PACKAGE_COL].x, r, package[i].name, strlen (package[i].name));
+       TextOut (hdc, x + headers[PACKAGE_COL].x, r, package[i].name, strlen (package[i].name));
     }
 
   if (nindexes == 0)
     {
       static char *msg = "Nothing to Install/Update";
       if (source == IDC_SOURCE_DOWNLOAD)
-        msg = "Nothing to Download";
+       msg = "Nothing to Download";
       TextOut (hdc, HMARGIN, header_height, msg, strlen (msg));
     }
 
@@ -297,19 +297,19 @@ list_click (HWND hwnd, BOOL dblclk, int x, int y, UINT hitCode)
     {
       extra[p].pick++;
       while (extra[p].chooser[extra[p].pick].trust < NTRUST &&
-             (package[p].info[extra[p].chooser[extra[p].pick].trust].install_exists
-              ==0 && source == IDC_SOURCE_CWD) &&
-             package[p].info[extra[p].chooser[extra[p].pick].trust].install &&
-             extra[p].chooser[extra[p].pick].caption != 0)
-        extra[p].pick++;
+            (package[p].info[extra[p].chooser[extra[p].pick].trust].install_exists
+             ==0 && source == IDC_SOURCE_CWD) &&
+            package[p].info[extra[p].chooser[extra[p].pick].trust].install &&
+            extra[p].chooser[extra[p].pick].caption != 0)
+       extra[p].pick++;
       if (extra[p].chooser[extra[p].pick].caption == 0)
-        extra[p].pick = 0;
+       extra[p].pick = 0;
     }
 
   if (x >= headers[SRC_COL].x - HMARGIN/2 && x <= headers[SRC_COL + 1].x - HMARGIN/2)
     {
       if (extra[p].chooser[extra[p].pick].src_avail)
-        package[p].srcaction ^= (SRCACTION_NO^SRCACTION_YES);
+       package[p].srcaction ^= (SRCACTION_NO^SRCACTION_YES);
     }
 
   RECT rect;
@@ -381,20 +381,20 @@ check_existence (int p, int trust, int check_src)
   if (source == IDC_SOURCE_DOWNLOAD)
     {
       if (check_src == 0 && _access (package[p].info[trust].install, 0) == 0)
-        return 1;
+       return 1;
       else if (check_src == 1 && _access (package[p].info[trust].source, 0) == 0)
-        return 1;
+       return 1;
       else
-        return 0;
+       return 0;
     }
   if (source == IDC_SOURCE_CWD)
     {
       if (check_src == 0  && package[p].info[trust].install &&
-          _access (package[p].info[trust].install, 0) == 0)
-        return 1;
+         _access (package[p].info[trust].install, 0) == 0)
+       return 1;
       else if (check_src == 1 && package[p].info[trust].source &&
-               _access (package[p].info[trust].source, 0) == 0)
-        return 1;
+              _access (package[p].info[trust].source, 0) == 0)
+       return 1;
     }
   return 0;
 }
@@ -405,31 +405,31 @@ set_existence ()
   for (int i = 0; i < npackages; i++)
     {
       for (int t = 0; t < NTRUST; t++)
-        {
-          /* 0 = check install file */
-          package[i].info[t].install_exists = check_existence (i, t, 0);
-          /* 1 = check source file */
-          package[i].info[t].source_exists = check_existence (i, t, 1);
-        }
+       {
+         /* 0 = check install file */
+         package[i].info[t].install_exists = check_existence (i, t, 0);
+         /* 1 = check source file */
+         package[i].info[t].source_exists = check_existence (i, t, 1);
+       }
       for (int t = 0; t < NTRUST; t++)
-        {
-          if (package[i].info[t].install &&
-              extra[i].installed_ver != package[i].info[t].version)
-            {
-              if (source == IDC_SOURCE_NETINST)
-                package[i].info[t].partial_list_display = 1;
-              else if (source == IDC_SOURCE_DOWNLOAD)
-                package[i].info[t].partial_list_display = 1-package[i].info[t].install_exists;
-              else if (source == IDC_SOURCE_CWD)
-                if (package[i].info[t].install_exists)
-                  package[i].info[t].partial_list_display = 1;
-                else
-                  package[i].info[t].partial_list_display = 0;
-            }
-          if (package[i].info[t].partial_list_display)
-            extra[i].in_partial_list = 1;
-
-        }
+       {
+         if (package[i].info[t].install &&
+             extra[i].installed_ver != package[i].info[t].version)
+           {
+             if (source == IDC_SOURCE_NETINST)
+               package[i].info[t].partial_list_display = 1;
+             else if (source == IDC_SOURCE_DOWNLOAD)
+               package[i].info[t].partial_list_display = 1-package[i].info[t].install_exists;
+             else if (source == IDC_SOURCE_CWD)
+               if (package[i].info[t].install_exists)
+                 package[i].info[t].partial_list_display = 1;
+               else
+                 package[i].info[t].partial_list_display = 0;
+           }
+         if (package[i].info[t].partial_list_display)
+           extra[i].in_partial_list = 1;
+
+       }
     }
 }
 
@@ -441,7 +441,7 @@ best_trust (int p, int trust)
   if (package[p].info[t].install &&
       ((package[p].info[t].install_exists && source == IDC_SOURCE_CWD) ||
        (package[p].info[t].install_exists == 0 &&
-        source == IDC_SOURCE_DOWNLOAD) || source == IDC_SOURCE_NETINST))
+       source == IDC_SOURCE_DOWNLOAD) || source == IDC_SOURCE_NETINST))
     return t;
   if (extra[p].installed_file && extra[p].installed_ver == package[p].info[t].version)
     return TRUST_KEEP;
@@ -459,8 +459,8 @@ default_trust (HWND h, int trust)
       extra[i].pick = 1;
       package[i].trust = t;
       for (c = 0; c < extra[i].npick; c++)
-        if (t == extra[i].chooser[c].trust)
-          extra[i].pick = c;
+       if (t == extra[i].chooser[c].trust)
+         extra[i].pick = c;
     }
   RECT r;
   GetClientRect (h, &r);
@@ -479,13 +479,13 @@ set_full_list (HWND h, int isfull)
   for (i = j = 0; i < npackages; i++)
     {
       if ((isfull || (extra[i].in_partial_list &&
-                      extra[i].chooser[extra[i].pick].trust != TRUST_KEEP &&
-                      extra[i].chooser[extra[i].pick].trust != TRUST_NONE)) &&
-          (source == IDC_SOURCE_DOWNLOAD || source == IDC_SOURCE_NETINST ||
-           package[i].info[TRUST_PREV].install_exists ||
-           package[i].info[TRUST_CURR].install_exists ||
-           package[i].info[TRUST_TEST].install_exists))
-        package_indexes[j++] = i;
+                     extra[i].chooser[extra[i].pick].trust != TRUST_KEEP &&
+                     extra[i].chooser[extra[i].pick].trust != TRUST_NONE)) &&
+         (source == IDC_SOURCE_DOWNLOAD || source == IDC_SOURCE_NETINST ||
+          package[i].info[TRUST_PREV].install_exists ||
+          package[i].info[TRUST_CURR].install_exists ||
+          package[i].info[TRUST_TEST].install_exists))
+       package_indexes[j++] = i;
     }
   nindexes = j;
 
@@ -522,78 +522,78 @@ build_labels ()
 
 #define C extra[i].chooser[c]
       if (extra[i].installed_ver)
-        {
-          C.caption = "Uninstall";
-          C.trust = TRUST_UNINSTALL;
-          c++;
-          C.caption = "Keep";
-          C.trust = TRUST_KEEP;
-          c++;
-        }
+       {
+         C.caption = "Uninstall";
+         C.trust = TRUST_UNINSTALL;
+         c++;
+         C.caption = "Keep";
+         C.trust = TRUST_KEEP;
+         c++;
+       }
 
       if (extra[i].installed_ver &&
-          package[i].info[extra[i].which_is_installed].source &&
-          ((package[i].info[extra[i].which_is_installed].source_exists &&
-            source==IDC_SOURCE_CWD) ||
-           source==IDC_SOURCE_DOWNLOAD || source==IDC_SOURCE_NETINST ))
-        {
-          C.caption = "Sources";
-          if (package[i].info[extra[i].which_is_installed].source_exists == 1 &&
-              source == IDC_SOURCE_DOWNLOAD)
-            C.caption = "Redo Sources";
-          C.trust = TRUST_SRC_ONLY;
-          C.src_avail = 1;
-          c++;
-        }
+         package[i].info[extra[i].which_is_installed].source &&
+         ((package[i].info[extra[i].which_is_installed].source_exists &&
+           source==IDC_SOURCE_CWD) ||
+          source==IDC_SOURCE_DOWNLOAD || source==IDC_SOURCE_NETINST ))
+       {
+         C.caption = "Sources";
+         if (package[i].info[extra[i].which_is_installed].source_exists == 1 &&
+             source == IDC_SOURCE_DOWNLOAD)
+           C.caption = "Redo Sources";
+         C.trust = TRUST_SRC_ONLY;
+         C.src_avail = 1;
+         c++;
+       }
 
       for (t = TRUST_PREV; t < NTRUST; t++)
-        if (package[i].info[t].install)
-          if (t != extra[i].which_is_installed)
-            {
-              C.caption = package[i].info[t].version;
-              if (C.caption == 0 || C.caption[0] == 0)
-                C.caption = "0.0";
-              C.trust = t;
-              if (package[i].info[t].source &&
-                  ((package[i].info[t].source_exists &&
-                    source==IDC_SOURCE_CWD) ||
-                   (package[i].info[t].source_exists==0 &&
-                    source==IDC_SOURCE_DOWNLOAD) || source==IDC_SOURCE_NETINST))
-                C.src_avail = 1;
-              c++;
-            }
-          else
-            {
-              if (source == IDC_SOURCE_DOWNLOAD)
-                {
-                  C.caption = "ReDownload";
-                }
-              else
-                {
-                  C.caption = "ReInstall";
-                }
-              if (package[i].info[t].source &&
-                  ((package[i].info[t].source_exists &&
-                    source==IDC_SOURCE_CWD) ||
-                   source == IDC_SOURCE_DOWNLOAD || source==IDC_SOURCE_NETINST))
-                C.src_avail = 1;
-              C.trust = TRUST_REDO;
-              c++;
-            }
+       if (package[i].info[t].install)
+         if (t != extra[i].which_is_installed)
+           {
+             C.caption = package[i].info[t].version;
+             if (C.caption == 0 || C.caption[0] == 0)
+               C.caption = "0.0";
+             C.trust = t;
+             if (package[i].info[t].source &&
+                 ((package[i].info[t].source_exists &&
+                   source==IDC_SOURCE_CWD) ||
+                  (package[i].info[t].source_exists==0 &&
+                   source==IDC_SOURCE_DOWNLOAD) || source==IDC_SOURCE_NETINST))
+               C.src_avail = 1;
+             c++;
+           }
+         else
+           {
+             if (source == IDC_SOURCE_DOWNLOAD)
+               {
+                 C.caption = "ReDownload";
+               }
+             else
+               {
+                 C.caption = "ReInstall";
+               }
+             if (package[i].info[t].source &&
+                 ((package[i].info[t].source_exists &&
+                   source==IDC_SOURCE_CWD) ||
+                  source == IDC_SOURCE_DOWNLOAD || source==IDC_SOURCE_NETINST))
+               C.src_avail = 1;
+             C.trust = TRUST_REDO;
+             c++;
+           }
 
       if (c == 0)
-        {
-          C.caption = "N/A";
-          C.trust = TRUST_NONE;
-          c++;
-        }
+       {
+         C.caption = "N/A";
+         C.trust = TRUST_NONE;
+         c++;
+       }
 
       if (! extra[i].installed_file)
-        {
-          C.caption = "Skip";
-          C.trust = TRUST_NONE;
-          c++;
-        }
+       {
+         C.caption = "Skip";
+         C.trust = TRUST_NONE;
+         c++;
+       }
 
       C.caption = 0;
       extra[i].npick = c;
@@ -606,15 +606,15 @@ create_listview (HWND dlg, RECT *r)
 {
   int i, t;
   lv = CreateWindowEx (WS_EX_CLIENTEDGE,
-                       "listview",
-                       "listviewwindow",
-                       WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
-                       r->left, r->top,
-                       r->right-r->left + 1, r->bottom-r->top + 1,
-                       dlg,
-                       (HMENU) MAKEINTRESOURCE(IDC_CHOOSE_LIST),
-                       hinstance,
-                       0);
+                      "listview",
+                      "listviewwindow",
+                      WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
+                      r->left, r->top,
+                      r->right-r->left + 1, r->bottom-r->top + 1,
+                      dlg,
+                      (HMENU) MAKEINTRESOURCE(IDC_CHOOSE_LIST),
+                      hinstance,
+                      0);
   ShowWindow (lv, SW_SHOW);
 
   for (i = 0; headers[i].text; i++)
@@ -640,7 +640,7 @@ create_listview (HWND dlg, RECT *r)
       note_width (dc, extra[i].installed_ver, 0, CURRENT_COL);
       note_width (dc, extra[i].installed_ver, 11 + ICON_MARGIN, NEW_COL);
       for (t = 0; t < NTRUST; t++)
-        note_width (dc, package[i].info[t].version, 11 + ICON_MARGIN, NEW_COL);
+       note_width (dc, package[i].info[t].version, 11 + ICON_MARGIN, NEW_COL);
       note_width (dc, package[i].name, 0, PACKAGE_COL);
       note_width (dc, package[i].sdesc, 0, PACKAGE_COL);
     }
@@ -649,7 +649,7 @@ create_listview (HWND dlg, RECT *r)
 
   headers[CURRENT_COL].x = HMARGIN/2;
   headers[NEW_COL].x = (headers[CURRENT_COL].x + headers[CURRENT_COL].width
-                        + HMARGIN + 11 + ICON_MARGIN);
+                       + HMARGIN + 11 + ICON_MARGIN);
   headers[SRC_COL].x = headers[NEW_COL].x + headers[NEW_COL].width + HMARGIN;
   headers[PACKAGE_COL].x = headers[SRC_COL].x + headers[SRC_COL].width + HMARGIN;
 
@@ -684,17 +684,17 @@ dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
 
     case IDOK:
       if (source == IDC_SOURCE_CWD)
-        NEXT (IDD_S_INSTALL);
+       NEXT (IDD_S_INSTALL);
       else
-        NEXT (IDD_S_DOWNLOAD);
+       NEXT (IDD_S_DOWNLOAD);
       break;
 
     case IDC_BACK:
       initialized = 0;
       if (source == IDC_SOURCE_CWD)
-        NEXT (IDD_ROOT);
+       NEXT (IDD_ROOT);
       else
-        NEXT (IDD_SITE);
+       NEXT (IDD_SITE);
       break;
 
     case IDCANCEL:
@@ -733,9 +733,9 @@ dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
       frame = GetDlgItem (h, IDC_LISTVIEW_POS);
       choose_inst_text = GetDlgItem(h,IDC_CHOOSE_INST_TEXT);
       if (source == IDC_SOURCE_DOWNLOAD)
-        SetWindowText (choose_inst_text, "Select packages to download ");
+       SetWindowText (choose_inst_text, "Select packages to download ");
       else
-        SetWindowText (choose_inst_text, "Select packages to install ");
+       SetWindowText (choose_inst_text, "Select packages to install ");
       GetParentRect (h, frame, &r);
       r.top += 2;
       r.bottom -= 2;
@@ -759,7 +759,7 @@ base (char *s)
   while (*s)
     {
       if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
-        rv = s + 1;
+       rv = s + 1;
       s++;
     }
   return rv;
@@ -778,27 +778,27 @@ get_package_version (int p , int trust)
   for (v = base (instpkg); *v; v++)
     if (*v == '-' && isdigit (v[1]))
       {
-        v++;
-        break;
+       v++;
+       break;
       }
   if (!v)
     v = instpkg;
   for (d = v; *d; d++)
     if (strncmp (d, ".tar", 4) == 0)
       {
-        *d = 0;
-        break;
+       *d = 0;
+       break;
       }
   if (v[0])
     {
       if (trust != -1)
-        package[p].info[trust].version = strdup (v);
+       package[p].info[trust].version = strdup (v);
       extra[p].installed_ver = strdup (v);
     }
   else
     {
       if (trust != -1)
-        package[p].info[trust].version = "0";
+       package[p].info[trust].version = "0";
       extra[p].installed_ver = "0";
     }
 }
@@ -812,7 +812,7 @@ find_tar_ext (const char *path)
   if (*p == '.')
     {
       if (strcmp (p, ".tar.gz") != 0)
-        return 0;
+       return 0;
     }
   else if (--p <= path || strcmp (p, ".tar.bz2") != 0)
     return 0;
@@ -840,99 +840,99 @@ scan2 (char *path, unsigned int size)
   for (ver = mainpkg; *ver; ver++)
     if ((*ver == '-' || *ver == '_') && isdigit (ver[1]))
       {
-        *ver++ = 0;
-        break;
+       *ver++ = 0;
+       break;
       }
 
   for (i = 0; i < npackages; i++)
     {
       pkginfo[0] = 0;
       for (t = 0; t < NTRUST; t++)
-        {
-          if (package[i].info[t].install)
-            {
-              strcpy (pkginfo, package[i].info[t].install);
-              pkginfo[find_tar_ext (pkginfo)] = '\0'; /* strip off the tar.gz */
-              for (verinfo = pkginfo; *verinfo; verinfo++)
-                {
-                  if ((*verinfo == '-' || *verinfo == '_') && isdigit (verinfo[1]))
-                    {
-                      *verinfo++ = 0;
-                      break;
-                    }
-                }
-              break;
-            }
-        }
+       {
+         if (package[i].info[t].install)
+           {
+             strcpy (pkginfo, package[i].info[t].install);
+             pkginfo[find_tar_ext (pkginfo)] = '\0'; /* strip off the tar.gz */
+             for (verinfo = pkginfo; *verinfo; verinfo++)
+               {
+                 if ((*verinfo == '-' || *verinfo == '_') && isdigit (verinfo[1]))
+                   {
+                     *verinfo++ = 0;
+                     break;
+                   }
+               }
+             break;
+           }
+       }
       if (strcmp (pkginfo, mainpkg) == 0)
-        {
-          for (t = 0; t < NTRUST; t++)
-            if ((package[i].info[t].install &&
-                 strcmp (base (package[i].info[t].install), base (path)) == 0) ||
-                (package[i].info[t].source &&
-                 strcmp (base (package[i].info[t].source), base (path)) == 0))
-              {
-                if (strcmp (base (package[i].info[t].install), base (path)) == 0)
-                  package[i].info[t].install_exists = 1;
-                else
-                  package[i].info[t].source_exists = 1;
-                break;
-              }
-            else if (t >= NTRUST - 1)
-              if (!package[i].info[TRUST_CURR].install)
-                {
-                  package[i].info[TRUST_CURR].version = 0;
-                  int tarsrcext = tarext - 4;
-                  if (tarsrcext > 0 && strncmp (path + tarsrcext , "-src", 4) == 0)
-                    {
-                      int n = find_tar_ext (tarpkg);
-                      memmove (tarpkg + n - 4, tarpkg + n, strlen (tarpkg + n) + 1);
-                      package[i].info[TRUST_CURR].install = strdup (tarpkg);
-                      if (!package[i].info[TRUST_CURR].source)
-                        package[i].info[TRUST_CURR].source = strdup (path);
-                      package[i].info[TRUST_CURR].source_size = size;
-                      package[i].info[TRUST_CURR].source_exists = 1;
-                      if (package[i].info[TRUST_CURR].version == 0)
-                        get_package_version (i, TRUST_CURR);
-                    }
-                  else
-                    {
-                      package[i].info[TRUST_CURR].install = strdup (path);
-                      package[i].info[TRUST_CURR].install_size = size;
-                      package[i].info[TRUST_CURR].install_exists = 1;
-                      if (package[i].info[TRUST_CURR].version == 0)
-                        get_package_version (i, TRUST_CURR);
-                    }
-                  break;
-                }
-              else if (!package[i].info[TRUST_PREV].install)
-                {
-                  package[i].info[TRUST_PREV].version = 0;
-                  int tarsrcext = tarext - 4;
-                  if (tarsrcext > 0 && strncmp (path + tarsrcext , "-src", 4) == 0)
-                    {
-                      int n = find_tar_ext (tarpkg);
-                      memmove (tarpkg + n - 4, tarpkg + n, strlen (tarpkg + n) + 1);
-                      package[i].info[TRUST_PREV].install = strdup (tarpkg);
-                      if (!package[i].info[TRUST_PREV].source)
-                        package[i].info[TRUST_PREV].source = strdup (path);
-                      package[i].info[TRUST_PREV].source_size = size;
-                      package[i].info[TRUST_PREV].source_exists = 1;
-                      if (package[i].info[TRUST_PREV].version == 0)
-                        get_package_version (i, TRUST_PREV);
-                    }
-                  else
-                    {
-                      package[i].info[TRUST_PREV].install = strdup (path);
-                      package[i].info[TRUST_PREV].install_size = size;
-                      package[i].info[TRUST_PREV].install_exists = 1;
-                      if (package[i].info[TRUST_PREV].version == 0)
-                        get_package_version (i, TRUST_PREV);
-                    }
-                  break;
-                }
-          break;
-        }
+       {
+         for (t = 0; t < NTRUST; t++)
+           if ((package[i].info[t].install &&
+                strcmp (base (package[i].info[t].install), base (path)) == 0) ||
+               (package[i].info[t].source &&
+                strcmp (base (package[i].info[t].source), base (path)) == 0))
+             {
+               if (strcmp (base (package[i].info[t].install), base (path)) == 0)
+                 package[i].info[t].install_exists = 1;
+               else
+                 package[i].info[t].source_exists = 1;
+               break;
+             }
+           else if (t >= NTRUST - 1)
+             if (!package[i].info[TRUST_CURR].install)
+               {
+                 package[i].info[TRUST_CURR].version = 0;
+                 int tarsrcext = tarext - 4;
+                 if (tarsrcext > 0 && strncmp (path + tarsrcext , "-src", 4) == 0)
+                   {
+                     int n = find_tar_ext (tarpkg);
+                     memmove (tarpkg + n - 4, tarpkg + n, strlen (tarpkg + n) + 1);
+                     package[i].info[TRUST_CURR].install = strdup (tarpkg);
+                     if (!package[i].info[TRUST_CURR].source)
+                       package[i].info[TRUST_CURR].source = strdup (path);
+                     package[i].info[TRUST_CURR].source_size = size;
+                     package[i].info[TRUST_CURR].source_exists = 1;
+                     if (package[i].info[TRUST_CURR].version == 0)
+                       get_package_version (i, TRUST_CURR);
+                   }
+                 else
+                   {
+                     package[i].info[TRUST_CURR].install = strdup (path);
+                     package[i].info[TRUST_CURR].install_size = size;
+                     package[i].info[TRUST_CURR].install_exists = 1;
+                     if (package[i].info[TRUST_CURR].version == 0)
+                       get_package_version (i, TRUST_CURR);
+                   }
+                 break;
+               }
+             else if (!package[i].info[TRUST_PREV].install)
+               {
+                 package[i].info[TRUST_PREV].version = 0;
+                 int tarsrcext = tarext - 4;
+                 if (tarsrcext > 0 && strncmp (path + tarsrcext , "-src", 4) == 0)
+                   {
+                     int n = find_tar_ext (tarpkg);
+                     memmove (tarpkg + n - 4, tarpkg + n, strlen (tarpkg + n) + 1);
+                     package[i].info[TRUST_PREV].install = strdup (tarpkg);
+                     if (!package[i].info[TRUST_PREV].source)
+                       package[i].info[TRUST_PREV].source = strdup (path);
+                     package[i].info[TRUST_PREV].source_size = size;
+                     package[i].info[TRUST_PREV].source_exists = 1;
+                     if (package[i].info[TRUST_PREV].version == 0)
+                       get_package_version (i, TRUST_PREV);
+                   }
+                 else
+                   {
+                     package[i].info[TRUST_PREV].install = strdup (path);
+                     package[i].info[TRUST_PREV].install_size = size;
+                     package[i].info[TRUST_PREV].install_exists = 1;
+                     if (package[i].info[TRUST_PREV].version == 0)
+                       get_package_version (i, TRUST_PREV);
+                   }
+                 break;
+               }
+         break;
+       }
     }
 }
 
@@ -963,30 +963,30 @@ read_installed_db ()
       sscanf (line, "%s %s %d %s %d", pkg, inst, &instsz, src, &srcsz);
 
       for (i = 0; i < npackages; i++)
-        if (strcmp (package[i].name, pkg) == 0)
-          {
-            int t;
-            extra[i].installed_file = inst;
-            extra[i].installed_size = instsz;
-            get_package_version (i, -1);
-
-            char *binst = base (inst);
-            int n = find_tar_ext (binst) + 4;
-            for (t = 0; t < NTRUST; t++)
-              if (package[i].info[t].install
-                  && strncmp (base (package[i].info[t].install), binst, n) == 0)
-                {
-                  extra[i].which_is_installed = t;
-                  extra[i].installed_ver = package[i].info[t].version;
-                  if (extra[i].installed_ver == 0) /* still */
-                    get_package_version (i, t);
-                  break;
-                }
-
-            if (extra[i].installed_ver == 0) /* still */
-              get_package_version (i, -1);
-            break;
-          }
+       if (strcmp (package[i].name, pkg) == 0)
+         {
+           int t;
+           extra[i].installed_file = inst;
+           extra[i].installed_size = instsz;
+           get_package_version (i, -1);
+
+           char *binst = base (inst);
+           int n = find_tar_ext (binst) + 4;
+           for (t = 0; t < NTRUST; t++)
+             if (package[i].info[t].install
+                 && strncmp (base (package[i].info[t].install), binst, n) == 0)
+               {
+                 extra[i].which_is_installed = t;
+                 extra[i].installed_ver = package[i].info[t].version;
+                 if (extra[i].installed_ver == 0) /* still */
+                   get_package_version (i, t);
+                 break;
+               }
+
+           if (extra[i].installed_ver == 0) /* still */
+             get_package_version (i, -1);
+           break;
+         }
     }
   fclose (db);
 }
@@ -1023,11 +1023,11 @@ do_choose (HINSTANCE h)
       extra[i].pick = 1;
       extra[i].chooser[extra[i].pick].trust = TRUST_NONE;
       for (int t = 0; t < NTRUST; t++)
-        {
-          package[i].info[t].partial_list_display = 0;
-          package[i].info[t].install_exists = 0;
-          package[i].info[t].source_exists = 0;
-        }
+       {
+         package[i].info[t].partial_list_display = 0;
+         package[i].info[t].install_exists = 0;
+         package[i].info[t].source_exists = 0;
+       }
     }
 
   register_windows (h);
@@ -1046,42 +1046,50 @@ do_choose (HINSTANCE h)
   for (i = 0; i < npackages; i++)
     {
       switch (extra[i].chooser[extra[i].pick].trust)
-        {
-        case TRUST_PREV:
-        case TRUST_CURR:
-        case TRUST_TEST:
-          if (extra[i].installed_file)
-            package[i].action = ACTION_UPGRADE;
-          else
-            package[i].action = ACTION_NEW;
-          package[i].trust = extra[i].chooser[extra[i].pick].trust;
-          break;
-
-        case TRUST_REDO:
-          package[i].action = ACTION_REDO;
-          package[i].trust = extra[i].chooser[extra[i].pick].trust;
-          break;
-
-        case TRUST_UNINSTALL:
-          package[i].action = ACTION_UNINSTALL;
-          if (package[i].srcaction == SRCACTION_YES)
-            package[i].action = ACTION_SRC_ONLY;
-          break;
-
-        case TRUST_SRC_ONLY:
-          package[i].action = ACTION_SRC_ONLY;
-          package[i].trust = extra[i].chooser[extra[i].pick].trust;
-          package[i].srcaction = SRCACTION_YES;
-          break;
-
-        case TRUST_KEEP:
-        case TRUST_NONE:
-        default:
-          package[i].action = ACTION_SAME;
-          if (package[i].srcaction == SRCACTION_YES)
-            package[i].action = ACTION_SRC_ONLY;
-          break;
-        }
+       {
+       case TRUST_PREV:
+       case TRUST_CURR:
+       case TRUST_TEST:
+         if (extra[i].installed_file)
+           package[i].action = ACTION_UPGRADE;
+         else
+           package[i].action = ACTION_NEW;
+         package[i].trust = extra[i].chooser[extra[i].pick].trust;
+         break;
+
+       case TRUST_REDO:
+         package[i].action = ACTION_REDO;
+       if ( extra[i].which_is_installed >= 0 
+           && extra[i].which_is_installed <= TRUST_TEST)
+         package[i].trust = extra[i].which_is_installed;
+       else 
+         package[i].trust = TRUST_CURR;
+         break;
+
+       case TRUST_UNINSTALL:
+         package[i].action = ACTION_UNINSTALL;
+         if (package[i].srcaction == SRCACTION_YES)
+           package[i].action = ACTION_SRC_ONLY;
+         break;
+
+       case TRUST_SRC_ONLY:
+         package[i].action = ACTION_SRC_ONLY;
+       if ( extra[i].which_is_installed >= 0 
+           && extra[i].which_is_installed <= TRUST_TEST)
+         package[i].trust = extra[i].which_is_installed;
+       else 
+         package[i].trust = TRUST_CURR;
+         package[i].srcaction = SRCACTION_YES;
+         break;
+
+       case TRUST_KEEP:
+       case TRUST_NONE:
+       default:
+         package[i].action = ACTION_SAME;
+         if (package[i].srcaction == SRCACTION_YES)
+           package[i].action = ACTION_SRC_ONLY;
+         break;
+       }
     }
 
   log (LOG_BABBLE, "Chooser results...");
@@ -1089,44 +1097,44 @@ do_choose (HINSTANCE h)
     {
       static char *infos[] = {"prev", "curr", "test"};
       const char *trust = ((package[i].trust == TRUST_PREV) ? "prev"
-                           : (package[i].trust == TRUST_CURR) ? "curr"
-                           : (package[i].trust == TRUST_TEST) ? "test"
-                           : "unknown");
+                          : (package[i].trust == TRUST_CURR) ? "curr"
+                          : (package[i].trust == TRUST_TEST) ? "test"
+                          : "unknown");
       const char *action = ((package[i].action == ACTION_UNKNOWN) ? "unknown"
-                            : (package[i].action == ACTION_SAME) ? "same"
-                            : (package[i].action == ACTION_NEW) ? "new"
-                            : (package[i].action == ACTION_UPGRADE) ? "upgrade"
-                            : (package[i].action == ACTION_UNINSTALL) ? "uninstall"
-                            : (package[i].action == ACTION_REDO &&
-                               source == IDC_SOURCE_DOWNLOAD) ? "redownload"
-                            : (package[i].action == ACTION_REDO &&
-                               source != IDC_SOURCE_DOWNLOAD) ? "reinstall"
-                            : (package[i].action == ACTION_SRC_ONLY) ? "sources"
-                            : (package[i].action == ACTION_ERROR) ? "error"
-                            : "unknown");
+                           : (package[i].action == ACTION_SAME) ? "same"
+                           : (package[i].action == ACTION_NEW) ? "new"
+                           : (package[i].action == ACTION_UPGRADE) ? "upgrade"
+                           : (package[i].action == ACTION_UNINSTALL) ? "uninstall"
+                           : (package[i].action == ACTION_REDO &&
+                              source == IDC_SOURCE_DOWNLOAD) ? "redownload"
+                           : (package[i].action == ACTION_REDO &&
+                              source != IDC_SOURCE_DOWNLOAD) ? "reinstall"
+                           : (package[i].action == ACTION_SRC_ONLY) ? "sources"
+                           : (package[i].action == ACTION_ERROR) ? "error"
+                           : "unknown");
       const char *installed = ((extra[i].which_is_installed == -1) ? "none"
-                               : (extra[i].which_is_installed == TRUST_PREV) ? "prev"
-                               : (extra[i].which_is_installed == TRUST_CURR) ? "curr"
-                               : (extra[i].which_is_installed == TRUST_TEST) ? "test"
-                               : "unknown");
+                              : (extra[i].which_is_installed == TRUST_PREV) ? "prev"
+                              : (extra[i].which_is_installed == TRUST_CURR) ? "curr"
+                              : (extra[i].which_is_installed == TRUST_TEST) ? "test"
+                              : "unknown");
       const char *partial_list = ((extra[i].in_partial_list == 1) ? "yes" : "no");
 
       log (LOG_BABBLE, "[%s] action=%s trust=%s installed=%s partial_list=%s src?=%s",
-           package[i].name, action, trust, installed,
-           partial_list, package[i].srcaction == SRCACTION_NO ? "no" : "yes");
+          package[i].name, action, trust, installed,
+          partial_list, package[i].srcaction == SRCACTION_NO ? "no" : "yes");
       for (int t = 0; t < NTRUST; t++)
-        {
-          if (package[i].info[t].install)
-            log (LOG_BABBLE, "     [%s] ver=%s partial_list=%s \r\n            inst=%s %d exists=%s \r\n            src=%s %d exists=%s",
-                 infos[t],
-                 package[i].info[t].version ?: "(none)",
-                 (package[i].info[t].partial_list_display == 1) ? "yes":"no",
-                 package[i].info[t].install ?: "(none)",
-                 package[i].info[t].install_size,
-                 (package[i].info[t].install_exists == 1) ? "yes":"no",
-                 package[i].info[t].source ?: "(none)",
-                 package[i].info[t].source_size,
-                 (package[i].info[t].source_exists == 1) ? "yes":"no");
-        }
+       {
+         if (package[i].info[t].install)
+           log (LOG_BABBLE, "     [%s] ver=%s partial_list=%s \r\n            inst=%s %d exists=%s \r\n            src=%s %d exists=%s",
+                infos[t],
+                package[i].info[t].version ?: "(none)",
+                (package[i].info[t].partial_list_display == 1) ? "yes":"no",
+                package[i].info[t].install ?: "(none)",
+                package[i].info[t].install_size,
+                (package[i].info[t].install_exists == 1) ? "yes":"no",
+                package[i].info[t].source ?: "(none)",
+                package[i].info[t].source_size,
+                (package[i].info[t].source_exists == 1) ? "yes":"no");
+       }
     }
 }
This page took 0.07243 seconds and 5 git commands to generate.