Skip to content

Commit 4979dca

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 for 8.0 Patch based on contribution from przemyslaw.skibinski@percona.com Change-Id: I69da0e6701052fce5ea6c07b96b580d0a655e6d2
1 parent 49b52a2 commit 4979dca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/comp_sql.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "my_config.h"
2929

3030
#include <stdarg.h>
31+
#include <stdint.h>
3132
#include <stdio.h>
3233
#include <stdlib.h>
3334

@@ -90,7 +91,8 @@ static void print_query(FILE *out, const char *query) {
9091

9192
fprintf(out, "\"");
9293
while (*ptr) {
93-
if (column >= 120) {
94+
/* utf-8 encoded characters are always >= 0x80 unsigned */
95+
if (column >= 120 && static_cast<uint8_t>(*ptr) < 0x80) {
9496
/* Wrap to the next line, tabulated. */
9597
fprintf(out, "\"\n \"");
9698
column = 3;

0 commit comments

Comments
 (0)