-static GdkPixbuf* gdk_pixbuf_from_svg_file_stream(FILE *fp, GError** error) {
- size_t bytecount, bytesread;
- char* buffer;
-
- /* Find the size of the file stream */
- fseek(fp, 0L, SEEK_END);
- bytecount = ftell(fp);
- rewind(fp);
-
- buffer = malloc(bytecount);
- if (!buffer) {
- fprintf(stderr, "Unable to allocate %zd bytes\n", bytecount);
- return NULL;
- }
-
- bytesread = fread(buffer, 1, bytecount, fp);
- if (bytesread != bytecount) {
- fprintf(stderr, "Read only %zd of %zd bytes from stream\n",
- bytesread,
- bytecount);
- }
- fclose(fp);
-
- return gdk_pixbuf_from_svg_buffer(buffer, bytecount, error);
-}
-