Fixed a bug which made reading an UTF-8 character impossible.
This commit is contained in:
parent
d3e590e4ef
commit
cd6d0773b3
|
@ -1,9 +1,9 @@
|
||||||
#include <librr/runes.h>
|
#include <librr/runes.h>
|
||||||
|
|
||||||
isz_t rr_distance_to_last_utf8_rune_start(const char *string, usz_t offset)
|
isz_t rr_distance_to_last_utf8_rune_start(const char *string, isz_t offset)
|
||||||
{
|
{
|
||||||
usz_t bytes_walked = 0;
|
usz_t bytes_walked = 0;
|
||||||
while(bytes_walked < offset)
|
while((offset - bytes_walked) >= 0)
|
||||||
{
|
{
|
||||||
if(bytes_walked > 4)
|
if(bytes_walked > 4)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue