From 08f88ff314eeaa165dd76272f92c8030cc879ec2 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Date: Fri, 30 Aug 2024 07:06:33 +0000 Subject: [PATCH] Resolved multiple warnings on `Apple` targets. (#1145) * Update CFFI.cpp * Update Dynamic.cpp * Update mac-toolchain.xml * Update mac-toolchain.xml * Update my_api.cpp * Update Immix.cpp * Removed whitespaces and adjusted ios and tvos toolchains. --- src/Dynamic.cpp | 2 +- src/hx/CFFI.cpp | 2 +- src/hx/gc/Immix.cpp | 6 +++--- src/hx/libs/mysql/my_api.cpp | 6 +++--- toolchain/appletvos-toolchain.xml | 12 ++++++++---- toolchain/appletvsim-toolchain.xml | 12 ++++++++---- toolchain/iphoneos-toolchain.xml | 6 ++++-- toolchain/iphonesim-toolchain.xml | 6 ++++-- toolchain/mac-toolchain.xml | 18 +++++++++++++----- 9 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/Dynamic.cpp b/src/Dynamic.cpp index 7a51401b5..9d52c070e 100644 --- a/src/Dynamic.cpp +++ b/src/Dynamic.cpp @@ -217,7 +217,7 @@ class PointerData : public hx::Object String toString() { char buf[100]; - sprintf(buf,"Pointer(%p)", mValue); + snprintf(buf,sizeof(buf),"Pointer(%p)", mValue); return String(buf); } String __ToString() const { return String(mValue); } diff --git a/src/hx/CFFI.cpp b/src/hx/CFFI.cpp index 81575a67c..592c8e230 100644 --- a/src/hx/CFFI.cpp +++ b/src/hx/CFFI.cpp @@ -106,7 +106,7 @@ class Abstract_obj : public Object return _hxcpp_toString( Dynamic(this) ); char buffer[40]; - sprintf(buffer,"0x%p", mHandle); + snprintf(buffer,sizeof(buffer),"0x%p", mHandle); return HX_CSTRING("Abstract(") + __hxcpp_get_kind(this) + diff --git a/src/hx/gc/Immix.cpp b/src/hx/gc/Immix.cpp index 458e33a4f..253199c53 100644 --- a/src/hx/gc/Immix.cpp +++ b/src/hx/gc/Immix.cpp @@ -4632,11 +4632,11 @@ class GlobalAllocator char strBuf[100]; if (byteslast_error,err,param); + snprintf(m->last_error,sizeof(m->last_error),err,param); free(p2); return; } } - sprintf(m->last_error,err,param); + snprintf(m->last_error,sizeof(m->last_error),err,param); m->errcode = -1; } @@ -408,7 +408,7 @@ const char *mysql_character_set_name( MYSQL *m ) { const char *name = myp_charset_name(m->infos.server_charset); if( name == NULL ) { static char tmp[512]; - sprintf(tmp,"#%d",m->infos.server_charset); + snprintf(tmp,sizeof(tmp),"#%d",m->infos.server_charset); return tmp; } return name; diff --git a/toolchain/appletvos-toolchain.xml b/toolchain/appletvos-toolchain.xml index 7bc504e1b..9b70a3eeb 100644 --- a/toolchain/appletvos-toolchain.xml +++ b/toolchain/appletvos-toolchain.xml @@ -24,8 +24,10 @@ - - + + + + @@ -69,8 +71,10 @@ - - + + + + diff --git a/toolchain/appletvsim-toolchain.xml b/toolchain/appletvsim-toolchain.xml index a571f07f4..1e80b5abd 100644 --- a/toolchain/appletvsim-toolchain.xml +++ b/toolchain/appletvsim-toolchain.xml @@ -22,8 +22,10 @@ - - + + + + @@ -76,8 +78,10 @@ - - + + + + diff --git a/toolchain/iphoneos-toolchain.xml b/toolchain/iphoneos-toolchain.xml index c3fd3307e..305aa6a49 100644 --- a/toolchain/iphoneos-toolchain.xml +++ b/toolchain/iphoneos-toolchain.xml @@ -95,8 +95,10 @@ - - + + + + diff --git a/toolchain/iphonesim-toolchain.xml b/toolchain/iphonesim-toolchain.xml index c509b4edd..b98a703ad 100644 --- a/toolchain/iphonesim-toolchain.xml +++ b/toolchain/iphonesim-toolchain.xml @@ -89,8 +89,10 @@ - - + + + + diff --git a/toolchain/mac-toolchain.xml b/toolchain/mac-toolchain.xml index c8e0f760d..f7928cdb0 100644 --- a/toolchain/mac-toolchain.xml +++ b/toolchain/mac-toolchain.xml @@ -31,8 +31,11 @@ - - + + + + + @@ -74,8 +77,10 @@ - - + + + + @@ -99,7 +104,10 @@ - + + + +