replaced std::vector with buffer
This commit is contained in:
parent
e28689237d
commit
0439399169
|
@ -57,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/peer_request.hpp"
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/buffer.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -344,8 +345,8 @@ namespace libtorrent
|
|||
// used to move pieces while expanding
|
||||
// the storage from compact allocation
|
||||
// to full allocation
|
||||
std::vector<char> m_scratch_buffer;
|
||||
std::vector<char> m_scratch_buffer2;
|
||||
buffer m_scratch_buffer;
|
||||
buffer m_scratch_buffer2;
|
||||
// the piece that is in the scratch buffer
|
||||
int m_scratch_piece;
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <windows.h>
|
||||
#include <boost/filesystem/exception.hpp>
|
||||
#include "libtorrent/utf8.hpp"
|
||||
#include "libtorrent/buffer.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -386,7 +387,7 @@ namespace libtorrent
|
|||
file_pool& m_files;
|
||||
|
||||
// temporary storage for moving pieces
|
||||
std::vector<char> m_scratch_buffer;
|
||||
buffer m_scratch_buffer;
|
||||
};
|
||||
|
||||
sha1_hash storage::hash_for_slot(int slot, partial_hash& ph, int piece_size)
|
||||
|
@ -468,14 +469,14 @@ namespace libtorrent
|
|||
void storage::release_files()
|
||||
{
|
||||
m_files.release(this);
|
||||
std::vector<char>().swap(m_scratch_buffer);
|
||||
buffer().swap(m_scratch_buffer);
|
||||
}
|
||||
|
||||
void storage::delete_files()
|
||||
{
|
||||
// make sure we don't have the files open
|
||||
m_files.release(this);
|
||||
std::vector<char>().swap(m_scratch_buffer);
|
||||
buffer().swap(m_scratch_buffer);
|
||||
|
||||
// delete the files from disk
|
||||
std::set<std::string> directories;
|
||||
|
@ -1623,8 +1624,8 @@ namespace libtorrent
|
|||
if (m_current_slot == m_info->num_pieces())
|
||||
{
|
||||
m_state = state_create_files;
|
||||
std::vector<char>().swap(m_scratch_buffer);
|
||||
std::vector<char>().swap(m_scratch_buffer2);
|
||||
buffer().swap(m_scratch_buffer);
|
||||
buffer().swap(m_scratch_buffer2);
|
||||
if (m_storage_mode != storage_mode_compact)
|
||||
{
|
||||
std::vector<int>().swap(m_piece_to_slot);
|
||||
|
|
Loading…
Reference in New Issue