diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-30 13:02:44 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-06-10 20:09:44 +0200 |
commit | e3717ae903cb770ae2ebc4abe45fa0cc77326409 (patch) | |
tree | 2a9b087c8fce31b51de3a7fe987be622323f963e /src/network/core | |
parent | df181bb641a75e9fae557c683b790cfba961ec5a (diff) | |
download | openttd-e3717ae903cb770ae2ebc4abe45fa0cc77326409.tar.xz |
Codechange: [ContentInfo] Use std::string instead of string buffers
Diffstat (limited to 'src/network/core')
-rw-r--r-- | src/network/core/config.h | 5 | ||||
-rw-r--r-- | src/network/core/tcp_content_type.h | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/network/core/config.h b/src/network/core/config.h index ce614188d..6d6038ec7 100644 --- a/src/network/core/config.h +++ b/src/network/core/config.h @@ -65,6 +65,11 @@ static const uint NETWORK_CLIENT_NAME_LENGTH = 25; ///< The maxim static const uint NETWORK_RCONCOMMAND_LENGTH = 500; ///< The maximum length of a rconsole command, in bytes including '\0' static const uint NETWORK_GAMESCRIPT_JSON_LENGTH = COMPAT_MTU-3; ///< The maximum length of a gamescript json string, in bytes including '\0'. Must not be longer than COMPAT_MTU including header (3 bytes) static const uint NETWORK_CHAT_LENGTH = 900; ///< The maximum length of a chat message, in bytes including '\0' +static const uint NETWORK_CONTENT_FILENAME_LENGTH = 48; ///< The maximum length of a content's filename, in bytes including '\0'. +static const uint NETWORK_CONTENT_NAME_LENGTH = 32; ///< The maximum length of a content's name, in bytes including '\0'. +static const uint NETWORK_CONTENT_VERSION_LENGTH = 16; ///< The maximum length of a content's version, in bytes including '\0'. +static const uint NETWORK_CONTENT_URL_LENGTH = 96; ///< The maximum length of a content's url, in bytes including '\0'. +static const uint NETWORK_CONTENT_DESC_LENGTH = 512; ///< The maximum length of a content's description, in bytes including '\0'. static const uint NETWORK_CONTENT_TAG_LENGTH = 32; ///< The maximum length of a content's tag, in bytes including '\0'. static const uint NETWORK_GRF_NAME_LENGTH = 80; ///< Maximum length of the name of a GRF diff --git a/src/network/core/tcp_content_type.h b/src/network/core/tcp_content_type.h index 2186997e8..25097c3ab 100644 --- a/src/network/core/tcp_content_type.h +++ b/src/network/core/tcp_content_type.h @@ -60,11 +60,11 @@ struct ContentInfo { ContentType type; ///< Type of content ContentID id; ///< Unique (server side) ID for the content uint32 filesize; ///< Size of the file - char filename[48]; ///< Filename (for the .tar.gz; only valid on download) - char name[32]; ///< Name of the content - char version[16]; ///< Version of the content - char url[96]; ///< URL related to the content - char description[512]; ///< Description of the content + std::string filename; ///< Filename (for the .tar.gz; only valid on download) + std::string name; ///< Name of the content + std::string version; ///< Version of the content + std::string url; ///< URL related to the content + std::string description; ///< Description of the content uint32 unique_id; ///< Unique ID; either GRF ID or shortname byte md5sum[16]; ///< The MD5 checksum std::vector<ContentID> dependencies; ///< The dependencies (unique server side ids) |