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


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

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.