From 1fc95ead6c74ca78877b65a59e883c82ec9c0e36 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Mon, 8 Nov 2021 11:59:07 +0000 Subject: Clean up whitespace in provider sources --- providers/enchant_aspell.c | 34 +++++++++++------------ providers/enchant_hspell.c | 32 +++++++++++----------- providers/enchant_hunspell.cpp | 32 +++++++++++----------- providers/enchant_voikko.c | 2 +- providers/enchant_zemberek.cpp | 62 +++++++++++++++++++++--------------------- 5 files changed, 81 insertions(+), 81 deletions(-) diff --git a/providers/enchant_aspell.c b/providers/enchant_aspell.c index 1d64df9..d79891c 100644 --- a/providers/enchant_aspell.c +++ b/providers/enchant_aspell.c @@ -71,7 +71,7 @@ aspell_dict_suggest (EnchantDict * me, const char *const word, size_t len, size_t * out_n_suggs) { AspellSpeller *manager = (AspellSpeller *) me->user_data; - + char *normalizedWord = g_utf8_normalize (word, len, G_NORMALIZE_NFC); const AspellWordList *word_list = aspell_speller_suggest (manager, normalizedWord, strlen(normalizedWord)); g_free(normalizedWord); @@ -84,11 +84,11 @@ aspell_dict_suggest (EnchantDict * me, const char *const word, { size_t n_suggestions = aspell_word_list_size (word_list); *out_n_suggs = n_suggestions; - + if (n_suggestions) { sugg_arr = g_new0 (char *, n_suggestions + 1); - + for (size_t i = 0; i < n_suggestions; i++) { const char *sugg = aspell_string_enumeration_next (suggestions); @@ -99,7 +99,7 @@ aspell_dict_suggest (EnchantDict * me, const char *const word, delete_aspell_string_enumeration (suggestions); } } - + return sugg_arr; } @@ -137,18 +137,18 @@ aspell_provider_request_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, const c AspellConfig *spell_config = new_aspell_config (); aspell_config_replace (spell_config, "language-tag", tag); aspell_config_replace (spell_config, "encoding", "utf-8"); - + AspellCanHaveError *spell_error = new_aspell_speller (spell_config); delete_aspell_config (spell_config); - + if (aspell_error_number (spell_error) != 0) { delete_aspell_can_have_error(spell_error); return NULL; } - + AspellSpeller *manager = to_aspell_speller (spell_error); - + EnchantDict *dict = g_new0 (EnchantDict, 1); dict->user_data = (void *) manager; dict->check = aspell_dict_check; @@ -156,7 +156,7 @@ aspell_provider_request_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, const c dict->add_to_personal = aspell_dict_add_to_personal; dict->add_to_session = aspell_dict_add_to_session; dict->store_replacement = aspell_dict_store_replacement; - + return dict; } @@ -165,12 +165,12 @@ aspell_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, Enchant { AspellSpeller *manager = (AspellSpeller *) dict->user_data; delete_aspell_speller (manager); - + g_free (dict); } -static char ** -aspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, +static char ** +aspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, size_t * out_n_dicts) { AspellConfig * spell_config = new_aspell_config (); @@ -190,18 +190,18 @@ aspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, if (*out_n_dicts) { out_list = g_new0 (char *, *out_n_dicts + 1); dels = aspell_dict_info_list_elements (dlist); - + for (size_t i = 0; i < *out_n_dicts; i++) { - entry = aspell_dict_info_enumeration_next (dels); + entry = aspell_dict_info_enumeration_next (dels); /* FIXME: should this be entry->code or entry->name ? */ out_list[i] = g_strdup (entry->code); } - + delete_aspell_dict_info_enumeration (dels); } - + delete_aspell_config (spell_config); - + return out_list; } diff --git a/providers/enchant_hspell.c b/providers/enchant_hspell.c index a2ff572..9f93f74 100644 --- a/providers/enchant_hspell.c +++ b/providers/enchant_hspell.c @@ -66,7 +66,7 @@ corlist2strv (struct corlist *cl, size_t nb_sugg) "utf-8", "iso8859-8", NULL, &len, NULL); } } - + return sugg_arr; } @@ -87,17 +87,17 @@ hspell_dict_check (EnchantDict * me, const char *const word, size_t len) struct dict_radix *hspell_dict = (struct dict_radix *)me->user_data; char *iso_word = hspell_convert_to_iso8859_8 (me, word, len); g_return_val_if_fail (iso_word, -1); - + /* check */ int preflen; int res = hspell_check_word (hspell_dict, iso_word, &preflen); - + /* if not correct try gimatria */ if (res != 1) res = hspell_is_canonic_gimatria (iso_word) != 0; - + g_free (iso_word); - + return (res != 1); } @@ -113,13 +113,13 @@ hspell_dict_suggest (EnchantDict * me, const char *const word, struct corlist cl; corlist_init (&cl); hspell_trycorrect (hspell_dict, iso_word, &cl); - + *out_n_suggs = corlist_n (&cl); char **sugg_arr = corlist2strv (&cl, *out_n_suggs); corlist_free (&cl); g_free (iso_word); - - return sugg_arr; + + return sugg_arr; } static EnchantDict * @@ -127,22 +127,22 @@ hspell_provider_request_dict (EnchantProvider * me, const char *const tag) { if(!((strlen(tag) >= 2) && tag[0] == 'h' && tag[1] == 'e')) return NULL; - + /* try to set a new session */ struct dict_radix *hspell_dict = NULL; int dict_flag = hspell_init (&hspell_dict, HSPELL_OPT_DEFAULT); - + if (dict_flag != 0 || !hspell_dict) { enchant_provider_set_error (me, "can't create new dict."); return NULL; } - + EnchantDict *dict = g_new0 (EnchantDict, 1); dict->user_data = (void *) hspell_dict; dict->check = hspell_dict_check; dict->suggest = hspell_dict_suggest; - + return dict; } @@ -156,8 +156,8 @@ hspell_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, Enchant /* test for the existence of, then return $prefix/share/hspell/hebrew.wgz */ -static char ** -hspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, +static char ** +hspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, size_t * out_n_dicts) { const char * dictionary_path = hspell_get_dictionary_path(); @@ -167,8 +167,8 @@ hspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, if(dictionary_path && *dictionary_path && g_file_test (dictionary_path, G_FILE_TEST_EXISTS)) { out_list = g_new0 (char *, 2); out_list[(*out_n_dicts)++] = g_strdup ("he"); - } - + } + return out_list; } diff --git a/providers/enchant_hunspell.cpp b/providers/enchant_hunspell.cpp index 535aa57..f0156a2 100644 --- a/providers/enchant_hunspell.cpp +++ b/providers/enchant_hunspell.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -242,16 +242,16 @@ static bool is_plausible_dict_for_tag(const char *dir_entry, const char *tag) size_t tag_len = strlen(tag); if (dir_entry_len - dic_suffix_len < tag_len) - return false; + return false; if (strcmp(dir_entry+dir_entry_len-dic_suffix_len, dic_suffix) != 0) - return false; + return false; if (strncmp (dir_entry, tag, tag_len) != 0) - return false; + return false; //e.g. requested dict for "fi", //reject "fil_PH.dic" //allow "fi-FOO.dic", "fi_FOO.dic", "fi.dic", etc. if (!ispunct(dir_entry[tag_len])) - return false; + return false; return true; } @@ -268,7 +268,7 @@ hunspell_request_dictionary (const char * tag) return strdup (names[i].c_str()); } } - + std::vector dirs; s_buildDictionaryDirs (dirs); @@ -278,7 +278,7 @@ hunspell_request_dictionary (const char * tag) const char *dir_entry; while ((dir_entry = g_dir_read_name (dir)) != NULL) { if (is_plausible_dict_for_tag(dir_entry, tag)) { - char *dict = g_build_filename (dirs[i].c_str(), + char *dict = g_build_filename (dirs[i].c_str(), dir_entry, nullptr); if(s_fileExists(s_correspondingAffFile(dict))) { g_dir_close (dir); @@ -348,10 +348,10 @@ static int hunspell_dict_check (EnchantDict * me, const char *const word, size_t len) { HunspellChecker * checker = static_cast(me->user_data); - + if (checker->checkWord(word, len)) return 0; - + return 1; } @@ -410,8 +410,8 @@ hunspell_provider_enum_dicts (const char * const directory, extern "C" { -static char ** -hunspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, +static char ** +hunspell_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, size_t * out_n_dicts) { std::vector dict_dirs, dicts; @@ -439,15 +439,15 @@ static EnchantDict * hunspell_provider_request_dict(EnchantProvider * me _GL_UNUSED_PARAMETER, const char *const tag) { HunspellChecker * checker = new HunspellChecker(); - + if (!checker) return NULL; - + if (!checker->requestDictionary(tag)) { delete checker; return NULL; } - + EnchantDict *dict = g_new0(EnchantDict, 1); dict->user_data = (void *) checker; dict->check = hunspell_dict_check; @@ -455,7 +455,7 @@ hunspell_provider_request_dict(EnchantProvider * me _GL_UNUSED_PARAMETER, const // don't implement personal, session dict->get_extra_word_characters = hunspell_dict_get_extra_word_characters; dict->is_word_character = hunspell_dict_is_word_character; - + return dict; } @@ -464,7 +464,7 @@ hunspell_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, Encha { HunspellChecker *checker = (HunspellChecker *) dict->user_data; delete checker; - + g_free (dict); } diff --git a/providers/enchant_voikko.c b/providers/enchant_voikko.c index 137de8f..964cf82 100644 --- a/providers/enchant_voikko.c +++ b/providers/enchant_voikko.c @@ -113,7 +113,7 @@ voikko_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, static int voikko_provider_dictionary_exists (struct str_enchant_provider * me _GL_UNUSED_PARAMETER, - const char *const tag) + const char *const tag) { size_t i; int exists = 0; diff --git a/providers/enchant_zemberek.cpp b/providers/enchant_zemberek.cpp index b724246..f5d97fb 100644 --- a/providers/enchant_zemberek.cpp +++ b/providers/enchant_zemberek.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 Barış Metin * Copyright (C) 2007 Serkan Kaba - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -52,7 +52,7 @@ static bool zemberek_service_is_running () "/net/zemberekserver/server/dbus/ZemberekDbus", "net.zemberekserver.server.dbus.ZemberekDbusInterface", &Error); - + dbus_g_connection_unref (connection); if (proxy == NULL) { return false; @@ -67,7 +67,7 @@ class Zemberek public: Zemberek(); ~Zemberek(); - + int checkWord(const char* word) const; char** suggestWord(const char* word, size_t *out_n_suggs); @@ -101,9 +101,9 @@ Zemberek::Zemberek() Zemberek::~Zemberek() { if(proxy) - g_object_unref (proxy); + g_object_unref (proxy); if(connection) - dbus_g_connection_unref (connection); + dbus_g_connection_unref (connection); } @@ -112,10 +112,10 @@ int Zemberek::checkWord(const char* word) const gboolean result; GError *Error = NULL; if (!dbus_g_proxy_call (proxy, "kelimeDenetle", &Error, - G_TYPE_STRING,word,G_TYPE_INVALID, - G_TYPE_BOOLEAN, &result, G_TYPE_INVALID)) { - g_error_free (Error); - return -1; + G_TYPE_STRING,word,G_TYPE_INVALID, + G_TYPE_BOOLEAN, &result, G_TYPE_INVALID)) { + g_error_free (Error); + return -1; } else return !result; @@ -127,10 +127,10 @@ char** Zemberek::suggestWord(const char* word, size_t *out_n_suggs) char** suggs; GError *Error = NULL; if (!dbus_g_proxy_call (proxy, "oner", &Error, - G_TYPE_STRING,word,G_TYPE_INVALID, - G_TYPE_STRV, &suggs,G_TYPE_INVALID)) { - g_error_free (Error); - return NULL; + G_TYPE_STRING,word,G_TYPE_INVALID, + G_TYPE_STRV, &suggs,G_TYPE_INVALID)) { + g_error_free (Error); + return NULL; } *out_n_suggs = g_strv_length(suggs); return suggs; @@ -172,23 +172,23 @@ static EnchantDict* zemberek_provider_request_dict(EnchantProvider *me _GL_UNUSED_PARAMETER, const char *tag) { if (!((strcmp(tag, "tr") == 0) || (strncmp(tag, "tr_", 3) == 0))) - return NULL; // only handle turkish + return NULL; // only handle turkish try { - Zemberek* checker = new Zemberek(); + Zemberek* checker = new Zemberek(); - EnchantDict* dict = g_new0(EnchantDict, 1); - dict->user_data = (void *) checker; - dict->check = zemberek_dict_check; - dict->suggest = zemberek_dict_suggest; + EnchantDict* dict = g_new0(EnchantDict, 1); + dict->user_data = (void *) checker; + dict->check = zemberek_dict_check; + dict->suggest = zemberek_dict_suggest; - return dict; + return dict; } catch(...) { - // will fail if zemberek service isn't running - return NULL; + // will fail if zemberek service isn't running + return NULL; } } @@ -203,31 +203,31 @@ zemberek_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, Encha static const char * zemberek_provider_identify (EnchantProvider * me _GL_UNUSED_PARAMETER) { - return "zemberek"; + return "zemberek"; } static const char * zemberek_provider_describe (EnchantProvider * me _GL_UNUSED_PARAMETER) { - return "Zemberek Provider"; + return "Zemberek Provider"; } static char ** zemberek_provider_list_dicts (EnchantProvider * me _GL_UNUSED_PARAMETER, - size_t * out_n_dicts) + size_t * out_n_dicts) { if (!zemberek_service_is_running ()) { - *out_n_dicts = 0; - return NULL; + *out_n_dicts = 0; + return NULL; } else { - *out_n_dicts = 1; - char ** out_list = g_new0 (char *, 2); - out_list[0] = g_strdup ("tr"); + *out_n_dicts = 1; + char ** out_list = g_new0 (char *, 2); + out_list[0] = g_strdup ("tr"); - return out_list; + return out_list; } } -- cgit v1.2.1