From b7c74cd5b22618d544a3f4ae124985d4837e3a22 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jun 2015 22:12:13 +0000 Subject: new mir_snprintf templates without SIZEOF git-svn-id: http://svn.miranda-ng.org/main/trunk@14002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_core.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/m_core.h b/include/m_core.h index c35fb86aa0..4515529b06 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -61,8 +61,6 @@ typedef uint32_t MCONTACT; typedef uint32_t MEVENT; - - /////////////////////////////////////////////////////////////////////////////// // events, hooks & services @@ -733,6 +731,35 @@ MIR_CORE_DLL(void) UnloadCoreModule(void); #if defined(__cplusplus) } + +template +inline int mir_snprintf(char(&buffer)[_Size], const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + return mir_vsnprintf(buffer, _Size, fmt, args); +} + +template +inline int mir_snwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, ...) +{ + va_list args; + va_start(args, fmt); + return mir_vsnwprintf(buffer, _Size, fmt, args); +} + +template +inline int mir_vsnprintf(char(&buffer)[_Size], const char* fmt, va_list va) +{ + return mir_vsnprintf(buffer, _Size, fmt, va); +} + +template +inline int mir_vsnwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, va_list va) +{ + return mir_vsnwprintf(buffer, _Size, fmt, va); +} + #endif #ifndef MIR_CORE_EXPORTS -- cgit v1.2.3