Author Topic: so how would i report this.  (Read 3034 times)

devilsclaw

  • Guest
so how would i report this.
« on: March 31, 2007, 10:50:59 pm »
now depending on how the coder wanted this to work
since the comment says it its self the index can be -1
then the current code would not even cover it being -1
well no in all possible ways.

Code
Compiler* CompilerFactory::GetCompiler(size_t index)
{
    // NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
    if ((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
        return 0;
    return Compilers[index];
}

when you select from the drop down the project you want to build and then you right click
on a project in the project tree size_t index is -1 yet the number of compilers are not from
Compilers.GetCount()

now depending on how you guys want it which i would like to know.
it could look like this.

Code
Compiler* CompilerFactory::GetCompiler(size_t index)
{

    // NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
    if (index < 1 || (Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
        return 0;
    //cbMessageBox(wxString::Format(_("Index: %d"),index));
    return Compilers[index];
}


or it could work like this.
Code
Compiler* CompilerFactory::GetCompiler(size_t index)
{

    // NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
    if ((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
        return 0;
       
    //the index can be -1
    else if(index < 0 && !((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount())))
        return GetDefaultCompiler();

    //cbMessageBox(wxString::Format(_("Index: %d"),index));
    return Compilers[index];
}

since i have already had a comment on my patches being crap. which some where.

im gun shy of posting patchs.

and i dont really want to just be a bug poster lacky and let you guys do all the work.
« Last Edit: April 01, 2007, 01:03:56 am by devilsclaw »