From 19a667b6ac0e5bf649b2ad8f3ca870584413b28e Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Wed, 7 Aug 2019 16:14:49 +0200 Subject: [PATCH] Bug #30152555 SCRIPTS/SQL_COMMANDS_HELP_DATA.H: CLANG-8 REPORTS BROKEN SOURCE ENCODING When generating C source from sql scripts, do not split utf8-encoded characters across lines. Patch based on contribution from przemyslaw.skibinski@percona.com Change-Id: I3c83b57ded745f7fee95d9d4da8c5957bddcf6d1 --- scripts/comp_sql.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index 038b95f74b06..5c0ac0e8237a 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -26,6 +26,7 @@ */ #include +#include #include #include @@ -86,7 +87,8 @@ static void print_query(FILE *out, const char *query) fprintf(out, "\""); while (*ptr) { - if (column >= 120) + /* utf-8 encoded characters are always >= 0x80 unsigned */ + if (column >= 120 && (uint8_t)(*ptr) < 0x80) { /* Wrap to the next line, tabulated. */ fprintf(out, "\"\n \"");