From 66cc3c66e8dca93421c13edfbbf36a0f2a241487 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 22 Apr 2016 17:56:48 +0300 Subject: fontsub: CreateFontPackage() straight copy Signed-off-by: Nikolay Sivov --- dlls/fontsub/main.c | 13 ++++++++++++- include/fontsub.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/fontsub/main.c b/dlls/fontsub/main.c index b78bd58..a0a6032 100644 --- a/dlls/fontsub/main.c +++ b/dlls/fontsub/main.c @@ -50,5 +50,16 @@ ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, u written, flags, face_index, format, lang, platform, encoding, keep_list, keep_len, allocproc, reallocproc, freeproc, reserved); - return ERR_GENERIC; + if (format != TTFCFP_SUBSET) + return ERR_GENERIC; + + *dest = allocproc(src_len); + if (!*dest) + return ERR_MEM; + + memcpy(*dest, src, src_len); + *dest_len = src_len; + *written = src_len; + + return NO_ERROR; } diff --git a/include/fontsub.h b/include/fontsub.h index 6fc7793..b5c77e3 100644 --- a/include/fontsub.h +++ b/include/fontsub.h @@ -27,6 +27,8 @@ typedef void *(__cdecl *CFP_ALLOCPROC)(size_t); typedef void *(__cdecl *CFP_REALLOCPROC)(void *, size_t); typedef void (__cdecl *CFP_FREEPROC)(void *); +#define TTFCFP_SUBSET 0 + ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, unsigned char **dest, ULONG *dest_len, ULONG *written, const unsigned short flags, const unsigned short face_index, const unsigned short format, const unsigned short lang, const unsigned short platform, @@ -34,6 +36,7 @@ ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, u CFP_ALLOCPROC allocproc, CFP_REALLOCPROC reallocproc, CFP_FREEPROC freeproc, void *reserved); #define ERR_GENERIC 1000 +#define ERR_MEM 1005 #ifdef __cplusplus } -- 2.8.0