This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Patch for Setup.exe problem and for mklink2.cc
- From: Ton van Overbeek <tvoverbe at cistron dot nl>
- To: cygwin-apps at cygwin dot com, cygwin-patches at cygwin dot com
- Cc: jonas_eriksson at home dot se
- Date: Wed, 27 Mar 2002 15:02:54 +0100
- Subject: Patch for Setup.exe problem and for mklink2.cc
Found the problem causing the segment violation and probably causing
Jonas Eriksson's problem. It is a typical case of 'off by 1'.
In PickView::set_headers the loop filling the window header does one
iteration too much, resulting in a call to DoInsertItem with a NULL
string pointer and hence a crash following.
While debugging this I could not compile the new mklink2.cc ( the
c++ version of the original mklink2.c). It seems three & (address of operator)
have disappeared in the transition. Putting them back made the compiler
happy. Is this OK Robert ?
Changelog
2002-03-27 Ton van Overbeek (tvoverbe@cistron.nl)
* Pickview.cc (PickView::set_headers) Correct loop count for DoInsertItem.
* mklink2.cc (make_link_2) Reinsert three & operators which got lost in the
c -> c++ transition.
Patch in attached file.
Ton van Overbeek
--- mklink2.cc-orig Wed Mar 27 12:18:34 2002
+++ mklink2.cc Wed Mar 27 12:41:16 2002
@@ -20,9 +20,9 @@ make_link_2 (char const *exepath, char c
IPersistFile *pf;
WCHAR widepath[_MAX_PATH];
- CoCreateInstance (CLSID_ShellLink, NULL,
- CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *) & sl);
- sl->lpVtbl->QueryInterface (sl, IID_IPersistFile, (void **) &pf);
+ CoCreateInstance (&CLSID_ShellLink, NULL,
+ CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID *) & sl);
+ sl->lpVtbl->QueryInterface (sl, &IID_IPersistFile, (void **) &pf);
sl->lpVtbl->SetPath (sl, exepath);
sl->lpVtbl->SetArguments (sl, args);
--- PickView.cc-orig Wed Mar 27 12:18:26 2002
+++ PickView.cc Wed Mar 27 12:20:16 2002
@@ -110,7 +110,7 @@ PickView::set_headers ()
SendMessage (listheader, HDM_DELETEITEM, n - 1, 0);
}
int i;
- for (i = 0; i <= last_col; i++)
+ for (i = 0; i < last_col; i++)
DoInsertItem (listheader, i, headers[i].width, (char *) headers[i].text);
}