mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
Removed deprecated rak errno and file headers.
This commit is contained in:
@@ -1,85 +0,0 @@
|
||||
// rak - Rakshasa's toolbox
|
||||
// Copyright (C) 2005-2007, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
#ifndef RAK_ERROR_NUMBER_H
|
||||
#define RAK_ERROR_NUMBER_H
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
|
||||
namespace rak {
|
||||
|
||||
class error_number {
|
||||
public:
|
||||
static const int e_access = EACCES;
|
||||
static const int e_again = EAGAIN;
|
||||
static const int e_connreset = ECONNRESET;
|
||||
static const int e_connaborted = ECONNABORTED;
|
||||
static const int e_deadlk = EDEADLK;
|
||||
|
||||
static const int e_noent = ENOENT;
|
||||
static const int e_nodev = ENODEV;
|
||||
static const int e_nomem = ENOMEM;
|
||||
static const int e_notdir = ENOTDIR;
|
||||
static const int e_isdir = EISDIR;
|
||||
|
||||
static const int e_intr = EINTR;
|
||||
|
||||
error_number() : m_errno(0) {}
|
||||
error_number(int e) : m_errno(e) {}
|
||||
|
||||
bool is_valid() const { return m_errno != 0; }
|
||||
|
||||
int value() const { return m_errno; }
|
||||
const char* c_str() const { return std::strerror(m_errno); }
|
||||
|
||||
bool is_blocked_momentary() const { return m_errno == e_again || m_errno == e_intr; }
|
||||
bool is_blocked_prolonged() const { return m_errno == e_deadlk; }
|
||||
|
||||
bool is_closed() const { return m_errno == e_connreset || m_errno == e_connaborted; }
|
||||
|
||||
bool is_bad_path() const { return m_errno == e_noent || m_errno == e_notdir || m_errno == e_access; }
|
||||
|
||||
static error_number current() { return errno; }
|
||||
static void clear_global() { errno = 0; }
|
||||
static void set_global(error_number err) { errno = err.m_errno; }
|
||||
|
||||
bool operator == (const error_number& e) const { return m_errno == e.m_errno; }
|
||||
|
||||
private:
|
||||
int m_errno;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,75 +0,0 @@
|
||||
// rak - Rakshasa's toolbox
|
||||
// Copyright (C) 2005-2007, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
|
||||
#ifndef RAK_FILE_STAT_H
|
||||
#define RAK_FILE_STAT_H
|
||||
|
||||
#include <string>
|
||||
#include <cinttypes>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace rak {
|
||||
|
||||
class file_stat {
|
||||
public:
|
||||
// Consider storing rak::error_number.
|
||||
|
||||
bool update(int fd) { return fstat(fd, &m_stat) == 0; }
|
||||
bool update(const char* filename) { return stat(filename, &m_stat) == 0; }
|
||||
bool update(const std::string& filename) { return update(filename.c_str()); }
|
||||
|
||||
bool update_link(const char* filename) { return lstat(filename, &m_stat) == 0; }
|
||||
bool update_link(const std::string& filename) { return update_link(filename.c_str()); }
|
||||
|
||||
bool is_regular() const { return S_ISREG(m_stat.st_mode); }
|
||||
bool is_directory() const { return S_ISDIR(m_stat.st_mode); }
|
||||
bool is_character() const { return S_ISCHR(m_stat.st_mode); }
|
||||
bool is_block() const { return S_ISBLK(m_stat.st_mode); }
|
||||
bool is_fifo() const { return S_ISFIFO(m_stat.st_mode); }
|
||||
bool is_link() const { return S_ISLNK(m_stat.st_mode); }
|
||||
bool is_socket() const { return S_ISSOCK(m_stat.st_mode); }
|
||||
|
||||
off_t size() const { return m_stat.st_size; }
|
||||
|
||||
time_t access_time() const { return m_stat.st_atime; }
|
||||
time_t change_time() const { return m_stat.st_ctime; }
|
||||
time_t modified_time() const { return m_stat.st_mtime; }
|
||||
|
||||
private:
|
||||
struct stat m_stat;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <functional>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <rak/regex.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <torrent/net/types.h>
|
||||
#include <torrent/peer/connection_list.h>
|
||||
#include <torrent/peer/peer_list.h>
|
||||
#include <torrent/utils/file_stat.h>
|
||||
#include <torrent/utils/log.h>
|
||||
#include <torrent/utils/option_strings.h>
|
||||
|
||||
@@ -109,7 +109,7 @@ apply_d_change_link(core::Download* download, const torrent::Object::list_type&
|
||||
|
||||
case 1:
|
||||
{
|
||||
rak::file_stat fileStat;
|
||||
torrent::utils::FileStat fileStat;
|
||||
errno = 0;
|
||||
|
||||
if (!fileStat.update_link(link) || !fileStat.is_link() || unlink(link.c_str()) == -1)
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
#include <functional>
|
||||
#include <cstdio>
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/hash_string.h>
|
||||
#include <torrent/utils/log.h>
|
||||
#include <torrent/utils/directory_events.h>
|
||||
#include <torrent/utils/file_stat.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include "control.h"
|
||||
@@ -67,7 +66,7 @@ apply_start_tied() {
|
||||
if (rpc::call_command_value("d.state", rpc::make_target(download)) == 1)
|
||||
continue;
|
||||
|
||||
rak::file_stat fs;
|
||||
torrent::utils::FileStat fs;
|
||||
const std::string& tied_to_file = rpc::call_command_string("d.tied_to_file", rpc::make_target(download));
|
||||
|
||||
if (!tied_to_file.empty() && fs.update(rak::path_expand(tied_to_file)))
|
||||
@@ -83,7 +82,7 @@ apply_stop_untied() {
|
||||
if (rpc::call_command_value("d.state", rpc::make_target(download)) == 0)
|
||||
continue;
|
||||
|
||||
rak::file_stat fs;
|
||||
torrent::utils::FileStat fs;
|
||||
const std::string& tied_to_file = rpc::call_command_string("d.tied_to_file", rpc::make_target(download));
|
||||
|
||||
if (!tied_to_file.empty() && !fs.update(rak::path_expand(tied_to_file)))
|
||||
@@ -96,7 +95,7 @@ apply_stop_untied() {
|
||||
torrent::Object
|
||||
apply_close_untied() {
|
||||
for (const auto& download : *control->core()->download_list()) {
|
||||
rak::file_stat fs;
|
||||
torrent::utils::FileStat fs;
|
||||
const std::string& tied_to_file = rpc::call_command_string("d.tied_to_file", rpc::make_target(download));
|
||||
|
||||
if (rpc::call_command_value("d.ignore_commands", rpc::make_target(download)) == 0 && !tied_to_file.empty() && !fs.update(rak::path_expand(tied_to_file)))
|
||||
@@ -109,7 +108,7 @@ apply_close_untied() {
|
||||
torrent::Object
|
||||
apply_remove_untied() {
|
||||
for (auto itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ) {
|
||||
rak::file_stat fs;
|
||||
torrent::utils::FileStat fs;
|
||||
const std::string& tied_to_file = rpc::call_command_string("d.tied_to_file", rpc::make_target(*itr));
|
||||
|
||||
if (!tied_to_file.empty() && !fs.update(rak::path_expand(tied_to_file))) {
|
||||
@@ -301,7 +300,7 @@ directory_watch_added(const torrent::Object::list_type& args) {
|
||||
auto& command = args.back().as_string();
|
||||
|
||||
if (!control->directory_events()->open())
|
||||
throw torrent::input_error("Could not open inotify:" + std::string(rak::error_number::current().c_str()));
|
||||
throw torrent::input_error("Could not open inotify:" + std::string(std::strerror(errno)));
|
||||
|
||||
control->directory_events()->notify_on(path.c_str(),
|
||||
torrent::directory_events::flag_on_added | torrent::directory_events::flag_on_updated,
|
||||
|
||||
@@ -1,40 +1,5 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005-2011, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/path.h>
|
||||
#include <torrent/data/file.h>
|
||||
#include <torrent/data/file_list.h>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <fcntl.h>
|
||||
#include <functional>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/error_number.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <torrent/torrent.h>
|
||||
@@ -171,8 +171,8 @@ cmd_file_append(const torrent::Object::list_type& args) {
|
||||
|
||||
FILE* output = fopen(args.front().as_string().c_str(), "a");
|
||||
|
||||
if (output == NULL)
|
||||
throw torrent::input_error("Could not append to file '" + args.front().as_string() + "': " + rak::error_number::current().c_str());
|
||||
if (output == nullptr)
|
||||
throw torrent::input_error("Could not append to file '" + args.front().as_string() + "': " + std::strerror(errno));
|
||||
|
||||
file_print_list(++args.begin(), args.end(), output, file_print_delim_space);
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "core/download.h"
|
||||
|
||||
#include <list>
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/rate.h>
|
||||
@@ -9,12 +10,12 @@
|
||||
#include <torrent/tracker/tracker.h>
|
||||
#include <torrent/data/file.h>
|
||||
#include <torrent/data/file_list.h>
|
||||
#include <torrent/utils/file_stat.h>
|
||||
|
||||
#include "rpc/parse_commands.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "download.h"
|
||||
#include "manager.h"
|
||||
#include "core/manager.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -118,13 +119,14 @@ void
|
||||
Download::set_root_directory(const std::string& path) {
|
||||
// If the download is open, hashed and has completed chunks make
|
||||
// sure to verify that the download files are still present.
|
||||
//
|
||||
//
|
||||
// This should ensure that no one tries to set the destination
|
||||
// directory 'after' moving files. In cases where the user wants to
|
||||
// override this behavior the download must first be closed or
|
||||
// 'd.directory_base.set' may be used.
|
||||
rak::file_stat file_stat;
|
||||
torrent::FileList* file_list = m_download.file_list();
|
||||
|
||||
torrent::utils::FileStat file_stat;
|
||||
torrent::FileList* file_list = m_download.file_list();
|
||||
|
||||
if (is_hash_checked() && file_list->completed_chunks() != 0 &&
|
||||
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ Manager::try_create_download(const std::string& uri, int flags, const command_li
|
||||
!is_network_uri(uri) &&
|
||||
!is_magnet_uri(uri) &&
|
||||
!is_data_uri(uri) &&
|
||||
!file_status_cache()->insert(uri, 0))
|
||||
!file_status_cache()->insert(uri))
|
||||
return;
|
||||
|
||||
// Adding download.
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@
|
||||
#include <torrent/net/fd.h>
|
||||
#include <torrent/utils/chrono.h>
|
||||
#include <torrent/utils/log.h>
|
||||
#include <rak/error_number.h>
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
#include <execinfo.h>
|
||||
@@ -564,7 +563,7 @@ handle_sigbus(int signum, siginfo_t* sa, [[maybe_unused]] void* ptr) {
|
||||
#else
|
||||
output << "Stack dump not enabled." << std::endl;
|
||||
#endif
|
||||
output << std::endl << "Error: " << rak::error_number(sa->si_errno).c_str() << std::endl;
|
||||
output << std::endl << "Error: " << std::strerror(sa->si_errno) << std::endl;
|
||||
|
||||
const char* signal_reason;
|
||||
|
||||
|
||||
+6
-2
@@ -1,5 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
@@ -10,7 +11,6 @@
|
||||
#include <lua.hpp>
|
||||
#endif
|
||||
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/object.h>
|
||||
@@ -419,12 +419,16 @@ execute_lua(LuaEngine* engine, rpc::target_type target_type, torrent::Object con
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
torrent::Object
|
||||
execute_lua(LuaEngine* engine, torrent::Object const& rawArgs, int flags) {
|
||||
execute_lua([[maybe_unused]] LuaEngine* engine, [[maybe_unused]] torrent::Object const& rawArgs, [[maybe_unused]] int flags) {
|
||||
throw torrent::input_error("Lua support not enabled");
|
||||
return torrent::Object();
|
||||
}
|
||||
|
||||
LuaEngine::LuaEngine() {}
|
||||
LuaEngine::~LuaEngine() {}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace rpc
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "rpc/scgi_task.h"
|
||||
|
||||
#include <rak/error_number.h>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include <sys/types.h>
|
||||
@@ -59,7 +58,7 @@ SCgiTask::event_read() {
|
||||
int bytes = ::recv(m_fileDesc, m_position, m_buffer_size - (m_position - m_buffer), 0);
|
||||
|
||||
if (bytes <= 0) {
|
||||
if (bytes == 0 || !rak::error_number::current().is_blocked_momentary())
|
||||
if (bytes == 0 || !(errno == EAGAIN || errno == EINTR))
|
||||
close();
|
||||
|
||||
return;
|
||||
@@ -194,7 +193,7 @@ SCgiTask::event_write() {
|
||||
#endif
|
||||
|
||||
if (bytes == -1) {
|
||||
if (!rak::error_number::current().is_blocked_momentary())
|
||||
if (!(errno == EAGAIN || errno == EINTR))
|
||||
close();
|
||||
|
||||
return;
|
||||
|
||||
+4
-37
@@ -1,44 +1,11 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005-2011, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <signal.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include "rak/error_number.h"
|
||||
#include "signal_handler.h"
|
||||
|
||||
#ifdef __sun__
|
||||
@@ -80,7 +47,7 @@ SignalHandler::set_handler(unsigned int signum, slot_void slot) {
|
||||
sa.sa_handler = &SignalHandler::caught;
|
||||
|
||||
if (sigaction(signum, &sa, NULL) == -1)
|
||||
throw std::logic_error("Could not set sigaction: " + std::string(rak::error_number::current().c_str()));
|
||||
throw std::logic_error("Could not set sigaction: " + std::string(std::strerror(errno)));
|
||||
else
|
||||
m_handlers[signum] = slot;
|
||||
}
|
||||
@@ -97,7 +64,7 @@ SignalHandler::set_sigaction_handler(unsigned int signum, handler_slot slot) {
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
if (sigaction(signum, &sa, NULL) == -1)
|
||||
throw std::logic_error("Could not set sigaction: " + std::string(rak::error_number::current().c_str()));
|
||||
throw std::logic_error("Could not set sigaction: " + std::string(std::strerror(errno)));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,50 +1,16 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005-2011, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/utils/file_stat.h>
|
||||
|
||||
#include "file_status_cache.h"
|
||||
|
||||
namespace utils {
|
||||
|
||||
bool
|
||||
FileStatusCache::insert(const std::string& path, int flags) {
|
||||
rak::file_stat fs;
|
||||
FileStatusCache::insert(const std::string& path) {
|
||||
torrent::utils::FileStat fs;
|
||||
|
||||
// Should we expand somewhere else? Problem is it adds a lot of junk
|
||||
// to the start of the paths added to the cache, causing more work
|
||||
@@ -71,7 +37,7 @@ FileStatusCache::prune() {
|
||||
iterator itr = begin();
|
||||
|
||||
while (itr != end()) {
|
||||
rak::file_stat fs;
|
||||
torrent::utils::FileStat fs;
|
||||
iterator tmp = itr++;
|
||||
|
||||
if (!fs.update(rak::path_expand(tmp->first)) || tmp->second.m_mtime != (uint32_t)fs.modified_time())
|
||||
|
||||
@@ -1,37 +1,3 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005-2011, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <sundell.software@gmail.com>
|
||||
|
||||
|
||||
#ifndef RTORRENT_UTILS_FILE_STATUS_CACHE_H
|
||||
#define RTORRENT_UTILS_FILE_STATUS_CACHE_H
|
||||
|
||||
@@ -69,7 +35,7 @@ public:
|
||||
|
||||
// Insert and return true if the entry does not exist or the new
|
||||
// file's mtime is more recent.
|
||||
bool insert(const std::string& path, int flags);
|
||||
bool insert(const std::string& path);
|
||||
|
||||
// Add a function for pruning a sorted list of paths.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user