diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-12-12 16:50:19 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-12-12 20:52:35 -0500 |
commit | 0dfbcd60c9e830aa5e8a4f880b3910aa1f88a323 (patch) | |
tree | b071020bbbdd36d00ad79135b0444e088e292f0d /gtk/gtkiconcachevalidator.c | |
parent | b6acc8f2c572f72d5c24217e604b7295ff5d9ddf (diff) | |
download | gtk+-0dfbcd60c9e830aa5e8a4f880b3910aa1f88a323.tar.gz |
Whitespace fixes
Diffstat (limited to 'gtk/gtkiconcachevalidator.c')
-rw-r--r-- | gtk/gtkiconcachevalidator.c | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/gtk/gtkiconcachevalidator.c b/gtk/gtkiconcachevalidator.c index 81a26e5914..9afc0c61cf 100644 --- a/gtk/gtkiconcachevalidator.c +++ b/gtk/gtkiconcachevalidator.c @@ -21,50 +21,50 @@ #include <gdk-pixbuf/gdk-pixdata.h> -#define VERBOSE(x) +#define VERBOSE(x) #define check(name,condition) \ if (!(condition)) \ { \ VERBOSE(g_print ("bad %s\n", (name))); \ return FALSE; \ - } + } -static inline gboolean -get_uint16 (CacheInfo *info, - guint32 offset, +static inline gboolean +get_uint16 (CacheInfo *info, + guint32 offset, guint16 *value) { - if (offset < info->cache_size) - { - *value = GUINT16_FROM_BE(*(guint16*)(info->cache + offset)); + if (offset < info->cache_size) + { + *value = GUINT16_FROM_BE(*(guint16*)(info->cache + offset)); return TRUE; } - else - { + else + { *value = 0; - return FALSE; - } + return FALSE; + } } -static inline gboolean -get_uint32 (CacheInfo *info, - guint32 offset, +static inline gboolean +get_uint32 (CacheInfo *info, + guint32 offset, guint32 *value) { - if (offset < info->cache_size) - { - *value = GUINT32_FROM_BE(*(guint32*)(info->cache + offset)); + if (offset < info->cache_size) + { + *value = GUINT32_FROM_BE(*(guint32*)(info->cache + offset)); return TRUE; } - else - { + else + { *value = 0; - return FALSE; - } + return FALSE; + } } -static gboolean +static gboolean check_version (CacheInfo *info) { guint16 major, minor; @@ -75,20 +75,20 @@ check_version (CacheInfo *info) return TRUE; } -static gboolean -check_string (CacheInfo *info, +static gboolean +check_string (CacheInfo *info, guint32 offset) { check ("string offset", offset < info->cache_size); - if (info->flags & CHECK_STRINGS) + if (info->flags & CHECK_STRINGS) { gint i; gchar c; /* assume no string is longer than 1k */ - for (i = 0; i < 1024; i++) - { + for (i = 0; i < 1024; i++) + { check ("string offset", offset + i < info->cache_size) c = *(info->cache + offset + i); if (c == '\0') @@ -101,20 +101,20 @@ check_string (CacheInfo *info, return TRUE; } -static gboolean -check_string_utf8 (CacheInfo *info, +static gboolean +check_string_utf8 (CacheInfo *info, guint32 offset) { check ("string offset", offset < info->cache_size); - if (info->flags & CHECK_STRINGS) + if (info->flags & CHECK_STRINGS) { gint i; gchar c; /* assume no string is longer than 1k */ - for (i = 0; i < 1024; i++) - { + for (i = 0; i < 1024; i++) + { check ("string offset", offset + i < info->cache_size) c = *(info->cache + offset + i); if (c == '\0') @@ -127,16 +127,16 @@ check_string_utf8 (CacheInfo *info, return TRUE; } -static gboolean -check_directory_list (CacheInfo *info, +static gboolean +check_directory_list (CacheInfo *info, guint32 offset) { guint32 directory_offset; gint i; - + check ("offset, directory list", get_uint32 (info, offset, &info->n_directories)); - - for (i = 0; i < info->n_directories; i++) + + for (i = 0; i < info->n_directories; i++) { check ("offset, directory", get_uint32 (info, offset + 4 + 4 * i, &directory_offset)); if (!check_string (info, directory_offset)) @@ -146,8 +146,8 @@ check_directory_list (CacheInfo *info, return TRUE; } -static gboolean -check_pixel_data (CacheInfo *info, +static gboolean +check_pixel_data (CacheInfo *info, guint32 offset) { guint32 type; @@ -159,20 +159,20 @@ check_pixel_data (CacheInfo *info, check ("pixel data type", type == 0); check ("pixel data length", offset + 8 + length < info->cache_size); - if (info->flags & CHECK_PIXBUFS) + if (info->flags & CHECK_PIXBUFS) { - GdkPixdata data; - + GdkPixdata data; + check ("pixel data", gdk_pixdata_deserialize (&data, length, - (const guint8*)info->cache + offset + 8, + (const guint8*)info->cache + offset + 8, NULL)); } - + return TRUE; } -static gboolean -check_embedded_rect (CacheInfo *info, +static gboolean +check_embedded_rect (CacheInfo *info, guint32 offset) { check ("embedded rect", offset + 4 < info->cache_size); @@ -180,28 +180,28 @@ check_embedded_rect (CacheInfo *info, return TRUE; } -static gboolean -check_attach_point_list (CacheInfo *info, +static gboolean +check_attach_point_list (CacheInfo *info, guint32 offset) { guint32 n_attach_points; check ("offset, attach point list", get_uint32 (info, offset, &n_attach_points)); - check ("attach points", offset + 4 + 4 * n_attach_points < info->cache_size); + check ("attach points", offset + 4 + 4 * n_attach_points < info->cache_size); return TRUE; } -static gboolean -check_display_name_list (CacheInfo *info, +static gboolean +check_display_name_list (CacheInfo *info, guint32 offset) { guint32 n_display_names, ofs; gint i; - check ("offset, display name list", + check ("offset, display name list", get_uint32 (info, offset, &n_display_names)); - for (i = 0; i < n_display_names; i++) + for (i = 0; i < n_display_names; i++) { get_uint32(info, offset + 4 + 8 * i, &ofs); if (!check_string (info, ofs)) @@ -210,38 +210,38 @@ check_display_name_list (CacheInfo *info, if (!check_string_utf8 (info, ofs)) return FALSE; } - - return TRUE; + + return TRUE; } -static gboolean -check_meta_data (CacheInfo *info, +static gboolean +check_meta_data (CacheInfo *info, guint32 offset) { guint32 embedded_rect_offset; guint32 attach_point_list_offset; guint32 display_name_list_offset; - check ("offset, embedded rect", + check ("offset, embedded rect", get_uint32 (info, offset, &embedded_rect_offset)); - check ("offset, attach point list", + check ("offset, attach point list", get_uint32 (info, offset + 4, &attach_point_list_offset)); - check ("offset, display name list", + check ("offset, display name list", get_uint32 (info, offset + 8, &display_name_list_offset)); - if (embedded_rect_offset != 0) + if (embedded_rect_offset != 0) { if (!check_embedded_rect (info, embedded_rect_offset)) return FALSE; } - if (attach_point_list_offset != 0) + if (attach_point_list_offset != 0) { if (!check_attach_point_list (info, attach_point_list_offset)) return FALSE; } - if (display_name_list_offset != 0) + if (display_name_list_offset != 0) { if (!check_display_name_list (info, display_name_list_offset)) return FALSE; @@ -250,8 +250,8 @@ check_meta_data (CacheInfo *info, return TRUE; } -static gboolean -check_image_data (CacheInfo *info, +static gboolean +check_image_data (CacheInfo *info, guint32 offset) { guint32 pixel_data_offset; @@ -260,22 +260,22 @@ check_image_data (CacheInfo *info, check ("offset, pixel data", get_uint32 (info, offset, &pixel_data_offset)); check ("offset, meta data", get_uint32 (info, offset + 4, &meta_data_offset)); - if (pixel_data_offset != 0) + if (pixel_data_offset != 0) { if (!check_pixel_data (info, pixel_data_offset)) return FALSE; } - if (meta_data_offset != 0) + if (meta_data_offset != 0) { if (!check_meta_data (info, meta_data_offset)) return FALSE; } - + return TRUE; } -static gboolean -check_image (CacheInfo *info, +static gboolean +check_image (CacheInfo *info, guint32 offset) { guint16 index; @@ -284,13 +284,13 @@ check_image (CacheInfo *info, check ("offset, image index", get_uint16 (info, offset, &index)); check ("offset, image flags", get_uint16 (info, offset + 2, &flags)); - check ("offset, image data offset", + check ("offset, image data offset", get_uint32 (info, offset + 4, &image_data_offset)); check ("image index", index < info->n_directories); check ("image flags", flags < 16); - if (image_data_offset != 0) + if (image_data_offset != 0) { if (!check_image_data (info, image_data_offset)) return FALSE; @@ -299,16 +299,16 @@ check_image (CacheInfo *info, return TRUE; } -static gboolean -check_image_list (CacheInfo *info, +static gboolean +check_image_list (CacheInfo *info, guint32 offset) { guint32 n_images; gint i; check ("offset, image list", get_uint32 (info, offset, &n_images)); - - for (i = 0; i < n_images; i++) + + for (i = 0; i < n_images; i++) { if (!check_image (info, offset + 4 + 8 * i)) return FALSE; @@ -317,8 +317,8 @@ check_image_list (CacheInfo *info, return TRUE; } -static gboolean -check_icon (CacheInfo *info, +static gboolean +check_icon (CacheInfo *info, guint32 offset) { guint32 chain_offset; @@ -327,14 +327,14 @@ check_icon (CacheInfo *info, check ("offset, icon chain", get_uint32 (info, offset, &chain_offset)); check ("offset, icon name", get_uint32 (info, offset + 4, &name_offset)); - check ("offset, icon image list", get_uint32 (info, offset + 8, + check ("offset, icon image list", get_uint32 (info, offset + 8, &image_list_offset)); if (!check_string (info, name_offset)) return FALSE; if (!check_image_list (info, image_list_offset)) return FALSE; - if (chain_offset != 0xffffffff) + if (chain_offset != 0xffffffff) { if (!check_icon (info, chain_offset)) return FALSE; @@ -343,8 +343,8 @@ check_icon (CacheInfo *info, return TRUE; } -static gboolean -check_hash (CacheInfo *info, +static gboolean +check_hash (CacheInfo *info, guint32 offset) { guint32 n_buckets, icon_offset; @@ -352,11 +352,11 @@ check_hash (CacheInfo *info, check ("offset, hash size", get_uint32 (info, offset, &n_buckets)); - for (i = 0; i < n_buckets; i++) + for (i = 0; i < n_buckets; i++) { - check ("offset, hash chain", + check ("offset, hash chain", get_uint32 (info, offset + 4 + 4 * i, &icon_offset)); - if (icon_offset != 0xffffffff) + if (icon_offset != 0xffffffff) { if (!check_icon (info, icon_offset)) return FALSE; @@ -368,7 +368,7 @@ check_hash (CacheInfo *info, /** * _gtk_icon_cache_validate: - * @info: a CacheInfo structure + * @info: a CacheInfo structure * * Validates the icon cache passed in the @cache and * @cache_size fields of the @info structure. The @@ -376,11 +376,11 @@ check_hash (CacheInfo *info, * cache do not point outside the mapped area, that * strings look reasonable, and that pixbufs can * be deserialized. The amount of validation can - * be controlled with the @flags field. + * be controlled with the @flags field. * * Returns: %TRUE if the cache is valid */ -gboolean +gboolean _gtk_icon_cache_validate (CacheInfo *info) { guint32 hash_offset; |