Browse files

Fix careless mistakes.

  • Loading branch information...
1 parent 58ae040 commit bfa09ae2e4504703e22111b2970f7336c9caa1c7 @ahefner committed Mar 22, 2012
Showing with 16 additions and 18 deletions.
  1. +7 −10 src/jpeg.c
  2. +1 −1 src/png.c
  3. +8 −7 src/x11.c
View
17 src/jpeg.c
@@ -157,7 +157,11 @@ int jlo_init_from_filename (struct jpeg_decoder_state *st, char *filename)
jpeg_create_decompress(&st->cinfo);
st->cinfo_initialized = 1;
- if (setjmp(st->jpeg_error_trampoline)) goto fatal_with_message;
+ if (setjmp(st->jpeg_error_trampoline)) {
+ st->errmgr.output_message((struct jpeg_common_struct *)&st->cinfo);
+ st->state = error;
+ return 0;
+ }
st->cinfo.err = jpeg_std_error(&st->errmgr);
st->errmgr.error_exit = handle_error_exit;
@@ -172,14 +176,7 @@ int jlo_init_from_filename (struct jpeg_decoder_state *st, char *filename)
jlo_mode_fastest(st);
jlo_set_downscale(st,1);
-success:
- return;
-
-fatal_with_message:
- st->errmgr.output_message((struct jpeg_common_struct *)&st->cinfo);
-fatal:
- st->state = error;
- return;
+ return 1;
}
void jlo_start_decompress (struct jpeg_decoder_state *st)
@@ -208,7 +205,7 @@ void jlo_start_decompress (struct jpeg_decoder_state *st)
goto fatal;
}
-success:
+ /* success: */
return;
fatal_with_message:
View
2 src/png.c
@@ -106,7 +106,7 @@ open_and_decode_png_file (const char *filename)
fread(header, 1, sizeof(header), in);
if (png_sig_cmp(header, 0, sizeof(header))) {
fclose(in);
- return;
+ return NULL;
}
pr = calloc(1, sizeof(*pr));
View
15 src/x11.c
@@ -40,6 +40,7 @@
#include <errno.h>
#include <X11/X.h>
+#include <X11/Xresource.h>
#include <X11/Xatom.h>
#include "windowing.h"
@@ -113,7 +114,6 @@ pwin_init (char *display_name)
if (cfgs && num_cfgs) {
int i;
int depth = -1, tmp;
- GLXContext context;
XRenderPictFormat *pictFormat;
// TODO: Use of an alpha visual should be an application choice.
@@ -241,8 +241,6 @@ create_window (enum window_type type, char *app_name,
void
scribble_window (struct window *window)
{
- int i;
-
window_begin_paint(window);
glClearColor (0.0, 0.0, 0.0, 0.3);
@@ -302,7 +300,9 @@ void
window_set_title (struct window *window, char *new_title)
{
XChangeProperty(display, window->window, XA_WM_NAME, XA_STRING, 8,
- PropModeReplace, new_title, strlen(new_title));
+ PropModeReplace,
+ (unsigned char *)new_title,
+ strlen(new_title));
}
static unsigned
@@ -390,7 +390,6 @@ translate_event (XEvent *xev, struct event *event_out)
struct window *win = lookup_window(xev->xany.window);
char buf[16];
KeySym sym;
- unsigned newstate;
memset(event_out, 0, sizeof(*event_out));
@@ -572,7 +571,10 @@ check_fd (int setidx, int fd)
{
if ((setidx >= 0) && (setidx <= 2) && (fd >= 0)) {
return (FD_ISSET(fd,&fdsets[setidx])? 1 : 0);
- } else fprintf(stderr, "check_fd(%i,%i) is sad.\n", setidx, fd);
+ } else {
+ fprintf(stderr, "check_fd(%i,%i) is sad.\n", setidx, fd);
+ return 0;
+ }
}
static int
@@ -602,7 +604,6 @@ nonblock_get_x_event (struct event *event_out)
static void
get_event_inner (struct event *event_out, int blocking, long long deadline)
{
- XEvent ev;
int i, tmp;
int xfd = ConnectionNumber(display), maxfd = xfd;
long long now, delta;

0 comments on commit bfa09ae

Please sign in to comment.