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 <[email protected]>
  • 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
Original file line number Diff line number Diff line change
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.