Issue #19: Replace g_errors because these errors are not fatal

This commit is contained in:
Mario Hüttel 2019-06-22 14:04:11 +02:00
parent 58d3f5c57c
commit d4f14c52ed
2 changed files with 8 additions and 5 deletions

View File

@ -101,8 +101,10 @@ static int create_renderers(char **renderers,
} else if (!strcmp(current_renderer, "svg")) { } else if (!strcmp(current_renderer, "svg")) {
output_renderer = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_svg()); output_renderer = GDS_RENDER_OUTPUT_RENDERER(cairo_renderer_new_svg());
} else if (!strcmp(current_renderer, "ext")) { } else if (!strcmp(current_renderer, "ext")) {
if (!so_path) if (!so_path) {
fprintf(stderr, "Please specify shared object for external renderer. Will ignore this renderer.\n");
continue; continue;
}
output_renderer = GDS_RENDER_OUTPUT_RENDERER(external_renderer_new_with_so(so_path)); output_renderer = GDS_RENDER_OUTPUT_RENDERER(external_renderer_new_with_so(so_path));
} else { } else {
continue; continue;
@ -148,7 +150,8 @@ int command_line_convert_gds(const char *gds_name,
layer_settings_load_from_csv(layer_sett, layer_file); layer_settings_load_from_csv(layer_sett, layer_file);
/* Create renderers */ /* Create renderers */
if (create_renderers(renderers, output_file_names, tex_layers, tex_standalone, so_path, &renderer_list, layer_sett)) if (create_renderers(renderers, output_file_names, tex_layers, tex_standalone,
so_path, &renderer_list, layer_sett))
goto ret_destroy_layer_mapping; goto ret_destroy_layer_mapping;

View File

@ -62,7 +62,7 @@ static int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *
int ret = 0; int ret = 0;
if (!so_path) { if (!so_path) {
g_error("Path to shared object not set!"); fprintf(stderr, "Path to shared object not set!\n");
return -3000; return -3000;
} }
@ -73,7 +73,7 @@ static int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *
/* Load shared object */ /* Load shared object */
so_handle = dlopen(so_path, RTLD_LAZY); so_handle = dlopen(so_path, RTLD_LAZY);
if (!so_handle) { if (!so_handle) {
g_error("Could not load external library '%s'\nDetailed error is:\n%s", so_path, dlerror()); fprintf(stderr, "Could not load external library '%s'\nDetailed error is:\n%s\n", so_path, dlerror());
return -2000; return -2000;
} }
@ -81,7 +81,7 @@ static int external_renderer_render_cell(struct gds_cell *toplevel_cell, GList *
so_render_func = (int (*)(struct gds_cell *, GList *, const char *, double))dlsym(so_handle, EXTERNAL_LIBRARY_FUNCTION); so_render_func = (int (*)(struct gds_cell *, GList *, const char *, double))dlsym(so_handle, EXTERNAL_LIBRARY_FUNCTION);
error_msg = dlerror(); error_msg = dlerror();
if (error_msg != NULL) { if (error_msg != NULL) {
g_error("Rendering function not found in library:\n%s\n", error_msg); fprintf(stderr, "Rendering function not found in library:\n%s\n", error_msg);
goto ret_close_so_handle; goto ret_close_so_handle;
} }