diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-11-01 01:09:51 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2020-11-02 22:15:01 +0100 |
commit | 45869513bfebba80cc2ab42e4218f68b34b1e6ac (patch) | |
tree | f064631dbff141bf1c945db8cff40b7bb82fd169 /RichString.c | |
parent | 61e14d4bb25268593019e6df3eb02264b4ac8e0e (diff) |
Embracing branches
Diffstat (limited to 'RichString.c')
-rw-r--r-- | RichString.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/RichString.c b/RichString.c index 99c535b1..904b44b6 100644 --- a/RichString.c +++ b/RichString.c @@ -52,6 +52,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char* len = mbstowcs(data, data_c, len); if (len < 0) return; + int newLen = from + len; RichString_setLen(this, newLen); for (int i = from, j = 0; i < newLen; i++, j++) { @@ -84,8 +85,9 @@ int RichString_findChar(RichString* this, char c, int start) { static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) { int newLen = from + len; RichString_setLen(this, newLen); - for (int i = from, j = 0; i < newLen; i++, j++) + for (int i = from, j = 0; i < newLen; i++, j++) { this->chptr[i] = (data_c[j] >= 32 ? data_c[j] : '?') | attrs; + } this->chptr[newLen] = 0; } |