Use C standard library utilities for booleans and fixed-width ints

This commit is contained in:
Chris Thrasher authored and Lukas Dürrenberger committed 2024-02-19 23:30:30 +01:00
1 parent 46bc9a7ed8
commit a51c22a7a3
97 files changed
+670 -707

No files matched your search

+8 -8
View File
@@ -129,10 +129,10 @@ CSFML_NETWORK_API void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpLis
///
/// \param ftpListingResponse Ftp listing response
///
/// \return sfTrue if the status is a success, sfFalse if it is a failure
/// \return true if the status is a success, false if it is a failure
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API bool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP listing response
@@ -191,10 +191,10 @@ CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ft
///
/// \param ftpDirectoryResponse Ftp directory response
///
/// \return sfTrue if the status is a success, sfFalse if it is a failure
/// \return true if the status is a success, false if it is a failure
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API bool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP directory response
@@ -243,10 +243,10 @@ CSFML_NETWORK_API void sfFtpResponse_destroy(sfFtpResponse* ftpResponse);
///
/// \param ftpResponse Ftp response object
///
/// \return sfTrue if the status is a success, sfFalse if it is a failure
/// \return true if the status is a success, false if it is a failure
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
CSFML_NETWORK_API bool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP response
@@ -500,12 +500,12 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFi
/// \param localFile Path of the local file to upload
/// \param remotePath Where to put to file on the server
/// \param mode Transfer mode
/// \param append Pass sfTrue to append to or sfFalse to overwrite the remote file if it already exists
/// \param append Pass true to append to or false to overwrite the remote file if it already exists
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append);
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, bool append);
////////////////////////////////////////////////////////////
/// \brief Send a command to the FTP server
+3 -3
View File
@@ -95,7 +95,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address);
/// \return Resulting address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3);
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(uint8_t byte0, uint8_t byte1, uint8_t byte2, uint8_t byte3);
////////////////////////////////////////////////////////////
/// \brief Construct an address from a 32-bits integer
@@ -110,7 +110,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1
/// \return Resulting address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address);
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(uint32_t address);
////////////////////////////////////////////////////////////
/// \brief Get a string representation of an address
@@ -139,7 +139,7 @@ CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
/// \return 32-bits unsigned integer representation of the address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfUint32 sfIpAddress_toInteger(sfIpAddress address);
CSFML_NETWORK_API uint32_t sfIpAddress_toInteger(sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Get the computer's local address
+18 -18
View File
@@ -128,10 +128,10 @@ CSFML_NETWORK_API size_t sfPacket_getDataSize(const sfPacket* packet);
///
/// \param packet Packet object
///
/// \return sfTrue if all data was read, sfFalse otherwise
/// \return true if all data was read, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet);
CSFML_NETWORK_API bool sfPacket_endOfPacket(const sfPacket* packet);
////////////////////////////////////////////////////////////
/// \brief Test the validity of a packet, for reading
@@ -144,10 +144,10 @@ CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet);
///
/// \param packet Packet object
///
/// \return sfTrue if last data extraction from packet was successful
/// \return true if last data extraction from packet was successful
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet);
CSFML_NETWORK_API bool sfPacket_canRead(const sfPacket* packet);
////////////////////////////////////////////////////////////
/// \brief Functions to extract data from a packet
@@ -155,13 +155,13 @@ CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet);
/// \param packet Packet object
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfPacket_readBool(sfPacket* packet);
CSFML_NETWORK_API sfInt8 sfPacket_readInt8(sfPacket* packet);
CSFML_NETWORK_API sfUint8 sfPacket_readUint8(sfPacket* packet);
CSFML_NETWORK_API sfInt16 sfPacket_readInt16(sfPacket* packet);
CSFML_NETWORK_API sfUint16 sfPacket_readUint16(sfPacket* packet);
CSFML_NETWORK_API sfInt32 sfPacket_readInt32(sfPacket* packet);
CSFML_NETWORK_API sfUint32 sfPacket_readUint32(sfPacket* packet);
CSFML_NETWORK_API bool sfPacket_readBool(sfPacket* packet);
CSFML_NETWORK_API int8_t sfPacket_readInt8(sfPacket* packet);
CSFML_NETWORK_API uint8_t sfPacket_readUint8(sfPacket* packet);
CSFML_NETWORK_API int16_t sfPacket_readInt16(sfPacket* packet);
CSFML_NETWORK_API uint16_t sfPacket_readUint16(sfPacket* packet);
CSFML_NETWORK_API int32_t sfPacket_readInt32(sfPacket* packet);
CSFML_NETWORK_API uint32_t sfPacket_readUint32(sfPacket* packet);
CSFML_NETWORK_API float sfPacket_readFloat(sfPacket* packet);
CSFML_NETWORK_API double sfPacket_readDouble(sfPacket* packet);
CSFML_NETWORK_API void sfPacket_readString(sfPacket* packet, char* string);
@@ -173,13 +173,13 @@ CSFML_NETWORK_API void sfPacket_readWideString(sfPacket* packet, wchar_t* st
/// \param packet Packet object
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, sfBool);
CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, sfInt8);
CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, sfUint8);
CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, sfInt16);
CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, sfUint16);
CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, sfInt32);
CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, sfUint32);
CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, bool);
CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, int8_t);
CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, uint8_t);
CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, int16_t);
CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, uint16_t);
CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, int32_t);
CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, uint32_t);
CSFML_NETWORK_API void sfPacket_writeFloat(sfPacket* packet, float);
CSFML_NETWORK_API void sfPacket_writeDouble(sfPacket* packet, double);
CSFML_NETWORK_API void sfPacket_writeString(sfPacket* packet, const char* string);
+8 -8
View File
@@ -107,15 +107,15 @@ CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector);
/// some data available to be received. To know which sockets are
/// ready, use the sfSocketSelector_isXxxReady functions.
/// If you use a timeout and no socket is ready before the timeout
/// is over, the function returns sfFalse.
/// is over, the function returns false.
///
/// \param selector Socket selector object
/// \param timeout Maximum time to wait (use sfTimeZero for infinity)
///
/// \return sfTrue if there are sockets ready, sfFalse otherwise
/// \return true if there are sockets ready, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout);
CSFML_NETWORK_API bool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Test a socket to know if it is ready to receive data
@@ -124,18 +124,18 @@ CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTim
/// sfSocketSelector_wait, to know which sockets are ready to
/// receive data. If a socket is ready, a call to Receive will
/// never block because we know that there is data available to read.
/// Note that if this function returns sfTrue for a sfTcpListener,
/// Note that if this function returns true for a sfTcpListener,
/// this means that it is ready to accept a new connection.
///
/// \param selector Socket selector object
/// \param socket Socket to test
///
/// \return sfTrue if the socket is ready to read, sfFalse otherwise
/// \return true if the socket is ready to read, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API sfBool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API sfBool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
CSFML_NETWORK_API bool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API bool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API bool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
#endif // SFML_SOCKETSELECTOR_H
+4 -4
View File
@@ -63,20 +63,20 @@ CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* listener);
/// By default, all sockets are blocking.
///
/// \param listener TCP listener object
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
/// \param blocking true to set the socket as blocking, false for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, sfBool blocking);
CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, bool blocking);
////////////////////////////////////////////////////////////
/// \brief Tell whether a TCP listener is in blocking or non-blocking mode
///
/// \param listener TCP listener object
///
/// \return sfTrue if the socket is blocking, sfFalse otherwise
/// \return true if the socket is blocking, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfTcpListener_isBlocking(const sfTcpListener* listener);
CSFML_NETWORK_API bool sfTcpListener_isBlocking(const sfTcpListener* listener);
////////////////////////////////////////////////////////////
/// \brief Get the port to which a TCP listener is bound locally
+4 -4
View File
@@ -65,20 +65,20 @@ CSFML_NETWORK_API void sfTcpSocket_destroy(sfTcpSocket* socket);
/// By default, all sockets are blocking.
///
/// \param socket TCP socket object
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
/// \param blocking true to set the socket as blocking, false for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, sfBool blocking);
CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, bool blocking);
////////////////////////////////////////////////////////////
/// \brief Tell whether a TCP socket is in blocking or non-blocking mode
///
/// \param socket TCP socket object
///
/// \return sfTrue if the socket is blocking, sfFalse otherwise
/// \return true if the socket is blocking, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfTcpSocket_isBlocking(const sfTcpSocket* socket);
CSFML_NETWORK_API bool sfTcpSocket_isBlocking(const sfTcpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Get the port to which a TCP socket is bound locally
+4 -4
View File
@@ -64,20 +64,20 @@ CSFML_NETWORK_API void sfUdpSocket_destroy(sfUdpSocket* socket);
/// By default, all sockets are blocking.
///
/// \param socket UDP socket object
/// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking
/// \param blocking true to set the socket as blocking, false for non-blocking
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, sfBool blocking);
CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, bool blocking);
////////////////////////////////////////////////////////////
/// \brief Tell whether a UDP socket is in blocking or non-blocking mode
///
/// \param socket UDP socket object
///
/// \return sfTrue if the socket is blocking, sfFalse otherwise
/// \return true if the socket is blocking, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfBool sfUdpSocket_isBlocking(const sfUdpSocket* socket);
CSFML_NETWORK_API bool sfUdpSocket_isBlocking(const sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Get the port to which a UDP socket is bound locally