Skip to content

Commit 19a667b

Browse files
author
Tor Didriksen
committed
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
1 parent 1d92f9c commit 19a667b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/comp_sql.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include <stdarg.h>
29+
#include <stdint.h>
2930
#include <stdlib.h>
3031
#include <stdio.h>
3132

@@ -86,7 +87,8 @@ static void print_query(FILE *out, const char *query)
8687
fprintf(out, "\"");
8788
while (*ptr)
8889
{
89-
if (column >= 120)
90+
/* utf-8 encoded characters are always >= 0x80 unsigned */
91+
if (column >= 120 && (uint8_t)(*ptr) < 0x80)
9092
{
9193
/* Wrap to the next line, tabulated. */
9294
fprintf(out, "\"\n \"");

0 commit comments

Comments
 (0)