fix missed static array specifier

This commit is contained in:
Andrei Kurushin 2017-01-22 18:33:43 +03:00 committed by Arvid Norberg
parent 4fe5320bf8
commit 06c68052b4
8 changed files with 13 additions and 13 deletions

View File

@ -546,7 +546,7 @@ namespace libtorrent
// an empty string. // an empty string.
char const* operation_str() const char const* operation_str() const
{ {
char const* ops[] = static char const* ops[] =
{ {
"", "stat", "mkdir", "open", "rename", "remove", "copy" "", "stat", "mkdir", "open", "rename", "remove", "copy"
, "read", "write", "fallocate", "allocate cache piece" , "read", "write", "fallocate", "allocate cache piece"

View File

@ -1170,7 +1170,7 @@ namespace libtorrent {
std::string anonymous_mode_alert::message() const std::string anonymous_mode_alert::message() const
{ {
char msg[200]; char msg[200];
char const* msgs[] = { static char const* msgs[] = {
"tracker is not anonymous, set a proxy" "tracker is not anonymous, set a proxy"
}; };
std::snprintf(msg, sizeof(msg), "%s: %s: %s" std::snprintf(msg, sizeof(msg), "%s: %s: %s"

View File

@ -234,7 +234,7 @@ namespace libtorrent
out_policy = settings_pack::pe_disabled; out_policy = settings_pack::pe_disabled;
#endif #endif
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
char const* policy_name[] = {"forced", "enabled", "disabled"}; static char const* policy_name[] = {"forced", "enabled", "disabled"};
TORRENT_ASSERT(out_policy < sizeof(policy_name)/sizeof(policy_name[0])); TORRENT_ASSERT(out_policy < sizeof(policy_name)/sizeof(policy_name[0]));
peer_log(peer_log_alert::info, "ENCRYPTION" peer_log(peer_log_alert::info, "ENCRYPTION"
, "outgoing encryption policy: %s", policy_name[out_policy]); , "outgoing encryption policy: %s", policy_name[out_policy]);
@ -628,7 +628,7 @@ namespace libtorrent
: std::uint8_t(enc_level); : std::uint8_t(enc_level);
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
char const* level[] = {"plaintext", "rc4", "plaintext rc4"}; static char const* level[] = {"plaintext", "rc4", "plaintext rc4"};
peer_log(peer_log_alert::info, "ENCRYPTION" peer_log(peer_log_alert::info, "ENCRYPTION"
, "%s", level[crypto_provide - 1]); , "%s", level[crypto_provide - 1]);
#endif #endif
@ -746,7 +746,7 @@ namespace libtorrent
TORRENT_ASSERT(t); TORRENT_ASSERT(t);
// add handshake to the send buffer // add handshake to the send buffer
const char version_string[] = "BitTorrent protocol"; static const char version_string[] = "BitTorrent protocol";
const int string_len = sizeof(version_string) - 1; const int string_len = sizeof(version_string) - 1;
char handshake[1 + string_len + 8 + 20 + 20]; char handshake[1 + string_len + 8 + 20 + 20];
@ -1564,7 +1564,7 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
if (should_log(peer_log_alert::incoming_message)) if (should_log(peer_log_alert::incoming_message))
{ {
char const* err_msg[] = {"no such peer", "not connected", "no support", "no self"}; static char const* err_msg[] = {"no such peer", "not connected", "no support", "no self"};
peer_log(peer_log_alert::incoming_message, "HOLEPUNCH" peer_log(peer_log_alert::incoming_message, "HOLEPUNCH"
, "msg:failed error: %d msg: %s", error , "msg:failed error: %d msg: %s", error
, ((error > 0 && error < 5)?err_msg[error-1]:"unknown message id")); , ((error > 0 && error < 5)?err_msg[error-1]:"unknown message id"));
@ -2750,7 +2750,7 @@ namespace libtorrent
// verify constant // verify constant
rc4_decrypt(m_recv_buffer.mutable_buffer().subspan(20, 8)); rc4_decrypt(m_recv_buffer.mutable_buffer().subspan(20, 8));
const char sh_vc[] = {0,0,0,0, 0,0,0,0}; static const char sh_vc[] = {0,0,0,0, 0,0,0,0};
if (!std::equal(sh_vc, sh_vc + 8, recv_buffer.begin() + 20)) if (!std::equal(sh_vc, sh_vc + 8, recv_buffer.begin() + 20))
{ {
disconnect(errors::invalid_encryption_constant, op_encryption, 2); disconnect(errors::invalid_encryption_constant, op_encryption, 2);
@ -3091,7 +3091,7 @@ namespace libtorrent
recv_buffer = m_recv_buffer.get(); recv_buffer = m_recv_buffer.get();
int packet_size = recv_buffer[0]; int packet_size = recv_buffer[0];
const char protocol_string[] = "\x13" "BitTorrent protocol"; static const char protocol_string[] = "\x13" "BitTorrent protocol";
if (packet_size != 19 || if (packet_size != 19 ||
memcmp(recv_buffer.begin(), protocol_string, 20) != 0) memcmp(recv_buffer.begin(), protocol_string, 20) != 0)

View File

@ -112,7 +112,7 @@ namespace libtorrent
if (0 == (tracker_req().kind & tracker_request::scrape_request)) if (0 == (tracker_req().kind & tracker_request::scrape_request))
{ {
const char* event_string[] = {"completed", "started", "stopped", "paused"}; static const char* event_string[] = {"completed", "started", "stopped", "paused"};
char str[1024]; char str[1024];
std::snprintf(str, sizeof(str) std::snprintf(str, sizeof(str)

View File

@ -140,7 +140,7 @@ void upnp::log(char const* fmt, ...) const
void upnp::discover_device_impl() void upnp::discover_device_impl()
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
const char msearch[] = static const char msearch[] =
"M-SEARCH * HTTP/1.1\r\n" "M-SEARCH * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n" "HOST: 239.255.255.250:1900\r\n"
"ST:upnp:rootdevice\r\n" "ST:upnp:rootdevice\r\n"

View File

@ -232,7 +232,7 @@ namespace libtorrent { namespace
TORRENT_ASSERT(!m_pc.associated_torrent().expired()); TORRENT_ASSERT(!m_pc.associated_torrent().expired());
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
char const* names[] = {"request", "data", "dont-have"}; static char const* names[] = {"request", "data", "dont-have"};
char const* n = ""; char const* n = "";
if (type >= 0 && type < 3) n = names[type]; if (type >= 0 && type < 3) n = names[type];
m_pc.peer_log(peer_log_alert::outgoing_message, "UT_METADATA" m_pc.peer_log(peer_log_alert::outgoing_message, "UT_METADATA"

View File

@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent { namespace namespace libtorrent { namespace
{ {
const char extension_name[] = "ut_pex"; static const char extension_name[] = "ut_pex";
enum enum
{ {

View File

@ -189,7 +189,7 @@ namespace libtorrent
std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT override
{ {
char const* error_messages[] = { static char const* error_messages[] = {
"ok", "ok",
"source exhausted", "source exhausted",
"target exhausted", "target exhausted",