diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-01 00:30:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-01 00:30:08 +0300 |
commit | f80240bc068a2ece54fd629fd90e09912415b27c (patch) | |
tree | d0b4c695bfa618a93e3436980e12c6f794230b77 /saedit | |
parent | 36e5c2a02596020c0f261b0d8222e254009cb040 (diff) | |
download | evol-tools-f80240bc068a2ece54fd629fd90e09912415b27c.tar.gz evol-tools-f80240bc068a2ece54fd629fd90e09912415b27c.tar.bz2 evol-tools-f80240bc068a2ece54fd629fd90e09912415b27c.tar.xz evol-tools-f80240bc068a2ece54fd629fd90e09912415b27c.zip |
SAE: Add make script with additional warning flags.
Fix simple code issues.
Diffstat (limited to 'saedit')
-rwxr-xr-x | saedit/bmake | 28 | ||||
-rw-r--r-- | saedit/config.c | 4 | ||||
-rw-r--r-- | saedit/config.h | 3 | ||||
-rw-r--r-- | saedit/main.c | 13 | ||||
-rw-r--r-- | saedit/sae.c | 27 | ||||
-rw-r--r-- | saedit/search.c | 1 | ||||
-rw-r--r-- | saedit/xml.c | 26 |
7 files changed, 68 insertions, 34 deletions
diff --git a/saedit/bmake b/saedit/bmake new file mode 100755 index 0000000..a1ecd7f --- /dev/null +++ b/saedit/bmake @@ -0,0 +1,28 @@ +#!/bin/sh + +dir=`pwd` + +export LANG=C + +make clean + +#export CFLAGS="-std=c99 -Wvariadic-macros -Wvla -Wredundant-decls + +export CFLAGS="-std=gnu99 -Wvariadic-macros -Wvla -Wredundant-decls \ +-Wpacked-bitfield-compat -Wtrampolines \ +-Wsuggest-attribute=noreturn -Wstrict-aliasing=2 \ +-fstrict-aliasing -Wunreachable-code -Wabi -Wdisabled-optimization \ +-Wvolatile-register-var -Winvalid-pch -Wredundant-decls \ +-Wnormalized=nfkc -Wmissing-format-attribute -Wmissing-noreturn \ +-Wswitch-default -Waddress \ +-Wlogical-op -Wcast-align -Wpointer-arith -Wundef \ +-Wmissing-include-dirs -Winit-self -pedantic -Wall -ggdb3 -O2 -pipe \ +-Wpacked -Wstrict-overflow=1 -Wunknown-pragmas -Wwrite-strings \ +-Wstack-protector -Wshadow -Wunused-macros \ +-Wbuiltin-macro-redefined -Wdeprecated \ +-Wendif-labels -Wformat=1 -Wimport -Wpsabi \ +-Wmissing-field-initializers -Wuninitialized \ +-Wignored-qualifiers -Winit-self -Wempty-body -Wclobbered -Wtype-limits \ +-Wsign-compare -Wwrite-strings" + +make 2>make.log diff --git a/saedit/config.c b/saedit/config.c index 303db6d..67bb63d 100644 --- a/saedit/config.c +++ b/saedit/config.c @@ -37,13 +37,13 @@ void config_options_load_from_file(Options *options, } } - if (options->sprites == NULL) options->sprites = OPTION_SPRITES_DEFAULT; + if (options->sprites == NULL) options->sprites = (gchar *)OPTION_SPRITES_DEFAULT; options->sprites = g_strjoin(SEPARATOR_SLASH, data_folder, options->sprites, NULL); } Keys *config_keys_new() { Keys *keys = g_new0(Keys, 1); - keys->clientdata_folder = KEY_CLIENTDATA_FOLDER_DEFAULT; + keys->clientdata_folder = (gchar *)KEY_CLIENTDATA_FOLDER_DEFAULT; keys->show_grid = KEY_SHOW_GRID_DEFAULT; return keys; } diff --git a/saedit/config.h b/saedit/config.h index 51c2f0b..ca43eed 100644 --- a/saedit/config.h +++ b/saedit/config.h @@ -13,10 +13,13 @@ #define CONFIG_H #include <glib.h> +#include <glib/gstdio.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> +#include <unistd.h> #include "common.h" #include "xml.h" diff --git a/saedit/main.c b/saedit/main.c index 7b74f07..d0ce20a 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -84,7 +84,7 @@ gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info) { //Common functions gchar *markup_bold(gchar *str) { - return g_strconcat("<b>", str, "</b>"); + return g_strconcat("<b>", str, "</b>", NULL); } void format_src_string(gchar *src) { @@ -208,9 +208,9 @@ void imagesets_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user set_up_imageset_by_name(gtk_combo_box_text_get_active_text(widget), gen_sae_info); } -gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int index) { +gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int idx) { gchar buf[10]; - gint len = g_sprintf(buf, "%d", index); + gint len = g_sprintf(buf, "%d", idx); gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(source_buffer), buf, len); return FALSE; } @@ -292,7 +292,7 @@ void show_imageset_dialog() { hbox = gtk_hbox_new(TRUE, 2); gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 2); for (x = 0; x < w; x++) { - int id = w * y + x; + unsigned long int id = w * y + x; event_box = gtk_event_box_new(); g_signal_connect(G_OBJECT(event_box), "button-press-event", G_CALLBACK(frame_image_button_press_event_callback), (gpointer)id); gtk_box_pack_start(GTK_BOX(hbox), event_box, TRUE, TRUE, 0); @@ -307,8 +307,8 @@ void show_imageset_dialog() { //Main functions -void set_sprite_by_index(size_t index, SAEInfo *sae_info) { - sae_info->sprite->pixbuf = get_sprite_by_index(index, sae_info); +void set_sprite_by_index(size_t idx, SAEInfo *sae_info) { + sae_info->sprite->pixbuf = get_sprite_by_index(idx, sae_info); gtk_widget_queue_draw(darea); } @@ -397,6 +397,7 @@ gboolean show_general_animation(SAEInfo *sae_info) { if (node == NULL) return FALSE; animations_combo_box_changed_callback(NULL, NULL); + return TRUE; } gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info) { diff --git a/saedit/sae.c b/saedit/sae.c index 3d42858..4f22cf2 100644 --- a/saedit/sae.c +++ b/saedit/sae.c @@ -16,9 +16,9 @@ void kill_timeout(guint tag) { g_source_remove(tag); } -Frame *frame_new(int index, int offsetX, int offsetY, int delay) { +Frame *frame_new(int index1, int offsetX, int offsetY, int delay) { Frame *res = g_new0(Frame, 1); - res->index = index; + res->index = index1; res->offsetX = offsetX; res->offsetY = offsetY; res->delay = delay; @@ -46,9 +46,9 @@ GdkPixbuf *sae_info_ground_new() { return ground; } -GdkPixbuf* get_sprite_by_index(size_t index, SAEInfo *sae_info) { - - if (index == -1) { +GdkPixbuf* get_sprite_by_index(size_t index1, SAEInfo *sae_info) { + // error because index1 is unsigned + if (index1 == -1) { GdkPixbuf *res = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, sae_info->imageset->width, sae_info->imageset->height); @@ -56,13 +56,14 @@ GdkPixbuf* get_sprite_by_index(size_t index, SAEInfo *sae_info) { return res; } - if (index >= 0) { + // error because index1 is unsigned + if (index1 >= 0) { size_t w = sae_info->imageset->spriteset_width/sae_info->imageset->width; if (sae_info->imageset->spriteset == NULL) return NULL; return gdk_pixbuf_new_subpixbuf(sae_info->imageset->spriteset, - index%w*sae_info->imageset->width, - index/w*sae_info->imageset->height, + index1%w*sae_info->imageset->width, + index1/w*sae_info->imageset->height, sae_info->imageset->width, sae_info->imageset->height); } @@ -70,11 +71,11 @@ GdkPixbuf* get_sprite_by_index(size_t index, SAEInfo *sae_info) { return NULL; } -inline void _add_frame(SAEInfo *sae_info, size_t index, size_t offsetX, size_t offsetY, size_t delay, size_t line) { +inline void _add_frame(SAEInfo *sae_info, size_t index1, size_t offsetX, size_t offsetY, size_t delay, size_t line) { - Frame *sprite = frame_new(index, offsetX, offsetY, delay); + Frame *sprite = frame_new(index1, offsetX, offsetY, delay); sprite->line_number = line; - sprite->pixbuf = get_sprite_by_index(index, sae_info); + sprite->pixbuf = get_sprite_by_index(index1, sae_info); if (sae_info->animation != NULL) sae_info->animation = g_list_append(sae_info->animation, sprite); @@ -147,7 +148,7 @@ gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction } else if (g_str_equal(node->name, "pause")) { - value = "p"; + value = (gchar *)"p"; gchar *repeat_attr = xml_node_get_attr_value(node, "repeat"); if (repeat_attr != NULL) @@ -180,7 +181,7 @@ gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction } else { - int f, s; + unsigned f, s; if (sscanf(*iter, "%u-%u", &f, &s) == 2) { diff --git a/saedit/search.c b/saedit/search.c index e8d4097..df2970e 100644 --- a/saedit/search.c +++ b/saedit/search.c @@ -49,6 +49,7 @@ gboolean search_find_text(gchar *text) { gboolean search_find_next() { if (search_last_text != NULL) search_find_text(search_last_text); + // here must return some thing } void search_find_dialog_response_callback(GtkWidget *dialog, diff --git a/saedit/xml.c b/saedit/xml.c index 7cf0968..6ead8fe 100644 --- a/saedit/xml.c +++ b/saedit/xml.c @@ -20,7 +20,7 @@ gchar** xml_attr_new(const gchar *name, const gchar *value) { gchar* xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name) { gchar **attr = node->attributes; - int i; + guint i; for (i = 0; i < g_strv_length(attr); i += 2) if (g_str_equal(attr[i], attr_name)) return attr[i + 1]; @@ -144,11 +144,11 @@ static void _start_root_element_cb ( GMarkupParseContext *context, GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); while (*attribute_names != NULL && *attribute_values != NULL) { - gchar *p; - p = g_strdup (*attribute_names++); - g_array_append_val (attributes, p); - p = g_strdup (*attribute_values++); - g_array_append_val (attributes, p); + gchar *p2; + p2 = g_strdup (*attribute_names++); + g_array_append_val (attributes, p2); + p2 = g_strdup (*attribute_values++); + g_array_append_val (attributes, p2); } p->attributes = (gchar **) g_array_free (attributes, FALSE); @@ -181,11 +181,11 @@ static void _start_element_cb ( GMarkupParseContext *context, GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); while (*attribute_names != NULL && *attribute_values != NULL) { - gchar *p; - p = g_strdup (*attribute_names++); - g_array_append_val (attributes, p); - p = g_strdup (*attribute_values++); - g_array_append_val (attributes, p); + gchar *p2; + p2 = g_strdup (*attribute_names++); + g_array_append_val (attributes, p2); + p2 = g_strdup (*attribute_values++); + g_array_append_val (attributes, p2); } p->attributes = (gchar **)g_array_free (attributes, FALSE); @@ -266,7 +266,7 @@ XMLNode *xml_parse_file (const gchar *filename) { GMarkupParseContext *context; XMLNode *node; - const static GMarkupParser root_parser = { + static const GMarkupParser root_parser = { _start_root_element_cb, _end_element_cb, _text_cb, @@ -313,7 +313,7 @@ XMLNode *xml_parse_buffer (const gchar *buffer, GError **error) { GMarkupParseContext *context; XMLNode *node; - const static GMarkupParser root_parser = { + static const GMarkupParser root_parser = { _start_root_element_cb, _end_element_cb, _text_cb, |