From 3b6a700ef12b59a48c4399eee1d9ce6d55f01711 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 24 May 2021 14:22:16 +0100 Subject: [PATCH] Link Darwin's resource fork data statically. --- setter/src/unix/darwin/rsrcfork.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/setter/src/unix/darwin/rsrcfork.h b/setter/src/unix/darwin/rsrcfork.h index 50c4d07..9e5496e 100644 --- a/setter/src/unix/darwin/rsrcfork.h +++ b/setter/src/unix/darwin/rsrcfork.h @@ -25,13 +25,20 @@ Copyright (C) 2011-2021 Natalia Portillo #ifndef AARU_FSTESTER_SETTER_SRC_DARWIN_RSRCFORK_H_ #define AARU_FSTESTER_SETTER_SRC_DARWIN_RSRCFORK_H_ -const char* icnsText = "This file has a custom icon in the resource fork.\n"; -const char* versText = "This file has a version in the resource fork.\n"; -const char* pictText = "This file has a picture, in the resource fork.\n"; -const char* rsrcText = "This file has a custom icon, a version, and a picture, in the resource fork.\n"; +// Old versions of Darwin do not define it, but only in split parts +#ifndef _PATH_RSRCFORKSPEC +#ifdef _PATH_RSRCNAME // Sanity check in case does not support them at all +#define _PATH_RSRCFORKSPEC "/..namedfork/rsrc" +#endif +#endif + +static const char* icnsText = "This file has a custom icon in the resource fork.\n"; +static const char* versText = "This file has a version in the resource fork.\n"; +static const char* pictText = "This file has a picture, in the resource fork.\n"; +static const char* rsrcText = "This file has a custom icon, a version, and a picture, in the resource fork.\n"; // Resource fork containing one "ICNS" resource -unsigned char icnsData[5941] = { +static unsigned char icnsData[5941] = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x16, 0xF6, 0x00, 0x00, 0x15, 0xF6, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -347,7 +354,7 @@ unsigned char icnsData[5941] = { 0x0C, 0x49, 0x63, 0x6F, 0x6E, 0x20, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63}; // Resource fork containing one "VERS" resource -unsigned char versData[371] = { +static unsigned char versData[371] = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -370,7 +377,7 @@ unsigned char versData[371] = { 0x6E, 0x20, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65}; // Resource fork containing one "PICT" resource -unsigned char pictData[10201] = { +static unsigned char pictData[10201] = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x27, 0x96, 0x00, 0x00, 0x26, 0x96, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -910,7 +917,7 @@ unsigned char pictData[10201] = { 0x10, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65}; // Resource fork containing one "ICNS" resource, one "VERS" resource and one "PICT" resource -unsigned char rsrcData[15941] = { +static unsigned char rsrcData[15941] = { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3D, 0xBC, 0x00, 0x00, 0x3C, 0xBC, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,