use size of output buffer for snprintf; on the way changed rebirth-specific song file to dxx-r.sng to respect hog 8+3 file convention
This commit is contained in:
parent
091623d196
commit
fc421b290a
|
@ -3,6 +3,8 @@ D1X-Rebirth Changelog
|
|||
20120601
|
||||
--------
|
||||
main/kconfig.c, main/kconfig.h, main/menu.c, main/playsave.c, main/playsave.h: Introduced sensitivity sliders for keyboard which cause movement increase the longer the designated key is pressed
|
||||
main/gauges.c, main/menu.c, main/net_udp.c, main/songs.c, misc/physfsx.c: use size of output buffer for snprintf; on the way changed rebirth-specific song file to dxx-r.sng to respect hog 8+3 file convention
|
||||
|
||||
|
||||
20120527
|
||||
--------
|
||||
|
|
|
@ -2336,7 +2336,7 @@ void show_HUD_names()
|
|||
if( Game_mode & GM_BOUNTY && pnum == Bounty_target )
|
||||
strncpy( s, "Target", 6 );
|
||||
else if (show_name)
|
||||
snprintf( s, strlen(Players[pnum].callsign)+1, "%s", Players[pnum].callsign );
|
||||
snprintf( s, sizeof(s), "%s", Players[pnum].callsign );
|
||||
if (show_typing && multi_sending_message[pnum])
|
||||
{
|
||||
if (strlen(s))
|
||||
|
|
|
@ -1737,9 +1737,9 @@ void do_sound_menu()
|
|||
char old_CMLevelMusicPath[PATH_MAX+1], old_CMMiscMusic0[PATH_MAX+1];
|
||||
|
||||
memset(old_CMLevelMusicPath, 0, sizeof(char)*(PATH_MAX+1));
|
||||
snprintf(old_CMLevelMusicPath, strlen(GameCfg.CMLevelMusicPath)+1, "%s", GameCfg.CMLevelMusicPath);
|
||||
snprintf(old_CMLevelMusicPath, sizeof(old_CMLevelMusicPath), "%s", GameCfg.CMLevelMusicPath);
|
||||
memset(old_CMMiscMusic0, 0, sizeof(char)*(PATH_MAX+1));
|
||||
snprintf(old_CMMiscMusic0, strlen(GameCfg.CMMiscMusic[SONG_TITLE])+1, "%s", GameCfg.CMMiscMusic[SONG_TITLE]);
|
||||
snprintf(old_CMMiscMusic0, sizeof(old_CMMiscMusic0), "%s", GameCfg.CMMiscMusic[SONG_TITLE]);
|
||||
|
||||
MALLOC(m, newmenu_item, SOUND_MENU_NITEMS);
|
||||
if (!m)
|
||||
|
|
|
@ -661,7 +661,7 @@ void net_udp_manual_join_game()
|
|||
net_udp_init();
|
||||
|
||||
memset(&dj->addrbuf,'\0', sizeof(char)*128);
|
||||
snprintf(dj->addrbuf, sizeof(char)*(strlen(GameArg.MplUdpHostAddr)+1), "%s", GameArg.MplUdpHostAddr);
|
||||
snprintf(dj->addrbuf, sizeof(dj->addrbuf), "%s", GameArg.MplUdpHostAddr);
|
||||
|
||||
if (GameArg.MplUdpHostPort != 0)
|
||||
snprintf(dj->portbuf, sizeof(dj->portbuf), "%d", GameArg.MplUdpHostPort);
|
||||
|
|
|
@ -75,14 +75,9 @@ void songs_init()
|
|||
d_free(BIMSongs);
|
||||
|
||||
memset(sng_file, '\0', sizeof(sng_file));
|
||||
if (Current_mission != NULL) // try MISSION_NAME.sngdxx - might be rarely used but handy if you want a songfile for a specific mission outside of the mission hog file. use special extension to not crash with other ports of the game
|
||||
{
|
||||
snprintf(sng_file, strlen(Current_mission_filename)+8, "%s.sngdxx", Current_mission_filename);
|
||||
fp = PHYSFSX_openReadBuffered(sng_file);
|
||||
}
|
||||
|
||||
if (fp == NULL) // try descent.sngdxx - a songfile specifically for dxx which level authors CAN use (dxx does not care if descent.sng contains MP3/OGG/etc. as well) besides the normal descent.sng containing files other versions of the game cannot play. this way a mission can contain a DOS-Descent compatible OST (hmp files) as well as a OST using MP3, OGG, etc.
|
||||
fp = PHYSFSX_openReadBuffered( "descent.sngdxx" );
|
||||
if (fp == NULL) // try dxx-r.sng - a songfile specifically for dxx which level authors CAN use (dxx does not care if descent.sng contains MP3/OGG/etc. as well) besides the normal descent.sng containing files other versions of the game cannot play. this way a mission can contain a DOS-Descent compatible OST (hmp files) as well as a OST using MP3, OGG, etc.
|
||||
fp = PHYSFSX_openReadBuffered( "dxx-r.sng" );
|
||||
|
||||
if (fp == NULL) // try to open regular descent.sng
|
||||
fp = PHYSFSX_openReadBuffered( "descent.sng" );
|
||||
|
|
|
@ -168,7 +168,7 @@ int PHYSFSX_addRelToSearchPath(char *relname, int add_to_end)
|
|||
{
|
||||
char relname2[PATH_MAX], pathname[PATH_MAX];
|
||||
|
||||
snprintf(relname2, strlen(relname)+1, "%s", relname);
|
||||
snprintf(relname2, sizeof(relname2), "%s", relname);
|
||||
PHYSFSEXT_locateCorrectCase(relname2);
|
||||
|
||||
if (!PHYSFSX_getRealPath(relname2, pathname))
|
||||
|
@ -181,7 +181,7 @@ int PHYSFSX_removeRelFromSearchPath(char *relname)
|
|||
{
|
||||
char relname2[PATH_MAX], pathname[PATH_MAX];
|
||||
|
||||
snprintf(relname2, strlen(relname)+1, "%s", relname);
|
||||
snprintf(relname2, sizeof(relname2), "%s", relname);
|
||||
PHYSFSEXT_locateCorrectCase(relname2);
|
||||
|
||||
if (!PHYSFSX_getRealPath(relname2, pathname))
|
||||
|
@ -196,7 +196,7 @@ int PHYSFSX_fsize(char *hogname)
|
|||
char hogname2[PATH_MAX];
|
||||
int size;
|
||||
|
||||
snprintf(hogname2, strlen(hogname)+1, "%s", hogname);
|
||||
snprintf(hogname2, sizeof(hogname2), "%s", hogname);
|
||||
PHYSFSEXT_locateCorrectCase(hogname2);
|
||||
|
||||
fp = PHYSFS_openRead(hogname2);
|
||||
|
@ -400,7 +400,7 @@ int PHYSFSX_exists(const char *filename, int ignorecase)
|
|||
if (!ignorecase)
|
||||
return PHYSFS_exists(filename);
|
||||
|
||||
snprintf(filename2, strlen(filename)+1, "%s", filename);
|
||||
snprintf(filename2, sizeof(filename2), "%s", filename);
|
||||
PHYSFSEXT_locateCorrectCase(filename2);
|
||||
|
||||
return PHYSFS_exists(filename2);
|
||||
|
@ -419,7 +419,7 @@ PHYSFS_file *PHYSFSX_openReadBuffered(char *filename)
|
|||
filename++;
|
||||
}
|
||||
|
||||
snprintf(filename2, strlen(filename)+1, "%s", filename);
|
||||
snprintf(filename2, sizeof(filename2), "%s", filename);
|
||||
PHYSFSEXT_locateCorrectCase(filename2);
|
||||
|
||||
fp = PHYSFS_openRead(filename2);
|
||||
|
|
Loading…
Reference in a new issue