On Wed, Apr 17, 2013 at 08:28:21AM +0100, Wols Lists wrote:
On 17/04/13 02:10, Lionel Elie Mamane wrote:
On Tue, Apr 16, 2013 at 09:24:03PM +0100, Wols Lists wrote:
On 16/04/13 20:28, Lionel Elie Mamane wrote:
RTL_CONSTASCII_STRINGPARAM is a hack/optimisation specific to
compile-time constants. With your change, the string is not anymore
a compile-time constant
I'm puzzled that it's not a compile-time constant
Well, it is not even a run-time constant: at each iteration of the
loop, it is a different value.
Yes, the value passed changes each time, but the array itself is a
constant array of constant strings ...
If you want to exploit that fact, you could do something like that:
static std::vector< std::pair< char*, sal_Int32 > > keyword_list =
boost::assign::list_of(::std::pair(RTL_CONSTASCII_STRINGPARAM( "password" )))
(::std::pair(RTL_CONSTASCII_STRINGPARAM( "user" )))
(etc)
(etc)
(etc).to_adapter()
....
if( args[i].Name.matchIgnoreAsciiCaseAsciiL( keyword_list[j].first, keyword_list[j].second ))
(or for more C++-y style, use an iterator instead of indexed access)
Yes, C++03 makes this *much* harder than it could be (C++11 has a
better solution: http://en.wikipedia.org/wiki/C++11#Initializer_lists )
IMHO it is *far* more trouble than it is worth.
--
Lionel
Context
- Re: patch for postgresql driver (continued)
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.