From: Conrad W. <we...@on...> - 2002-07-01 05:44:57
|
Hi all, Installed my new CW v8 some days ago and in the process of updating projects. Just finished making changes to Whisper2 and thought I'd give zoolib a go. Working on zac right now. >The current projects (I've only gotten as far as zac so far) won't >compile as CVS-ed. > >MetroWerks has changed the STL part of MSL (see the release notes for >the details.) I spent a morning on this one in my company's product >already this week. >In ZFileTrail::sTrailFromTo(): > if (matchUntil < iDest.size()) > theTrail.AppendTrail((iDest.begin() + matchUntil).base(), >iDest.size() - matchUntil); > >Adding ".base()" fixes the problem, which seems to involve getting a >pointer to data out of an iterator. This shouldn't be necessary and the AppendTrail requires a const string* as its first param. iDest is const vector of string, compiler seems happy with: theTrail.AppendTrail(&(*(iDest.begin() + matchUntil)), iDest.size() - matchUntil); Alternatively, I try writing several lines when in doubt/trouble: vector<string>::const_iterator it = iDest.begin(); it += matchUntil; string tmp(*it); theTrail.AppendTrail(&tmp, iDest.size() - matchUntil); (Actually, I am surprised this worked pre v8. Is there supposed to be an implicit conversion from a vector<string>::iterator to the string*, I would have thought that to be a reference only, but then I have to admit, the stl often baffles me, and particularly std::vector seems to have many different faces across stl implementations) >Pro8 also seems to have tightened the rules about implicit casting (saw >this at work too.) >Two errors are in ZASCompilerCW.cpp: >static ZFileSpec sFromCWFileSpec(const CWFileSpec& inSpec) >and >static CWFileSpec sFromZFileSpec(const ZFileSpec& inSpec) >Involve casting between ZFileLoc, CWFileSpec, and ZFileLoc_Mac_FSSpec. The Plug-In SDK has changed in CW v8. It seems to turn on the use of long file names now - allways. (Do a diff between the CWPlugins.h files of v7 and v8) Casting is not possible anylonger between a CWFileSpec and an FSSpec when CWPLUGIN_LONG_FILENAME_SUPPORT is turned on, see CWPlugins.h: #if CWPLUGIN_LONG_FILENAME_SUPPORT #define CWPLUGIN_FILENAME_LEN 256 typedef struct CWFileSpec { FSRef parentDirRef; /* parent directory */ HFSUniStr255 filename; /* unicode file name */ } CWFileSpec; typedef char CWFileName[CWPLUGIN_FILENAME_LEN]; #else #define CWPLUGIN_FILENAME_LEN 32 typedef FSSpec CWFileSpec; typedef char CWFileName[CWPLUGIN_FILENAME_LEN]; #endif Pre v8, CWFileSpec was typedefed to differ between Win and Mac only, now it allso caters for OS X where an FSSpec doesn't even come into it any more! Zoolib will have to change. If you are using an old zac with cw v8, this may be why you get an unknown error. I'll give this some thought. nb: none of my projects that make moderate use of templates and the stl made it through this upgrade without changes - so, once again, I have had to adjust my understanding of the language.... Cheers, Conrad Weyns. |