From cf36b04850f0cbfd7945962d9bba2ebc2b8bae50 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 20 Feb 2021 14:26:13 +0800 Subject: [PATCH] Fix the issue that rlottie use the same cache key for different json data, which cause the wrong frame and index --- .../Classes/SDImageLottieCoder.m | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/SDWebImageLottieCoder/Classes/SDImageLottieCoder.m b/SDWebImageLottieCoder/Classes/SDImageLottieCoder.m index 796af93..de7c310 100644 --- a/SDWebImageLottieCoder/Classes/SDImageLottieCoder.m +++ b/SDWebImageLottieCoder/Classes/SDImageLottieCoder.m @@ -15,6 +15,7 @@ #else @import librlottie; #endif +#import #define SD_TWO_CC(c1,c2) ((uint16_t)(((c2) << 8) | (c1))) @@ -58,6 +59,18 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio return CGSizeMake(resultWidth, resultHeight); } +static NSString *SDCalculateMD5(NSString *input) { + const char* str = [input UTF8String]; + unsigned char result[CC_MD5_DIGEST_LENGTH]; + CC_MD5(str, (CC_LONG)strlen(str), result); + + NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2]; + for(int i = 0; i