Skip to content

Commit

Permalink
Bug #30152555 SCRIPTS/SQL_COMMANDS_HELP_DATA.H: CLANG-8 REPORTS BROKE…
Browse files Browse the repository at this point in the history
…N 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
  • Loading branch information
Tor Didriksen committed Aug 12, 2019
1 parent 1d92f9c commit 19a667b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/comp_sql.c
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -26,6 +26,7 @@
*/

#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>

Expand Down Expand Up @@ -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 \"");
Expand Down

0 comments on commit 19a667b

Please sign in to comment.