Help - Search - Members - Calendar
Full Version: string_simple::truncate
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
musicmusic
Seems to me like it doesn't work?

CODE
    void truncate(t_size len)
    {
        if (len<length(len))  //(*)
        {
            do_realloc(len+1);
            ptr[len]=0;
        }
    }


Is (*) really ever going to evaluate to true?
falling down the stairs
The length() function there returns whichever is smaller: the length of the string, or the value of the parameter passed to length().

EDIT: and after I typed that out, I realized that the test won't ever evaluate to true.
musicmusic
QUOTE(falling down the stairs @ Jun 8 2006, 22:47) *

The length() function there returns whichever is smaller: the length of the string, or the value of the parameter passed to length().

Which is exactly why I said the statement would always be false?

In any case the problem is fixed in the 0.9.2 SDK.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.