Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hello,

Scan coverity reported this:
dead_error_begin: Execution cannot reach this statement "case 5:"
dead_error_begin: Execution cannot reach this statement "case 6:"
dead_error_begin: Execution cannot reach this statement "case 7:"

See
http://opengrok.libreoffice.org/xref/core/registry/source/keyimpl.cxx#604

Indeed we have this switch:
    622     switch (valueType)
    623     {
    624         case RG_VALUETYPE_NOT_DEFINED:
    625             memcpy(value, pBuffer, valueSize);
    626             break;
    627         case RG_VALUETYPE_LONG:
    628             readINT32(pBuffer, *((sal_Int32*)value));
    629             break;
    630         case RG_VALUETYPE_STRING:
    631             readUtf8(pBuffer, (sal_Char*)value, valueSize);
    632             break;
    633         case RG_VALUETYPE_UNICODE:
    634             readString(pBuffer, (sal_Unicode*)value, valueSize);
    635             break;
    636         case RG_VALUETYPE_BINARY:
    637             memcpy(value, pBuffer, valueSize);
    638             break;
    639         case RG_VALUETYPE_LONGLIST:
    640         case RG_VALUETYPE_STRINGLIST:
    641         case RG_VALUETYPE_UNICODELIST:
    642             memcpy(value, pBuffer, valueSize);
    643             break;
    644     }

but some lines above:
    604     if (valueType > 4)
    605     {
    606         return REG_INVALID_VALUE;
    607     }

I took a look, it's like this since initial import in 2000.
Should if (valueType > 4) be removed or should we clean the >4 cases ?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/About-coverity-440107-keyimpl-cxx-in-registry-tp4045470.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.