mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-20 13:09:15 +00:00
(svn r14949) -Cleanup: pointer coding style
This commit is contained in:
@@ -160,7 +160,7 @@ static int NetworkFindBroadcastIPsInternal(uint32 *broadcast, int limit) // !GET
|
||||
const char *buf_end = buf + ifconf.ifc_len;
|
||||
int index = 0;
|
||||
for (const char *p = buf; p < buf_end && index != limit;) {
|
||||
const struct ifreq* req = (const struct ifreq*)p;
|
||||
const struct ifreq *req = (const struct ifreq*)p;
|
||||
|
||||
if (req->ifr_addr.sa_family == AF_INET) {
|
||||
struct ifreq r;
|
||||
|
@@ -124,7 +124,7 @@ void Packet::Send_uint64(uint64 data)
|
||||
* the string + '\0'. No size-byte or something.
|
||||
* @param data the string to send
|
||||
*/
|
||||
void Packet::Send_string(const char* data)
|
||||
void Packet::Send_string(const char *data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
/* The <= *is* valid due to the fact that we are comparing sizes and not the index. */
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
void Send_uint16(uint16 data);
|
||||
void Send_uint32(uint32 data);
|
||||
void Send_uint64(uint64 data);
|
||||
void Send_string(const char* data);
|
||||
void Send_string(const char *data);
|
||||
|
||||
/* Reading/receiving of packets */
|
||||
void ReadRawPacketSize();
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
uint16 Recv_uint16();
|
||||
uint32 Recv_uint32();
|
||||
uint64 Recv_uint64();
|
||||
void Recv_string(char* buffer, size_t size);
|
||||
void Recv_string(char *buffer, size_t size);
|
||||
};
|
||||
|
||||
Packet *NetworkSend_Init(PacketType type);
|
||||
|
@@ -251,7 +251,7 @@ static void ServerStartError(const char *error)
|
||||
NetworkError(STR_NETWORK_ERR_SERVER_START);
|
||||
}
|
||||
|
||||
static void NetworkClientError(NetworkRecvStatus res, NetworkClientSocket* cs)
|
||||
static void NetworkClientError(NetworkRecvStatus res, NetworkClientSocket *cs)
|
||||
{
|
||||
// First, send a CLIENT_ERROR to the server, so he knows we are
|
||||
// disconnection (and why!)
|
||||
@@ -644,7 +644,7 @@ static void NetworkInitialize()
|
||||
// Query a server to fetch his game-info
|
||||
// If game_info is true, only the gameinfo is fetched,
|
||||
// else only the client_info is fetched
|
||||
void NetworkTCPQueryServer(const char* host, unsigned short port)
|
||||
void NetworkTCPQueryServer(const char *host, unsigned short port)
|
||||
{
|
||||
if (!_network_available) return;
|
||||
|
||||
|
@@ -820,7 +820,7 @@ typedef NetworkRecvStatus NetworkClientPacket(Packet *p);
|
||||
// packet it is matches against this array
|
||||
// and that way the right function to handle that
|
||||
// packet is found.
|
||||
static NetworkClientPacket* const _network_client_packet[] = {
|
||||
static NetworkClientPacket * const _network_client_packet[] = {
|
||||
RECEIVE_COMMAND(PACKET_SERVER_FULL),
|
||||
RECEIVE_COMMAND(PACKET_SERVER_BANNED),
|
||||
NULL, /*PACKET_CLIENT_JOIN,*/
|
||||
|
@@ -53,7 +53,7 @@ bool NetworkServerStart();
|
||||
NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientIndex index);
|
||||
NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id);
|
||||
NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
|
||||
const char* GetClientIP(const NetworkClientInfo *ci);
|
||||
const char *GetClientIP(const NetworkClientInfo *ci);
|
||||
|
||||
void NetworkServerSendRcon(ClientID client_id, ConsoleColour colour_code, const char *string);
|
||||
void NetworkServerSendError(ClientID client_id, NetworkErrorCode error);
|
||||
|
@@ -150,7 +150,7 @@ protected:
|
||||
}
|
||||
|
||||
/** Sort servers by name. */
|
||||
static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameNameSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
return strcasecmp((*a)->info.server_name, (*b)->info.server_name);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ protected:
|
||||
/** Sort servers by the amount of clients online on a
|
||||
* server. If the two servers have the same amount, the one with the
|
||||
* higher maximum is preferred. */
|
||||
static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameClientSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
/* Reverse as per default we are interested in most-clients first */
|
||||
int r = (*a)->info.clients_on - (*b)->info.clients_on;
|
||||
@@ -170,7 +170,7 @@ protected:
|
||||
}
|
||||
|
||||
/** Sort servers by map size */
|
||||
static int CDECL NGameMapSizeSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameMapSizeSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
/* Sort by the area of the map. */
|
||||
int r = ((*a)->info.map_height) * ((*a)->info.map_width) - ((*b)->info.map_height) * ((*b)->info.map_width);
|
||||
@@ -180,14 +180,14 @@ protected:
|
||||
}
|
||||
|
||||
/** Sort servers by current date */
|
||||
static int CDECL NGameDateSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameDateSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
int r = (*a)->info.game_date - (*b)->info.game_date;
|
||||
return (r != 0) ? r : NGameClientSorter(a, b);
|
||||
}
|
||||
|
||||
/** Sort servers by the number of days the game is running */
|
||||
static int CDECL NGameYearsSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameYearsSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
int r = (*a)->info.game_date - (*a)->info.start_date - (*b)->info.game_date + (*b)->info.start_date;
|
||||
return (r != 0) ? r : NGameDateSorter(a, b);
|
||||
@@ -195,7 +195,7 @@ protected:
|
||||
|
||||
/** Sort servers by joinability. If both servers are the
|
||||
* same, prefer the non-passworded server first. */
|
||||
static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b)
|
||||
static int CDECL NGameAllowedSorter(NetworkGameList * const *a, NetworkGameList * const *b)
|
||||
{
|
||||
/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
|
||||
int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision);
|
||||
|
@@ -122,7 +122,7 @@ extern uint16 _network_udp_broadcast;
|
||||
|
||||
extern uint8 _network_advertise_retries;
|
||||
|
||||
void NetworkTCPQueryServer(const char* host, unsigned short port);
|
||||
void NetworkTCPQueryServer(const char *host, unsigned short port);
|
||||
|
||||
void NetworkAddServer(const char *b);
|
||||
void NetworkRebuildHostList();
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
// This file handles all the server-commands
|
||||
|
||||
static void NetworkHandleCommandQueue(NetworkClientSocket* cs);
|
||||
static void NetworkHandleCommandQueue(NetworkClientSocket *cs);
|
||||
|
||||
// **********
|
||||
// Sending functions
|
||||
@@ -1205,7 +1205,7 @@ typedef void NetworkServerPacket(NetworkClientSocket *cs, Packet *p);
|
||||
// packet it is matches against this array
|
||||
// and that way the right function to handle that
|
||||
// packet is found.
|
||||
static NetworkServerPacket* const _network_server_packet[] = {
|
||||
static NetworkServerPacket * const _network_server_packet[] = {
|
||||
NULL, /*PACKET_SERVER_FULL,*/
|
||||
NULL, /*PACKET_SERVER_BANNED,*/
|
||||
RECEIVE_COMMAND(PACKET_CLIENT_JOIN),
|
||||
@@ -1420,7 +1420,7 @@ bool NetworkServer_ReadPackets(NetworkClientSocket *cs)
|
||||
}
|
||||
|
||||
// Handle the local command-queue
|
||||
static void NetworkHandleCommandQueue(NetworkClientSocket* cs)
|
||||
static void NetworkHandleCommandQueue(NetworkClientSocket *cs)
|
||||
{
|
||||
CommandPacket *cp;
|
||||
|
||||
@@ -1534,7 +1534,7 @@ void NetworkServerChangeOwner(Owner current_owner, Owner new_owner)
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetClientIP(const NetworkClientInfo* ci)
|
||||
const char *GetClientIP(const NetworkClientInfo *ci)
|
||||
{
|
||||
struct in_addr addr;
|
||||
|
||||
@@ -1544,7 +1544,7 @@ const char* GetClientIP(const NetworkClientInfo* ci)
|
||||
|
||||
void NetworkServerShowStatusToConsole()
|
||||
{
|
||||
static const char* const stat_str[] = {
|
||||
static const char * const stat_str[] = {
|
||||
"inactive",
|
||||
"authorizing",
|
||||
"authorized",
|
||||
@@ -1559,7 +1559,7 @@ void NetworkServerShowStatusToConsole()
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
int lag = NetworkCalculateLag(cs);
|
||||
const NetworkClientInfo *ci = cs->GetInfo();
|
||||
const char* status;
|
||||
const char *status;
|
||||
|
||||
status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
|
||||
IConsolePrintF(CC_INFO, "Client #%1d name: '%s' status: '%s' frame-lag: %3d company: %1d IP: %s unique-id: '%s'",
|
||||
|
@@ -425,7 +425,7 @@ void NetworkUDPSearchGame()
|
||||
_network_udp_broadcast = 300; // Stay searching for 300 ticks
|
||||
}
|
||||
|
||||
void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually)
|
||||
void NetworkUDPQueryServer(const char *host, unsigned short port, bool manually)
|
||||
{
|
||||
struct sockaddr_in out_addr;
|
||||
NetworkGameList *item;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
void NetworkUDPInitialize();
|
||||
void NetworkUDPSearchGame();
|
||||
void NetworkUDPQueryMasterServer();
|
||||
void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually = false);
|
||||
void NetworkUDPQueryServer(const char *host, unsigned short port, bool manually = false);
|
||||
void NetworkUDPAdvertise();
|
||||
void NetworkUDPRemoveAdvertise();
|
||||
void NetworkUDPShutdown();
|
||||
|
Reference in New Issue
Block a user