Boost logo

Boost :

From: Philipp Henkel (threadpool_at_[hidden])
Date: 2006-08-09 12:29:47


Hi,

I discovered a bug in split_winmain.
If the wstring version of the function is used the result vector is
always empty:

Original code in libs/program_options/src/winmain.cpp:

#ifndef BOOST_NO_STD_WSTRING
    BOOST_PROGRAM_OPTIONS_DECL std::vector<std::wstring>
    split_winmain(const std::wstring& cmdline)
    {
        vector<wstring> result;
        vector<string> aux = split_winmain(to_internal(cmdline));
        for (unsigned i = 0, e = result.size(); i < e; ++i)
            result.push_back(from_utf8(aux[i]));
        return result;
    }
#endif

The expression result.size() in the for-loop has to be replaced with aux.size().

At least boost lib 1.33.0 and 1.33.1 contain this bug but I think
nobody used the function for years...

Best regards,
Philipp


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk