Skip to content

Commit

Permalink
Fix compiler warning
Browse files Browse the repository at this point in the history
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 <sw@weilnetz.de>
  • Loading branch information
stweil committed Jan 1, 2019
1 parent 5dd606c commit 91af010
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/training/text2image.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 91af010

Please sign in to comment.