From efd91b90c2d974ea098412f08ddc3aa93eeb2d05 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 14 Feb 2026 22:00:21 -0500 Subject: [PATCH] =?UTF-8?q?standards=E2=80=91compliant=20thread=20id=20str?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MagickCore/thread-private.h | 24 ++++++++++++++++++++++++ coders/coders-private.h | 7 ------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/MagickCore/thread-private.h b/MagickCore/thread-private.h index bccc689d56..7ca31b69c5 100644 --- a/MagickCore/thread-private.h +++ b/MagickCore/thread-private.h @@ -85,6 +85,30 @@ static inline MagickThreadType GetMagickThreadId(void) #endif } +static inline void DecorateFilenameWithThreadId(const char *filename, + char *thread_filename) +{ + MagickThreadType + id; + + char + thread_id[2*sizeof(id)+1]; + + ssize_t + i; + + unsigned char + bytes[sizeof(id)]; + + id=GetMagickThreadId(); + (void) memcpy(bytes,&id,sizeof(id)); + for (i=0; i < (ssize_t) sizeof(bytes); i++) + (void) sprintf(thread_id+2*i,"%02x",bytes[i]); + thread_id[sizeof(thread_id)-1]='\0'; + (void) FormatLocaleString(thread_filename,MagickPathExtent,"%s|%s",thread_id, + filename); +} + static inline size_t GetMagickThreadSignature(void) { #if defined(MAGICKCORE_THREAD_SUPPORT) diff --git a/coders/coders-private.h b/coders/coders-private.h index f4639b49ba..4c220e6a89 100644 --- a/coders/coders-private.h +++ b/coders/coders-private.h @@ -36,13 +36,6 @@ extern ModuleExport size_t \ extern ModuleExport void \ Unregister ## coder ## Image(void); -static inline void DecorateFilenameWithThreadId(const char *filename, - char *thread_filename) -{ - (void) FormatLocaleString(thread_filename,MagickPathExtent,"%.20g|%s", - (double) GetMagickThreadId(),filename); -} - static inline ImageType IdentifyImageCoderType(const Image *image, ExceptionInfo *exception) {