diff --git a/docs/todo.html b/docs/todo.html index 26f7dbf0d..f7dafcfd3 100644 --- a/docs/todo.html +++ b/docs/todo.html @@ -443,7 +443,7 @@ namespace aux { boost::uint32_t filter; }; - const static class_mapping v4_classes[] = + static const class_mapping v4_classes[] = { // everything relevance 2../src/session_impl.cpp:1813the udp socket(s) should be using the same generic mechanism and not be restricted to a single one we should open a one listen socket for each entry in the listen_interfaces list

the udp socket(s) should be using the same generic @@ -1319,7 +1319,7 @@ void node_impl::lookup_peers(sha1_hash const& info_hash, entry& reply if (port < 0 || port >= 65536) relevance 2../src/kademlia/routing_table.cpp:110use the non deprecated function instead of this one

use the non deprecated function instead of this one

../src/kademlia/routing_table.cpp:110

-	const static int size_exceptions[] = {16, 8, 4, 2};
+	static const int size_exceptions[] = {16, 8, 4, 2};
 	if (bucket < int(sizeof(size_exceptions)/sizeof(size_exceptions[0])))
 		return m_bucket_size * size_exceptions[bucket];
 	return m_bucket_size;
@@ -7683,4 +7683,4 @@ public:
 
 #endif
 
-
\ No newline at end of file + diff --git a/examples/print.cpp b/examples/print.cpp index b4fd51add..e4e065288 100644 --- a/examples/print.cpp +++ b/examples/print.cpp @@ -203,7 +203,7 @@ void terminal_size(int* terminal_width, int* terminal_height) #ifdef _WIN32 void apply_ansi_code(int* attributes, bool* reverse, int code) { - const static int color_table[8] = + static const int color_table[8] = { 0, // black FOREGROUND_RED, // red @@ -221,10 +221,10 @@ void apply_ansi_code(int* attributes, bool* reverse, int code) background_mask = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE }; - const static int fg_mask[2] = {foreground_mask, background_mask}; - const static int bg_mask[2] = {background_mask, foreground_mask}; - const static int fg_shift[2] = { 0, 4}; - const static int bg_shift[2] = { 4, 0}; + static const int fg_mask[2] = {foreground_mask, background_mask}; + static const int bg_mask[2] = {background_mask, foreground_mask}; + static const int fg_shift[2] = { 0, 4}; + static const int bg_shift[2] = { 4, 0}; if (code == 0) { diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 58c2644ef..b653b4257 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -53,7 +53,7 @@ namespace libtorrent TORRENT_EXPORT char const* operation_name(int op); // user defined alerts should use IDs greater than this - const static int user_alert_id = 10000; + static const int user_alert_id = 10000; // This is a base class for alerts that are associated with a // specific torrent. It contains a handle to the torrent. @@ -63,7 +63,7 @@ namespace libtorrent torrent_alert(torrent_handle const& h); // internal - const static int alert_type = 0; + static const int alert_type = 0; virtual std::string message() const; // The torrent_handle pointing to the torrent this @@ -84,8 +84,8 @@ namespace libtorrent , pid(pi) {} - const static int alert_type = 1; - const static int static_category = alert::peer_notification; + static const int alert_type = 1; + static const int static_category = alert::peer_notification; virtual int category() const { return static_category; } virtual std::string message() const; @@ -108,8 +108,8 @@ namespace libtorrent , url(u) {} - const static int alert_type = 2; - const static int static_category = alert::tracker_notification; + static const int alert_type = 2; + static const int static_category = alert::tracker_notification; virtual int category() const { return static_category; } virtual std::string message() const; @@ -118,7 +118,7 @@ namespace libtorrent }; #define TORRENT_DEFINE_ALERT(name, seq) \ - const static int alert_type = seq; \ + static const int alert_type = seq; \ virtual int type() const { return alert_type; } \ virtual std::auto_ptr clone() const \ { return std::auto_ptr(new name(*this)); } \ @@ -137,7 +137,7 @@ namespace libtorrent {} TORRENT_DEFINE_ALERT(torrent_added_alert, 3); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; }; @@ -162,7 +162,7 @@ namespace libtorrent {} TORRENT_DEFINE_ALERT(torrent_removed_alert, 4); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } sha1_hash info_hash; @@ -195,7 +195,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(read_piece_alert, 5); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -218,7 +218,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(file_completed_alert, 6); - const static int static_category = alert::progress_notification; + static const int static_category = alert::progress_notification; virtual std::string message() const; // refers to the index of the file that completed. @@ -240,7 +240,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(file_renamed_alert, 7); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -266,7 +266,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(file_rename_failed_alert, 8); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -371,7 +371,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(performance_alert, 9); - const static int static_category = alert::performance_warning; + static const int static_category = alert::performance_warning; virtual std::string message() const; @@ -392,7 +392,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(state_changed_alert, 10); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; @@ -431,7 +431,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_error_alert, 11); - const static int static_category = alert::tracker_notification | alert::error_notification; + static const int static_category = alert::tracker_notification | alert::error_notification; virtual std::string message() const; int times_in_row; @@ -455,7 +455,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_warning_alert, 12); - const static int static_category = alert::tracker_notification | alert::error_notification; + static const int static_category = alert::tracker_notification | alert::error_notification; virtual std::string message() const; // contains the warning message from the tracker. @@ -507,7 +507,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(scrape_failed_alert, 14); - const static int static_category = alert::tracker_notification | alert::error_notification; + static const int static_category = alert::tracker_notification | alert::error_notification; virtual std::string message() const; // contains a message describing the error. @@ -596,7 +596,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(hash_failed_alert, 18); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; int piece_index; @@ -665,7 +665,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_error_alert, 22); - const static int static_category = alert::peer_notification; + static const int static_category = alert::peer_notification; virtual std::string message() const; // a NULL-terminated string of the low-level operation that failed, or NULL if @@ -692,7 +692,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_connect_alert, 23); - const static int static_category = alert::debug_notification; + static const int static_category = alert::debug_notification; virtual std::string message() const; int socket_type; @@ -719,7 +719,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_disconnected_alert, 24); - const static int static_category = alert::debug_notification; + static const int static_category = alert::debug_notification; virtual std::string message() const; // the kind of socket this peer was connected over @@ -772,7 +772,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_finished_alert, 26); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { return torrent_alert::message() + " torrent finished downloading"; } }; @@ -792,7 +792,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(piece_finished_alert, 27); - const static int static_category = alert::progress_notification; + static const int static_category = alert::progress_notification; virtual std::string message() const; // the index of the piece that finished @@ -812,7 +812,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(request_dropped_alert, 28); - const static int static_category = alert::progress_notification + static const int static_category = alert::progress_notification | alert::peer_notification; virtual std::string message() const; @@ -833,7 +833,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(block_timeout_alert, 29); - const static int static_category = alert::progress_notification + static const int static_category = alert::progress_notification | alert::peer_notification; virtual std::string message() const; @@ -854,7 +854,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(block_finished_alert, 30); - const static int static_category = alert::progress_notification; + static const int static_category = alert::progress_notification; virtual std::string message() const; int block_index; @@ -877,7 +877,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(block_downloading_alert, 31); - const static int static_category = alert::progress_notification; + static const int static_category = alert::progress_notification; virtual std::string message() const; #ifndef TORRENT_NO_DEPRECATE @@ -921,7 +921,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(storage_moved_alert, 33); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const { return torrent_alert::message() + " moved storage to: " @@ -948,7 +948,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(storage_moved_failed_alert, 34); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const { return torrent_alert::message() + " storage move failed. " @@ -985,7 +985,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_deleted_alert, 35); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const { return torrent_alert::message() + " deleted"; } virtual bool discardable() const { return false; } @@ -1010,7 +1010,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_delete_failed_alert, 36); - const static int static_category = alert::storage_notification + static const int static_category = alert::storage_notification | alert::error_notification; virtual std::string message() const { @@ -1043,7 +1043,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(save_resume_data_alert, 37); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; virtual std::string message() const { return torrent_alert::message() + " resume data generated"; } virtual bool discardable() const { return false; } @@ -1069,7 +1069,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(save_resume_data_failed_alert, 38); - const static int static_category = alert::storage_notification + static const int static_category = alert::storage_notification | alert::error_notification; virtual std::string message() const { @@ -1097,7 +1097,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_paused_alert, 39); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { return torrent_alert::message() + " paused"; } }; @@ -1112,7 +1112,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_resumed_alert, 40); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { return torrent_alert::message() + " resumed"; } }; @@ -1128,7 +1128,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_checked_alert, 41); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { return torrent_alert::message() + " checked"; } }; @@ -1156,7 +1156,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(url_seed_alert, 42); - const static int static_category = alert::peer_notification | alert::error_notification; + static const int static_category = alert::peer_notification | alert::error_notification; virtual std::string message() const { return torrent_alert::message() + " url seed (" @@ -1192,7 +1192,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(file_error_alert, 43); - const static int static_category = alert::status_notification + static const int static_category = alert::status_notification | alert::error_notification | alert::storage_notification; virtual std::string message() const @@ -1228,7 +1228,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(metadata_failed_alert, 44); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const { return torrent_alert::message() + " invalid metadata received: " + error.message(); } @@ -1271,7 +1271,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(metadata_received_alert, 45); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { return torrent_alert::message() + " metadata successfully received"; } }; @@ -1291,7 +1291,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(udp_error_alert, 46); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const { error_code ec; @@ -1318,7 +1318,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(external_ip_alert, 47); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const { error_code ec; @@ -1356,7 +1356,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(listen_failed_alert, 48); - const static int static_category = alert::status_notification | alert::error_notification; + static const int static_category = alert::status_notification | alert::error_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1393,7 +1393,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(listen_succeeded_alert, 49); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1424,7 +1424,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(portmap_error_alert, 50); - const static int static_category = alert::port_mapping_notification + static const int static_category = alert::port_mapping_notification | alert::error_notification; virtual std::string message() const; @@ -1455,7 +1455,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(portmap_alert, 51); - const static int static_category = alert::port_mapping_notification; + static const int static_category = alert::port_mapping_notification; virtual std::string message() const; // refers to the mapping index of the port map that failed, i.e. @@ -1482,7 +1482,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(portmap_log_alert, 52); - const static int static_category = alert::port_mapping_notification; + static const int static_category = alert::port_mapping_notification; virtual std::string message() const; int map_type; @@ -1511,7 +1511,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(fastresume_rejected_alert, 53); - const static int static_category = alert::status_notification + static const int static_category = alert::status_notification | alert::error_notification; virtual std::string message() const { @@ -1554,7 +1554,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_blocked_alert, 54); - const static int static_category = alert::ip_block_notification; + static const int static_category = alert::ip_block_notification; virtual std::string message() const; // the address that was blocked. @@ -1588,7 +1588,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_announce_alert, 55); - const static int static_category = alert::dht_notification; + static const int static_category = alert::dht_notification; virtual std::string message() const; address ip; @@ -1607,7 +1607,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_get_peers_alert, 56); - const static int static_category = alert::dht_notification; + static const int static_category = alert::dht_notification; virtual std::string message() const; sha1_hash info_hash; @@ -1624,7 +1624,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(stats_alert, 57); - const static int static_category = alert::stats_notification; + static const int static_category = alert::stats_notification; virtual std::string message() const; enum stats_channel @@ -1675,7 +1675,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(cache_flushed_alert, 58); - const static int static_category = alert::storage_notification; + static const int static_category = alert::storage_notification; }; // This alert is posted when a bittorrent feature is blocked because of the @@ -1694,7 +1694,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(anonymous_mode_alert, 59); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const; enum kind_t @@ -1722,7 +1722,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(lsd_peer_alert, 60); - const static int static_category = alert::peer_notification; + static const int static_category = alert::peer_notification; virtual std::string message() const; }; @@ -1741,7 +1741,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(trackerid_alert, 61); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; // The tracker ID returned by the tracker @@ -1756,7 +1756,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_bootstrap_alert, 62); - const static int static_category = alert::dht_notification; + static const int static_category = alert::dht_notification; virtual std::string message() const; }; @@ -1774,7 +1774,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(rss_alert, 63); - const static int static_category = alert::rss_notification; + static const int static_category = alert::rss_notification; virtual std::string message() const; enum state_t @@ -1820,7 +1820,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_error_alert, 64); - const static int static_category = alert::error_notification | alert::status_notification; + static const int static_category = alert::error_notification | alert::status_notification; virtual std::string message() const; // specifies which error the torrent encountered. @@ -1843,7 +1843,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_need_cert_alert, 65); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1866,7 +1866,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(incoming_connection_alert, 66); - const static int static_category = alert::peer_notification; + static const int static_category = alert::peer_notification; virtual std::string message() const; // tells you what kind of socket the connection was accepted @@ -1904,7 +1904,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(add_torrent_alert, 67); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1924,7 +1924,7 @@ namespace libtorrent { TORRENT_DEFINE_ALERT(state_update_alert, 68); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1940,7 +1940,7 @@ namespace libtorrent mmap_cache_alert(error_code const& ec): error(ec) {} TORRENT_DEFINE_ALERT(mmap_cache_alert, 69); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const; error_code error; @@ -1955,7 +1955,7 @@ namespace libtorrent session_stats_alert() {} TORRENT_DEFINE_ALERT(session_stats_alert, 70); - const static int static_category = alert::stats_notification; + static const int static_category = alert::stats_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -1995,7 +1995,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_update_alert, 71); - const static int static_category = alert::status_notification; + static const int static_category = alert::status_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -2019,7 +2019,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(rss_item_alert, 72); - const static int static_category = alert::rss_notification; + static const int static_category = alert::rss_notification; virtual std::string message() const; feed_handle handle; @@ -2036,7 +2036,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_error_alert, 73); - const static int static_category = alert::error_notification + static const int static_category = alert::error_notification | alert::dht_notification; virtual std::string message() const; @@ -2062,7 +2062,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_immutable_item_alert, 74); - const static int static_category = alert::error_notification + static const int static_category = alert::error_notification | alert::dht_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -2088,7 +2088,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_mutable_item_alert, 75); - const static int static_category = alert::error_notification + static const int static_category = alert::error_notification | alert::dht_notification; virtual std::string message() const; virtual bool discardable() const { return false; } @@ -2136,7 +2136,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_put_alert, 76); - const static int static_category = alert::dht_notification; + static const int static_category = alert::dht_notification; virtual std::string message() const; // the target hash the item was stored under if this was an *immutable* @@ -2158,7 +2158,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(i2p_alert, 77); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const; // the error that occurred in the i2p SAM connection @@ -2179,7 +2179,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_outgoing_get_peers_alert, 78); - const static int static_category = alert::dht_notification; + static const int static_category = alert::dht_notification; virtual std::string message() const; // the info_hash of the torrent we're looking for peers for. @@ -2208,7 +2208,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(log_alert, 79); - const static int static_category = alert::session_log_notification; + static const int static_category = alert::session_log_notification; virtual std::string message() const; // the log message @@ -2231,7 +2231,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_log_alert, 80); - const static int static_category = alert::torrent_log_notification; + static const int static_category = alert::torrent_log_notification; virtual std::string message() const; // the log message @@ -2255,7 +2255,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_log_alert, 81); - const static int static_category = alert::peer_log_notification; + static const int static_category = alert::peer_log_notification; virtual std::string message() const; // the log message @@ -2274,7 +2274,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(lsd_error_alert, 82); - const static int static_category = alert::error_notification; + static const int static_category = alert::error_notification; virtual std::string message() const; // The error code @@ -2348,7 +2348,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_stats_alert, 83); - const static int static_category = alert::stats_notification; + static const int static_category = alert::stats_notification; virtual std::string message() const; // a vector of the currently running DHT lookups. diff --git a/include/libtorrent/extensions.hpp b/include/libtorrent/extensions.hpp index 45dc29926..6063ead40 100644 --- a/include/libtorrent/extensions.hpp +++ b/include/libtorrent/extensions.hpp @@ -123,7 +123,7 @@ POSSIBILITY OF SUCH DAMAGE. // // .. parsed-literal:: // -// const static int alert_type = **; +// static const int alert_type = **; // virtual int type() const { return alert_type; } // // virtual std::string message() const; @@ -131,7 +131,7 @@ POSSIBILITY OF SUCH DAMAGE. // virtual std::auto_ptr clone() const // { return std::auto_ptr(new name(\*this)); } // -// const static int static_category = **; +// static const int static_category = **; // virtual int category() const { return static_category; } // // virtual char const* what() const { return **; } diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index e85cb9ce7..2b5830469 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -78,7 +78,7 @@ namespace libtorrent struct TORRENT_EXTRA_EXPORT piece_block { - const static piece_block invalid; + static const piece_block invalid; piece_block() {} piece_block(boost::uint32_t p_index, boost::uint16_t b_index) diff --git a/src/alert.cpp b/src/alert.cpp index 1bed110b8..cf08ac172 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -198,7 +198,7 @@ namespace libtorrent { std::string tracker_announce_alert::message() const { - const static char* event_str[] = {"none", "completed", "started", "stopped", "paused"}; + static const char* event_str[] = {"none", "completed", "started", "stopped", "paused"}; TORRENT_ASSERT_VAL(event < int(sizeof(event_str)/sizeof(event_str[0])), event); return tracker_alert::message() + " sending announce (" + event_str[event] + ")"; } @@ -644,7 +644,7 @@ namespace libtorrent { std::string dht_error_alert::message() const { - const static char* const operation_names[] = + static const char* const operation_names[] = { "unknown", "hostname lookup" diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 83a8c327c..32e6b5010 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -75,7 +75,7 @@ namespace libtorrent void assert_print_piece(cached_piece_entry const* pe) { - const static char* const cache_state[] = + static const char* const cache_state[] = { "write", "volatile-read", "read-lru", "read-lru-ghost", "read-lfu", "read-lfu-ghost" }; diff --git a/src/file.cpp b/src/file.cpp index ca81ddd1d..fdaf1e8b4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1239,7 +1239,7 @@ namespace libtorrent DWORD create_mode; }; - const static open_mode_t mode_array[] = + static const open_mode_t mode_array[] = { // read_only {GENERIC_READ, OPEN_EXISTING}, @@ -1249,7 +1249,7 @@ namespace libtorrent {GENERIC_WRITE | GENERIC_READ, OPEN_ALWAYS}, }; - const static DWORD attrib_array[] = + static const DWORD attrib_array[] = { FILE_ATTRIBUTE_NORMAL, // no attrib FILE_ATTRIBUTE_HIDDEN, // hidden diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index 1cca97e28..68f405076 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -1026,7 +1026,7 @@ void node_impl::incoming_request(msg const& m, entry& e) { // the first 2 entries are for both mutable and // immutable puts - const static key_desc_t msg_desc[] = { + static const key_desc_t msg_desc[] = { {"token", bdecode_node::string_t, 0, 0}, {"v", bdecode_node::none_t, 0, 0}, {"seq", bdecode_node::int_t, 0, key_desc_t::optional}, diff --git a/src/kademlia/node_id.cpp b/src/kademlia/node_id.cpp index b2feeb499..5a6d301b7 100644 --- a/src/kademlia/node_id.cpp +++ b/src/kademlia/node_id.cpp @@ -101,9 +101,9 @@ node_id generate_id_impl(address const& ip_, boost::uint32_t r) { boost::uint8_t* ip = 0; - const static boost::uint8_t v4mask[] = { 0x03, 0x0f, 0x3f, 0xff }; + static const boost::uint8_t v4mask[] = { 0x03, 0x0f, 0x3f, 0xff }; #if TORRENT_USE_IPV6 - const static boost::uint8_t v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; + static const boost::uint8_t v6mask[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; #endif boost::uint8_t const* mask = 0; int num_octets = 0; diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index cbe00434f..2e3e9a53f 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -88,7 +88,7 @@ int routing_table::bucket_limit(int bucket) const { if (!m_settings.extended_routing_table) return m_bucket_size; - const static int size_exceptions[] = {16, 8, 4, 2}; + static const int size_exceptions[] = {16, 8, 4, 2}; if (bucket < int(sizeof(size_exceptions)/sizeof(size_exceptions[0]))) return m_bucket_size * size_exceptions[bucket]; return m_bucket_size; diff --git a/src/kademlia/rpc_manager.cpp b/src/kademlia/rpc_manager.cpp index 0062b068b..d067ff66d 100644 --- a/src/kademlia/rpc_manager.cpp +++ b/src/kademlia/rpc_manager.cpp @@ -377,8 +377,8 @@ time_duration rpc_manager::tick() { INVARIANT_CHECK; - const static int short_timeout = 1; - const static int timeout = 15; + static const int short_timeout = 1; + static const int timeout = 15; // look for observers that have timed out diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 9129ceafe..c99aceead 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -242,7 +242,7 @@ namespace aux { boost::uint32_t filter; }; - const static class_mapping v4_classes[] = + static const class_mapping v4_classes[] = { // everything {"0.0.0.0", "255.255.255.255", gfilter}, @@ -257,7 +257,7 @@ namespace aux { }; #if TORRENT_USE_IPV6 - const static class_mapping v6_classes[] = + static const class_mapping v6_classes[] = { // everything {"::0", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", gfilter}, @@ -1250,7 +1250,7 @@ namespace aux { boost::uint32_t peer_class_mask = m_peer_class_filter.access(a); // assign peer class based on socket type - const static int mapping[] = { 0, 0, 0, 0, 1, 4, 2, 2, 2, 3}; + static const int mapping[] = { 0, 0, 0, 0, 1, 4, 2, 2, 2, 3}; int socket_type = mapping[st]; // filter peer classes based on type peer_class_mask = m_peer_class_type_filter.apply(socket_type, peer_class_mask); diff --git a/src/session_stats.cpp b/src/session_stats.cpp index 0869e4da0..30b47fb93 100644 --- a/src/session_stats.cpp +++ b/src/session_stats.cpp @@ -45,7 +45,7 @@ namespace libtorrent }; #define METRIC(category, name) { #category "." #name, counters:: name }, - const static stats_metric_impl metrics[] = + static const stats_metric_impl metrics[] = { // ``error_peers`` is the total number of peer disconnects // caused by an error (not initiated by this client) and diff --git a/src/string_util.cpp b/src/string_util.cpp index aebcb94b8..2ffce0e48 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -57,7 +57,7 @@ namespace libtorrent bool is_space(char c) { - const static char* ws = " \t\n\r\f\v"; + static const char* ws = " \t\n\r\f\v"; return strchr(ws, c) != 0; } diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index fa5cd1a76..2a6219dd9 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -217,7 +217,7 @@ namespace libtorrent sha1_hash torrent_handle::info_hash() const { boost::shared_ptr t = m_torrent.lock(); - const static sha1_hash empty; + static const sha1_hash empty; if (!t) return empty; return t->info_hash(); } @@ -602,7 +602,7 @@ namespace libtorrent std::vector torrent_handle::trackers() const { - const static std::vector empty; + static const std::vector empty; TORRENT_SYNC_CALL_RET(std::vector, empty, trackers); return r; } @@ -619,7 +619,7 @@ namespace libtorrent std::set torrent_handle::url_seeds() const { - const static std::set empty; + static const std::set empty; TORRENT_SYNC_CALL_RET1(std::set, empty, web_seeds, web_seed_entry::url_seed); return r; } @@ -636,7 +636,7 @@ namespace libtorrent std::set torrent_handle::http_seeds() const { - const static std::set empty; + static const std::set empty; TORRENT_SYNC_CALL_RET1(std::set, empty, web_seeds, web_seed_entry::http_seed); return r; } diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index ef8a486d4..2d680dc98 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -195,7 +195,7 @@ namespace libtorrent #if !TORRENT_USE_UNC_PATHS && defined TORRENT_WINDOWS // if we're not using UNC paths on windows, there // are certain filenames we're not allowed to use - const static char const* reserved_names[] = + static const char const* reserved_names[] = { "con", "prn", "aux", "clock$", "nul", "com0", "com1", "com2", "com3", "com4", diff --git a/src/torrent_peer.cpp b/src/torrent_peer.cpp index c07efebb7..8d9a9a046 100644 --- a/src/torrent_peer.cpp +++ b/src/torrent_peer.cpp @@ -86,7 +86,7 @@ namespace libtorrent #if TORRENT_USE_IPV6 else if (e1.address().is_v6()) { - const static boost::uint8_t v6mask[][8] = { + static const boost::uint8_t v6mask[][8] = { { 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55 }, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55 }, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } @@ -107,7 +107,7 @@ namespace libtorrent #endif else { - const static boost::uint8_t v4mask[][4] = { + static const boost::uint8_t v4mask[][4] = { { 0xff, 0xff, 0x55, 0x55 }, { 0xff, 0xff, 0xff, 0x55 }, { 0xff, 0xff, 0xff, 0xff } diff --git a/test/test_dht.cpp b/test/test_dht.cpp index 98ead05d8..99efb4e7b 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -1093,7 +1093,7 @@ int test_main() } // test verify_message - const static key_desc_t msg_desc[] = { + static const key_desc_t msg_desc[] = { {"A", bdecode_node::string_t, 4, 0}, {"B", bdecode_node::dict_t, 0, key_desc_t::optional | key_desc_t::parse_children}, {"B1", bdecode_node::string_t, 0, 0}, diff --git a/test/test_piece_picker.cpp b/test/test_piece_picker.cpp index 0d90c5243..ed4256661 100644 --- a/test/test_piece_picker.cpp +++ b/test/test_piece_picker.cpp @@ -98,7 +98,7 @@ boost::shared_ptr setup_picker( const int avail = availability[i] - '0'; assert(avail >= 0); - const static torrent_peer* peers[10] = { &tmp0, &tmp1, &tmp2 + static const torrent_peer* peers[10] = { &tmp0, &tmp1, &tmp2 , &tmp3, &tmp4, &tmp5, &tmp6, &tmp7, &tmp8, &tmp9 }; TORRENT_ASSERT(avail < 10); for (int j = 0; j < avail; ++j) p->inc_refcount(i, peers[j]);