mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 02:32:32 +00:00
* Renamed 'check_hash' and added a redirect.
* Added proper torrent::Object stack type in rpc::Command. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1160 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+10
-7
@@ -77,23 +77,26 @@ get_target_cast<torrent::File*>(target_type target, int type) {
|
||||
}
|
||||
|
||||
inline torrent::Object*
|
||||
Command::push_stack(const torrent::Object::list_type& args, torrent::Object* tmp_stack) {
|
||||
Command::push_stack(const torrent::Object::list_type& args, stack_type* stack) {
|
||||
unsigned int idx = 0;
|
||||
|
||||
for (torrent::Object::list_const_iterator itr = args.begin(), last = args.end();
|
||||
itr != last && idx < Command::max_arguments; itr++, idx++) {
|
||||
new (tmp_stack + idx) torrent::Object(*itr);
|
||||
tmp_stack[idx].swap(*Command::argument(idx));
|
||||
new (&(*stack)[idx]) torrent::Object(*itr);
|
||||
(*stack)[idx].swap(*Command::argument(idx));
|
||||
}
|
||||
|
||||
return tmp_stack + idx;
|
||||
return stack->begin() + idx;
|
||||
}
|
||||
|
||||
inline void
|
||||
Command::pop_stack(torrent::Object* first_stack, torrent::Object* last_stack) {
|
||||
while (last_stack-- != first_stack) {
|
||||
last_stack->swap(*Command::argument(std::distance(first_stack, last_stack)));
|
||||
Command::pop_stack(stack_type* stack, torrent::Object* last_stack) {
|
||||
while (last_stack-- != stack->begin()) {
|
||||
last_stack->swap(*Command::argument(std::distance(stack->begin(), last_stack)));
|
||||
last_stack->~Object();
|
||||
|
||||
// To ensure we catch errors:
|
||||
std::memset(last_stack, 0xAA, sizeof(torrent::Object));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user