About coverity 440107 (keyimpl.cxx in registry)

Stephan Bergmann sbergman at redhat.com
Fri Mar 22 15:53:13 PDT 2013


On 03/22/2013 10:12 PM, julien2412 wrote:
> 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 ?

The >4 cases are the RG_VALUETYPE_*LIST cases for which there are 
dedicated ORegKey::get*ListValue functions, so they can be removed from 
the switch.  Shudder.  (All this would go to the bin shortly anyway if 
it weren't for our beloved backwards compatibility...)

Stephan


More information about the LibreOffice mailing list