reduce number of warnings with -Wall -Wextra.

there are still some shadow cases to be fixed and some parameters I've
left unused since it seems like a bug in the API or code.



SVN revision: 72302
devs/lucas/wip
Gustavo Sverzut Barbieri 10 years ago
parent 3ecf32e825
commit 3fe325aad5
  1. 1
      configure.ac
  2. 47
      m4/ac_attribute.m4
  3. 14
      src/bin/main.c
  4. 49
      src/bin/media.c
  5. 16
      src/bin/options.c
  6. 8
      src/bin/options_behavior.c
  7. 18
      src/bin/options_font.c
  8. 9
      src/bin/options_video.c
  9. 25
      src/bin/termio.c
  10. 7
      src/bin/termpty.c

@ -16,6 +16,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_C___ATTRIBUTE__
requirements="\
elementary >= 1.0.99 \

@ -0,0 +1,47 @@
dnl Copyright (C) 2004-2008 Kim Woelders
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
dnl That code is public domain and can be freely used or copied.
dnl Originally snatched from somewhere...
dnl Macro for checking if the compiler supports __attribute__
dnl Usage: AC_C___ATTRIBUTE__
dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__
dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is
dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused))
dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is
dnl defined to nothing.
AC_DEFUN([AC_C___ATTRIBUTE__],
[
AC_MSG_CHECKING([for __attribute__])
AC_CACHE_VAL([ac_cv___attribute__],
[AC_TRY_COMPILE(
[
#include <stdlib.h>
int func(int x);
int foo(int x __attribute__ ((unused)))
{
exit(1);
}
],
[],
[ac_cv___attribute__="yes"],
[ac_cv___attribute__="no"]
)])
AC_MSG_RESULT($ac_cv___attribute__)
if test "x${ac_cv___attribute__}" = "xyes" ; then
AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__])
AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused])
else
AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused])
fi
])
dnl End of ac_attribute.m4

@ -15,14 +15,14 @@ static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL;
static Ecore_Timer *flush_timer = NULL;
static void
_cb_focus_in(void *data, Evas_Object *obj, void *event)
_cb_focus_in(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
edje_object_signal_emit(bg, "focus,in", "terminology");
elm_object_focus_set(data, EINA_TRUE);
}
static void
_cb_focus_out(void *data, Evas_Object *obj, void *event)
_cb_focus_out(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
edje_object_signal_emit(bg, "focus,out", "terminology");
elm_object_focus_set(data, EINA_FALSE);
@ -30,7 +30,7 @@ _cb_focus_out(void *data, Evas_Object *obj, void *event)
}
static void
_cb_size_hint(void *data, Evas *e, Evas_Object *obj, void *event)
_cb_size_hint(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Coord mw, mh, rw, rh, w = 0, h = 0;
@ -49,13 +49,13 @@ _cb_size_hint(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_cb_options(void *data, Evas_Object *obj, void *event)
_cb_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
options_toggle(win, bg, term);
}
static Eina_Bool
_cb_flush(void *data)
_cb_flush(void *data __UNUSED__)
{
flush_timer = NULL;
elm_cache_all_flush();
@ -63,7 +63,7 @@ _cb_flush(void *data)
}
static void
_cb_change(void *data, Evas_Object *obj, void *event)
_cb_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
if (!flush_timer) flush_timer = ecore_timer_add(0.25, _cb_flush, NULL);
else ecore_timer_delay(flush_timer, 0.25);
@ -227,7 +227,7 @@ elm_main(int argc, char **argv)
if (video_module)
{
int i;
for (i = 0; i < EINA_C_ARRAY_LENGTH(emotion_choices); i++)
for (i = 0; i < (int)EINA_C_ARRAY_LENGTH(emotion_choices); i++)
{
if (video_module == emotion_choices[i])
break;

@ -73,7 +73,7 @@ _is_fmt(const char *f, const char **extn)
//////////////////////// img
static void
_cb_img_preloaded(void *data, Evas *e, Evas_Object *obj, void *event)
_cb_img_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -160,7 +160,7 @@ _type_img_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_
//////////////////////// scalable img
static void
_cb_scale_preloaded(void *data, Evas *e, Evas_Object *obj, void *event)
_cb_scale_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -243,7 +243,7 @@ _type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Eva
//////////////////////// edj
static void
_cb_edje_preloaded(void *data, Evas_Object *obj, const char *sig, const char *src)
_cb_edje_preloaded(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *src __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -292,7 +292,7 @@ _type_edje_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas
static void _type_mov_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
static void
_cb_mov_frame_decode(void *data, Evas_Object *obj, void *event)
_cb_mov_frame_decode(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
Evas_Coord ox, oy, ow, oh;
@ -304,7 +304,7 @@ _cb_mov_frame_decode(void *data, Evas_Object *obj, void *event)
}
static void
_cb_mov_frame_resize(void *data, Evas_Object *obj, void *event)
_cb_mov_frame_resize(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
Evas_Coord ox, oy, ow, oh;
@ -315,7 +315,7 @@ _cb_mov_frame_resize(void *data, Evas_Object *obj, void *event)
}
static void
_cb_mov_len_change(void *data, Evas_Object *obj, void *event)
_cb_mov_len_change(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -332,7 +332,7 @@ _cb_mov_restart(void *data)
}
static void
_cb_mov_decode_stop(void *data, Evas_Object *obj, void *event)
_cb_mov_decode_stop(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -341,7 +341,7 @@ _cb_mov_decode_stop(void *data, Evas_Object *obj, void *event)
}
static void
_cb_mov_progress(void *data, Evas_Object *obj, void *event)
_cb_mov_progress(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -351,7 +351,7 @@ _cb_mov_progress(void *data, Evas_Object *obj, void *event)
}
static void
_cb_mov_ref(void *data, Evas_Object *obj, void *event)
_cb_mov_ref(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
@ -379,7 +379,7 @@ _type_mov_init(Evas_Object *obj)
emotion_init();
o = sd->o_img = emotion_object_add(evas_object_evas_get(obj));
if ((config->vidmod >= 0) &&
(config->vidmod < (sizeof(modules) / sizeof(modules[0]))))
(config->vidmod < (int)EINA_C_ARRAY_LENGTH(modules)))
mod = modules[config->vidmod];
if (!emotion_object_init(o, mod))
{
@ -453,8 +453,7 @@ _smart_add(Evas_Object *obj)
Media *sd;
Evas_Object_Smart_Clipped_Data *cd;
Evas_Object *o;
char buf[4096];
_meida_sc.add(obj);
cd = evas_object_smart_data_get(obj);
if (!cd) return;
@ -514,7 +513,7 @@ _smart_calculate(Evas_Object *obj)
}
static void
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
_smart_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
{
Media *sd = evas_object_smart_data_get(obj);
if (!sd) return;
@ -556,10 +555,26 @@ media_add(Evas_Object *parent, const char *src, int mode, int *type)
sd->src = eina_stringshare_add(src);
sd->mode = mode;
if (_is_fmt(src, extn_img)) _type_img_init(obj);
else if (_is_fmt(src, extn_scale)) _type_scale_init(obj);
else if (_is_fmt(src, extn_edj)) _type_edje_init(obj);
else if (_is_fmt(src, extn_mov)) _type_mov_init(obj);
if (_is_fmt(src, extn_img))
{
_type_img_init(obj);
if (type) *type = TYPE_IMG;
}
else if (_is_fmt(src, extn_scale))
{
_type_scale_init(obj);
if (type) *type = TYPE_SCALE;
}
else if (_is_fmt(src, extn_edj))
{
_type_edje_init(obj);
if (type) *type = TYPE_EDJE;
}
else if (_is_fmt(src, extn_mov))
{
_type_mov_init(obj);
if (type) *type = TYPE_MOV;
}
return obj;
}

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h>
#include "options.h"
#include "options_font.h"
@ -11,48 +13,48 @@ static Eina_Bool op_out = EINA_FALSE;
static Ecore_Timer *op_del_timer = NULL;
static void
_cb_op_font(void *data, Evas_Object *obj, void *event)
_cb_op_font(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_box_clear(op_opbox);
options_font(op_opbox, data);
}
static void
_cb_op_theme(void *data, Evas_Object *obj, void *event)
_cb_op_theme(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_box_clear(op_opbox);
// XXX: not done yet
}
static void
_cb_op_wallpaper(void *data, Evas_Object *obj, void *event)
_cb_op_wallpaper(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_box_clear(op_opbox);
// XXX: not done yet
}
static void
_cb_op_video(void *data, Evas_Object *obj, void *event)
_cb_op_video(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_box_clear(op_opbox);
options_video(op_opbox, data);
}
static void
_cb_op_behavior(void *data, Evas_Object *obj, void *event)
_cb_op_behavior(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
elm_box_clear(op_opbox);
options_behavior(op_opbox, data);
}
static void
_cb_op_tmp_chg(void *data, Evas_Object *obj, void *event)
_cb_op_tmp_chg(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
config_tmp = elm_check_state_get(obj);
}
static Eina_Bool
_cb_op_del_delay(void *data)
_cb_op_del_delay(void *data __UNUSED__)
{
evas_object_del(op_frame);
options_font_clear();

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h>
#include "config.h"
#include "termio.h"
@ -8,7 +10,7 @@
static Evas_Object *op_sbslider, *op_jumpcheck, *op_wordsep;
static void
_cb_op_behavior_jump_chg(void *data, Evas_Object *obj, void *event)
_cb_op_behavior_jump_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
{
config->jump_on_change = elm_check_state_get(obj);
termio_config_update(data);
@ -16,7 +18,7 @@ _cb_op_behavior_jump_chg(void *data, Evas_Object *obj, void *event)
}
static void
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event)
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
{
char *txt;
@ -36,7 +38,7 @@ _cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event)
}
static void
_cb_op_behavior_sback_chg(void *data, Evas_Object *obj, void *event)
_cb_op_behavior_sback_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
{
config->scrollback = elm_slider_value_get(obj) + 0.5;
termio_config_update(data);

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h>
#include "config.h"
#include "termio.h"
@ -36,7 +38,7 @@ _update_sizing(Evas_Object *term)
}
static void
_cb_op_font_sel(void *data, Evas_Object *obj, void *event)
_cb_op_font_sel(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Font *f = data;
if ((config->font.name) && (!strcmp(f->name, config->font.name)))
@ -49,7 +51,7 @@ _cb_op_font_sel(void *data, Evas_Object *obj, void *event)
}
static void
_cb_op_fontsize_sel(void *data, Evas_Object *obj, void *event)
_cb_op_fontsize_sel(void *data, Evas_Object *obj, void *event __UNUSED__)
{
int size = elm_slider_value_get(obj) + 0.5;
@ -67,7 +69,7 @@ _cb_op_font_sort(const void *d1, const void *d2)
}
static void
_cb_op_font_preview_del(void *data, Evas *e, Evas_Object *obj, void *event)
_cb_op_font_preview_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Object *o;
@ -76,7 +78,7 @@ _cb_op_font_preview_del(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_cb_op_font_preview_eval(void *data, Evas *e, Evas_Object *obj, void *event)
_cb_op_font_preview_eval(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
Font *f = data;
Evas_Object *o;
@ -143,12 +145,12 @@ _cb_op_font_content_get(void *data, Evas_Object *obj, const char *part)
}
static char *
_cb_op_font_text_get(void *data, Evas_Object *obj, const char *part)
_cb_op_font_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
Font *f = data;
char buf[4096], *p;
snprintf(buf, sizeof(buf), "%s", f->name);
eina_strlcpy(buf, f->name, sizeof(buf));
buf[0] = toupper(buf[0]);
p = strrchr(buf, '.');
if (p) *p = 0;
@ -156,7 +158,7 @@ _cb_op_font_text_get(void *data, Evas_Object *obj, const char *part)
}
static char *
_cb_op_font_group_text_get(void *data, Evas_Object *obj, const char *part)
_cb_op_font_group_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
return strdup(data);
}

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h>
#include "config.h"
#include "termio.h"
@ -8,7 +10,7 @@
static Evas_Object *op_trans, *op_mute, *op_vidmod;
static void
_cb_op_video_trans_chg(void *data, Evas_Object *obj, void *event)
_cb_op_video_trans_chg(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
config->translucent = elm_check_state_get(obj);
main_trans_update();
@ -16,7 +18,7 @@ _cb_op_video_trans_chg(void *data, Evas_Object *obj, void *event)
}
static void
_cb_op_video_mute_chg(void *data, Evas_Object *obj, void *event)
_cb_op_video_mute_chg(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
config->mute = elm_check_state_get(obj);
main_media_mute_update();
@ -24,7 +26,7 @@ _cb_op_video_mute_chg(void *data, Evas_Object *obj, void *event)
}
static void
_cb_op_video_vidmod_chg(void *data, Evas_Object *obj, void *event)
_cb_op_video_vidmod_chg(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
int v = elm_radio_value_get(obj);
if (v == config->vidmod) return;
@ -37,7 +39,6 @@ void
options_video(Evas_Object *opbox, Evas_Object *term)
{
Evas_Object *o;
char *txt;
op_trans = o = elm_check_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);

@ -1,3 +1,5 @@
#include "private.h"
#include <Elementary.h>
#include "termio.h"
#include "termpty.h"
@ -48,8 +50,7 @@ _smart_apply(Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
Evas_Coord ox, oy, ow, oh;
char txt[8];
int i, j, x, y, w, ch1, ch2;
int j, x, y, w, ch1, ch2;
if (!sd) return;
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
@ -337,7 +338,7 @@ _take_selection(Evas_Object *obj)
}
static Eina_Bool
_getsel_cb(void *data, Evas_Object *obj, Elm_Selection_Data *ev)
_getsel_cb(void *data, Evas_Object *obj __UNUSED__, Elm_Selection_Data *ev)
{
Termio *sd = evas_object_smart_data_get(data);
if (!sd) return EINA_FALSE;
@ -361,7 +362,7 @@ _paste_selection(Evas_Object *obj)
}
void
_smart_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event)
{
Evas_Event_Key_Down *ev = event;
Termio *sd;
@ -403,7 +404,7 @@ _smart_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
}
void
_smart_cb_focus_in(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Termio *sd;
@ -415,7 +416,7 @@ _smart_cb_focus_in(void *data, Evas *e, Evas_Object *obj, void *event)
}
void
_smart_cb_focus_out(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Termio *sd;
@ -512,7 +513,7 @@ _sel_word(Evas_Object *obj, int cx, int cy)
}
static void
_smart_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
{
Evas_Event_Mouse_Down *ev = event;
Termio *sd;
@ -552,7 +553,7 @@ _smart_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_smart_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
{
Evas_Event_Mouse_Up *ev = event;
Termio *sd;
@ -576,7 +577,7 @@ _smart_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_smart_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
{
Evas_Event_Mouse_Move *ev = event;
Termio *sd;
@ -601,7 +602,7 @@ _smart_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_smart_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event)
_smart_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
{
Evas_Event_Mouse_Wheel *ev = event;
Termio *sd;
@ -618,7 +619,7 @@ _smart_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event)
}
static void
_win_obj_del(void *data, Evas *e, Evas_Object *obj, void *event)
_win_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
{
Termio *sd;
@ -811,7 +812,7 @@ _smart_calculate(Evas_Object *obj)
}
static void
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
_smart_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
{
Termio *sd = evas_object_smart_data_get(obj);
if (!sd) return;

@ -1312,7 +1312,7 @@ _pty_size(Termpty *ty)
}
static Eina_Bool
_cb_exe_exit(void *data, int type, void *event)
_cb_exe_exit(void *data, int type __UNUSED__, void *event)
{
Ecore_Exe_Event_Del *ev = event;
Termpty *ty = data;
@ -1324,7 +1324,7 @@ _cb_exe_exit(void *data, int type, void *event)
}
static Eina_Bool
_cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
_cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Termpty *ty = data;
char buf[4097];
@ -1568,8 +1568,7 @@ void
termpty_backscroll_set(Termpty *ty, int size)
{
int i;
Termsave *tso;
if (ty->backmax == size) return;
if (ty->back)

Loading…
Cancel
Save