[strings] fix lowercasing in string_utils.c
This commit is contained in:
@@ -206,15 +206,22 @@ char *utf8_case(const char *s, casing_option_t casing, utf8proc_option_t options
|
||||
} else if (casing == UTF8_UPPER) {
|
||||
norm = utf8proc_toupper(uc);
|
||||
}
|
||||
buffer[i] = norm;
|
||||
}
|
||||
|
||||
result = utf8proc_reencode(buffer, result, options);
|
||||
if (result < 0) {
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
utf8proc_int32_t *newptr;
|
||||
newptr = (utf8proc_int32_t *) realloc(buffer, (size_t)result+1);
|
||||
if (newptr) buffer = newptr;
|
||||
|
||||
free(buffer);
|
||||
utf8proc_int32_t *newptr = (utf8proc_int32_t *) realloc(buffer, (size_t)result+1);
|
||||
if (newptr != NULL) {
|
||||
buffer = newptr;
|
||||
} else {
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (char *)buffer;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ Utilities for manipulating strings in C.
|
||||
#define UTF8PROC_OPTIONS_STRIP_ACCENTS UTF8PROC_OPTIONS_BASE | UTF8PROC_DECOMPOSE | UTF8PROC_STRIPMARK
|
||||
|
||||
// Lowercase
|
||||
#define UTF8PROC_OPTIONS_LOWERCASE UTF8PROC_OPTIONS_BASE | UTF8PROC_CASEFOLD
|
||||
#define UTF8PROC_OPTIONS_CASE_FOLD UTF8PROC_OPTIONS_BASE | UTF8PROC_CASEFOLD
|
||||
|
||||
|
||||
// ASCII string methods
|
||||
|
||||
Reference in New Issue
Block a user