Will Truelove, ttruel@aosi.com wrote:
> Subject: Problem with SmaugWiz
>
> Hi all
> I'm having a big problem with SmaugWiz. SmaugWiz runs fine, but when I
> try to start it up I get this message:
>
> Microsoft Visual C++ Debug Library
>
> Program: C:\SMAUGWIZ\SMAUGWIZ.EXE
> File: strex.cpp
> Line: 332
>
> Abort Retry Ignore
>
> Line 332 in strex.cpp is
> ASSERT(nFirst + nCount <= GetData()->nDataLength);
>
> If I press Ignore it runs until the next line is output into the
> SmaugWiz window but then the error happens again. Can someone please
> help me out? I have no idea how to fix this.
You didn't say, but I suspect you are using VC++ version 6.0...
I've had a couple of other people ask about this so I will post my previous
reply which explains the problem and how to fix it:
----------------------------
Yes, Microsoft has made the version 6 compiler even more picky than it was.
It looks like the error you are getting is from the CString::Mid function in
strex.cpp. I looked at my strex and they don't have any ASSERT in it, but a
there is a comment about returning 'reasonable values' if the value of
nFirst or nCount are invalid. I suspect what Microsoft has done in version
6 is to add assertions for these out of bounds conditions, in the debug
version only. I expect if you were to build a release version of SmaugWiz,
it would work ok.
I looked through SmaugWiz code and found the place where the problem is
likely to be. In SmaugWizDoc.cpp at line 374 is the line:
s = s.Mid (len+1);
In some cases the value len+1 can point to the end of the string, and Strex
is now saying that this is invalid, instead of simply returning an empty
string as before. I was relying on the empty string as a means to simplify
my code. To fix the problem try changing the above line to:
if (len < s.GetLength ())
s = s.Mid (len+1);
else
s.Empty ();
Try that and let me know if it solves the problem.
----------------------------
Regards, Rustry