From 91af010200b8abeeed7c2613a2c87c02b814ae0f Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 1 Jan 2019 22:49:04 +0100 Subject: [PATCH] Fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc warning: src/training/text2image.cpp:694:35: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] putenv expects a string which can be modified. Signed-off-by: Stefan Weil --- src/training/text2image.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/training/text2image.cpp b/src/training/text2image.cpp index 43c1a96a48..bc4c73eafd 100644 --- a/src/training/text2image.cpp +++ b/src/training/text2image.cpp @@ -690,8 +690,9 @@ int main(int argc, char** argv) { // See https://github.com/tesseract-ocr/tesseract/issues/736 char* backend; backend = getenv("PANGOCAIRO_BACKEND"); - if (backend == NULL) { - putenv("PANGOCAIRO_BACKEND=fc"); + if (backend == nullptr) { + static char envstring[] = "PANGOCAIRO_BACKEND=fc"; + putenv(envstring); } else { printf("Using '%s' as pango cairo backend based on environment " "variable.\n", backend);