]> git.sesse.net Git - nageru/blobdiff - futatabi/flow_main.cpp
On errors, abort() instead of exit(1); exit() in a multithreaded program just gives...
[nageru] / futatabi / flow_main.cpp
index ef481a04b4ba8e7360214d442cdd3e0f05d44d2b..ef3b5bf976a8417f22b36ea995763987701a3edf 100644 (file)
@@ -54,7 +54,7 @@ GLuint load_texture(const char *filename, unsigned *width_ret, unsigned *height_
        SDL_Surface *surf = IMG_Load(filename);
        if (surf == nullptr) {
                fprintf(stderr, "IMG_Load(%s): %s\n", filename, IMG_GetError());
-               exit(1);
+               abort();
        }
 
        // For whatever reason, SDL doesn't support converting to YUV surfaces
@@ -62,7 +62,7 @@ GLuint load_texture(const char *filename, unsigned *width_ret, unsigned *height_
        SDL_Surface *rgb_surf = SDL_ConvertSurfaceFormat(surf, SDL_PIXELFORMAT_RGBA32, /*flags=*/0);
        if (rgb_surf == nullptr) {
                fprintf(stderr, "SDL_ConvertSurfaceFormat(%s): %s\n", filename, SDL_GetError());
-               exit(1);
+               abort();
        }
 
        SDL_FreeSurface(surf);
@@ -234,7 +234,7 @@ void compute_flow_only(int argc, char **argv, int optind)
        if (width1 != width2 || height1 != height2) {
                fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n",
                        width1, height1, width2, height2);
-               exit(1);
+               abort();
        }
 
        // Move them into an array texture, since that's how the rest of the code
@@ -298,7 +298,7 @@ void compute_flow_only(int argc, char **argv, int optind)
                if (width != width1 || height != height1) {
                        fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n",
                                filename0, width, height, width1, height1);
-                       exit(1);
+                       abort();
                }
                glCopyImageSubData(tex0, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width1, height1, 1);
                glDeleteTextures(1, &tex0);
@@ -307,7 +307,7 @@ void compute_flow_only(int argc, char **argv, int optind)
                if (width != width1 || height != height1) {
                        fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n",
                                filename1, width, height, width1, height1);
-                       exit(1);
+                       abort();
                }
                glCopyImageSubData(tex1, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 1, width1, height1, 1);
                glDeleteTextures(1, &tex1);
@@ -347,7 +347,7 @@ void interpolate_image(int argc, char **argv, int optind)
        if (width1 != width2 || height1 != height2) {
                fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n",
                        width1, height1, width2, height2);
-               exit(1);
+               abort();
        }
 
        // Move them into an array texture, since that's how the rest of the code
@@ -462,13 +462,13 @@ int main(int argc, char **argv)
                        break;
                default:
                        fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
-                       exit(1);
+                       abort();
                };
        }
 
        if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
                fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
-               exit(1);
+               abort();
        }
        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);