[geany/geany] 013c47: TM: Fix various integer signedness issues
Colomban Wendling
git-noreply at xxxxx
Fri Oct 31 19:25:13 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Fri, 31 Oct 2014 19:25:13 UTC
Commit: 013c47c6e3edf5ed556e5cc1ebe2bf28c3600f42
https://github.com/geany/geany/commit/013c47c6e3edf5ed556e5cc1ebe2bf28c3600f42
Log Message:
-----------
TM: Fix various integer signedness issues
Modified Paths:
--------------
tagmanager/src/tm_source_file.c
tagmanager/src/tm_tag.c
tagmanager/src/tm_workspace.c
Modified: tagmanager/src/tm_source_file.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -238,7 +238,7 @@ gboolean tm_source_file_parse(TMSourceFile *source_file)
{
const char *file_name;
gboolean status = TRUE;
- int passCount = 0;
+ guint passCount = 0;
if ((NULL == source_file) || (NULL == source_file->file_name))
{
@@ -338,7 +338,7 @@ gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf
}
else
{
- int passCount = 0;
+ guint passCount = 0;
while ((TRUE == status) && (passCount < 3))
{
tm_tags_array_free(source_file->tags_array, FALSE);
Modified: tagmanager/src/tm_tag.c
12 lines changed, 6 insertions(+), 6 deletions(-)
===================================================================
@@ -351,10 +351,10 @@ static gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
case TA_INACTIVE: /* Obsolete */
break;
case TA_ACCESS:
- tag->access = *(start + 1);
+ tag->access = (char) *(start + 1);
break;
case TA_IMPL:
- tag->impl = *(start + 1);
+ tag->impl = (char) *(start + 1);
break;
default:
#ifdef GEANY_DEBUG
@@ -599,7 +599,7 @@ TMTag *tm_tag_new_from_file(TMSourceFile *file, FILE *fp, gint mode, TMFileForma
@param attrs Attributes to be written (bitmask).
@return TRUE on success, FALSE on failure.
*/
-gboolean tm_tag_write(TMTag *tag, FILE *fp, guint attrs)
+gboolean tm_tag_write(TMTag *tag, FILE *fp, TMTagAttrType attrs)
{
fprintf(fp, "%s", tag->name);
if (attrs & tm_tag_attr_type_t)
@@ -1056,11 +1056,11 @@ static TMTag **tags_search(const GPtrArray *tags_array, TMTag *tag, gboolean par
else
{ /* the slow way: linear search (to make it a bit faster, search reverse assuming
* that the tag to search was added recently) */
- int i;
+ guint i;
TMTag **t;
- for (i = tags_array->len - 1; i >= 0; i--)
+ for (i = tags_array->len; i > 0; i--)
{
- t = (TMTag **) &tags_array->pdata[i];
+ t = (TMTag **) &tags_array->pdata[i - 1];
if (0 == tm_tag_compare(&tag, t, sort_options))
return t;
}
Modified: tagmanager/src/tm_workspace.c
12 lines changed, 6 insertions(+), 6 deletions(-)
===================================================================
@@ -227,7 +227,7 @@ static void write_includes_file(FILE *fp, GList *includes_files)
while (node)
{
char *str = g_strdup_printf("#include \"%s\"\n", (char*)node->data);
- int str_len = strlen(str);
+ size_t str_len = strlen(str);
fwrite(str, str_len, 1, fp);
g_free(str);
@@ -324,7 +324,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
if (includes[0][0] == '"') /* leading \" char for glob matching */
for(idx_inc = 0; idx_inc < includes_count; idx_inc++)
{
- int dirty_len = strlen(includes[idx_inc]);
+ size_t dirty_len = strlen(includes[idx_inc]);
char *clean_path = g_malloc(dirty_len - 1);
strncpy(clean_path, includes[idx_inc] + 1, dirty_len - 1);
@@ -638,7 +638,7 @@ const GPtrArray *tm_workspace_find(const char *name, TMTagType type, TMTagAttrTy
{
static GPtrArray *tags = NULL;
TMTag **matches[2];
- int len;
+ size_t len;
guint tagCount[2]={0,0}, tagIter;
gint tags_lang;
@@ -734,7 +734,7 @@ static gboolean match_langs(gint lang, const TMTag *tag)
/* scope can be NULL.
* lang can be -1 */
-static int
+static guint
fill_find_tags_array (GPtrArray *dst, const GPtrArray *src,
const char *name, const char *scope, TMTagType type, gboolean partial,
gint lang, gboolean first)
@@ -973,7 +973,7 @@ tm_workspace_find_scope_members (const GPtrArray * file_tags, const char *name,
while (1)
{
const GPtrArray *tags2;
- int got = 0;
+ guint got = 0;
TMTagType types = (tm_tag_class_t | tm_tag_namespace_t |
tm_tag_struct_t | tm_tag_typedef_t |
tm_tag_union_t | tm_tag_enum_t);
@@ -1196,7 +1196,7 @@ tm_workspace_find_namespace_members (const GPtrArray * file_tags, const char *na
while (1)
{
const GPtrArray *tags2;
- int got = 0;
+ guint got = 0;
TMTagType types = (tm_tag_class_t
tm_tag_struct_t | tm_tag_typedef_t |
tm_tag_union_t | tm_tag_enum_t);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list