Commit 5851ba86 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

opengl32: Replace sprintf with snprintf/asprintf to avoid deprecation warnings on macOS.

parent 3af1e7df
...@@ -318,13 +318,13 @@ static HKEY open_hkcu_key( const char *name ) ...@@ -318,13 +318,13 @@ static HKEY open_hkcu_key( const char *name )
return 0; return 0;
sid = ((TOKEN_USER *)sid_data)->User.Sid; sid = ((TOKEN_USER *)sid_data)->User.Sid;
len = sprintf( buffer, "\\Registry\\User\\S-%u-%u", sid->Revision, len = snprintf( buffer, sizeof(buffer), "\\Registry\\User\\S-%u-%u", sid->Revision,
(int)MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5], (int)MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5],
sid->IdentifierAuthority.Value[4] ), sid->IdentifierAuthority.Value[4] ),
MAKEWORD( sid->IdentifierAuthority.Value[3], MAKEWORD( sid->IdentifierAuthority.Value[3],
sid->IdentifierAuthority.Value[2] ))); sid->IdentifierAuthority.Value[2] )));
for (i = 0; i < sid->SubAuthorityCount; i++) for (i = 0; i < sid->SubAuthorityCount; i++)
len += sprintf( buffer + len, "-%u", (int)sid->SubAuthority[i] ); len += snprintf( buffer + len, sizeof(buffer) - len, "-%u", (int)sid->SubAuthority[i] );
ascii_to_unicode( bufferW, buffer, len ); ascii_to_unicode( bufferW, buffer, len );
hkcu = reg_open_key( NULL, bufferW, len * sizeof(WCHAR) ); hkcu = reg_open_key( NULL, bufferW, len * sizeof(WCHAR) );
...@@ -491,9 +491,9 @@ static const GLubyte *wrap_glGetString( TEB *teb, GLenum name ) ...@@ -491,9 +491,9 @@ static const GLubyte *wrap_glGetString( TEB *teb, GLenum name )
/* 4.4 depends on ARB_buffer_storage, which we don't support on wow64. */ /* 4.4 depends on ARB_buffer_storage, which we don't support on wow64. */
if (major > 4 || (major == 4 && minor >= 4)) if (major > 4 || (major == 4 && minor >= 4))
{ {
char *str = malloc( 3 + strlen( rest ) + 1 ); char *str = NULL;
sprintf( str, "4.3%s", rest ); asprintf( &str, "4.3%s", rest );
if (InterlockedCompareExchangePointer( (void **)&ptr->u.context->version_string, str, NULL )) if (InterlockedCompareExchangePointer( (void **)&ptr->u.context->version_string, str, NULL ))
free( str ); free( str );
return ptr->u.context->version_string; return ptr->u.context->version_string;
...@@ -536,7 +536,7 @@ static char *build_extension_list( TEB *teb ) ...@@ -536,7 +536,7 @@ static char *build_extension_list( TEB *teb )
capacity = max( capacity, len + strlen( extension ) + 2 ); capacity = max( capacity, len + strlen( extension ) + 2 );
if (!(tmp = realloc( available_extensions, capacity ))) break; if (!(tmp = realloc( available_extensions, capacity ))) break;
available_extensions = tmp; available_extensions = tmp;
len += sprintf( available_extensions + len, "%s ", extension ); len += snprintf( available_extensions + len, capacity - len, "%s ", extension );
} }
if (len) available_extensions[len - 1] = 0; if (len) available_extensions[len - 1] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment