Read about our upcoming Code of Conduct on this issue

Commit 35544b69 authored by a1ex's avatar a1ex
Browse files

Removed most compiler warnings

--HG--
branch : 550d
parent 2d84bc2de1c6
......@@ -141,6 +141,7 @@ CFLAGS=\
-Wno-unused-parameter \
-Wno-implicit-function-declaration \
-Wno-unused-function \
-Wno-format \
-D__ARM__ \
ifeq ($(CONFIG_PYMITE),y)
......
......@@ -28,6 +28,10 @@
#include "menu.h"
#include "gui.h"
void audio_configure(int force);
void volume_display();
void volume_display_clear();
// Dump the audio registers to a file if defined
#undef CONFIG_AUDIO_REG_LOG
......@@ -328,7 +332,7 @@ int audio_meters_are_drawn()
* before drawing.
*/
static void
meter_task( void )
meter_task( void* unused )
{
while(1)
{
......@@ -359,10 +363,10 @@ TASK_CREATE( "meter_task", meter_task, 0, 0x18, 0x1000 );
/** Monitor the audio levels very quickly */
static void
compute_audio_level_task( void )
compute_audio_level_task( void* unused )
{
audio_levels[0].peak = audio_levels[1].peak = 0;
audio_levels[1].avg = audio_levels[1].avg = 0;
audio_levels[0].avg = audio_levels[1].avg = 0;
while(1)
{
......@@ -933,7 +937,7 @@ audio_monitoring_display( void * priv, int x, int y, int selected )
static void
audio_micpower_display( void * priv, int x, int y, int selected )
{
int mic_pow = get_mic_power(get_input_source());
unsigned int mic_pow = get_mic_power(get_input_source());
bmp_printf(
selected ? MENU_FONT_SEL : MENU_FONT,
x, y,
......@@ -1107,13 +1111,15 @@ PROP_HANDLER( PROP_MVR_REC_START )
return prop_cleanup( token, property );
}
void sounddev_task();
/** Replace the sound dev task with our own to disable AGC.
*
* This task disables the AGC when the sound device is activated.
*/
void
my_sounddev_task( int some_param )
my_sounddev_task()
{
msleep( 2000 );
if (magic_is_off()) { sounddev_task(); return; }
......@@ -1265,6 +1271,19 @@ my_audio_level_task( void )
TASK_OVERRIDE( audio_level_task, my_audio_level_task );
#endif
void volume_display_schedule()
{
show_volume = 10;
}
void volume_display()
{
int mgain_db = mgain_index2gain(mgain);
bmp_printf(FONT_MED, 50, 40, "Vol: %d + (%d,%d) dB ", mgain_db, dgain_l, dgain_r);
}
void volume_display_clear()
{
bmp_printf(FONT(FONT_MED,COLOR_WHITE,0), 50, 40, " ");
}
void volume_up()
{
......@@ -1295,17 +1314,3 @@ void volume_down()
audio_mgain_toggle_reverse(&mgain);
volume_display_schedule();
}
void volume_display_schedule()
{
show_volume = 10;
}
void volume_display()
{
int mgain_db = mgain_index2gain(mgain);
bmp_printf(FONT_MED, 50, 40, "Vol: %d + (%d,%d) dB ", mgain_db, dgain_l, dgain_r);
}
void volume_display_clear()
{
bmp_printf(FONT(FONT_MED,COLOR_WHITE,0), 50, 40, " ");
}
......@@ -22,7 +22,7 @@ int timecode_y = 0;
int timecode_width = 160;
int timecode_height = 20;
int timecode_warning = 120;
static unsigned timecode_font = FONT(FONT_MED, COLOR_RED, COLOR_BG );
static int timecode_font = FONT(FONT_MED, COLOR_RED, COLOR_BG );
int measured_bitrate = 0; // mbps
int free_space_32k = 0;
......@@ -60,15 +60,15 @@ void opt_set(int num, int den)
{
for (j = 0; j < MOV_OPT_NUM_PARAMS; j++)
{
int* opt0 = &(mvr_config_copy.fullhd_30fps_opt_size_I) + i * MOV_OPT_STEP + j;
int* opt = &(mvr_config.fullhd_30fps_opt_size_I) + i * MOV_OPT_STEP + j;
int* opt0 = (int*) &(mvr_config_copy.fullhd_30fps_opt_size_I) + i * MOV_OPT_STEP + j;
int* opt = (int*) &(mvr_config.fullhd_30fps_opt_size_I) + i * MOV_OPT_STEP + j;
if (*opt0 < 10000) { bmp_printf(FONT_LARGE, 0, 50, "opt_set: err!"); return; }
(*opt) = (*opt0) * num / den;
}
for (j = 0; j < MOV_GOP_OPT_NUM_PARAMS; j++)
{
int* opt0 = &(mvr_config_copy.fullhd_30fps_gop_opt_0) + i * MOV_OPT_STEP + j;
int* opt = &(mvr_config.fullhd_30fps_gop_opt_0) + i * MOV_OPT_STEP + j;
int* opt0 = (int*) &(mvr_config_copy.fullhd_30fps_gop_opt_0) + i * MOV_OPT_STEP + j;
int* opt = (int*) &(mvr_config.fullhd_30fps_gop_opt_0) + i * MOV_OPT_STEP + j;
if (*opt0 < 10000) { bmp_printf(FONT_LARGE, 0, 50, "opt_set: err!"); return; }
(*opt) = (*opt0) * num / den;
}
......@@ -96,7 +96,7 @@ void bitrate_set()
{
vbr_fix(1);
opt_set(1,1);
int q = qscale;
int16_t q = qscale;
mvrSetDefQScale(&q);
}
bitrate_dirty = 1;
......@@ -294,7 +294,7 @@ int is_mvr_buffer_almost_full()
if (recording == 1) return 1;
// 2
int ans = MVR_BUFFER_USAGE > buffer_warning_level;
int ans = MVR_BUFFER_USAGE > (int)buffer_warning_level;
if (ans) warning = 10;
return warning;
}
......@@ -338,7 +338,7 @@ void bitrate_init()
INIT_FUNC(__FILE__, bitrate_init);
static void
bitrate_task( void )
bitrate_task( void* unused )
{
cbr_init();
......
......@@ -178,9 +178,9 @@ bmp_puts(
void
bmp_puts_w(
unsigned fontspec,
unsigned * x,
unsigned * y,
unsigned max_chars_per_line,
int * x,
int * y,
int max_chars_per_line,
const char * s
)
{
......@@ -188,7 +188,7 @@ bmp_puts_w(
uint8_t * vram = bmp_vram();
if( !vram || ((uintptr_t)vram & 1) == 1 )
return;
const unsigned initial_x = *x;
const int initial_x = *x;
uint8_t * first_row = vram + (*y) * pitch + (*x);
uint8_t * row = first_row;
......@@ -249,7 +249,7 @@ con_printf(
static int y = 32;
va_start( ap, fmt );
int len = vsnprintf( buf, sizeof(buf), fmt, ap );
vsnprintf( buf, sizeof(buf), fmt, ap );
va_end( ap );
const uint32_t pitch = BMPPITCH;
......@@ -550,8 +550,8 @@ void bmp_draw(struct bmp_file_t * bmp, int x0, int y0, uint8_t* const mirror, in
uint8_t * const bvram = bmp_vram();
if (!bvram) return;
x0 = COERCE(x0, 0, 960 - bmp->width);
y0 = COERCE(y0, 0, 540 - bmp->height);
x0 = COERCE(x0, 0, 960 - (int)bmp->width);
y0 = COERCE(y0, 0, 540 - (int)bmp->height);
if (x0 < 0) return;
if (x0 + bmp->width > 960) return;
if (y0 < 0) return;
......@@ -634,11 +634,11 @@ uint8_t bmp_getpixel(int x, int y)
uint8_t * const b_row = bvram + y * bmppitch;
return b_row[x];
}
uint8_t bmp_putpixel(int x, int y, uint8_t color)
void bmp_putpixel(int x, int y, uint8_t color)
{
//~ if (!bmp_enabled) return;
uint8_t * const bvram = bmp_vram();
if (!bvram) return 0;
if (!bvram) return;
int bmppitch = BMPPITCH;
x = COERCE(x, 0, 960);
y = COERCE(y, 0, 540);
......@@ -649,7 +649,7 @@ void bmp_draw_rect(uint8_t color, int x0, int y0, int w, int h)
{
//~ if (!bmp_enabled) return;
uint8_t * const bvram = bmp_vram();
if (!bvram) return 0;
if (!bvram) return;
int x, y;
#define P(X,Y) bvram[COERCE(X, 0, 960) + COERCE(Y, 0, 540) * BMPPITCH]
......@@ -730,13 +730,13 @@ void bmp_draw_scaled_ex(struct bmp_file_t * bmp, int x0, int y0, int xmax, int y
// quick sanity test
int bfnt_ok()
{
int* codes = BFNT_CHAR_CODES;
int* codes = (int*) BFNT_CHAR_CODES;
int i;
for (i = 0; i < 20; i++)
if (codes[i] != 0x20+i) return 0;
int* off = BFNT_BITMAP_OFFSET;
int* off = (int*) BFNT_BITMAP_OFFSET;
if (off[0] != 0) return 0;
for (i = 1; i < 20; i++)
......@@ -749,15 +749,15 @@ int bfnt_ok()
uint8_t* bfnt_find_char(int code)
{
int n = (BFNT_BITMAP_OFFSET - BFNT_CHAR_CODES) / 4;
int* codes = BFNT_CHAR_CODES;
int* off = BFNT_BITMAP_OFFSET;
int* codes = (int*) BFNT_CHAR_CODES;
int* off = (int*) BFNT_BITMAP_OFFSET;
if (code <= 'z') return BFNT_BITMAP_DATA + off[code - 0x20];
if (code <= 'z') return (uint8_t*) (BFNT_BITMAP_DATA + off[code - 0x20]);
int i;
for (i = 0; i < n; i++)
if (codes[i] == code)
return BFNT_BITMAP_DATA + off[i];
return (uint8_t*) (BFNT_BITMAP_DATA + off[i]);
return 0;
}
......@@ -770,17 +770,17 @@ int bfnt_draw_char(int c, int px, int py, int fg, int bg)
return 0;
}
uint16_t* chardata = bfnt_find_char(c);
uint16_t* chardata = (uint16_t*) bfnt_find_char(c);
if (!chardata) return 0;
uint8_t* buff = chardata + 5;
uint8_t* buff = (uint8_t*)(chardata + 5);
int ptr = 0;
unsigned int cw = chardata[0]; // the stored bitmap width
unsigned int ch = chardata[1]; // the stored bitmap height
unsigned int crw = chardata[2]; // the displayed character width
unsigned int xo = chardata[3]; // X offset for displaying the bitmap
unsigned int yo = chardata[4]; // Y offset for displaying the bitmap
unsigned int bb = cw / 8 + (cw % 8 == 0 ? 0 : 1); // calculate the byte number per line
int cw = chardata[0]; // the stored bitmap width
int ch = chardata[1]; // the stored bitmap height
int crw = chardata[2]; // the displayed character width
int xo = chardata[3]; // X offset for displaying the bitmap
int yo = chardata[4]; // Y offset for displaying the bitmap
int bb = cw / 8 + (cw % 8 == 0 ? 0 : 1); // calculate the byte number per line
//~ bmp_printf(FONT_SMALL, 0, 0, "%x %d %d %d %d %d %d", chardata, cw, ch, crw, xo, yo, bb);
......
......@@ -48,6 +48,6 @@
/** Compute the number of entries in a static array */
#define COUNT(x) (sizeof(x)/sizeof((x)[0]))
#define COUNT(x) ((int)(sizeof(x)/sizeof((x)[0])))
#endif
......@@ -111,7 +111,7 @@ parse_error:
msleep(2000);
//~ FreeMemory( cfg );
dumpf();
malloc_error:
//~ malloc_error:
return 0;
}
......
......@@ -114,6 +114,14 @@ void card_led_blink(int times, int delay_on, int delay_off)
int config_ok = 0;
void
config_autosave_toggle(void* priv)
{
config_flag_file_setting_save(CONFIG_AUTOSAVE_FLAG_FILE, !!config_autosave);
msleep(50);
config_autosave = !config_flag_file_setting_load(CONFIG_AUTOSAVE_FLAG_FILE);
}
static void
save_config( void * priv )
{
......@@ -142,14 +150,6 @@ config_autosave_display(
);
}
void
config_autosave_toggle(void* priv)
{
config_flag_file_setting_save(CONFIG_AUTOSAVE_FLAG_FILE, !!config_autosave);
msleep(50);
config_autosave = !config_flag_file_setting_load(CONFIG_AUTOSAVE_FLAG_FILE);
}
static int vmax(int* x, int n)
{
int i;
......@@ -173,6 +173,7 @@ void font_test(void* priv)
void xx_test(void* priv)
{
ChangeHDMIOutputSizeToVGA();
}
void toggle_mirror_display()
......@@ -389,12 +390,14 @@ void display_clock()
}
}
#if CONFIG_DEBUGMSG
static void dbg_draw_props(int changed);
static unsigned dbg_last_changed_propindex = 0;
#endif
int screenshot_sec = 0;
static void
debug_loop_task( void ) // screenshot, draw_prop
debug_loop_task( void * unused ) // screenshot, draw_prop
{
msleep(500);
int k;
......@@ -457,7 +460,7 @@ debug_loop_task( void ) // screenshot, draw_prop
}
}
static void screenshot_start(void)
static void screenshot_start(void* priv)
{
screenshot_sec = 10;
}
......@@ -503,7 +506,7 @@ PROP_HANDLER(PROP_ROLLING_PITCHING_LEVEL)
struct menu_entry debug_menus[] = {
{
.priv = "Draw palette",
.select = bmp_draw_palette,
.select = (void(*)(void*))bmp_draw_palette,
.display = menu_print,
.help = "Display a test pattern to see the color palette."
},
......@@ -762,16 +765,16 @@ CONFIG_INT( "debug.timed-dump", timed_dump, 0 );
CONFIG_INT( "magic.disable_bootdiskf", disable_bootdiskf, 0 );
struct bmp_file_t * logo = -1;
struct bmp_file_t * logo = (void*) -1;
void load_logo()
{
if (logo == -1)
if (logo == (void*) -1)
logo = bmp_load("B:/logo.bmp");
}
void show_logo()
{
load_logo();
if (logo > 0)
if ((int)logo > 0)
{
bmp_draw(logo, 360 - logo->width/2, 240 - logo->height/2, 0, 0);
}
......
......@@ -743,6 +743,8 @@ SIZE_CHECK_STRUCT( dryos_meminfo, 0xC );
extern void * malloc( size_t len );
extern void free( void * buf );
extern void * AllocateMemory( size_t len );
extern void FreeMemory( void * buf );
extern void * realloc( void * buf, size_t newlen );
......
......@@ -29,7 +29,7 @@ int get_follow_focus_dir_v() { return follow_focus_reverse_v ? -1 : 1; }
int get_follow_focus_dir_h() { return follow_focus_reverse_h ? -1 : 1; }
#define FOCUS_MAX 1700
static int focus_position;
//~ static int focus_position;
static struct semaphore * focus_stack_sem;
......@@ -148,7 +148,7 @@ focus_stack(
static void
focus_stack_task( void )
focus_stack_task( void* unused )
{
while(1)
{
......@@ -228,7 +228,7 @@ focus_toggle( void * priv )
give_semaphore( focus_task_sem );
}
unsigned rack_speed_values[] = {1,2,3,4,5,7,10,15,20,25,30,40,50,60,75,85,100,150,200,300,500,1000};
int rack_speed_values[] = {1,2,3,4,5,7,10,15,20,25,30,40,50,60,75,85,100,150,200,300,500,1000};
static void
focus_rack_speed_display(
......@@ -248,7 +248,7 @@ focus_rack_speed_display(
}
int current_speed_index(speed)
int current_speed_index(int speed)
{
int i;
for (i = 0; i < COUNT(rack_speed_values); i++)
......@@ -386,7 +386,7 @@ rack_focus(
static void
focus_task( void )
focus_task( void* unused )
{
while(1)
{
......@@ -775,7 +775,7 @@ void movie_af_noisefilter_bump(void* priv)
#endif
static void
focus_misc_task()
focus_misc_task(void* unused)
{
while(1)
{
......@@ -883,7 +883,7 @@ static struct menu_entry focus_menu[] = {
static void
focus_init( void )
focus_init( void* unused )
{
focus_stack_sem = create_named_semaphore( "focus_stack_sem", 0 );
focus_task_sem = create_named_semaphore( "focus_task_sem", 1 );
......
......@@ -37,7 +37,7 @@ void gui_unlock( void )
prop_request_change(0x80020009, &x, 4);
}
int button_center_lvafframe = BGMT_PRESS_SET;
unsigned int button_center_lvafframe = BGMT_PRESS_SET;
// halfshutter press is easier to detect from GUI events (PROP_HALFSHUTTER works only in LV mode)
int halfshutter_pressed = 0;
......@@ -145,9 +145,9 @@ static int handle_buttons(struct event * event)
kev,
event->type,
event->param,
event->obj ? ((int)event->obj & 0xf0000000 ? event->obj : *(uint32_t*)(event->obj)) : 0,
event->obj ? ((int)event->obj & 0xf0000000 ? event->obj : *(uint32_t*)(event->obj + 4)) : 0,
event->obj ? ((int)event->obj & 0xf0000000 ? event->obj : *(uint32_t*)(event->obj + 8)) : 0,
event->obj ? ((int)event->obj & 0xf0000000 ? (int)event->obj : *(int*)(event->obj)) : 0,
event->obj ? ((int)event->obj & 0xf0000000 ? (int)event->obj : *(int*)(event->obj + 4)) : 0,
event->obj ? ((int)event->obj & 0xf0000000 ? (int)event->obj : *(int*)(event->obj + 8)) : 0,
event->arg);
/* console_printf("Ev%d[%d]: p=%8x *o=%8x/%8x/%8x a=%8x\ns",
kev,
......@@ -539,7 +539,7 @@ static void gui_main_task_550d()
struct event * event = NULL;
int index = 0;
void* funcs[GMT_NFUNCS];
memcpy(funcs, GMT_FUNCTABLE, 4*GMT_NFUNCS);
memcpy(funcs, (void*)GMT_FUNCTABLE, 4*GMT_NFUNCS);
gui_init_end();
while(1)
{
......
......@@ -94,6 +94,8 @@ typedef enum {
EVENTID_METERING_START = 0x10000039,
EVENTID_94 = 0x10000094,
EVENT_10000086 = 0x10000086,
EVENT_1 = 1
} gui_event_t;
......
......@@ -29,6 +29,8 @@
#include "config.h"
#include "menu.h"
void update_stuff();
CONFIG_INT("movie.log", movie_log, 1);
static struct semaphore * lens_sem;
......@@ -378,7 +380,7 @@ void lens_focus_ex(unsigned mode, int step, int active)
prop_request_change( PROP_LV_FOCUS, &focus, sizeof(focus) );
}*/
void lens_wait_readytotakepic(uint32_t wait)
void lens_wait_readytotakepic(int wait)
{
int i;
for (i = 0; i < wait * 10; i++)
......@@ -418,16 +420,16 @@ mvr_update_logfile(
if( mvr_logfile == INVALID_PTR )
return;
static int last_iso;
static int last_shutter;
static int last_aperture;
static int last_focal_len;
static int last_focus_dist;
static int last_wb_mode;
static int last_kelvin;
static unsigned last_iso;
static unsigned last_shutter;
static unsigned last_aperture;
static unsigned last_focal_len;
static unsigned last_focus_dist;
static unsigned last_wb_mode;
static unsigned last_kelvin;
static int last_wbs_gm;
static int last_wbs_ba;
static int last_picstyle;
static unsigned last_picstyle;
static int last_contrast;
static int last_saturation;
static int last_sharpness;
......@@ -745,7 +747,7 @@ PROP_HANDLER( PROP_LV_LENS )
lens_info.focal_len = bswap16( lv_lens->focal_len );
lens_info.focus_dist = bswap16( lv_lens->focus_dist );
static int old_focus_dist = 0;
static unsigned old_focus_dist = 0;
if (get_zoom_overlay_mode()==2 && lv_drawn() && old_focus_dist && lens_info.focus_dist != old_focus_dist)
{
zoom_overlay_set_countdown(300);
......@@ -790,7 +792,7 @@ static struct menu_entry lens_menus[] = {
};
static void
lens_init( void )
lens_init( void* unused )
{
lens_sem = create_named_semaphore( "lens_info", 1 );
focus_done_sem = create_named_semaphore( "focus_sem", 1 );
......
......@@ -112,6 +112,8 @@ struct prop_picstyle_settings
SIZE_CHECK_STRUCT( prop_picstyle_settings, 0x18 );
void lens_wait_readytotakepic(int wait);
/** Camera control functions */
static inline void
lens_set_rawaperture(
......
......@@ -578,7 +578,7 @@ menu_redraw_if_damaged()
}
}
int menu_send_event(int event)
void menu_send_event(int event)
{
ctrlman_dispatch_event(gui_menu_task, event, 0, 0);
}
......@@ -753,10 +753,10 @@ menu_handler(
break;
#endif
case 1: // Synthetic redraw event
case EVENT_1: // Synthetic redraw event
break;
case 0x10000086:
case EVENT_10000086:
// Who knows? Fall through
default:
......@@ -836,7 +836,7 @@ gui_stop_menu( void )
if( !gui_menu_task )
return;
while (gui_menu_task == 1) msleep(100);
//~ while (gui_menu_task == 1) msleep(100);
gui_task_destroy( gui_menu_task );
gui_menu_task = NULL;
......@@ -991,9 +991,9 @@ static struct menu_entry about_menu[] = {
};
static void
menu_task( void )
menu_task( void* unused )
{
int x, y;
//~ int x, y;
DebugMsg( DM_MAGIC, 3, "%s: Starting up\n", __func__ );
// Add the draw_prop menu
......
......@@ -110,6 +110,7 @@ menu_add(
extern void
menu_init( void );
void menu_draw_icon(int x, int y, int type, int arg);
#define MNI_OFF 0
#define MNI_ON 1
......
......@@ -40,7 +40,7 @@ int mode_remap_done = 0;
PROP_HANDLER(PROP_SHOOTING_MODE)
{
static int shooting_mode = -1;
if (shooting_mode != buf[0]) mode_remap_done = 0;
if (shooting_mode != (int)buf[0]) mode_remap_done = 0;
shooting_mode = buf[0];
restore_kelvin_wb();
intervalometer_stop();
......@@ -221,7 +221,7 @@ void force_liveview()
}
static void