gpointer user_data;
/* The SVG "file" that we're building in memory. */
- char* svg_data;
+ gchar* svg_data;
/* 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
* returned; if not, @c NULL is returned. You are expected to @c
* svgtiny_free the result if it is valid.
*/
-static diagram_t* svgtiny_diagram_from_buffer(char* buffer,
- size_t bytecount,
- int width,
- int height,
+static diagram_t* svgtiny_diagram_from_buffer(gchar* buffer,
+ gsize bytecount,
+ guint width,
+ guint height,
GError** error) {
diagram_t* diagram;
svgtiny_code code;
return NULL;
}
- code = svgtiny_parse(diagram, buffer, bytecount, "", width, height);
+ g_assert((int)width >= 0);
+ g_assert((int)height >= 0);
+ code = svgtiny_parse(diagram,
+ buffer,
+ bytecount, "",
+ (int)width,
+ (int)height);
switch(code) {
case svgtiny_OK:
* @return If successful, a valid pointer to a @c GdkPixbuf is
* returned; if not, @c NULL is returned and @c error is populated.
*/
-static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer,
- size_t bytecount,
+static GdkPixbuf* gdk_pixbuf_from_svg_buffer(gchar* buffer,
+ gsize bytecount,
GError** error) {
diagram_t* diagram;
cairo_t* cr = 0;
* processed. If no replacements were made, the result will be @c
* NULL; otherwise, you are expected to @c free it when you are done.
*/
-static char* process_gtk_symbolic_svg_xinclude(const char* buffer,
- size_t buf_size,
- size_t* new_size) {
- char* xi_start;
- char* xi;
- char* xi_stop;
+static gchar* process_gtk_symbolic_svg_xinclude(const gchar* buffer,
+ gsize buf_size,
+ gsize* new_size) {
+ gchar* xi_start;
+ gchar* xi;
+ gchar* xi_stop;
xi_start = g_strstr_len(buffer, buf_size, XI_SIGNATURE);
if (xi_start == NULL) {
* started at, say, position three, then this would compute a size
* of three. Which is correct: we want to retain buffer[0],
* buffer[1], and buffer[2]. */
- size_t keep_size = xi_start - buffer;
+ gsize keep_size = xi_start - buffer;
*new_size = keep_size + decoded_size;
- char* result = g_malloc(*new_size);
+ gchar* result = g_malloc(*new_size);
memcpy(result, buffer, keep_size);
memcpy(result+keep_size, decoded, decoded_size);
g_free(decoded);
/* If we're inside of gtk-encode-symbolic-svg right now, we need to
process the insane librsvg-specific XInclude directive it hands
us before proceeding. */
- size_t newsize;
- char* newdata = process_gtk_symbolic_svg_xinclude(context->svg_data,
- context->svg_data_size,
- &newsize);
+ gsize newsize;
+ gchar* newdata = process_gtk_symbolic_svg_xinclude(context->svg_data,
+ context->svg_data_size,
+ &newsize);
if (newdata != NULL) {
g_free(context->svg_data);
context->svg_data = newdata;