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
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to