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


On 04/06/2017 12:02 AM, Chris Sherlock wrote:
On 23 Mar 2017, at 10:47 pm, Stephan Bergmann <sbergman@redhat.com> wrote:
What remains is the source of the five C programs

 rsc/Executable_rsc.mk (rsc/source/rscpp/cpp{2,3,5,6}.c)
 shell/Executable_uri_encode.mk (shell/source/unix/misc/uri-encode.c)
 solenv/Executable_concat-deps.mk (solenv/bin/concat-deps.c)
 soltools/Executable_cpp.mk (soltools/cpp/_{tokens,unix}.c)
 soltools/Executable_mkdepend.mk (soltools/mkdepend/{cppsetup,ifparser,parse}.c)

For one, I have added any casts from char to unsigned char where missing.  (But note that in some 
cases the input already was of the expected form.)

So the recommendation is to avoid C string functions in LibreOffice code in future?

I'm not sure how you read that recommendation out of that? (Though, generally, the brittle low-level memory management that comes with using <string.h> is indeed best avoided where possible.)

I realise this may be a silly question, but does this mean we have a portable, cross-culture string 
handling module that makes things like character case handling consistent across platforms?

For culture-aware string operations, we have ICU.

For another, with a recent set of commits to master I have removed all but one call to setlocale 
from the LO code base itself.  (The remaining one is in SetSystemLocale in 
vcl/unx/generic/app/i18n_im.cxx, and smells like it is necessary for proper IME support in 
VCL-based applications on Linux.  None of those five C programs should be affected by it.)  So 
barring any calls to setlocale in external code, and ignoring the somewhat fuzzy definition of 
isprint as called from rsc/source/rscpp/cpp{5,6}.c, those five C programs should not (any longer) 
be affected by locale issues.

Was this done because of the character casing challenges mentioned above? Or was calling on this 
causing problems elsewhere?

The main short-term motivation was to avoid any locale-specific behavior in the five remaining programs mentioned above. But apart from that, changing such global state at random places in the program is hardly a good idea, especially so with the MT-issues that come with setlocale.

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.