From 8fb017342c9e3a895cd07ae6e2845f716c6f7c0d Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 23 Aug 2015 11:35:13 +0200 Subject: [PATCH] Bug 753980 - manage layer resource block lyvr Layer version appeared in PS7 Just warns if version is < 70 but nothing more --- plug-ins/file-psd/psd-layer-res-load.c | 35 ++++++++++++++++++++++++++ plug-ins/file-psd/psd.h | 1 + 2 files changed, 36 insertions(+) diff --git a/plug-ins/file-psd/psd-layer-res-load.c b/plug-ins/file-psd/psd-layer-res-load.c index bd942f0bb5..c8424bf0e1 100644 --- a/plug-ins/file-psd/psd-layer-res-load.c +++ b/plug-ins/file-psd/psd-layer-res-load.c @@ -64,6 +64,7 @@ PSD_LPRP_PROTECT "lspf" - * Protected setting (PS6) * PSD_LPRP_COLOR "lclr" - * Sheet color setting (PS6) * PSD_LPRP_REF_POINT "fxrp" - * Reference point (PS6) * + PSD_LPRP_VERSION "lyvr" Loaded * Layer version (PS7) * * Vector mask * PSD_LMSK_VMASK "vmsk" - * Vector mask setting (PS6) * @@ -178,6 +179,11 @@ static gint load_resource_lrfx (const PSDlayerres *res_a, FILE *f, GError **error); +static gint load_resource_lyvr (const PSDlayerres *res_a, + PSDlayer *lyr_a, + FILE *f, + GError **error); + /* Public Functions */ gint get_layer_resource_header (PSDlayerres *res_a, @@ -261,6 +267,9 @@ load_layer_resource (PSDlayerres *res_a, else if (memcmp (res_a->key, PSD_LFX_FX, 4) == 0) load_resource_lrfx (res_a, lyr_a, f, error); + + else if (memcmp (res_a->key, PSD_LPRP_VERSION, 4) == 0) + load_resource_lyvr (res_a, lyr_a, f, error); else load_resource_unknown (res_a, lyr_a, f, error); } @@ -812,3 +821,29 @@ load_resource_lrfx (const PSDlayerres *res_a, return 0; } + +static gint +load_resource_lyvr (const PSDlayerres *res_a, + PSDlayer *lyr_a, + FILE *f, + GError **error) +{ + gint32 version; + if (fread (&version, 4, 1, f) < 1) + { + psd_set_error (feof (f), errno, error); + return -1; + } + version = GINT32_FROM_BE(version); + + /* minimum value is 70 according to specs but there's no reason to + * stop the loading + */ + if (version < 70) + { + g_message ('Invalid version layer'); + } + + IFDBG(2) g_debug ("Process layer resource block %.4s: Version effects", res_a->key); + +} diff --git a/plug-ins/file-psd/psd.h b/plug-ins/file-psd/psd.h index aff8c5b605..6002cb54d3 100644 --- a/plug-ins/file-psd/psd.h +++ b/plug-ins/file-psd/psd.h @@ -95,6 +95,7 @@ #define PSD_LPRP_PROTECT "lspf" /* Protected setting (PS6) */ #define PSD_LPRP_COLOR "lclr" /* Sheet color setting (PS6) */ #define PSD_LPRP_REF_POINT "fxrp" /* Reference point (PS6) */ +#define PSD_LPRP_VERSION "lyvr" /* Layer version (PS7) */ /* Vector mask */ #define PSD_LMSK_VMASK "vmsk" /* Vector mask setting (PS6) */