fixed int messiness

This commit is contained in:
mes5k 2004-08-11 03:35:53 +00:00
parent ee1ca9b844
commit 65fd6009a2

View File

@ -31,15 +31,16 @@ void spacePrint( ostream& os,
int indentSpaces, int indentSpaces,
int secondLineOffset ) int secondLineOffset )
{ {
if ( (s.length() + indentSpaces > (unsigned int) maxWidth) && int len = (int)(s.length());
maxWidth > 0 )
if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
{ {
int allowedLen = maxWidth - indentSpaces; int allowedLen = maxWidth - indentSpaces;
int start = 0; int start = 0;
while ( (unsigned int)start < s.length() ) while ( start < len )
{ {
// find the substring length // find the substring length
int stringLen = min( s.length() - start, (unsigned int)allowedLen ); int stringLen = min( len - start, allowedLen );
// trim the length so it doesn't end in middle of a word // trim the length so it doesn't end in middle of a word
if ( stringLen == allowedLen ) if ( stringLen == allowedLen )