* Fixed the log redraw which didn't happen as the display's scheduler

didn't get re-added to the task scheduler until a new event happened.

* Added redraw delay interval of 100ms, consider 50ms.

* Removed exceptions from core::DownloadStore::save.

* Added load, load_run, tied_stop and tied_remove to man-page.

* Cleaned up the command/option instances, move them to Control.

* PCB::load_up_chunk grabbed the errno from m_downChunk, not m_upChunk.

* Various string operations were moved to rak/string_manip.h.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@617 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-01-06 21:14:49 +00:00
parent 4431fd1652
commit f32c15878a
33 changed files with 471 additions and 482 deletions
+1 -5
View File
@@ -3,10 +3,6 @@ noinst_LIBRARIES = libsub_utils.a
libsub_utils_a_SOURCES = \
directory.cc \
directory.h \
file_stat.cc \
file_stat.h \
list_focus.h \
parse.cc \
parse.h
list_focus.h
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
-85
View File
@@ -1,85 +0,0 @@
// rTorrent - BitTorrent client
// Copyright (C) 2005, 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 <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#include "config.h"
#include <errno.h>
#include <stdexcept>
#include "file_stat.h"
namespace utils {
void
FileStat::update_throws(int fd) {
int r = update(fd);
if (r < 0)
throw std::runtime_error(error_string(r));
}
void
FileStat::update_throws(const char* filename) {
int r = update(filename);
if (r < 0)
throw std::runtime_error(error_string(r));
}
std::string
FileStat::error_string(int err) {
switch (err) {
case 0:
return "Success";
case EBADF:
return "Bad file descriptor";
case ENOENT:
return "Filename does not exist";
case ENOTDIR:
return "Path not a directory";
case EACCES:
return "Permission denied";
default:
return "Unknown error";
}
}
}
-80
View File
@@ -1,80 +0,0 @@
// libTorrent - BitTorrent library
// Copyright (C) 2005, 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 <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#ifndef RTORRENT_UTILS_FILE_STAT_H
#define RTORRENT_UTILS_FILE_STAT_H
#include <string>
#include <inttypes.h>
#include <sys/stat.h>
namespace utils {
class FileStat {
public:
FileStat() {}
FileStat(const char* filename) { update_throws(filename); }
explicit FileStat(int fd) { update_throws(fd); }
int update(int fd) { return fstat(fd, &m_stat); }
int update(const char* filename) { return stat(filename, &m_stat); }
void update_throws(int fd);
void update_throws(const char* filename);
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_sockt() const { return S_ISSOCK(m_stat.st_mode); }
off_t get_size() const { return m_stat.st_size; }
time_t get_atime() const { return m_stat.st_atime; }
time_t get_ctime() const { return m_stat.st_ctime; }
time_t get_mtime() const { return m_stat.st_mtime; }
static std::string error_string(int err);
private:
struct stat m_stat;
};
}
#endif
-75
View File
@@ -1,75 +0,0 @@
// rTorrent - BitTorrent client
// Copyright (C) 2005, 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 <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#include "config.h"
#include <sstream>
#include "utils/parse.h"
namespace utils {
std::string
escape_string(const std::string& src) {
std::stringstream stream;
stream << std::hex << std::uppercase;
for (std::string::const_iterator itr = src.begin(); itr != src.end(); ++itr)
if ((*itr >= 'A' && *itr <= 'Z') ||
(*itr >= 'a' && *itr <= 'z') ||
(*itr >= '0' && *itr <= '9') ||
*itr == '-')
stream << *itr;
else
stream << '%' << ((unsigned char)*itr >> 4) << ((unsigned char)*itr & 0xf);
return stream.str();
}
std::string
string_to_hex(const std::string& src) {
std::stringstream stream;
stream << std::hex << std::uppercase;
for (std::string::const_iterator itr = src.begin(); itr != src.end(); ++itr)
stream << ((unsigned char)*itr >> 4) << ((unsigned char)*itr & 0xf);
return stream.str();
}
}
-51
View File
@@ -1,51 +0,0 @@
// rTorrent - BitTorrent client
// Copyright (C) 2005, 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 <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#ifndef RTORRENT_UTILS_PARSE_H
#define RTORRENT_UTILS_PARSE_H
#include <string>
namespace utils {
// Various functinos for manipulating strings.
std::string escape_string(const std::string& src);
std::string string_to_hex(const std::string& src);
}
#endif