Commits

Torr_Samaho  committed a8578c5

- NETWORK_ReadString now returns const char * instead of char (this required a lot of changes in the code)
- the vote system internally now mostly uses FStrings instead of char arrays
- Fixed some potential issues during map authentication.

SVN r1140 (trunk)

  • Participants
  • Parent commits d69d024

Comments (0)

Files changed (20)

File docs/Skulltag Version History.txt

 -	- Fixed: A_CustomComboAttack doesn't spawn the missile on the clients online. [Torr Samaho]
 -	- Fixed: Entering a command in the console with 64 or more chars may cause a crash. [Torr Samaho]
 -	- Fixed: If a client collects all pieces of one weapon online, but not all on the same level, it won't get the completed weapon before the next map change. [Torr Samaho]
+-	- Fixed some potential issues during map authentication. [Torr Samaho]
 !	- Survival co-op is now disabled in hubs. [Carnevil]
 !	- Skulltag's invasion spawners are now defined in skulltag.pk3. [Carnevil]
 !	- Skulltag.wad is now loaded before doom2.wad. This should fix certain texture errors. [Carnevil]

File src/MD5/MD5Checksum.cpp

 				A buffer of zero length can be checksummed; all buffers of zero length 
 				will return the same checksum. 
 *****************************************************************************************/
-void CMD5Checksum::GetMD5(BYTE* pBuf, UINT nLength, char *pszOutString)
+void CMD5Checksum::GetMD5(BYTE* pBuf, UINT nLength, FString &OutString)
 {
 	//entry invariants
 //	AfxIsValidAddress(pBuf,nLength,FALSE);
 	//calculate and return the checksum
 	CMD5Checksum MD5Checksum;
 	MD5Checksum.Update( pBuf, nLength );
-	MD5Checksum.Final(pszOutString);
+	MD5Checksum.Final(OutString);
 }
 
 
 NOTES:			Performs the final MD5 checksum calculation ('Update' does most of the work,
 				this function just finishes the calculation.) 
 *****************************************************************************************/
-void CMD5Checksum::Final(char *pszOutString)
+void CMD5Checksum::Final(FString &OutString)
 {
 	//Save number of bits
 	BYTE Bits[8];
 		strcat( szMD5String, sz );
 	}
 
-	sprintf( pszOutString, szMD5String );
+	OutString = szMD5String;
 }
 
 

File src/MD5/MD5Checksum.h

 {
 public:
 	//interface functions for the RSA MD5 calculation
-	static void GetMD5(BYTE* pBuf, UINT nLength, char *pszOutString);
+	static void GetMD5(BYTE* pBuf, UINT nLength, FString &OutString);
 //	static CString GetMD5(CFile& File);
 //	static CString GetMD5(const CString& strFilePath);
 
 	//RSA MD5 implementation
 	void Transform(BYTE Block[64]);
 	void Update(BYTE* Input, ULONG nInputLen);
-	void Final(char *pszOutString);
+	void Final(FString &OutString);
 	inline DWORD RotateLeft(DWORD x, int n);
 	inline void FF( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
 	inline void GG( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);

File src/callvote.cpp

 static	void			callvote_EndVote( void );
 static	ULONG			callvote_CountPlayersWhoVotedYes( void );
 static	ULONG			callvote_CountPlayersWhoVotedNo( void );
-static	bool			callvote_CheckValidity( char *pszCommand, char *pszParameters );
+static	bool			callvote_CheckValidity( FString &Command, FString &Parameters );
 
 //*****************************************************************************
 //	FUNCTIONS
 
 //*****************************************************************************
 //
-void CALLVOTE_BeginVote( char *pszCommand, char *pszParameters, ULONG ulPlayer )
+void CALLVOTE_BeginVote( FString Command, FString Parameters, ULONG ulPlayer )
 {
 	// Don't allow a vote in the middle of another vote.
 	if ( g_VoteState != VOTESTATE_NOVOTE )
 		return;
 
 	// Check and make sure all the parameters are valid.
-	if ( callvote_CheckValidity( pszCommand, pszParameters ) == false )
+	if ( callvote_CheckValidity( Command, Parameters ) == false )
 		return;
 
 	// Play the announcer sound for this.
 	ANNOUNCER_PlayEntry( cl_announcer, "VoteNow" );
 
-	g_VoteCommand = pszCommand;
+	g_VoteCommand = Command;
 	g_VoteCommand += " ";
-	g_VoteCommand += pszParameters;
+	g_VoteCommand += Parameters;
 	g_ulVoteCaller = ulPlayer;
 
 	g_VoteState = VOTESTATE_INVOTE;
 
 	// Inform clients about the vote being called.
 	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
-		SERVERCOMMANDS_CallVote( ulPlayer, pszCommand, pszParameters );
+		SERVERCOMMANDS_CallVote( ulPlayer, Command, Parameters );
 }
 
 //*****************************************************************************
 
 //*****************************************************************************
 //
-static bool callvote_CheckValidity( char *pszCommand, char *pszParameters )
+static bool callvote_CheckValidity( FString &Command, FString &Parameters )
 {
 	ULONG	ulIdx;
 	ULONG	ulVoteCmd;
 	char	szPlayerName[64];
 
-	if (( pszCommand == NULL ) || ( pszParameters == NULL ))
-		return ( false );
-
 	// First, figure out what kind of command we're trying to vote on.
-	if ( stricmp( "kick", pszCommand ) == 0 )
+	if ( Command.CompareNoCase( "kick" ) == 0 )
 		ulVoteCmd = VOTECMD_KICK;
 	else {
 		int i = 0;
-		while( pszParameters[i] != '\0' )
+		while( Parameters.GetChars()[i] != '\0' )
 		{
-		  if( pszParameters[i] == ';' || pszParameters[i] == ' ' )
+		  if( Parameters.GetChars()[i] == ';' || Parameters.GetChars()[i] == ' ' )
 			  	return ( false );
 		  i++;
 		}
-		if ( stricmp( "map", pszCommand ) == 0 )
+		if ( Command.CompareNoCase( "map" ) == 0 )
 			ulVoteCmd = VOTECMD_MAP;
-		else if ( stricmp( "changemap", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "changemap" ) == 0 )
 			ulVoteCmd = VOTECMD_CHANGEMAP;
-		else if ( stricmp( "fraglimit", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "fraglimit" ) == 0 )
 			ulVoteCmd = VOTECMD_FRAGLIMIT;
-		else if ( stricmp( "timelimit", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "timelimit" ) == 0 )
 			ulVoteCmd = VOTECMD_TIMELIMIT;
-		else if ( stricmp( "winlimit", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "winlimit" ) == 0 )
 			ulVoteCmd = VOTECMD_WINLIMIT;
-		else if ( stricmp( "duellimit", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "duellimit" ) == 0 )
 			ulVoteCmd = VOTECMD_DUELLIMIT;
-		else if ( stricmp( "pointlimit", pszCommand ) == 0 )
+		else if ( Command.CompareNoCase( "pointlimit" ) == 0 )
 			ulVoteCmd = VOTECMD_POINTLIMIT;
 		else
 			return ( false );
 	}
 
 	// Then, make sure the parameter for each vote is valid.
-	int parameterInt = atoi( pszParameters );
+	int parameterInt = atoi( Parameters.GetChars() );
 	switch ( ulVoteCmd )
 	{
 	case VOTECMD_KICK:
 			// Compare the parameter to the version of the player's name without color codes.
 			sprintf( szPlayerName, players[ulIdx].userinfo.netname );
 			V_RemoveColorCodes( szPlayerName );
-			if ( stricmp( pszParameters, szPlayerName ) == 0 ){
+			if ( Parameters.CompareNoCase( szPlayerName ) == 0 ){
 				// to prevent a player from escaping a kick vote by renaming, we store his ID at the beginning of the vote
 				g_ulKickVoteTargetPlayerIdx = ulIdx;
 				break;
 	case VOTECMD_CHANGEMAP:
 
 		// Don't allow the command if the map doesn't exist.
-		if ( !P_CheckIfMapExists( pszParameters ) )
+		if ( !P_CheckIfMapExists( Parameters.GetChars() ) )
 			return ( false );
 		// Don't allow to leave the maprotation (Only the server knows the maprotation)
 		if ( NETWORK_GetState( ) == NETSTATE_SERVER )
 		{
-			if ( sv_maprotation && ( MAPROTATION_IsMapInRotation( pszParameters ) == false ) )
+			if ( sv_maprotation && ( MAPROTATION_IsMapInRotation( Parameters.GetChars() ) == false ) )
 			{
 				SERVER_PrintfPlayer( PRINT_HIGH, SERVER_GetCurrentClient(), "This map is not in the map rotation.\n" );
-				Printf ( "map %s is not in the map rotation\n", pszParameters );
+				Printf ( "map %s is not in the map rotation\n", Parameters.GetChars() );
 				return ( false );
 			}
 		}
 			return ( false );
 		else if ( parameterInt == 0 )
 		{
-			if (( pszParameters[0] != '0' ) || ( strlen( pszParameters ) != 1 ))
+			if (( Parameters.GetChars()[0] != '0' ) || ( Parameters.Len() != 1 ))
 				return ( false );
 		}
-		sprintf( pszParameters, "%d", parameterInt );
+		Parameters.Format( "%d", parameterInt );
 		break;
 	case VOTECMD_TIMELIMIT:
 	case VOTECMD_POINTLIMIT:
 			return ( false );
 		else if ( parameterInt == 0 )
 		{
-			if (( pszParameters[0] != '0' ) || ( strlen( pszParameters ) != 1 ))
+			if (( Parameters.GetChars()[0] != '0' ) || ( Parameters.Len() != 1 ))
 				return ( false );
 		}
-		sprintf( pszParameters, "%d", parameterInt );
+		Parameters.Format( "%d", parameterInt );
 		break;
 	default:
 

File src/callvote.h

 void			CALLVOTE_Construct( void );
 void			CALLVOTE_Tick( void );
 //void			CALLVOTE_Render( void );
-void			CALLVOTE_BeginVote( char *pszCommand, char *pszParameters, ULONG ulPlayer );
+void			CALLVOTE_BeginVote( FString Command, FString Parameters, ULONG ulPlayer );
 void			CALLVOTE_ClearVote( void );
 bool			CALLVOTE_VoteYes( ULONG ulPlayer );
 bool			CALLVOTE_VoteNo( ULONG ulPlayer );

File src/cl_demo.cpp

 //
 void CLIENTDEMO_ReadPacket( void )
 {
-	LONG	lCommand;
-	char	*pszString;
+	LONG		lCommand;
+	const char	*pszString;
 
 	while ( 1 )
 	{  

File src/cl_main.cpp

 
 //*****************************************************************************
 //
-void CLIENT_AuthenticateLevel( char *pszMapName )
-{
-	char		szChecksum[64];
+void CLIENT_AuthenticateLevel( const char *pszMapName )
+{
+	FString		Checksum;
 	MapData		*pMap;
 
 	// [BB] Check if the wads contain the map at all. If not, don't send any checksums.
 	}
 
 	// Generate and send checksums for the map lumps.
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_VERTEXES, szChecksum );
-	NETWORK_WriteString( &g_LocalBuffer.ByteStream, szChecksum );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_LINEDEFS, szChecksum );
-	NETWORK_WriteString( &g_LocalBuffer.ByteStream, szChecksum );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SIDEDEFS, szChecksum );
-	NETWORK_WriteString( &g_LocalBuffer.ByteStream, szChecksum );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SECTORS, szChecksum );
-	NETWORK_WriteString( &g_LocalBuffer.ByteStream, szChecksum );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_VERTEXES, Checksum );
+	NETWORK_WriteString( &g_LocalBuffer.ByteStream, Checksum.GetChars() );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_LINEDEFS, Checksum );
+	NETWORK_WriteString( &g_LocalBuffer.ByteStream, Checksum.GetChars() );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SIDEDEFS, Checksum );
+	NETWORK_WriteString( &g_LocalBuffer.ByteStream, Checksum.GetChars() );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SECTORS, Checksum );
+	NETWORK_WriteString( &g_LocalBuffer.ByteStream, Checksum.GetChars() );
 
 	// Finally, free the map.
 	delete ( pMap );
 
 //*****************************************************************************
 //
-AActor *CLIENT_SpawnThing( char *pszName, fixed_t X, fixed_t Y, fixed_t Z, LONG lNetID )
+AActor *CLIENT_SpawnThing( const char *pszName, fixed_t X, fixed_t Y, fixed_t Z, LONG lNetID )
 {
 	AActor			*pActor;
 	const PClass	*pType;
 
 //*****************************************************************************
 //
-void CLIENT_SpawnMissile( char *pszName, fixed_t X, fixed_t Y, fixed_t Z, fixed_t MomX, fixed_t MomY, fixed_t MomZ, LONG lNetID, LONG lTargetNetID )
+void CLIENT_SpawnMissile( const char *pszName, fixed_t X, fixed_t Y, fixed_t Z, fixed_t MomX, fixed_t MomY, fixed_t MomZ, LONG lNetID, LONG lTargetNetID )
 {
 	AActor				*pActor;
 	const PClass		*pType;
 	LONG		lInflictorID;
 	LONG		lHealth;
 	FName		MOD;
-	char		*pszString;
+	const char	*pszString;
 	FName		DamageType;
 	AActor		*pSource;
 	AActor		*pInflictor;
 {
 	ULONG		ulPlayer;
 	LONG		lArmorAmount;
-	char		*pszArmorIconName;
+	const char	*pszArmorIconName;
 	AInventory	*pArmor;
 
 	// Read in the player whose armor display is updated.
 	char		szName[MAXPLAYERNAME + 1];
 	LONG		lGender = 0;
 	LONG		lColor = 0;
-	char		*pszSkin = NULL;
+	const char	*pszSkin = NULL;
 	LONG		lRailgunTrailColor = 0;
 	LONG		lHandicap = 0;
 	LONG		lSkin;
 static void client_SetPlayerAmmoCapacity( BYTESTREAM_s *pByteStream )
 {
 	ULONG			ulPlayer;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lMaxAmount;
 	AInventory		*pAmmo;
 
 //
 static void client_PlayerSay( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulPlayer;
-	ULONG	ulMode;
-	char	*pszString;
+	ULONG		ulPlayer;
+	ULONG		ulMode;
+	const char	*pszString;
 
 	// Read in the player who's supposed to be talking.
 	ulPlayer = NETWORK_ReadByte( pByteStream );
 	fixed_t			X;
 	fixed_t			Y;
 	fixed_t			Z;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lID;
 
 	// Read in the XYZ location of the item.
 	fixed_t			X;
 	fixed_t			Y;
 	fixed_t			Z;
-	char			*pszName;
+	const char		*pszName;
 
 	// Read in the XYZ location of the item.
 	X = NETWORK_ReadShort( pByteStream ) << FRACBITS;
 	fixed_t			X;
 	fixed_t			Y;
 	fixed_t			Z;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lID;
 
 	// Read in the XYZ location of the item.
 	fixed_t			X;
 	fixed_t			Y;
 	fixed_t			Z;
-	char			*pszName;
+	const char		*pszName;
 
 	// Read in the XYZ location of the item.
 	X = NETWORK_ReadLong( pByteStream );
 //
 static void client_SetThingSound( BYTESTREAM_s *pByteStream )
 {
-	LONG	lID;
-	ULONG	ulSound;
-	char	*pszSound;
-	AActor	*pActor;
+	LONG		lID;
+	ULONG		ulSound;
+	const char	*pszSound;
+	AActor		*pActor;
 
 	// Get the ID of the actor whose translation is being updated.
 	lID = NETWORK_ReadShort( pByteStream );
 	fixed_t			X;
 	fixed_t			Y;
 	fixed_t			Z;
-	char			*pszName;
+	const char		*pszName;
 	ULONG			ulState;
 	bool			bReceiveTranslation;
 	AActor			*pActor;
 //
 static void client_Print( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulPrintLevel;
-	char	*pszString;
+	ULONG		ulPrintLevel;
+	const char	*pszString;
 
 	// Read in the print level.
 	ulPrintLevel = NETWORK_ReadByte( pByteStream );
 //
 static void client_PrintMid( BYTESTREAM_s *pByteStream )
 {
-	char	*pszString;
-	bool	bBold;
+	const char	*pszString;
+	bool		bBold;
 
 	// Read in the string that's supposed to be printed.
 	pszString = NETWORK_ReadString( pByteStream );
 	LONG		lHUDHeight;
 	LONG		lColor;
 	float		fHoldTime;
-	char		*pszFont;
+	const char	*pszFont;
 	bool		bLog;
 	LONG		lID;
 	DHUDMessage	*pMsg;
 	LONG				lColor;
 	float				fHoldTime;
 	float				fFadeOutTime;
-	char				*pszFont;
+	const char			*pszFont;
 	bool				bLog;
 	LONG				lID;
 	DHUDMessageFadeOut	*pMsg;
 	float					fHoldTime;
 	float					fFadeInTime;
 	float					fFadeOutTime;
-	char					*pszFont;
+	const char				*pszFont;
 	bool					bLog;
 	LONG					lID;
 	DHUDMessageFadeInOut	*pMsg;
 	float						fTypeOnTime;
 	float						fHoldTime;
 	float						fFadeOutTime;
-	char						*pszFont;
+	const char					*pszFont;
 	bool						bLog;
 	LONG						lID;
 	DHUDMessageTypeOnFadeOut	*pMsg;
 //
 static void client_SpawnMissile( BYTESTREAM_s *pByteStream )
 {
-	char				*pszName;
+	const char			*pszName;
 	fixed_t				X;
 	fixed_t				Y;
 	fixed_t				Z;
 //
 static void client_SpawnMissileExact( BYTESTREAM_s *pByteStream )
 {
-	char				*pszName;
+	const char			*pszName;
 	fixed_t				X;
 	fixed_t				Y;
 	fixed_t				Z;
 //
 static void client_WeaponSound( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulPlayer;
-	char	*pszSound;
+	ULONG		ulPlayer;
+	const char	*pszSound;
 
 	// Read in the player who's creating a weapon sound.
 	ulPlayer = NETWORK_ReadByte( pByteStream );
 	sector_t		*pSector;
 	LONG			lSectorID;
 	char			szCeilingFlatName[MAX_NETWORK_STRING];
-	char			*pszFloorFlatName;
+	const char		*pszFloorFlatName;
 	LONG			lFlatLump;
 
 	// Read in the sector ID.
 	line_t		*pLine;
 	side_t		*pSide;
 	ULONG		ulLineIdx;
-	char		*pszTextureName;
+	const char	*pszTextureName;
 	ULONG		ulSide;
 	ULONG		ulPosition;
 	LONG		lTexture;
 //
 static void client_ACSScriptExecute( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulScript;
-	LONG	lID;
-	LONG	lLineIdx;
-	char	*pszMap;
-	bool	bBackSide;
-	ULONG	ulArg0;
-	ULONG	ulArg1;
-	ULONG	ulArg2;
-	bool	bAlways;
-	AActor	*pActor;
-	line_s	*pLine;
+	ULONG		ulScript;
+	LONG		lID;
+	LONG		lLineIdx;
+	const char	*pszMap;
+	bool		bBackSide;
+	ULONG		ulArg0;
+	ULONG		ulArg1;
+	ULONG		ulArg2;
+	bool		bAlways;
+	AActor		*pActor;
+	line_s		*pLine;
 
 	// Read in the script to be executed.
 	ulScript = NETWORK_ReadShort( pByteStream );
 //
 static void client_Sound( BYTESTREAM_s *pByteStream )
 {
-	char	*pszSoundString;
-	LONG	lChannel;
-	LONG	lVolume;
-	LONG	lAttenuation;
+	const char	*pszSoundString;
+	LONG		lChannel;
+	LONG		lVolume;
+	LONG		lAttenuation;
 
 	// Read in the channel.
 	lChannel = NETWORK_ReadByte( pByteStream );
 //
 static void client_SoundActor( BYTESTREAM_s *pByteStream )
 {
-	LONG	lID;
-	char	*pszSoundString;
-	LONG	lChannel;
-	LONG	lVolume;
-	LONG	lAttenuation;
-	AActor	*pActor;
+	LONG		lID;
+	const char	*pszSoundString;
+	LONG		lChannel;
+	LONG		lVolume;
+	LONG		lAttenuation;
+	AActor		*pActor;
 
 	// Read in the spot ID.
 	lID = NETWORK_ReadShort( pByteStream );
 //
 static void client_SoundPoint( BYTESTREAM_s *pByteStream )
 {
-	char	*pszSoundString;
-	LONG	lChannel;
-	LONG	lVolume;
-	LONG	lAttenuation;
-	fixed_t	X;
-	fixed_t	Y;
+	const char	*pszSoundString;
+	LONG		lChannel;
+	LONG		lVolume;
+	LONG		lAttenuation;
+	fixed_t		X;
+	fixed_t		Y;
 
 	// Read in the XY of the sound.
 	X = NETWORK_ReadShort( pByteStream ) << FRACBITS;
 static void client_StartSectorSequence( BYTESTREAM_s *pByteStream )
 {
 	LONG		lSectorID;
-	char		*pszSequence;
+	const char	*pszSequence;
 	sector_t	*pSector;
 
 	// Read in the sector ID.
 //
 static void client_CallVote( BYTESTREAM_s *pByteStream )
 {
-	char	szCommand[128];
-	char	*pszParameters;
-	ULONG	ulVoteCaller;
+	FString		command;
+	FString		parameters;
+	ULONG		ulVoteCaller;
 
 	// Read in the vote starter.
 	ulVoteCaller = NETWORK_ReadByte( pByteStream );
 
 	// Read in the command.
-	sprintf( szCommand, NETWORK_ReadString( pByteStream ));
+	command = NETWORK_ReadString( pByteStream );
 
 	// Read in the parameters.
-	pszParameters = NETWORK_ReadString( pByteStream );
+	parameters = NETWORK_ReadString( pByteStream );
 
 	// Begin the vote!
-	CALLVOTE_BeginVote( szCommand, pszParameters, ulVoteCaller );
+	CALLVOTE_BeginVote( command, parameters, ulVoteCaller );
 }
 
 //*****************************************************************************
 static void client_MapLoad( BYTESTREAM_s *pByteStream )
 {
 	bool	bPlaying;
-	char	*pszMap;
+	const char	*pszMap;
 	
 	// Read in the lumpname of the map we're about to load.
 	pszMap = NETWORK_ReadString( pByteStream );
 //
 static void client_MapNew( BYTESTREAM_s *pByteStream )
 {
-	char	*pszMapName;
+	const char	*pszMapName;
 
 	// Read in the new mapname the server is switching the level to.
 	pszMapName = NETWORK_ReadString( pByteStream );
 static void client_MapExit( BYTESTREAM_s *pByteStream )
 {
 	LONG	lPos;
-	char	*pszNextMap;
+	const char	*pszNextMap;
 
 	// Read in the position we're supposed to spawn at (is this needed?).
 	lPos = NETWORK_ReadByte( pByteStream );
 //
 static void client_MapAuthenticate( BYTESTREAM_s *pByteStream )
 {
-	char	*pszMapName;
+	const char	*pszMapName;
 
 	pszMapName = NETWORK_ReadString( pByteStream );
 
 //
 static void client_SetMapMusic( BYTESTREAM_s *pByteStream )
 {
-	char	*pszMusicString;
+	const char	*pszMusicString;
 
 	// Read in the music string.
 	pszMusicString = NETWORK_ReadString( pByteStream );
 //
 static void client_SetMapSky( BYTESTREAM_s *pByteStream )
 {
-	char	*pszSky1;
-	char	*pszSky2;
+	const char	*pszSky1;
+	const char	*pszSky2;
 
 	// Read in the texture name of the first sky.
 	pszSky1 = NETWORK_ReadString( pByteStream );
 {
 	const PClass	*pType;
 	ULONG			ulPlayer;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lAmount;
 	AInventory		*pInventory;
 
 {
 	const PClass	*pType;
 	ULONG			ulPlayer;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lAmount;
 	AInventory		*pInventory;
 
 {
 	const PClass	*pType;
 	ULONG			ulPlayer;
-	char			*pszName;
+	const char		*pszName;
 	LONG			lAmount;
 	LONG			lEffectTics;
 	AInventory		*pInventory;
 //
 static void client_SetCameraToTexture( BYTESTREAM_s *pByteStream )
 {
-	LONG	lID;
-	char	*pszTexture;
-	LONG	lFOV;
-	AActor	*pCamera;
-	LONG	lPicNum;
+	LONG		lID;
+	const char	*pszTexture;
+	LONG		lFOV;
+	AActor		*pCamera;
+	LONG		lPicNum;
 
 	// Read in the ID of the camera.
 	lID = NETWORK_ReadShort( pByteStream );

File src/cl_main.h

 void				CLIENT_WaitForServer( void );
 
 // Support functions to make things work more smoothly.
-void				CLIENT_AuthenticateLevel( char *pszMapName );
-AActor				*CLIENT_SpawnThing( char *pszName, fixed_t X, fixed_t Y, fixed_t Z, LONG lNetID );
-void				CLIENT_SpawnMissile( char *pszName, fixed_t X, fixed_t Y, fixed_t Z, fixed_t MomX, fixed_t MomY, fixed_t MomZ, LONG lNetID, LONG lTargetNetID );
+void				CLIENT_AuthenticateLevel( const char *pszMapName );
+AActor				*CLIENT_SpawnThing( const char *pszName, fixed_t X, fixed_t Y, fixed_t Z, LONG lNetID );
+void				CLIENT_SpawnMissile( const char *pszName, fixed_t X, fixed_t Y, fixed_t Z, fixed_t MomX, fixed_t MomY, fixed_t MomZ, LONG lNetID, LONG lTargetNetID );
 void				CLIENT_MoveThing( AActor *pActor, fixed_t X, fixed_t Y, fixed_t Z );
 AActor				*CLIENT_FindThingByNetID( LONG lID );
 void				CLIENT_DisplayMOTD( void );

File src/d_net.cpp

 #include "team.h"
 #include "chat.h"
 
-int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
+int P_StartScript (AActor *who, line_t *where, int script, const char *map, bool backSide,
 					int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net);
 
 EXTERN_CVAR (Int, disableautosave)

File src/network.cpp

 
 //*****************************************************************************
 //
-void NETWORK_GenerateMapLumpMD5Hash( MapData *Map, const LONG LumpNumber, char *pszMD5Hash )
+void NETWORK_GenerateMapLumpMD5Hash( MapData *Map, const LONG LumpNumber, FString &MD5Hash )
 {
 	LONG lLumpSize = Map->Size( LumpNumber );
 	BYTE *pbData = new BYTE[lLumpSize];
 	Map->Read( LumpNumber, pbData );
 
 	// Perform the checksum on our buffer, and free it.
-	CMD5Checksum::GetMD5( pbData, lLumpSize, pszMD5Hash );
+	CMD5Checksum::GetMD5( pbData, lLumpSize, MD5Hash );
 	delete ( pbData );
 }
 

File src/network.h

 void			NETWORK_ConvertWeaponNameToKeyLetter( const char *&pszName );
 void			NETWORK_ConvertKeyLetterToFullString( const char *&pszName, bool bPrintKeyLetter );
 void			NETWORK_ConvertWeaponKeyLetterToFullString( const char *&pszName );
-void			NETWORK_GenerateMapLumpMD5Hash( MapData *Map, const LONG LumpNumber, char *pszMD5Hash );
+void			NETWORK_GenerateMapLumpMD5Hash( MapData *Map, const LONG LumpNumber, FString &MD5Hash );
 
 // Access functions.
 LONG			NETWORK_GetState( void );

File src/networkshared.cpp

 
 //*****************************************************************************
 //
-char *NETWORK_ReadString( BYTESTREAM_s *pByteStream )
+const char *NETWORK_ReadString( BYTESTREAM_s *pByteStream )
 {
 	char			c;
 	ULONG			ulIdx;

File src/networkshared.h

 float			NETWORK_ReadFloat( BYTESTREAM_s *pByteStream );
 void			NETWORK_WriteFloat( BYTESTREAM_s *pByteStream, float Float );
 
-char			*NETWORK_ReadString( BYTESTREAM_s *pByteStream );
+const char		*NETWORK_ReadString( BYTESTREAM_s *pByteStream );
 void			NETWORK_WriteString( BYTESTREAM_s *pByteStream, const char *pszString );
 
 void			NETWORK_WriteBuffer( BYTESTREAM_s *pByteStream, const void *pvBuffer, int nLength );

File src/p_acs.cpp

 
 EXTERN_CVAR (Bool, sv_cheats)
 
-int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
+int P_StartScript (AActor *who, line_t *where, int script, const char *map, bool backSide,
 					int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net)
 {
 	if (map == NULL || 0 == strnicmp (level.mapname, map, 8))

File src/p_spec.h

 // [RH] ACS (see also p_acs.h)
 //
 
-int  P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
+int  P_StartScript (AActor *who, line_t *where, int script, const char *map, bool backSide,
 					int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net=false);
 void P_SuspendScript (int script, char *map);
 void P_TerminateScript (int script, char *map);

File src/sv_commands.cpp

 //*****************************************************************************
 //*****************************************************************************
 //
-void SERVERCOMMANDS_CallVote( ULONG ulPlayer, char *pszCommand, char *pszParameters, ULONG ulPlayerExtra, ULONG ulFlags )
+void SERVERCOMMANDS_CallVote( ULONG ulPlayer, FString Command, FString Parameters, ULONG ulPlayerExtra, ULONG ulFlags )
 {
 	ULONG	ulIdx;
 
 	if ( SERVER_IsValidPlayer( ulPlayer ) == false )
 		return;
 
-	if (( pszCommand == NULL ) || ( pszParameters == NULL ))
-		return;
-
-	for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
-	{
-		if ( SERVER_IsValidClient( ulIdx ) == false )
-			continue;
-
-		if ((( ulFlags & SVCF_SKIPTHISCLIENT ) && ( ulPlayerExtra == ulIdx )) ||
-			(( ulFlags & SVCF_ONLYTHISCLIENT ) && ( ulPlayerExtra != ulIdx )))
-		{
-			continue;
-		}
-
-		SERVER_CheckClientBuffer( ulIdx, 2 + (ULONG)strlen( pszCommand ) + (ULONG)strlen( pszParameters ), true );
+	for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
+	{
+		if ( SERVER_IsValidClient( ulIdx ) == false )
+			continue;
+
+		if ((( ulFlags & SVCF_SKIPTHISCLIENT ) && ( ulPlayerExtra == ulIdx )) ||
+			(( ulFlags & SVCF_ONLYTHISCLIENT ) && ( ulPlayerExtra != ulIdx )))
+		{
+			continue;
+		}
+
+		SERVER_CheckClientBuffer( ulIdx, 2 + ULONG( Command.Len() ) + ULONG ( Parameters.Len() ), true );
 		NETWORK_WriteHeader( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, SVC_CALLVOTE );
 		NETWORK_WriteByte( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, ulPlayer );
-		NETWORK_WriteString( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, pszCommand );
-		NETWORK_WriteString( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, pszParameters );
+		NETWORK_WriteString( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, Command.GetChars() );
+		NETWORK_WriteString( &SERVER_GetClient( ulIdx )->PacketBuffer.ByteStream, Parameters.GetChars() );
 	}
 }
 

File src/sv_commands.h

 void	SERVERCOMMANDS_StopSectorSequence( sector_t *pSector, ULONG ulPlayerExtra = MAXPLAYERS, ULONG ulFlags = 0 );
 
 // Voting commands. These handle the voting.
-void	SERVERCOMMANDS_CallVote( ULONG ulPlayer, char *pszCommand, char *pszParameters, ULONG ulPlayerExtra = MAXPLAYERS, ULONG ulFlags = 0 );
+void	SERVERCOMMANDS_CallVote( ULONG ulPlayer, FString Command, FString Parameters, ULONG ulPlayerExtra = MAXPLAYERS, ULONG ulFlags = 0 );
 void	SERVERCOMMANDS_PlayerVote( ULONG ulPlayer, bool bVoteYes, ULONG ulPlayerExtra = MAXPLAYERS, ULONG ulFlags = 0 );
 void	SERVERCOMMANDS_VoteEnded( bool bVotePassed, ULONG ulPlayerExtra = MAXPLAYERS, ULONG ulFlags = 0 );
 

File src/sv_main.cpp

 bool SERVER_PerformAuthenticationChecksum( BYTESTREAM_s *pByteStream )
 {
 	MapData		*pMap;
-	char		szServerVertexString[64];
-	char		szServerLinedefString[64];
-	char		szServerSidedefString[64];
-	char		szServerSectorString[64];
-	char		szClientVertexString[MAX_NETWORK_STRING];
-	char		szClientLinedefString[MAX_NETWORK_STRING];
-	char		szClientSidedefString[MAX_NETWORK_STRING];
-	char		szClientSectorString[MAX_NETWORK_STRING];
+	FString		serverVertexString;
+	FString		serverLinedefString;
+	FString		serverSidedefString;
+	FString		serverSectorString;
+	FString		clientVertexString;
+	FString		clientLinedefString;
+	FString		clientSidedefString;
+	FString		clientSectorString;
 
 	// [BB] Open the map. Since we are already using the map, we won't get a NULL pointer.
 	pMap = P_OpenMapData( level.mapname );
 
 	// Generate checksums for the map lumps.
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_VERTEXES, szServerVertexString );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_LINEDEFS, szServerLinedefString );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SIDEDEFS, szServerSidedefString );
-	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SECTORS, szServerSectorString );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_VERTEXES, serverVertexString );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_LINEDEFS, serverLinedefString );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SIDEDEFS, serverSidedefString );
+	NETWORK_GenerateMapLumpMD5Hash( pMap, ML_SECTORS, serverSectorString );
 
 	// Free the map pointer, we don't need it anymore.
 	delete ( pMap );
 
 	// Read in the client's checksum strings.
-	strncpy( szClientVertexString, NETWORK_ReadString( pByteStream ), 64 );
-	strncpy( szClientLinedefString, NETWORK_ReadString( pByteStream ), 64 );
-	strncpy( szClientSidedefString, NETWORK_ReadString( pByteStream ), 64 );
-	strncpy( szClientSectorString, NETWORK_ReadString( pByteStream ), 64 );
+	clientVertexString = NETWORK_ReadString( pByteStream );
+	clientLinedefString = NETWORK_ReadString( pByteStream );
+	clientSidedefString = NETWORK_ReadString( pByteStream );
+	clientSectorString = NETWORK_ReadString( pByteStream );
 
 	// Checksums did not match! Therefore, the level authentication has failed.
-	if (( strcmp( szServerVertexString, szClientVertexString ) != 0 ) ||
-		( strcmp( szServerLinedefString, szClientLinedefString ) != 0 ) ||
-		( strcmp( szServerSidedefString, szClientSidedefString ) != 0 ) ||
-		( strcmp( szServerSectorString, szClientSectorString ) != 0 ))
+	if (( serverVertexString.Compare( clientVertexString ) != 0 ) ||
+		( serverLinedefString.Compare( clientLinedefString ) != 0 ) ||
+		( serverSidedefString.Compare( clientSidedefString ) != 0 ) ||
+		( serverSectorString.Compare( clientSectorString ) != 0 ))
 	{
 		return ( false );
 	}
 {
 	LONG			lClient;
 	char			szClientVersion[MAX_NETWORK_STRING];
-	char			szClientPassword[MAX_NETWORK_STRING];
+	FString			clientPassword;
 	char			szServerPassword[MAX_NETWORK_STRING];
 	LONG			lClientNetworkGameVersion;
 	char			szAddress[4][4];
 	strncpy( szClientVersion, NETWORK_ReadString( pByteStream ), 16 );
 
 	// Read in the client's password.
-	strncpy( szClientPassword, strupr( NETWORK_ReadString( pByteStream )), 64 );
+	clientPassword = NETWORK_ReadString( pByteStream );
+	clientPassword.ToUpper();
 
 	// Read in whether or not the client wants to start as a spectator.
 	g_aClients[lClient].bWantStartAsSpectator = !!NETWORK_ReadByte( pByteStream );
 		strcpy( szServerPassword, Val.String );
 
 		// Check their password against ours (both not case sensitive).
-		if ( strcmp( strupr( szServerPassword ), szClientPassword ) != 0 )
+		if ( strcmp( strupr( szServerPassword ), clientPassword.GetChars() ) != 0 )
 		{
 			// Client has the wrong password! GET THE FUCK OUT OF HERE!
 			SERVER_ClientError( lClient, NETWORK_ERRORCODE_WRONGPASSWORD );
 //	ULONG		ulIdx;
 	ULONG		ulFlags;
     player_t	*pPlayer;
-	char		*pszString;
+	FString		nameString;
 	char		szSkin[64];
 	char		szClass[64];
 	char		szOldPlayerName[64];
 	if ( ulFlags & USERINFO_NAME )
 	{
 		sprintf( szOldPlayerName, pPlayer->userinfo.netname );
-		pszString = NETWORK_ReadString( pByteStream );
-
-		if ( strlen( pszString ) > MAXPLAYERNAME )
-			pszString[MAXPLAYERNAME] = '\0';
+		nameString = NETWORK_ReadString( pByteStream );
+
+		if ( nameString.Len() > MAXPLAYERNAME )
+			nameString.Truncate(MAXPLAYERNAME);
 
 		// [RC] Remove bad characters from their username.
-		strcpy( pPlayer->userinfo.netname, pszString );
-		V_CleanPlayerName(pszString);
+		strcpy( pPlayer->userinfo.netname, nameString.GetChars() );
+		V_CleanPlayerName(nameString);
 
 		// The user really shouldn't have an invalid name unless they are using a hacked executable.
-		if ( strcmp( pPlayer->userinfo.netname, pszString ) != 0 )
+		if ( nameString.Compare( pPlayer->userinfo.netname ) != 0 )
 		{
 			SERVER_KickPlayer( g_lCurrentClient, "User name contains illegal characters." );
 			return ( false );
 //
 static bool server_Say( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulPlayer;
-	ULONG	ulChatMode;
-	char	*pszChatString;
-	ULONG	ulChatInstance;
+	ULONG		ulPlayer;
+	ULONG		ulChatMode;
+	const char	*pszChatString;
+	ULONG		ulChatInstance;
 
 	ulPlayer = g_lCurrentClient;
 
 	angle_t			Pitch;
 	ULONG			ulGametic;
 	ULONG			ulBits;
-	char			*pszWeapon;
+	const char		*pszWeapon;
 	const PClass	*pType;
 	AInventory		*pInventory;
 //	ULONG			ulIdx;
 static bool server_RequestJoin( BYTESTREAM_s *pByteStream )
 {
 	UCVarValue	Val;
-	char		szClientJoinPassword[MAX_NETWORK_STRING];
+	FString		clientJoinPassword;
 
 	// Read in the join password.
-	strncpy( szClientJoinPassword, strupr( NETWORK_ReadString( pByteStream )), 64 );
+	clientJoinPassword = NETWORK_ReadString( pByteStream );
+	clientJoinPassword.ToUpper();
 
 	// Player can't rejoin game if he's not spectating!
 	if (( playeringame[g_lCurrentClient] == false ) || ( players[g_lCurrentClient].bSpectating == false ))
 		strcpy( szServerJoinPassword, Val.String );
 
 		// Check their password against ours (both not case sensitive).
-		if ( strcmp( strupr( szServerJoinPassword ), szClientJoinPassword ) != 0 )
+		if ( strcmp( strupr( szServerJoinPassword ), clientJoinPassword.GetChars() ) != 0 )
 		{
 			// Tell the client that the password didn't match.
 			SERVER_PrintfPlayer( PRINT_HIGH, g_lCurrentClient, "Incorrect join password.\n" );
 static bool server_RequestRCON( BYTESTREAM_s *pByteStream )
 {
 	UCVarValue	Val;
-	char		*pszUserPassword;
+	const char	*pszUserPassword;
 
 	Val = sv_rconpassword.GetGenericRep( CVAR_String );
 
 //
 static bool server_RCONCommand( BYTESTREAM_s *pByteStream )
 {
-	char	*pszCommand;
+	const char	*pszCommand;
 
 	// Read in the command the user sent us.
 	pszCommand = NETWORK_ReadString( pByteStream );
 	LONG		lDesiredTeam;
 	bool		bOnTeam;
 	UCVarValue	Val;
-	char		szClientJoinPassword[MAX_NETWORK_STRING];
+	FString		clientJoinPassword;
 
 	// Read in the join password.
-	strncpy( szClientJoinPassword, strupr( NETWORK_ReadString( pByteStream )), 64 );
+	clientJoinPassword = NETWORK_ReadString( pByteStream );
+	clientJoinPassword.ToUpper();
 
 	lDesiredTeam = NETWORK_ReadByte( pByteStream );
 	if ( playeringame[g_lCurrentClient] == false )
 		strcpy( szServerJoinPassword, Val.String );
 
 		// Check their password against ours (both not case sensitive).
-		if ( strcmp( strupr( szServerJoinPassword ), szClientJoinPassword ) != 0 )
+		if ( strcmp( strupr( szServerJoinPassword ), clientJoinPassword.GetChars() ) != 0 )
 		{
 			// Tell the client that the password didn't match.
 			SERVER_PrintfPlayer( PRINT_HIGH, g_lCurrentClient, "Incorrect join password.\n" );
 //
 static bool server_GiveCheat( BYTESTREAM_s *pByteStream )
 {
-	char	*pszItemName;
-	ULONG	ulAmount;
+	const char	*pszItemName;
+	ULONG		ulAmount;
 
 	// Read in the item name.
 	pszItemName = NETWORK_ReadString( pByteStream );
 //
 static bool server_SummonCheat( BYTESTREAM_s *pByteStream, bool bFriend )
 {
-	char			*pszName;
+	const char		*pszName;
 	AActor			*pSource;
 	const PClass	*pType;
 	AActor			*pActor;
 //
 static bool server_CallVote( BYTESTREAM_s *pByteStream )
 {
-	ULONG	ulVoteCmd;
-	char	*pszParameters;
-	char	szCommand[128];
+	ULONG		ulVoteCmd;
+	const char	*pszParameters;
+	char		szCommand[128];
 
 	// Read in the type of vote happening.
 	ulVoteCmd = NETWORK_ReadByte( pByteStream );

File src/v_text.cpp

 	}
 }
 
+// [BB] Version of V_CleanPlayerName that accepts a FString as argument.
+void V_CleanPlayerName( FString &String )
+{
+	const int length = (int) String.Len();
+	char *tempCharArray = new char[length+1];
+	strncpy( tempCharArray, String.GetChars(), length );
+	tempCharArray[length] = 0;
+	V_CleanPlayerName( tempCharArray );
+	String = tempCharArray;
+	delete[] tempCharArray;
+}
+
 // [RC] Converts COL_ numbers to their \c counterparts.
 char V_GetColorChar( ULONG ulColor )
 {

File src/v_text.h

 bool	v_IsCharAcceptableInNames ( char c );
 bool	v_IsCharacterWhitespace ( char c );
 void	V_CleanPlayerName( char *pszString );
+void	V_CleanPlayerName( FString &String );
 
 FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *str);
 void V_FreeBrokenLines (FBrokenLines *lines);