[vlc-commits] [Git][videolan/vlc][master] 8 commits: aout: auhal: avoid using sprintf
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Jan 10 10:14:19 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f754b6d5 by Marvin Scholz at 2024-01-10T09:57:27+00:00
aout: auhal: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
3117c2f6 by Marvin Scholz at 2024-01-10T09:57:27+00:00
libvlc: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
8fba6c29 by Marvin Scholz at 2024-01-10T09:57:27+00:00
access: cdda: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
b93f201c by Marvin Scholz at 2024-01-10T09:57:27+00:00
http: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
d0c5c9c3 by Marvin Scholz at 2024-01-10T09:57:27+00:00
access: ftp: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
9d9cc3eb by Marvin Scholz at 2024-01-10T09:57:27+00:00
demux: mkv: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
c077a35b by Marvin Scholz at 2024-01-10T09:57:27+00:00
misc: actions: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
8668a5ac by Marvin Scholz at 2024-01-10T09:57:27+00:00
player: avoid using sprintf
Use snprintf to avoid a deprecation warning about sprintf on Darwin platforms.
- - - - -
9 changed files:
- lib/video.c
- modules/access/cdda.c
- modules/access/ftp.c
- modules/access/http/message.c
- modules/audio_output/auhal.c
- modules/demux/mkv/chapter_command.cpp
- modules/demux/mkv/chapter_command.hpp
- src/misc/actions.c
- src/player/metadata.c
Changes:
=====================================
lib/video.c
=====================================
@@ -415,7 +415,7 @@ void libvlc_video_set_crop_ratio(libvlc_media_player_t *mp,
if (den == 0)
geometry[0] = '\0';
else
- sprintf(geometry, "%u:%u", num, den);
+ snprintf(geometry, ARRAY_SIZE(geometry), "%u:%u", num, den);
libvlc_video_set_crop(mp, geometry);
}
@@ -427,7 +427,7 @@ void libvlc_video_set_crop_window(libvlc_media_player_t *mp,
char geometry[4 * (3 * sizeof (unsigned) + 1)];
assert(width != 0 && height != 0);
- sprintf(geometry, "%ux%u+%u+%u", x, y, width, height);
+ snprintf(geometry, ARRAY_SIZE(geometry), "%ux%u+%u+%u", x, y, width, height);
libvlc_video_set_crop(mp, geometry);
}
@@ -437,7 +437,7 @@ void libvlc_video_set_crop_border(libvlc_media_player_t *mp,
{
char geometry[4 * (3 * sizeof (unsigned) + 1)];
- sprintf(geometry, "%u+%u+%u+%u", left, top, right, bottom);
+ snprintf(geometry, ARRAY_SIZE(geometry), "%u+%u+%u+%u", left, top, right, bottom);
libvlc_video_set_crop(mp, geometry);
}
=====================================
modules/access/cdda.c
=====================================
@@ -409,9 +409,9 @@ static char * BuildMusicbrainzDiscID( const vcddev_toc_t *p_toc,
char buffer[16];
- sprintf( buffer, "%02X", i_first );
+ snprintf( buffer, ARRAY_SIZE(buffer), "%02X", i_first );
gcry_md_write( hd, buffer, 2 );
- sprintf( buffer, "%02X", i_last );
+ snprintf( buffer, ARRAY_SIZE(buffer), "%02X", i_last );
gcry_md_write( hd, buffer, 2 );
/* LEAD OUT sector info */
@@ -423,12 +423,12 @@ static char * BuildMusicbrainzDiscID( const vcddev_toc_t *p_toc,
else
i_last_track_end = LBAPregap(p_toc->p_sectors[p_toc->i_tracks].i_lba);
- sprintf( buffer, "%08X", i_last_track_end );
+ snprintf( buffer, ARRAY_SIZE(buffer), "%08X", i_last_track_end );
gcry_md_write( hd, buffer, 8 );
for( int i = 0; i<i_total; i++ ) /* skip LEAD OUT */
{
- sprintf( buffer, "%08X", LBAPregap(p_toc->p_sectors[i].i_lba) );
+ snprintf( buffer, ARRAY_SIZE(buffer), "%08X", LBAPregap(p_toc->p_sectors[i].i_lba) );
gcry_md_write( hd, buffer, 8 );
}
=====================================
modules/access/ftp.c
=====================================
@@ -1199,7 +1199,7 @@ static int ftp_StartStream( vlc_object_t *p_access, access_sys_t *p_sys,
return VLC_EGENERIC;
}
- sprintf( psz_ipv4, "%u.%u.%u.%u", a1, a2, a3, a4 );
+ snprintf( psz_ipv4, ARRAY_SIZE(psz_ipv4), "%u.%u.%u.%u", a1, a2, a3, a4 );
psz_ip = psz_ipv4;
i_port = (p1 << 8) | p2;
}
=====================================
modules/access/http/message.c
=====================================
@@ -443,7 +443,7 @@ struct vlc_h2_frame *vlc_http_msg_h2_frame(const struct vlc_http_msg *m,
if (m->status >= 0)
{
assert(m->status < 1000);
- sprintf(status, "%hd", m->status);
+ snprintf(status, ARRAY_SIZE(status), "%hd", m->status);
headers[i][0] = ":status";
headers[i][1] = status;
i++;
=====================================
modules/audio_output/auhal.c
=====================================
@@ -393,7 +393,7 @@ static void
ReportDevice(audio_output_t *p_aout, UInt32 i_id, const char *name)
{
char deviceid[10];
- sprintf(deviceid, "%i", i_id);
+ snprintf(deviceid, ARRAY_SIZE(deviceid), "%i", i_id);
aout_HotplugReport(p_aout, deviceid, name);
}
@@ -1782,7 +1782,7 @@ static int Open(vlc_object_t *obj)
}
char deviceid[10];
- sprintf(deviceid, "%i", p_sys->i_new_selected_dev);
+ snprintf(deviceid, ARRAY_SIZE(deviceid), "%i", p_sys->i_new_selected_dev);
aout_DeviceReport(p_aout, deviceid);
/* remember the volume */
=====================================
modules/demux/mkv/chapter_command.cpp
=====================================
@@ -117,7 +117,7 @@ std::string dvd_chapter_codec_c::GetCodecName( bool f_for_title ) const
else */ if ( p_data[0] == MATROSKA_DVD_LEVEL_LU )
{
char psz_str[11];
- sprintf( psz_str, " (%c%c) ---", p_data[1], p_data[2] );
+ snprintf( psz_str, ARRAY_SIZE(psz_str), " (%c%c) ---", p_data[1], p_data[2] );
result = "--- DVD Menu";
result += psz_str;
}
@@ -131,7 +131,7 @@ std::string dvd_chapter_codec_c::GetCodecName( bool f_for_title ) const
{
uint16_t i_title = (p_data[2] << 8) + p_data[3];
char psz_str[20];
- sprintf( psz_str, " %d -----", i_title );
+ snprintf( psz_str, ARRAY_SIZE(psz_str), " %d -----", i_title );
result = "----- Title";
result += psz_str;
}
=====================================
modules/demux/mkv/chapter_command.hpp
=====================================
@@ -160,7 +160,7 @@ protected:
{
std::string result;
char s_value[6], s_reg_value[6];
- sprintf( s_value, "%.5d", value );
+ snprintf( s_value, ARRAY_SIZE(s_value), "%.5d", value );
if ( b_value )
{
@@ -170,7 +170,7 @@ protected:
}
else if ( value < 0x80 )
{
- sprintf( s_reg_value, "%.5d", GetPRM( value ) );
+ snprintf( s_reg_value, ARRAY_SIZE(s_reg_value), "%.5d", GetPRM( value ) );
result = "GPreg[";
result += s_value;
result += "] (";
@@ -179,7 +179,7 @@ protected:
}
else
{
- sprintf( s_reg_value, "%.5d", GetPRM( value ) );
+ snprintf( s_reg_value, ARRAY_SIZE(s_reg_value), "%.5d", GetPRM( value ) );
result = "SPreg[";
result += s_value;
result += "] (";
=====================================
src/misc/actions.c
=====================================
@@ -630,7 +630,7 @@ vlc_actions_get_keycodes(vlc_object_t *p_obj, const char *psz_key_name,
{
assert(strlen( psz_key_name ) <= MAXACTION);
char varname[12 /* "global-key-" */ + MAXACTION];
- sprintf( varname, "%skey-%s", b_global ? "global-" : "", psz_key_name );
+ snprintf( varname, ARRAY_SIZE(varname), "%skey-%s", b_global ? "global-" : "", psz_key_name );
*pp_keycodes = NULL;
=====================================
src/player/metadata.c
=====================================
@@ -95,7 +95,7 @@ vlc_player_AddMetadataLoudnessListener(vlc_player_t *player,
unsigned mode = listener_id->option == VLC_PLAYER_METADATA_LOUDNESS_FULL ? 4 : 0;
char chain[sizeof("ebur128{mode=X}")];
- sprintf(chain, "ebur128{mode=%1u}", mode);
+ snprintf(chain, ARRAY_SIZE(chain), "ebur128{mode=%1u}", mode);
const struct vlc_audio_meter_plugin_owner meter_plugin_owner =
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b92564463b451d26d7e228621a09193ebedfc89f...8668a5ace7e3ed98d33f0ad13672860f34758c29
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b92564463b451d26d7e228621a09193ebedfc89f...8668a5ace7e3ed98d33f0ad13672860f34758c29
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list