From: Michael Orlitzky Date: Sat, 5 Aug 2023 17:48:59 +0000 (-0400) Subject: io-svg.c: whitespace cleanup. X-Git-Tag: 0.0.1~25 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=cf9e5d27a7c777661d02debc01eedfe1e0dff491;p=libsvgtiny-pixbuf.git io-svg.c: whitespace cleanup. --- diff --git a/io-svg.c b/io-svg.c index 15d3d89..b65d089 100644 --- a/io-svg.c +++ b/io-svg.c @@ -27,10 +27,10 @@ typedef struct { GdkPixbufModuleSizeFunc size_func; gpointer user_data; - /* The "file" */ + /* The SVG "file" that we're building in memory. */ char* svg_data; - /* How far into the file are we? This should always point to the + /* How far into svg_data are we? This should always point to the next empty byte. If (for example) svg_data_size is 2, then svg_data[0] and svg_data[1] are used, but svg_data[2] is free. */ size_t svg_data_size; @@ -56,8 +56,8 @@ static void render_path(cairo_t* cr, shape_t* path) { switch ((int) path->path[j]) { case svgtiny_PATH_MOVE: cairo_move_to(cr, - path->path[j + 1], - path->path[j + 2]); + path->path[j + 1], + path->path[j + 2]); j += 3; break; case svgtiny_PATH_CLOSE: @@ -114,10 +114,10 @@ static void render_path(cairo_t* cr, shape_t* path) { * svgtiny_free the result if it is valid. */ static diagram_t* svgtiny_diagram_from_buffer(char* buffer, - size_t bytecount, - int width, - int height, - GError** error) { + size_t bytecount, + int width, + int height, + GError** error) { diagram_t* diagram; svgtiny_code code; @@ -248,8 +248,8 @@ static cairo_t* cairo_context_from_diagram(diagram_t* diagram) { crs = cairo_status(cr); if (crs != CAIRO_STATUS_SUCCESS) { fprintf(stderr, - "cairo error: %s\n", - cairo_status_to_string(crs)); + "cairo error: %s\n", + cairo_status_to_string(crs)); cairo_destroy(cr); return NULL; } @@ -273,18 +273,18 @@ static cairo_t* cairo_context_from_diagram(diagram_t* diagram) { * returned; if not, @c NULL is returned and @c error is populated. */ static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer, - size_t bytecount, - GError** error) { + size_t bytecount, + GError** error) { diagram_t* diagram; cairo_t* cr = 0; GdkPixbuf* pb; GError* sub_error = NULL; diagram = svgtiny_diagram_from_buffer(buffer, - bytecount, - VIEWPORT_WIDTH, - VIEWPORT_HEIGHT, - &sub_error); + bytecount, + VIEWPORT_WIDTH, + VIEWPORT_HEIGHT, + &sub_error); if (!diagram) { g_propagate_error(error, sub_error); return NULL; @@ -294,9 +294,9 @@ static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer, if (!cr) { svgtiny_free(diagram); g_set_error_literal(error, - GDK_PIXBUF_ERROR, - GDK_PIXBUF_ERROR_CORRUPT_IMAGE, - "could not create Cairo surface from SVG diagram"); + GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_CORRUPT_IMAGE, + "could not create Cairo surface from SVG diagram"); return NULL; } @@ -310,17 +310,17 @@ static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer, * So for now I'm back in the diagram camp. */ pb = gdk_pixbuf_get_from_surface(cairo_get_target(cr), - 0, - 0, - diagram->width, - diagram->height); + 0, + 0, + diagram->width, + diagram->height); if (!pb) { g_set_error_literal(error, - GDK_PIXBUF_ERROR, - GDK_PIXBUF_ERROR_FAILED, - "failed to obtain a GdkPixbuf from Cairo surface"); + GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_FAILED, + "failed to obtain a GdkPixbuf from Cairo surface"); } return pb; @@ -328,10 +328,10 @@ static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer, static gpointer gdk_pixbuf_begin_load(GdkPixbufModuleSizeFunc size_func, - GdkPixbufModulePreparedFunc prep_func, - GdkPixbufModuleUpdatedFunc updated_func, - gpointer user_data, - GError **error) { + GdkPixbufModulePreparedFunc prep_func, + GdkPixbufModuleUpdatedFunc updated_func, + gpointer user_data, + GError **error) { SvgTinyContext* context = g_new(SvgTinyContext, 1); @@ -366,11 +366,11 @@ static gboolean gdk_pixbuf_load_increment(gpointer data, static void emit_updated(SvgTinyContext* context, GdkPixbuf* pixbuf) { if (context->updated_func != NULL) { (*context->updated_func)(pixbuf, - 0, - 0, - gdk_pixbuf_get_width(pixbuf), - gdk_pixbuf_get_height(pixbuf), - context->user_data); + 0, + 0, + gdk_pixbuf_get_width(pixbuf), + gdk_pixbuf_get_height(pixbuf), + context->user_data); } } @@ -399,8 +399,8 @@ static gboolean gdk_pixbuf_stop_load(gpointer data, GError **error) { GError* sub_error = NULL; pixbuf = gdk_pixbuf_from_svg_buffer(context->svg_data, - context->svg_data_size, - &sub_error); + context->svg_data_size, + &sub_error); if (pixbuf != NULL) { /*emit_size(context, pixbuf);*/