summaryrefslogtreecommitdiff
path: root/saedit
diff options
context:
space:
mode:
authorVasily_Makarov <danilka.pro@gmail.com>2012-01-30 21:29:46 +0400
committerVasily_Makarov <danilka.pro@gmail.com>2012-01-30 21:29:46 +0400
commite0e931518b1e5072749e2f2db768a9f0ed899d30 (patch)
treeee3ea4b49cf75c8ed533a8fa0357add8c971031c /saedit
parentdfee2a915a49e479345add234e453a423881d12e (diff)
downloadevol-tools-e0e931518b1e5072749e2f2db768a9f0ed899d30.tar.gz
evol-tools-e0e931518b1e5072749e2f2db768a9f0ed899d30.tar.bz2
evol-tools-e0e931518b1e5072749e2f2db768a9f0ed899d30.tar.xz
evol-tools-e0e931518b1e5072749e2f2db768a9f0ed899d30.zip
Correcting code to remove all compiler warnings.
Diffstat (limited to 'saedit')
-rw-r--r--saedit/Makefile2
-rw-r--r--saedit/main.c29
-rw-r--r--saedit/sae.c4
-rw-r--r--saedit/search.c2
-rw-r--r--saedit/xml.c8
-rw-r--r--saedit/xml.h4
6 files changed, 23 insertions, 26 deletions
diff --git a/saedit/Makefile b/saedit/Makefile
index ede29b1..d5a7bdc 100644
--- a/saedit/Makefile
+++ b/saedit/Makefile
@@ -32,4 +32,4 @@ config.o: config.c config.h common.h
sae.o: sae.c sae.h common.h
gcc ${CFLAGS} ${GTK_CFLAGS} ${IBUS_CFLAGS} -c -o sae.o sae.c
clean:
- rm -rfv '${OUTPUT}' *.o *.o~ *.c~ *.h~
+ rm -rfv '${OUTPUT}' *.o *.o~ *~
diff --git a/saedit/main.c b/saedit/main.c
index a87850f..b0f1b3b 100644
--- a/saedit/main.c
+++ b/saedit/main.c
@@ -84,9 +84,7 @@ gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info) {
//String functions (common)
gchar *markup_bold(gchar *str) {
- gchar buffer[255];
- g_sprintf(buffer, "<b>%s</b>", str);
- return buffer;
+ return g_strconcat("<b>", str, "</b>");
}
void format_src_string(gchar *src) {
@@ -117,7 +115,7 @@ void save_to_xml_file(gchar *filename) {
GtkTextIter start, end;
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(source_buffer), &start);
gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(source_buffer), &end);
- g_file_set_contents(filename, gtk_text_buffer_get_text(GTK_TEXT_BUFFER(source_buffer), &start, &end, NULL), -1, NULL);
+ g_file_set_contents(filename, gtk_text_buffer_get_text(GTK_TEXT_BUFFER(source_buffer), &start, &end, TRUE), -1, NULL);
}
//SAEInfo functions (must be ported to sae.c)
@@ -278,10 +276,10 @@ void set_up_actions_by_imageset_name(gchar *imageset_name, SAEInfo *sae_info) {
sae_info->actions = _actions_list;
_actions_list->data = list->data;
} else
- g_list_append(_actions_list, list->data);
+ _actions_list = g_list_append(_actions_list, list->data);
node = list->data;
if (sae_info->actions_combo_box != NULL)
- gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->actions_combo_box), xml_node_get_attr_value(node, "name"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->actions_combo_box), xml_node_get_attr_value(node, "name"));
list = list->next;
}
if (sae_info->actions_combo_box != NULL);
@@ -302,10 +300,10 @@ gboolean set_up_imagesets(SAEInfo *sae_info) {
_imagesets_list->data = list->data;
sae_info->imagesets = _imagesets_list;
} else
- g_list_append(_imagesets_list, list->data);
+ _imagesets_list = g_list_append(_imagesets_list, list->data);
node = list->data;
if (sae_info->imagesets_combo_box != NULL)
- gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->imagesets_combo_box), xml_node_get_attr_value(node, "name"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->imagesets_combo_box), xml_node_get_attr_value(node, "name"));
list = list->next;
}
if (_imagesets_list == NULL)
@@ -323,8 +321,7 @@ void show_animation(SAEInfo *sae_info) {
sae_info->sprite = sprite;
gtk_widget_queue_draw(darea);
sae_info->animation = sae_info->animation->next;
- sae_info->anim_tag = g_timeout_add(sprite->delay, show_animation, sae_info);
- return FALSE;
+ sae_info->anim_tag = g_timeout_add(sprite->delay, (GSourceFunc)show_animation, sae_info);
}
gboolean show_general_animation(SAEInfo *sae_info) {
@@ -338,7 +335,7 @@ gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info) {
free_animations(sae_info);
GList *list = g_list_find_custom(sae_info->actions,
xml_attr_new("name", name),
- xml_node_compare_with_attr_func);
+ (GCompareFunc)xml_node_compare_with_attr_func);
if (list == NULL) return FALSE;
list = ((XMLNode *)list->data)->sub_nodes;
gboolean was_direction = FALSE;
@@ -350,12 +347,12 @@ gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info) {
sae_info->animations = g_list_alloc();
sae_info->animations->data = list->data;
} else
- g_list_append(sae_info->animations, list->data);
+ sae_info->animations = g_list_append(sae_info->animations, list->data);
XMLNode *node = list->data;
gchar *direction = xml_node_get_attr_value(node, "direction");
if (direction != NULL) {
if (sae_info->animations_combo_box != NULL)
- gtk_combo_box_text_append_text(GTK_COMBO_BOX(sae_info->animations_combo_box), direction);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->animations_combo_box), direction);
was_direction = TRUE;
}
list = list->next;
@@ -376,10 +373,10 @@ void set_up_imageset_by_name(const gchar *name, SAEInfo *sae_info) {
GList *list = g_list_find_custom(sae_info->imagesets,
xml_attr_new("name", name),
- xml_node_compare_with_attr_func);
+ (GCompareFunc)xml_node_compare_with_attr_func);
if (list == NULL)
- return FALSE;
+ return;
XMLNode *node = list->data;
if (node == NULL)
@@ -470,7 +467,7 @@ void parse_xml_text(gchar *text, SAEInfo *sae_info) {
file_attr = g_strjoin(NULL, paths->sprites, file_attr, NULL);
gchar *buf;
if (g_file_get_contents(file_attr, &buf, NULL, NULL))
- g_list_concat(_root_node->sub_nodes, ibus_xml_parse_buffer(buf)->sub_nodes);
+ _root_node->sub_nodes = g_list_concat(_root_node->sub_nodes, ibus_xml_parse_buffer(buf)->sub_nodes);
}
if (list->next != NULL)
list = g_list_find_custom(list->next, "include", xml_node_compare_with_name_func);
diff --git a/saedit/sae.c b/saedit/sae.c
index 736e90d..0501269 100644
--- a/saedit/sae.c
+++ b/saedit/sae.c
@@ -59,7 +59,7 @@ gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction
GList *list = g_list_find_custom(sae_info->animations,
xml_attr_new("direction", direction),
- xml_node_compare_with_attr_func);
+ (GCompareFunc)xml_node_compare_with_attr_func);
if (list == NULL)
return FALSE;
int count = 0;
@@ -115,7 +115,7 @@ gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction
sprite->pixbuf = get_sprite_by_index(i, sae_info);
count++;
if (sae_info->animation != NULL)
- g_list_append(sae_info->animation, sprite);
+ sae_info->animation = g_list_append(sae_info->animation, sprite);
else {
sae_info->animation = g_list_alloc();
sae_info->animation->data = sprite;
diff --git a/saedit/search.c b/saedit/search.c
index 245b006..d156523 100644
--- a/saedit/search.c
+++ b/saedit/search.c
@@ -100,5 +100,5 @@ void search_find_dialog_show(GtkWindow *parent,
search_text_view = text_view;
- gtk_dialog_run(dialog);
+ gtk_dialog_run(GTK_DIALOG(dialog));
}
diff --git a/saedit/xml.c b/saedit/xml.c
index 2968082..715a208 100644
--- a/saedit/xml.c
+++ b/saedit/xml.c
@@ -11,14 +11,14 @@
#include "xml.h"
-gchar **xml_attr_new(gchar *name, gchar *value) {
+gchar **xml_attr_new(const gchar *name, const gchar *value) {
gchar **attr = g_new0(gchar*, 2);
- attr[0] = name;
- attr[1] = value;
+ attr[0] = g_strdup(name);
+ attr[1] = g_strdup(value);
return attr;
}
-gchar* xml_node_get_attr_value(XMLNode *node, gchar *attr_name) {
+gchar* xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name) {
gchar **attr = node->attributes;
int i;
for (i = 0; i < g_strv_length(attr); i += 2)
diff --git a/saedit/xml.h b/saedit/xml.h
index 4c02ce9..cf76795 100644
--- a/saedit/xml.h
+++ b/saedit/xml.h
@@ -15,8 +15,8 @@
#include <ibus.h>
#include "common.h"
-gchar **xml_attr_new(gchar *name, gchar *value);
-gchar *xml_node_get_attr_value(XMLNode *node, gchar *attr_name);
+gchar **xml_attr_new(const gchar *name, const gchar *value);
+gchar *xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name);
gint xml_node_compare_with_name_func(gconstpointer a, gconstpointer b);
gint xml_node_compare_with_action_node_by_imageset_name_func(gconstpointer a, gconstpointer b);
gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr);