minor code tidyup

This commit is contained in:
UnknownShadow200 2021-07-05 19:12:06 +10:00
parent 800cfe03d4
commit 65b2a861e6
5 changed files with 8 additions and 8 deletions

View File

@ -169,11 +169,11 @@ CC_API void TabList_Remove(EntityID id);
CC_API void TabList_Set(EntityID id, const cc_string* player, const cc_string* list, const cc_string* group, cc_uint8 rank); CC_API void TabList_Set(EntityID id, const cc_string* player, const cc_string* list, const cc_string* group, cc_uint8 rank);
/* Raw unformatted name (for Tab name auto complete) */ /* Raw unformatted name (for Tab name auto complete) */
#define TabList_UNSAFE_GetPlayer(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 3); #define TabList_UNSAFE_GetPlayer(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 3)
/* Formatted name for display in tab list. */ /* Formatted name for display in tab list. */
#define TabList_UNSAFE_GetList(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 2); #define TabList_UNSAFE_GetList(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 2)
/* Name of the group this entry is in (e.g. rank name, map name) */ /* Name of the group this entry is in (e.g. rank name, map name) */
#define TabList_UNSAFE_GetGroup(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 1); #define TabList_UNSAFE_GetGroup(id) StringsBuffer_UNSAFE_Get(&TabList._buffer, TabList.NameOffsets[id] - 1)
/* Represents another entity in multiplayer */ /* Represents another entity in multiplayer */
struct NetPlayer { struct NetPlayer {

View File

@ -483,13 +483,13 @@ cc_result Socket_Connect(cc_socket* s, const cc_string* address, int port) {
} }
cc_result Socket_Read(cc_socket s, cc_uint8* data, cc_uint32 count, cc_uint32* modified) { cc_result Socket_Read(cc_socket s, cc_uint8* data, cc_uint32 count, cc_uint32* modified) {
int recvCount = recv(s, data, count, 0); int recvCount = recv(s, (char*)data, count, 0);
if (recvCount != -1) { *modified = recvCount; return 0; } if (recvCount != -1) { *modified = recvCount; return 0; }
*modified = 0; return WSAGetLastError(); *modified = 0; return WSAGetLastError();
} }
cc_result Socket_Write(cc_socket s, const cc_uint8* data, cc_uint32 count, cc_uint32* modified) { cc_result Socket_Write(cc_socket s, const cc_uint8* data, cc_uint32 count, cc_uint32* modified) {
int sentCount = send(s, data, count, 0); int sentCount = send(s, (const char*)data, count, 0);
if (sentCount != -1) { *modified = sentCount; return 0; } if (sentCount != -1) { *modified = sentCount; return 0; }
*modified = 0; return WSAGetLastError(); *modified = 0; return WSAGetLastError();
} }

View File

@ -173,6 +173,7 @@ int Convert_ToBase64(const void* data, int len, char* dst) {
return (int)(dst - beg); return (int)(dst - beg);
} }
/* Maps a base 64 character back into a 6 bit integer */
CC_NOINLINE static int DecodeBase64(char c) { CC_NOINLINE static int DecodeBase64(char c) {
if (c >= 'A' && c <= 'Z') return (c - 'A'); if (c >= 'A' && c <= 'Z') return (c - 'A');
if (c >= 'a' && c <= 'z') return (c - 'a') + 26; if (c >= 'a' && c <= 'z') return (c - 'a') + 26;

View File

@ -3,7 +3,6 @@
#include "Logger.h" #include "Logger.h"
#include "Constants.h" #include "Constants.h"
/*########################################################################################################################* /*########################################################################################################################*
*---------------------------------------------------------Memory----------------------------------------------------------* *---------------------------------------------------------Memory----------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/