[geany/geany] 308f98: Use gssize to avoid casts for encodings_convert_to_utf8_*()
Nick Treleaven
git-noreply at xxxxx
Thu Jul 26 00:02:41 UTC 2012
Branch: refs/heads/document-messages
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Tue, 03 Jan 2012 13:30:38
Commit: 308f98a2b96c96fa5a66d70561e2064e60854dc5
https://github.com/geany/geany/commit/308f98a2b96c96fa5a66d70561e2064e60854dc5
Log Message:
-----------
Use gssize to avoid casts for encodings_convert_to_utf8_*()
Modified Paths:
--------------
src/encodings.c
src/encodings.h
src/plugindata.h
src/socket.c
src/symbols.c
Modified: src/encodings.c
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -509,7 +509,7 @@ void encodings_init(void)
* @return If the conversion was successful, a newly allocated nul-terminated string,
* which must be freed with @c g_free(). Otherwise @c NULL.
**/
-gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gsize size,
+gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gssize size,
const gchar *charset, gboolean fast)
{
gchar *utf8_content = NULL;
@@ -567,7 +567,7 @@ static gchar *encodings_check_regexes(const gchar *buffer, gsize size)
}
-static gchar *encodings_convert_to_utf8_with_suggestion(const gchar *buffer, gsize size,
+static gchar *encodings_convert_to_utf8_with_suggestion(const gchar *buffer, gssize size,
const gchar *suggested_charset, gchar **used_encoding)
{
const gchar *locale_charset = NULL;
@@ -577,7 +577,7 @@ static gchar *encodings_convert_to_utf8_with_suggestion(const gchar *buffer, gsi
gboolean check_locale = FALSE;
gint i, preferred_charset;
- if ((gint)size == -1)
+ if (size == -1)
{
size = strlen(buffer);
}
@@ -667,7 +667,7 @@ static gchar *encodings_convert_to_utf8_with_suggestion(const gchar *buffer, gsi
* @return If the conversion was successful, a newly allocated nul-terminated string,
* which must be freed with @c g_free(). Otherwise @c NULL.
**/
-gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_encoding)
+gchar *encodings_convert_to_utf8(const gchar *buffer, gssize size, gchar **used_encoding)
{
gchar *regex_charset;
gchar *utf8;
Modified: src/encodings.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -79,11 +79,11 @@
void encodings_init(void);
void encodings_finalize(void);
-gchar *encodings_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_encoding);
+gchar *encodings_convert_to_utf8(const gchar *buffer, gssize size, gchar **used_encoding);
/* Converts a string from the given charset to UTF-8.
* If fast is set, no further checks are performed. */
-gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gsize size,
+gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gssize size,
const gchar *charset, gboolean fast);
gboolean encodings_is_unicode_charset(const gchar *string);
Modified: src/plugindata.h
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -52,7 +52,7 @@
* @warning You should not test for values below 200 as previously
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
*/
-#define GEANY_API_VERSION 211
+#define GEANY_API_VERSION 212
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered.
@@ -521,8 +521,8 @@
/* See encodings.h */
typedef struct EncodingFuncs
{
- gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gsize size, gchar **used_encoding);
- gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gsize size,
+ gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gssize size, gchar **used_encoding);
+ gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gssize size,
const gchar *charset, gboolean fast);
const gchar* (*encodings_get_charset_from_index) (gint idx);
}
Modified: src/socket.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -551,7 +551,7 @@ static void handle_input_filename(const gchar *buf)
/* we never know how the input is encoded, so do the best auto detection we can */
if (! g_utf8_validate(buf, -1, NULL))
- utf8_filename = encodings_convert_to_utf8(buf, (gsize) -1, NULL);
+ utf8_filename = encodings_convert_to_utf8(buf, -1, NULL);
else
utf8_filename = g_strdup(buf);
Modified: src/symbols.c
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -1023,7 +1023,7 @@ static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag, gboole
if (! doc_is_utf8)
utf8_name = encodings_convert_to_utf8_from_charset(tag->name,
- (gsize) -1, doc->encoding, TRUE);
+ -1, doc->encoding, TRUE);
else
utf8_name = tag->name;
@@ -1066,7 +1066,7 @@ static gchar *get_symbol_tooltip(GeanyDocument *doc, const TMTag *tag)
! utils_str_equal(doc->encoding, "None"))
{
setptr(utf8_name,
- encodings_convert_to_utf8_from_charset(utf8_name, (gsize) -1, doc->encoding, TRUE));
+ encodings_convert_to_utf8_from_charset(utf8_name, -1, doc->encoding, TRUE));
}
if (utf8_name != NULL)
@@ -1276,12 +1276,12 @@ static void free_iter_slice(gpointer iter)
* @param doc a document
* @param tags a pointer to a GList* holding the tags to add/update. This
* list may be updated, removing updated elements.
- *
+ *
* The update is done in two passes:
* 1) walking the current tree, update tags that still exist and remove the
* obsolescent ones;
* 2) walking the remaining (non updated) tags, adds them in the list.
- *
+ *
* For better performances, we use 2 hash tables:
* - one containing all the tags for lookup in the first pass (actually stores a
* reference in the tags list for removing it efficiently), avoiding list search
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list