mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
parent
3e18aab9f3
commit
d52355d72c
@ -467,13 +467,13 @@ prof_occurrences(const char *const needle, const char *const haystack, int offse
|
|||||||
gchar *needle_last_ch = g_utf8_offset_to_pointer(needle, g_utf8_strlen(needle, -1)- 1);
|
gchar *needle_last_ch = g_utf8_offset_to_pointer(needle, g_utf8_strlen(needle, -1)- 1);
|
||||||
int needle_last_ch_len = mblen(needle_last_ch, MB_CUR_MAX);
|
int needle_last_ch_len = mblen(needle_last_ch, MB_CUR_MAX);
|
||||||
|
|
||||||
gunichar before = NULL;
|
gunichar before = 0;
|
||||||
gchar *haystack_before_ch = g_utf8_find_prev_char(haystack, haystack_curr);
|
gchar *haystack_before_ch = g_utf8_find_prev_char(haystack, haystack_curr);
|
||||||
if (haystack_before_ch) {
|
if (haystack_before_ch) {
|
||||||
before = g_utf8_get_char(haystack_before_ch);
|
before = g_utf8_get_char(haystack_before_ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
gunichar after = NULL;
|
gunichar after = 0;
|
||||||
gchar *haystack_after_ch = g_utf8_find_next_char(haystack_curr + strlen(needle) - needle_last_ch_len, NULL);
|
gchar *haystack_after_ch = g_utf8_find_next_char(haystack_curr + strlen(needle) - needle_last_ch_len, NULL);
|
||||||
if (haystack_after_ch) {
|
if (haystack_after_ch) {
|
||||||
after = g_utf8_get_char(haystack_after_ch);
|
after = g_utf8_get_char(haystack_after_ch);
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <cmocka.h>
|
#include <cmocka.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <langinfo.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "xmpp/chat_session.h"
|
#include "xmpp/chat_session.h"
|
||||||
@ -38,7 +40,21 @@
|
|||||||
#include "test_plugins_disco.h"
|
#include "test_plugins_disco.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "en_GB.UTF-8");
|
||||||
|
char *codeset = nl_langinfo(CODESET);
|
||||||
|
char *lang = getenv("LANG");
|
||||||
|
|
||||||
|
printf("Charset information:\n");
|
||||||
|
|
||||||
|
if (lang) {
|
||||||
|
printf(" LANG: %s\n", lang);
|
||||||
|
}
|
||||||
|
if (codeset) {
|
||||||
|
printf(" CODESET: %s\n", codeset);
|
||||||
|
}
|
||||||
|
printf(" MB_CUR_MAX: %d\n", MB_CUR_MAX);
|
||||||
|
printf(" MB_LEN_MAX: %d\n", MB_LEN_MAX);
|
||||||
|
|
||||||
const UnitTest all_tests[] = {
|
const UnitTest all_tests[] = {
|
||||||
|
|
||||||
unit_test(replace_one_substr),
|
unit_test(replace_one_substr),
|
||||||
|
Loading…
Reference in New Issue
Block a user