foo
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 9 Mar 2020 04:36:54 +0000 (06:36 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 9 Mar 2020 04:36:54 +0000 (06:36 +0200)
src/sdl/main.c
src/sprite.c

index cfd9761..57cc7f2 100644 (file)
@@ -99,12 +99,12 @@ void blit_frame(void *pixels, int vsync)
        int i, j;
        unsigned short *sptr, *dptr;
 
+       dbg_fps(pixels);
+
        if(vsync) {
                wait_vsync();
        }
 
-       dbg_fps(pixels);
-
        if(SDL_MUSTLOCK(fbsurf)) {
                SDL_LockSurface(fbsurf);
        }
index 7426cb0..7a2b7a8 100644 (file)
@@ -45,7 +45,7 @@ int load_sprites(struct sprites *ss, const char *fname)
                fprintf(stderr, "failed to load sprites from %s: %s\n", fname, strerror(errno));
                return -1;
        }
-       if(fread(&hdr, sizeof hdr, 1, fp) <= 0) {
+       if(fread(&hdr, sizeof hdr, 1, fp) == 0) {
                fprintf(stderr, "unexpected EOF while reading from %s\n", fname);
                goto err;
        }
@@ -90,7 +90,7 @@ static int read_sprite(struct sprite *spr, int pixsz, FILE *fp)
 
        do {
                /* read the op */
-               if(fread(&op, sizeof op, 1, fp) <= 0) {
+               if(fread(&op, sizeof op, 1, fp) == 0) {
                        free(spr->ops);
                        return -1;
                }