aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-03 19:00:18 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-03 19:59:14 (GMT)
commitdb3a9eec148a0e7bc1ca649e4f76860d7ac28e16 (patch)
tree4f53772ab8089ab3b66292c2e9cf4bc160bc8219
parentc1d40f2a0066abba0cedddb4c740cd1873edf915 (diff)
Fix some gcc warnings
Fedora tries to build it with: CFLAGS="-Wall -Wstrict-prototypes -Wnested-externs -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -Werror=return-type" With makes it hit some Werror conditions. Solve those and a bunch of random warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/callbacks.c12
-rw-r--r--src/camorama-filter-mirror.c2
-rw-r--r--src/camorama-stock-items.c1
-rw-r--r--src/camorama-window.c3
-rw-r--r--src/fileio.c16
-rw-r--r--src/filter.c3
-rw-r--r--src/filter.h12
-rw-r--r--src/main.c3
-rw-r--r--src/v4l.c34
9 files changed, 42 insertions, 44 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index ccbb31a..941e828 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -166,12 +166,12 @@ void acap_func (GtkWidget * rb, cam * cam)
g_timeout_add (cam->timeout_interval,
(GSourceFunc) timeout_capture_func, cam);
if (cam->debug == TRUE) {
- printf ("add autocap - %d - timeout_interval = \n",
+ printf ("add autocap - %d - timeout_interval = %d\n",
cam->timeout_id, cam->timeout_interval);
}
} else {
if (cam->debug == TRUE) {
- printf ("remove autocap - %d - timeout_interval = \n",
+ printf ("remove autocap - %d - timeout_interval = %d\n",
cam->timeout_id, cam->timeout_interval);
}
g_source_remove (cam->timeout_id);
@@ -350,7 +350,6 @@ static int apply_remote_pref(cam *cam)
void prefs_func (GtkWidget * okbutton, cam * cam)
{
GConfClient *client;
- gchar *rdir;
client = gconf_client_get_default ();
@@ -534,9 +533,6 @@ void on_about_activate (GtkMenuItem * menuitem, cam * cam)
gtk_widget_show (about);
}
-void
-camorama_filter_color_filter(void* filter, guchar *image, int x, int y, int depth);
-
static void
apply_filters(cam* cam) {
/* v4l has reverse rgb order from what camora expect so call the color
@@ -559,7 +555,7 @@ apply_filters(cam* cam) {
* https://github.com/bratsche/gtk-/blob/master/gdk/gdkcairo.c
* With a small backport.
*/
-cairo_surface_t *create_from_pixbuf(const GdkPixbuf *pixbuf,
+static cairo_surface_t *create_from_pixbuf(const GdkPixbuf *pixbuf,
GdkWindow *for_window)
{
gint width = gdk_pixbuf_get_width (pixbuf);
@@ -800,7 +796,7 @@ void wb_change (GtkHScale * sc1, cam * cam)
v4l2_set_control(cam->dev, V4L2_CID_WHITENESS, cam->whiteness);
}
-void help_cb (GtkWidget * widget, gpointer data)
+static void help_cb (GtkWidget * widget, gpointer data)
{
GError *error = NULL;
diff --git a/src/camorama-filter-mirror.c b/src/camorama-filter-mirror.c
index 41e67a6..9ed5724 100644
--- a/src/camorama-filter-mirror.c
+++ b/src/camorama-filter-mirror.c
@@ -40,7 +40,7 @@ camorama_filter_mirror_init(CamoramaFilterMirror* self) {}
static void
camorama_filter_mirror_filter(CamoramaFilter* filter, guchar *image, gint width, gint height, gint depth) {
- gint x, y, z, row_length, image_length, new_row, next_row, half_row, index1, index2;
+ gint x, z, row_length, image_length, new_row, next_row, half_row, index1, index2;
guchar temp;
row_length = width * depth;
diff --git a/src/camorama-stock-items.c b/src/camorama-stock-items.c
index 795bacd..e27e20f 100644
--- a/src/camorama-stock-items.c
+++ b/src/camorama-stock-items.c
@@ -23,7 +23,6 @@ add_default_image(const gchar* stock_id, gint size, gchar *pixfilename)
void
camorama_stock_init(void) {
- gchar *pixfilename;
GtkIconFactory* factory = gtk_icon_factory_new();
GtkIconSet * set = gtk_icon_set_new ();
GtkIconSource * source = gtk_icon_source_new();
diff --git a/src/camorama-window.c b/src/camorama-window.c
index 22f8e12..7ba879e 100644
--- a/src/camorama-window.c
+++ b/src/camorama-window.c
@@ -186,9 +186,6 @@ tray_clicked_callback (GtkStatusIcon* status, guint button, guint activate_time,
}
}
-static guint resolution_signals[8] = { 0 };
-
-
void
load_interface(cam* cam) {
int i;
diff --git a/src/fileio.c b/src/fileio.c
index 065900c..df13dbe 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -40,8 +40,12 @@ add_rgb_text (guchar *image, int width, int height, char *cstring, char *format,
time (&t);
tm = localtime (&t);
- len = strftime (line, 127, image_label, tm);
-
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ len = strftime (line, sizeof(line) - 1, image_label, tm);
+#pragma GCC diagnostic pop
+
for (y = 0; y < CHAR_HEIGHT; y++) {
/* locate text in lower left corner of image */
ptr = image + 3 * width * (height - CHAR_HEIGHT - 2 + y) + 12;
@@ -83,18 +87,10 @@ add_rgb_text (guchar *image, int width, int height, char *cstring, char *format,
void remote_save (cam * cam)
{
GThread *remote_thread;
- char *output_uri_string, *input_uri_string;
- unsigned char *tmp;
- gboolean test;
char *filename, *error_message;
- FILE *fp;
- int bytes = 0, fc;
- time_t t;
gchar *ext;
- struct tm *tm;
gboolean pbs;
GdkPixbuf *pb;
- GError *error;
switch (cam->rsavetype) {
case JPEG:
diff --git a/src/filter.c b/src/filter.c
index cdcac4b..c55e9b8 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -152,7 +152,8 @@ static void
camorama_filter_color_init(CamoramaFilterColor* self) {}
void
-camorama_filter_color_filter(CamoramaFilterColor* filter, guchar *image, int x, int y, int depth) {
+camorama_filter_color_filter(void *__filter, guchar *image, int x, int y, int depth) {
+ CamoramaFilterColor *filter = __filter;
int i;
char tmp;
i = x * y;
diff --git a/src/filter.h b/src/filter.h
index dd9ecdb..24b526d 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -46,6 +46,18 @@ GType camorama_filter_get_type (void);
GType camorama_filter_mirror_get_type (void);
GType camorama_filter_laplace_get_type(void);
GType camorama_filter_reichardt_get_type(void);
+GType camorama_filter_color_get_type(void);
+GType camorama_filter_invert_get_type(void);
+GType camorama_filter_threshold_get_type(void);
+GType camorama_filter_threshold_channel_get_type(void);
+GType camorama_filter_wacky_get_type(void);
+GType camorama_filter_mono_get_type(void);
+GType camorama_filter_mono_weight_get_type(void);
+GType camorama_filter_sobel_get_type(void);
+GType camorama_filter_smooth_get_type(void);
+
+void
+camorama_filter_color_filter(void *__filter, guchar *image, int x, int y, int depth);
void camorama_filters_init (void);
gchar const* camorama_filter_get_name(CamoramaFilter* self);
diff --git a/src/main.c b/src/main.c
index d7d5cd3..f6f0671 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,8 +48,6 @@ main(int argc, char *argv[]) {
cam cam_object, *cam;
Display *display;
Screen *screen_num;
- gchar *pixfilename = "camorama/camorama.png";
- GtkWidget *button;
GConfClient *gc;
unsigned int bufsize;
GError *error = NULL;
@@ -166,6 +164,7 @@ main(int argc, char *argv[]) {
/* get desktop depth */
display = (Display *) gdk_x11_get_default_xdisplay ();
screen_num = xlib_rgb_get_screen ();
+
gdk_pixbuf_xlib_init (display, 0);
cam->desk_depth = xlib_rgb_get_depth ();
diff --git a/src/v4l.c b/src/v4l.c
index 24242f2..7e3d7d5 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -7,7 +7,6 @@
#include "support.h"
extern int frame_number;
-extern int errno;
void print_cam(cam *cam){
printf("\nCamera Info\n");
@@ -34,12 +33,12 @@ void print_cam(cam *cam){
printf("timestamp = %s\n\n",cam->ts_string);
}
-void insert_resolution(cam * cam, int x, int y)
+static void insert_resolution(cam * cam, int x, int y)
{
int i;
try_set_win_info(cam, &x, &y);
- for (i = 0; i++; i < cam->n_res) {
+ for (i = 0; i < cam->n_res; i++) {
if (cam->res[i].x == x && cam->res[i].y == y)
return;
}
@@ -69,7 +68,6 @@ void get_supported_resolutions(cam * cam)
{
struct v4l2_fmtdesc fmt;
struct v4l2_frmsizeenum frmsize;
- struct v4l2_frmivalenum frmival;
int i, x, y;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -133,15 +131,15 @@ void camera_cap(cam * cam)
if (v4l2_ioctl(cam->dev, VIDIOC_ENUM_FMT, &fmtdesc))
break;
- if(cam->debug == TRUE)
- printf("format index %d: FOURCC: '%c%c%c%c' (%08x)%s\n", i,
- fmtdesc.pixelformat & 0xff,
- (fmtdesc.pixelformat >> 8) & 0xff,
- (fmtdesc.pixelformat >> 16) & 0xff,
- fmtdesc.pixelformat >> 24,
- fmtdesc.pixelformat,
- fmtdesc.flags & V4L2_FMT_FLAG_EMULATED ? " (emulated)" : ""
- );
+ if (cam->debug == TRUE)
+ printf("format index %d: FOURCC: '%c%c%c%c' (%08x)%s\n", i,
+ fmtdesc.pixelformat & 0xff,
+ (fmtdesc.pixelformat >> 8) & 0xff,
+ (fmtdesc.pixelformat >> 16) & 0xff,
+ fmtdesc.pixelformat >> 24,
+ fmtdesc.pixelformat,
+ fmtdesc.flags & V4L2_FMT_FLAG_EMULATED ? " (emulated)" : ""
+ );
/* FIXME: add a check for emulated formats */
@@ -229,7 +227,7 @@ void camera_cap(cam * cam)
cam->read = TRUE;
}
- strncpy(cam->name, vid_cap.card, sizeof(cam->name));
+ strncpy(cam->name, (const char *)vid_cap.card, sizeof(cam->name));
cam->name[sizeof(cam->name) - 1] = '\0';
if(cam->debug == TRUE) {
@@ -244,7 +242,6 @@ void camera_cap(cam * cam)
}
void get_pic_info(cam * cam){
- char *msg;
int i;
if(cam->debug == TRUE)
@@ -342,7 +339,6 @@ void get_win_info(cam * cam)
void try_set_win_info(cam * cam, int *x, int *y)
{
- gchar *msg;
struct v4l2_format fmt;
memset(&fmt, 0, sizeof(fmt));
@@ -544,7 +540,7 @@ void stop_streaming(cam * cam)
unsigned int i;
int r;
enum v4l2_buf_type type;
- fd_set fds;
+ fd_set fds, fderrs;
struct v4l2_buffer buf;
struct timeval tv;
@@ -552,12 +548,14 @@ void stop_streaming(cam * cam)
for (i = 0; i < cam->n_buffers; ++i) {
FD_ZERO(&fds);
FD_SET(cam->dev, &fds);
+ FD_ZERO(&fderrs);
+ FD_SET(cam->dev, &fderrs);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
- r = select(cam->dev + 1, &fds, NULL, &fds, &tv);
+ r = select(cam->dev + 1, &fds, NULL, &fderrs, &tv);
if (r == -1 && errno == EINTR)
continue;

Privacy Policy