From fe6dda917a76789d2c69c647517c7c5ceaf9fc85 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Thu, 9 Aug 2018 23:54:16 -0400 Subject: [PATCH] word_wrap: hack to workaround long lines without spaces --- libretro-common/string/stdstring.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 71b2ea2442..dba253163a 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -159,6 +159,7 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode) while (i < len) { unsigned counter; + int pos = &buffer[i] - buffer; /* copy string until the end of the line is reached */ for (counter = 1; counter <= (unsigned)line_width; counter++) @@ -214,6 +215,9 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode) i = k + 1; break; } + + if (&buffer[i] - buffer == pos) + return buffer; } }