| 6 |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
|
#ifdef HAVE_CONFIG_H |
| 10 |
|
#include "config.h" |
| 11 |
|
#endif |
| 12 |
|
|
| 13 |
#include "common.h" |
#include "common.h" |
| 14 |
#include "log.h" |
#include "log.h" |
| 15 |
#include "str_process.h" |
#include "str_process.h" |
| 76 |
|
|
| 77 |
if (mbstowcs(wcs, input_str, 1) == (size_t)-1) |
if (mbstowcs(wcs, input_str, 1) == (size_t)-1) |
| 78 |
{ |
{ |
| 79 |
|
#ifdef _DEBUG |
| 80 |
log_error("mbstowcs(%s) error\n", input_str); |
log_error("mbstowcs(%s) error\n", input_str); |
| 81 |
|
#endif |
| 82 |
|
wc_len = (UTF8_fixed_width ? 2 : 1); // Fallback |
| 83 |
|
} |
| 84 |
|
else |
| 85 |
|
{ |
| 86 |
|
wc_len = (UTF8_fixed_width ? 2 : wcwidth(wcs[0])); |
| 87 |
} |
} |
|
wc_len = (UTF8_fixed_width ? 2 : wcwidth(wcs[0])); |
|
| 88 |
|
|
| 89 |
i += (str_len - 1); |
i += (str_len - 1); |
| 90 |
ret += wc_len; |
ret += wc_len; |
| 142 |
|
|
| 143 |
if (mbstowcs(wcs, input_str, 1) == (size_t)-1) |
if (mbstowcs(wcs, input_str, 1) == (size_t)-1) |
| 144 |
{ |
{ |
| 145 |
|
#ifdef _DEBUG |
| 146 |
log_error("mbstowcs(%s) error\n", input_str); |
log_error("mbstowcs(%s) error\n", input_str); |
| 147 |
|
#endif |
| 148 |
|
wc_len = (UTF8_fixed_width ? 2 : 1); // Fallback |
| 149 |
} |
} |
| 150 |
wc_len = (UTF8_fixed_width ? 2 : wcwidth(wcs[0])); |
else |
| 151 |
|
{ |
| 152 |
|
wc_len = (UTF8_fixed_width ? 2 : wcwidth(wcs[0])); |
| 153 |
|
} |
| 154 |
|
|
| 155 |
if (*p_display_len + wc_len > max_display_len) |
if (*p_display_len + wc_len > max_display_len) |
| 156 |
{ |
{ |
| 157 |
break; |
break; |