l10ntools/source/localize.cxx | 9 +++++++-- l10ntools/source/merge.cxx | 5 ++++- l10ntools/source/pocheck.cxx | 7 ++++++- 3 files changed, 17 insertions(+), 4 deletions(-)
New commits: commit a5484e496dcee9b110ef696101576a14b7a5a20e Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Dec 8 14:19:00 2020 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Dec 8 16:03:47 2020 +0100 Assert that certain env vars are set in these build-time tools All of those env vars are exported from config_host.mk or config_host_lang.mk. The asserts guard potential future changes from using OString to using std::string_view, where OString has an undocumented feature of allowing construction from a null pointer. Change-Id: I7bb2217fb1d38300bf169b17e9e72dafc6970b2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107414 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 402403a8e5ea..17ad73f3b2a4 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <cassert> #include <cstddef> #include <cstdlib> #include <iostream> @@ -90,12 +91,16 @@ void handleCommand( OStringBuffer buf; if (rExecutable == "uiex" || rExecutable == "hrcex") { - buf.append(OString(getenv("SRC_ROOT"))); + auto const env = getenv("SRC_ROOT"); + assert(env != nullptr); + buf.append(OString(env)); buf.append("/solenv/bin/"); } else { - buf.append(OString(getenv("WORKDIR_FOR_BUILD"))); + auto const env = getenv("WORKDIR_FOR_BUILD"); + assert(env != nullptr); + buf.append(OString(env)); buf.append("/LinkTarget/Executable/"); } buf.append(rExecutable.data()); diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 75afdf77b9a6..b94bb7c84fc8 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -21,6 +21,7 @@ #include <sal/log.hxx> #include <algorithm> +#include <cassert> #include <fstream> #include <string> #include <vector> @@ -112,7 +113,9 @@ MergeDataFile::MergeDataFile( const OString &rFileName, const OString &rFile, bool bCaseSensitive, bool bWithQtz ) { - OString sEnableReleaseBuild(getenv("ENABLE_RELEASE_BUILD")); + auto const env = getenv("ENABLE_RELEASE_BUILD"); + assert(env != nullptr); + OString sEnableReleaseBuild(env); std::ifstream aInputStream( rFileName.getStr() ); if ( !aInputStream.is_open() ) diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx index 1e7c951863be..0dcb2d0dcef9 100644 --- a/l10ntools/source/pocheck.cxx +++ b/l10ntools/source/pocheck.cxx @@ -7,6 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <cassert> #include <iostream> #include <map> #include <vector> @@ -395,7 +398,9 @@ int main() { try { - OString aLanguages(getenv("ALL_LANGS")); + auto const env = getenv("ALL_LANGS"); + assert(env != nullptr); + OString aLanguages(env); if( aLanguages.isEmpty() ) { std::cerr << "Usage: LD_LIBRARY_PATH=instdir/program make cmd cmd=workdir/LinkTarget/Executable/pocheck\n"; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits