Wed, 21 Dec 2005 18:43:39 +0000
[gaim-migrate @ 14935]
Jason LeBrun wrote to gaim-devel:
"I have found a small quirk in the way gdk_pixbuf_loader works. When you
are using it without signalling, the proper way to use it is to call
gdk_pixbuf_loader_close *before* calling gdk_pixbuf_loader_get_animation
or gdk_pixbuf_loader_get_pixbuf. The call to gdk_pixbuf_loader_close
signals that no more writes will be occuring.
In particular, this affects images that are less than 1k in size. If
gdk_pixbuf_loader_close is not called before _get_animation, the loader
will not return anything unless it has received more than 1k of data
(the file type sniffing buffer size) or it has been closed.
So, the proper order of calls for loaders in the gtk*.c code is:
gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write();
gdk_pixbuf_loader_close();
gdk_pixbuf_loader_get_animation();"
I know we fixed a bug by changing this in one place. I've gone through and updated the rest.
| 10978 | 1 | |
| 2 | /* | |
| 3 | Gaim | |
| 4 | ||
| 5 | Gaim is the legal property of its developers, whose names are too | |
| 6 | numerous to list here. Please refer to the COPYRIGHT file distributed | |
| 7 | with this source distribution | |
| 8 | ||
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; either version 2 of the License, or (at | |
| 12 | your option) any later version. | |
| 13 | ||
| 14 | This program is distributed in the hope that it will be useful, but | |
| 15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | General Public License for more details. | |
| 18 | ||
| 19 | You should have received a copy of the GNU General Public License | |
| 20 | along with this program; if not, write to the Free Software | |
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
| 22 | USA. | |
| 23 | */ | |
| 24 | ||
| 25 | #ifndef _GAIM_MIME_H | |
| 26 | #define _GAIM_MIME_H | |
| 27 | ||
| 28 | ||
| 29 | #include <glib.h> | |
| 30 | #include <glib/glist.h> | |
| 31 | ||
| 32 | ||
| 33 | /** | |
| 34 | @file mime.h | |
| 35 | @ingroup core | |
| 36 | ||
| 37 | Rudimentary parsing of multi-part MIME messages into more | |
| 38 | accessible structures. | |
| 39 | */ | |
| 40 | ||
| 41 | ||
| 42 | /** @typedef GaimMimeDocument | |
| 43 | A MIME document | |
| 44 | */ | |
| 45 | typedef struct _GaimMimeDocument GaimMimeDocument; | |
| 46 | ||
| 47 | ||
| 48 | /** @typedef GaimMimePart | |
| 49 | A part of a multipart MIME document | |
| 50 | */ | |
| 51 | typedef struct _GaimMimePart GaimMimePart; | |
| 52 | ||
| 53 | ||
| 54 | /** Allocate an empty MIME document */ | |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
11183
diff
changeset
|
55 | GaimMimeDocument *gaim_mime_document_new(void); |
| 10978 | 56 | |
| 57 | ||
| 58 | /** Frees memory used in a MIME document and all of its parts and fields | |
| 59 | @param doc the MIME document to free | |
| 60 | */ | |
| 61 | void gaim_mime_document_free(GaimMimeDocument *doc); | |
| 62 | ||
| 63 | ||
| 64 | /** Parse a MIME document from a NUL-terminated string | |
| 65 | @param buf the NULL-terminated string containing the MIME-encoded data | |
| 66 | @returns MIME document | |
| 67 | */ | |
| 68 | GaimMimeDocument *gaim_mime_document_parse(const char *buf); | |
| 69 | ||
| 70 | ||
| 71 | /** Parse a MIME document from a string | |
| 72 | @param buf the string containing the MIME-encoded data | |
| 73 | @param len length of buf | |
| 74 | @returns MIME document | |
| 75 | */ | |
| 76 | GaimMimeDocument *gaim_mime_document_parsen(const char *buf, gsize len); | |
| 77 | ||
| 78 | ||
| 79 | /** Write (append) a MIME document onto a GString */ | |
| 80 | void gaim_mime_document_write(GaimMimeDocument *doc, GString *str); | |
| 81 | ||
| 82 | ||
| 83 | /** The list of fields in the header of a document | |
| 84 | ||
| 85 | @param doc the MIME document | |
| 86 | @returns list of strings indicating the fields (but not the values of | |
| 87 | the fields) in the header of doc | |
| 88 | */ | |
| 89 | const GList *gaim_mime_document_get_fields(GaimMimeDocument *doc); | |
| 90 | ||
| 91 | ||
| 92 | /** Get the value of a specific field in the header of a document | |
| 93 | ||
| 94 | @param doc the MIME document | |
| 95 | @param field case-insensitive field name | |
| 96 | @returns value associated with the indicated header field, or | |
| 97 | NULL if the field doesn't exist | |
| 98 | */ | |
| 99 | const char *gaim_mime_document_get_field(GaimMimeDocument *doc, | |
| 100 | const char *field); | |
| 101 | ||
| 102 | ||
| 103 | /** Set or replace the value of a specific field in the header of a | |
| 104 | document | |
| 105 | ||
| 106 | @param doc the MIME document | |
| 107 | @param field case-insensitive field name | |
| 108 | @param value value to associate with the indicated header field, | |
| 109 | of NULL to remove the field | |
| 110 | */ | |
| 111 | void gaim_mime_document_set_field(GaimMimeDocument *doc, | |
| 112 | const char *field, | |
| 113 | const char *value); | |
| 114 | ||
| 115 | ||
| 116 | /** The list of parts in a multipart document | |
| 117 | ||
| 118 | @param doc the MIME document | |
| 119 | @returns list of GaimMimePart contained within doc | |
| 120 | */ | |
| 121 | const GList *gaim_mime_document_get_parts(GaimMimeDocument *doc); | |
| 122 | ||
| 123 | ||
| 124 | /** Create and insert a new part into a MIME document | |
| 125 | ||
| 126 | @param doc the new part's parent MIME document | |
| 127 | */ | |
| 128 | GaimMimePart *gaim_mime_part_new(GaimMimeDocument *doc); | |
| 129 | ||
| 130 | ||
| 131 | /** The list of fields in the header of a document part | |
| 132 | ||
| 133 | @param part the MIME document part | |
| 134 | @returns list of strings indicating the fields (but not the values | |
| 135 | of the fields) in the header of part | |
| 136 | */ | |
| 137 | const GList *gaim_mime_part_get_fields(GaimMimePart *part); | |
| 138 | ||
| 139 | ||
| 140 | /** Get the value of a specific field in the header of a document part | |
| 141 | ||
| 142 | @param part the MIME document part | |
| 143 | @param field case-insensitive name of the header field | |
| 144 | @returns value of the specified header field, or NULL if the | |
| 145 | field doesn't exist | |
| 146 | */ | |
| 147 | const char *gaim_mime_part_get_field(GaimMimePart *part, | |
| 148 | const char *field); | |
| 149 | ||
| 150 | ||
| 151 | /** Get the decoded value of a specific field in the header of a | |
| 152 | document part */ | |
| 153 | char *gaim_mime_part_get_field_decoded(GaimMimePart *part, | |
| 154 | const char *field); | |
| 155 | ||
| 156 | ||
| 157 | /** Set or replace the value of a specific field in the header of a | |
| 158 | document | |
|
11035
c10c382f4896
[gaim-migrate @ 12922]
Gary Kramlich <grim@reaperworld.com>
parents:
10978
diff
changeset
|
159 | @param part the part of the MIME document |
| 10978 | 160 | @param field case-insensitive field name |
| 161 | @param value value to associate with the indicated header field, | |
| 162 | of NULL to remove the field | |
| 163 | */ | |
| 164 | void gaim_mime_part_set_field(GaimMimePart *part, | |
| 165 | const char *field, | |
| 166 | const char *value); | |
| 167 | ||
| 168 | ||
| 169 | /** Get the (possibly encoded) data portion of a MIME document part | |
| 170 | @param part the MIME document part | |
| 171 | @returns NULL-terminated data found in the document part | |
| 172 | */ | |
| 173 | const char *gaim_mime_part_get_data(GaimMimePart *part); | |
| 174 | ||
| 175 | ||
| 176 | /** Get the data portion of a MIME document part, after attempting to | |
| 177 | decode it according to the content-transfer-encoding field. If the | |
| 178 | specified encoding method is not supported, this function will | |
| 179 | return NULL. | |
| 180 | ||
| 181 | @param part the MIME documemt part | |
|
11035
c10c382f4896
[gaim-migrate @ 12922]
Gary Kramlich <grim@reaperworld.com>
parents:
10978
diff
changeset
|
182 | @param data Buffer for the data |
|
11066
0d599a3a02c8
[gaim-migrate @ 13047]
Christopher O'Brien <siege@pidgin.im>
parents:
11035
diff
changeset
|
183 | @param len The length of the buffer |
| 10978 | 184 | */ |
| 185 | void gaim_mime_part_get_data_decoded(GaimMimePart *part, | |
|
11183
be87fe695c93
[gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
186 | guchar **data, gsize *len); |
| 10978 | 187 | |
| 188 | ||
| 189 | /** Get the length of the data portion of a MIME document part | |
| 190 | ||
| 191 | @param part the MIME document part | |
| 192 | @returns length of the data in the document part | |
| 193 | */ | |
| 194 | gsize gaim_mime_part_get_length(GaimMimePart *part); | |
| 195 | ||
| 196 | ||
| 197 | void gaim_mime_part_set_data(GaimMimePart *part, const char *data); | |
| 198 | ||
| 199 | ||
| 200 | #endif |