fix bug in load/save settings (introduced by altering pe_settings layout)
This commit is contained in:
parent
a05103154b
commit
9c761f6777
|
@ -45,7 +45,7 @@ namespace libtorrent
|
||||||
enum struct_field_type_t
|
enum struct_field_type_t
|
||||||
{
|
{
|
||||||
std_string, character, integer, floating_point,
|
std_string, character, integer, floating_point,
|
||||||
boolean, size_integer, time_integer
|
boolean, size_integer, time_integer, integer16
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is used to map struct entries
|
// this is used to map struct entries
|
||||||
|
|
|
@ -463,10 +463,10 @@ namespace aux {
|
||||||
bencode_map_entry proxy_settings_map[] =
|
bencode_map_entry proxy_settings_map[] =
|
||||||
{
|
{
|
||||||
TORRENT_SETTING(std_string, hostname)
|
TORRENT_SETTING(std_string, hostname)
|
||||||
TORRENT_SETTING(integer, port)
|
TORRENT_SETTING(integer16, port)
|
||||||
TORRENT_SETTING(std_string, username)
|
TORRENT_SETTING(std_string, username)
|
||||||
TORRENT_SETTING(std_string, password)
|
TORRENT_SETTING(std_string, password)
|
||||||
TORRENT_SETTING(integer, type)
|
TORRENT_SETTING(character, type)
|
||||||
TORRENT_SETTING(boolean, proxy_hostnames)
|
TORRENT_SETTING(boolean, proxy_hostnames)
|
||||||
TORRENT_SETTING(boolean, proxy_peer_connections)
|
TORRENT_SETTING(boolean, proxy_peer_connections)
|
||||||
};
|
};
|
||||||
|
@ -496,9 +496,9 @@ namespace aux {
|
||||||
#define TORRENT_SETTING(t, x) {#x, offsetof(pe_settings,x), t},
|
#define TORRENT_SETTING(t, x) {#x, offsetof(pe_settings,x), t},
|
||||||
bencode_map_entry pe_settings_map[] =
|
bencode_map_entry pe_settings_map[] =
|
||||||
{
|
{
|
||||||
TORRENT_SETTING(integer, out_enc_policy)
|
TORRENT_SETTING(character, out_enc_policy)
|
||||||
TORRENT_SETTING(integer, in_enc_policy)
|
TORRENT_SETTING(character, in_enc_policy)
|
||||||
TORRENT_SETTING(integer, allowed_enc_level)
|
TORRENT_SETTING(character, allowed_enc_level)
|
||||||
TORRENT_SETTING(boolean, prefer_rc4)
|
TORRENT_SETTING(boolean, prefer_rc4)
|
||||||
};
|
};
|
||||||
#undef TORRENT_SETTING
|
#undef TORRENT_SETTING
|
||||||
|
|
|
@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO: 4 eliminate all use of this mechanism
|
||||||
void load_struct(lazy_entry const& e, void* s, bencode_map_entry const* m, int num)
|
void load_struct(lazy_entry const& e, void* s, bencode_map_entry const* m, int num)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num; ++i)
|
for (int i = 0; i < num; ++i)
|
||||||
|
@ -56,6 +57,7 @@ namespace libtorrent
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case character:
|
case character:
|
||||||
|
case integer16:
|
||||||
case boolean:
|
case boolean:
|
||||||
case integer:
|
case integer:
|
||||||
case size_integer:
|
case size_integer:
|
||||||
|
@ -67,6 +69,7 @@ namespace libtorrent
|
||||||
switch (m[i].type)
|
switch (m[i].type)
|
||||||
{
|
{
|
||||||
case character: *((char*)dest) = char(val); break;
|
case character: *((char*)dest) = char(val); break;
|
||||||
|
case integer16: *((boost::uint16_t*)dest) = boost::uint16_t(val); break;
|
||||||
case integer: *((int*)dest) = int(val); break;
|
case integer: *((int*)dest) = int(val); break;
|
||||||
case size_integer: *((size_type*)dest) = size_type(val); break;
|
case size_integer: *((size_type*)dest) = size_type(val); break;
|
||||||
case time_integer: *((time_t*)dest) = time_t(val); break;
|
case time_integer: *((time_t*)dest) = time_t(val); break;
|
||||||
|
@ -101,6 +104,9 @@ namespace libtorrent
|
||||||
case integer:
|
case integer:
|
||||||
if (*((int*)src) == *((int*)default_value)) continue;
|
if (*((int*)src) == *((int*)default_value)) continue;
|
||||||
break;
|
break;
|
||||||
|
case integer16:
|
||||||
|
if (*((boost::uint16_t*)src) == *((boost::uint16_t*)default_value)) continue;
|
||||||
|
break;
|
||||||
case size_integer:
|
case size_integer:
|
||||||
if (*((size_type*)src) == *((size_type*)default_value)) continue;
|
if (*((size_type*)src) == *((size_type*)default_value)) continue;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue