[bug] win32lib in world distance calculator
- Posted by Jason Gade <jaygade at yahoo.com> May 05, 2005
- 428 views
I had a bug in win32file.ew (of win32lib) when running Greg Habarek's World Distance Calculator. The main wd_calc.exw program tacks a ';' on the end of the PATH variable in lines 22-24. This causes win32file.ew to add an empty sequence to the end of vSearchPaths, causing setSearchPaths() function to fail with a subscript 0 out of bounds reading from a sequence length 0 error. It is in the loop where setSearchPaths() is adding a trailing backslash to each entry in vSearchPaths. Using the "short" version of win32lib 0.60.6
for i=1 to length(vSearchPaths)do if vSearchPaths[i][length(vSearchPaths[i])]!='\\' then -- error vSearchPaths[i]&='\\' end if end for
Maybe change the line above to
if length(vSearchPaths[i]) and vSearchPaths[i][length(vSearchPaths[i])]!='\\' then
Or have it eliminate empty entries earlier when it is parsing the path. Anyone's path could have an empty ';' in the middle or the end causing this error. ===================================== World distance calculator is pretty cool, but it took me some time to get it to work. Maybe a readme file that mentions that it requires xControls, strtok, and the zip code database downloaded separately. ===================================== Too many freaks, not enough circuses. j.