Boost logo

Boost-Build :

From: Andreas Fredriksson (deplinenoise_at_[hidden])
Date: 2006-05-21 07:14:24


Hey guys,
I was toying around with bjam from CVS today and I noticed that
jam0.exe would crash when built for x64.

It seems the bug is that ShortPathToLongPath function uses DWORDs for
indexes while at the same time relying on them wrapping around; this
doesn't work well when indices are 64-bit (DWORD is still a 32-bit
datatype).

This patch make the bootstrap succeed with a x64 cl, but I'm not
entirely sure it's correct for 32-bit compilation.

Best regards,
Andreas

Index: pathunix.c
===================================================================
RCS file: /cvsroot/boost/boost/tools/jam/src/pathunix.c,v
retrieving revision 1.15
diff -u -r1.15 pathunix.c
--- pathunix.c 5 Nov 2005 07:05:28 -0000 1.15
+++ pathunix.c 21 May 2006 11:09:01 -0000
@@ -287,11 +287,11 @@
  DWORD ShortPathToLongPath(LPCTSTR lpszShortPath,LPTSTR lpszLongPath,DWORD
                           cchBuffer)
 {
- DWORD i=0;
+ LONG i=0;
     TCHAR path[_MAX_PATH]={0};
     TCHAR ret[_MAX_PATH]={0};
- DWORD pos=0, prev_pos=0;
- DWORD len=_tcslen(lpszShortPath);
+ LONG pos=0, prev_pos=0;
+ LONG len=_tcslen(lpszShortPath);

     /* Is the string valid? */
     if (!lpszShortPath) {

-- 
Those who live by the sword get shot by those who don't.

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk