src/pngtile/main.c
changeset 102 a4d1e046ed3e
parent 101 578d90d0cf92
child 112 bd964d3551eb
equal deleted inserted replaced
101:578d90d0cf92 102:a4d1e046ed3e
   347             
   347             
   348             if (!no_update) {
   348             if (!no_update) {
   349                 log_debug("\tUpdating image cache...");
   349                 log_debug("\tUpdating image cache...");
   350 
   350 
   351                 if ((err = pt_image_update(image, &update_params))) {
   351                 if ((err = pt_image_update(image, &update_params))) {
   352                     log_warn_errno("pt_image_update: %s: %s", img_path, pt_strerror(err));
   352                     log_error("pt_image_update: %s: %s", img_path, pt_strerror(err));
       
   353                     goto error;
   353                 }
   354                 }
   354 
   355 
   355                 log_info("\tUpdated image cache");
   356                 log_info("\tUpdated image cache");
   356 
   357 
   357             } else {
   358             } else {
   362             log_debug("\tImage cache is fresh");
   363             log_debug("\tImage cache is fresh");
   363 
   364 
   364             // ensure it's loaded
   365             // ensure it's loaded
   365             log_debug("\tLoad image cache...");
   366             log_debug("\tLoad image cache...");
   366 
   367 
   367             if ((err = pt_image_load(image)))
   368             if ((err = pt_image_load(image))) {
   368                 log_errno("pt_image_load: %s", pt_strerror(err));
   369                 log_errno("pt_image_load: %s", pt_strerror(err));
   369 
   370                 goto error;
       
   371             }
   370         }
   372         }
   371 
   373 
   372         // show info
   374         // show info
   373         const struct pt_image_info *info;
   375         const struct pt_image_info *info;
   374         
   376         
   405             // just once
   407             // just once
   406             if (do_tile(ctx, image, &ti, out_path))
   408             if (do_tile(ctx, image, &ti, out_path))
   407                 goto error;
   409                 goto error;
   408 
   410 
   409         }
   411         }
   410 error:
       
   411         // cleanup
   412         // cleanup
   412         // XXX: leak because of async
   413         // XXX: leak because of async
   413         if (!ctx)
   414         if (!ctx)
   414             pt_image_destroy(image);
   415             pt_image_destroy(image);
       
   416         
       
   417         continue;
       
   418 
       
   419 error:
       
   420         // quit
       
   421         EXIT_ERROR(EXIT_FAILURE, "Processing image failed: %s", img_path);
   415     }
   422     }
   416     
   423     
   417     if (ctx) {
   424     if (ctx) {
   418         log_info("Waiting for images to finish...");
   425         log_info("Waiting for images to finish...");
   419 
   426