* Cleaned up the exception classes so they require less space. This

reduced the size of the stripped libtorrent by 1/7.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@822 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-12-11 10:33:09 +00:00
parent 460aac5df0
commit fcb8154188
26 changed files with 97 additions and 97 deletions
+5 -5
View File
@@ -96,7 +96,7 @@ Download::Download(core::Download* d) :
Download::~Download() {
if (is_active())
throw torrent::client_error("ui::Download::~Download() called on an active object.");
throw torrent::internal_error("ui::Download::~Download() called on an active object.");
std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete<ElementBase>());
@@ -187,7 +187,7 @@ Download::create_info() {
void
Download::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::Download::activate() called on an already activated object.");
throw torrent::internal_error("ui::Download::activate() called on an already activated object.");
control->input()->push_back(&m_bindings);
@@ -203,7 +203,7 @@ Download::activate(display::Frame* frame, bool focus) {
void
Download::disable() {
if (!is_active())
throw torrent::client_error("ui::Download::disable() called on an already disabled object.");
throw torrent::internal_error("ui::Download::disable() called on an already disabled object.");
control->input()->erase(&m_bindings);
@@ -218,10 +218,10 @@ Download::disable() {
void
Download::activate_display(Display displayType, bool focusDisplay) {
if (!is_active())
throw torrent::client_error("ui::Download::activate_display(...) !is_active().");
throw torrent::internal_error("ui::Download::activate_display(...) !is_active().");
if (displayType > DISPLAY_MAX_SIZE)
throw torrent::client_error("ui::Download::activate_display(...) out of bounds");
throw torrent::internal_error("ui::Download::activate_display(...) out of bounds");
if (focusDisplay == m_focusDisplay && displayType == m_state)
return;
+5 -5
View File
@@ -91,7 +91,7 @@ DownloadList::~DownloadList() {
void
DownloadList::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::DownloadList::activate() called on an already activated object");
throw torrent::internal_error("ui::DownloadList::activate() called on an already activated object");
m_frame = frame;
@@ -122,10 +122,10 @@ DownloadList::current_view() {
void
DownloadList::activate_display(Display displayType) {
if (!is_active())
throw torrent::client_error("ui::DownloadList::activate_display(...) !is_active().");
throw torrent::internal_error("ui::DownloadList::activate_display(...) !is_active().");
if (displayType > DISPLAY_MAX_SIZE)
throw torrent::client_error("ui::DownloadList::activate_display(...) out of bounds");
throw torrent::internal_error("ui::DownloadList::activate_display(...) out of bounds");
if (displayType == m_state)
return;
@@ -240,7 +240,7 @@ DownloadList::receive_view_input(Input type) {
break;
default:
throw torrent::client_error("DownloadList::receive_view_input(...) Invalid input type.");
throw torrent::internal_error("DownloadList::receive_view_input(...) Invalid input type.");
}
ElementStringList* esl = dynamic_cast<ElementStringList*>(m_uiArray[DISPLAY_STRING_LIST]);
@@ -292,7 +292,7 @@ DownloadList::receive_exit_input(Input type) {
break;
default:
throw torrent::client_error("DownloadList::receive_exit_input(...) Invalid input type.");
throw torrent::internal_error("DownloadList::receive_exit_input(...) Invalid input type.");
}
} catch (torrent::input_error& e) {
+6 -6
View File
@@ -63,7 +63,7 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) :
void
ElementChunksSeen::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementChunksSeen::activate(...) is_active().");
throw torrent::internal_error("ui::ElementChunksSeen::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -78,7 +78,7 @@ ElementChunksSeen::activate(display::Frame* frame, bool focus) {
void
ElementChunksSeen::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementChunksSeen::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementChunksSeen::disable(...) !is_active().");
control->input()->erase(&m_bindings);
@@ -110,7 +110,7 @@ ElementChunksSeen::window() {
void
ElementChunksSeen::receive_next() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementChunksSeen::receive_next(...) called on a disabled object");
throw torrent::internal_error("ui::ElementChunksSeen::receive_next(...) called on a disabled object");
if (++m_focus > m_window->max_focus())
m_focus = 0;
@@ -121,7 +121,7 @@ ElementChunksSeen::receive_next() {
void
ElementChunksSeen::receive_prev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementChunksSeen::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementChunksSeen::receive_prev(...) called on a disabled object");
if (m_focus > 0)
--m_focus;
@@ -134,7 +134,7 @@ ElementChunksSeen::receive_prev() {
void
ElementChunksSeen::receive_pagenext() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementChunksSeen::receive_pagenext(...) called on a disabled object");
throw torrent::internal_error("ui::ElementChunksSeen::receive_pagenext(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
@@ -152,7 +152,7 @@ ElementChunksSeen::receive_pagenext() {
void
ElementChunksSeen::receive_pageprev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementChunksSeen::receive_pageprev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementChunksSeen::receive_pageprev(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
+3 -3
View File
@@ -59,7 +59,7 @@ ElementDownloadList::ElementDownloadList() :
receive_change_view("main");
if (m_view == NULL)
throw torrent::client_error("View \"main\" must be present to initialize the main display.");
throw torrent::internal_error("View \"main\" must be present to initialize the main display.");
m_bindings['\x13'] = sigc::mem_fun(*this, &ElementDownloadList::receive_start_download);
m_bindings['\x04'] = sigc::mem_fun(*this, &ElementDownloadList::receive_stop_download);
@@ -85,7 +85,7 @@ ElementDownloadList::ElementDownloadList() :
void
ElementDownloadList::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementDownloadList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementDownloadList::activate(...) is_active().");
control->input()->push_back(&m_bindings);
@@ -100,7 +100,7 @@ ElementDownloadList::activate(display::Frame* frame, bool focus) {
void
ElementDownloadList::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementDownloadList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementDownloadList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
+8 -8
View File
@@ -69,7 +69,7 @@ ElementFileList::ElementFileList(core::Download* d) :
void
ElementFileList::activate(display::Frame* frame, bool focus) {
if (m_window != NULL)
throw torrent::client_error("ui::ElementFileList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementFileList::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -86,7 +86,7 @@ ElementFileList::activate(display::Frame* frame, bool focus) {
void
ElementFileList::disable() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementFileList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
@@ -105,7 +105,7 @@ ElementFileList::window() {
void
ElementFileList::receive_next() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_next(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_next(...) called on a disabled object");
if (++m_focus >= m_download->download()->file_list()->size_files())
m_focus = 0;
@@ -116,7 +116,7 @@ ElementFileList::receive_next() {
void
ElementFileList::receive_prev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList* fl = m_download->download()->file_list();
@@ -134,7 +134,7 @@ ElementFileList::receive_prev() {
void
ElementFileList::receive_pagenext() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_pagenext(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_pagenext(...) called on a disabled object");
unsigned int count = (m_window->height() - 1) / 2;
torrent::FileList* fl = m_download->download()->file_list();
@@ -152,7 +152,7 @@ ElementFileList::receive_pagenext() {
void
ElementFileList::receive_pageprev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_pageprev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_pageprev(...) called on a disabled object");
torrent::FileList* fl = m_download->download()->file_list();
@@ -174,7 +174,7 @@ ElementFileList::receive_pageprev() {
void
ElementFileList::receive_priority() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList* fl = m_download->download()->file_list();
@@ -192,7 +192,7 @@ ElementFileList::receive_priority() {
void
ElementFileList::receive_change_all() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList* fl = m_download->download()->file_list();
+2 -2
View File
@@ -56,7 +56,7 @@ ElementLogComplete::ElementLogComplete(core::Log* l) :
void
ElementLogComplete::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementLogComplete::activate(...) is_active().");
throw torrent::internal_error("ui::ElementLogComplete::activate(...) is_active().");
control->input()->push_back(&m_bindings);
@@ -70,7 +70,7 @@ ElementLogComplete::activate(display::Frame* frame, bool focus) {
void
ElementLogComplete::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementLogComplete::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementLogComplete::disable(...) !is_active().");
control->input()->erase(&m_bindings);
+2 -2
View File
@@ -86,7 +86,7 @@ ElementMenu::~ElementMenu() {
void
ElementMenu::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementMenu::activate(...) is_active().");
throw torrent::internal_error("ui::ElementMenu::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -103,7 +103,7 @@ ElementMenu::activate(display::Frame* frame, bool focus) {
void
ElementMenu::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementMenu::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementMenu::disable(...) !is_active().");
control->input()->erase(&m_bindings);
+3 -3
View File
@@ -140,7 +140,7 @@ ElementPeerList::create_info() {
void
ElementPeerList::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementPeerList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementPeerList::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -154,7 +154,7 @@ ElementPeerList::activate(display::Frame* frame, bool focus) {
void
ElementPeerList::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementPeerList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementPeerList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
@@ -240,7 +240,7 @@ ElementPeerList::receive_peer_disconnected(torrent::Peer p) {
PList::iterator itr = std::find(m_list.begin(), m_list.end(), p);
if (itr == m_list.end())
throw torrent::client_error("ElementPeerList::receive_peer_disconnected(...) itr == m_list.end().");
throw torrent::internal_error("ElementPeerList::receive_peer_disconnected(...) itr == m_list.end().");
if (itr == m_listItr)
m_listItr = m_list.erase(itr);
+2 -2
View File
@@ -53,7 +53,7 @@ ElementStringList::ElementStringList() :
void
ElementStringList::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementStringList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementStringList::activate(...) is_active().");
control->input()->push_back(&m_bindings);
@@ -67,7 +67,7 @@ ElementStringList::activate(display::Frame* frame, bool focus) {
void
ElementStringList::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementStringList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementStringList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
+2 -2
View File
@@ -68,7 +68,7 @@ ElementText::~ElementText() {
void
ElementText::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementText::activate(...) is_active().");
throw torrent::internal_error("ui::ElementText::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -84,7 +84,7 @@ ElementText::activate(display::Frame* frame, bool focus) {
void
ElementText::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementText::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementText::disable(...) !is_active().");
control->input()->erase(&m_bindings);
+7 -7
View File
@@ -66,7 +66,7 @@ ElementTrackerList::ElementTrackerList(core::Download* d) :
void
ElementTrackerList::activate(display::Frame* frame, bool focus) {
if (m_window != NULL)
throw torrent::client_error("ui::ElementTrackerList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementTrackerList::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -81,7 +81,7 @@ ElementTrackerList::activate(display::Frame* frame, bool focus) {
void
ElementTrackerList::disable() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTrackerList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementTrackerList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
@@ -100,7 +100,7 @@ ElementTrackerList::window() {
void
ElementTrackerList::receive_disable() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
torrent::Tracker t = m_download->download()->tracker_list().get(m_focus);
@@ -115,7 +115,7 @@ ElementTrackerList::receive_disable() {
void
ElementTrackerList::receive_next() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
if (++m_focus >= m_download->download()->tracker_list().size())
m_focus = 0;
@@ -126,7 +126,7 @@ ElementTrackerList::receive_next() {
void
ElementTrackerList::receive_prev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
if (m_download->download()->tracker_list().size() == 0)
return;
@@ -142,12 +142,12 @@ ElementTrackerList::receive_prev() {
void
ElementTrackerList::receive_cycle_group() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object");
torrent::TrackerList tl = m_download->download()->tracker_list();
if (m_focus >= tl.size())
throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
tl.cycle_group(tl.get(m_focus).group());
+6 -6
View File
@@ -63,7 +63,7 @@ ElementTransferList::ElementTransferList(core::Download* d) :
void
ElementTransferList::activate(display::Frame* frame, bool focus) {
if (is_active())
throw torrent::client_error("ui::ElementTransferList::activate(...) is_active().");
throw torrent::internal_error("ui::ElementTransferList::activate(...) is_active().");
if (focus)
control->input()->push_back(&m_bindings);
@@ -78,7 +78,7 @@ ElementTransferList::activate(display::Frame* frame, bool focus) {
void
ElementTransferList::disable() {
if (!is_active())
throw torrent::client_error("ui::ElementTransferList::disable(...) !is_active().");
throw torrent::internal_error("ui::ElementTransferList::disable(...) !is_active().");
control->input()->erase(&m_bindings);
@@ -110,7 +110,7 @@ ElementTransferList::window() {
void
ElementTransferList::receive_next() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTransferList::receive_next(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTransferList::receive_next(...) called on a disabled object");
if (++m_focus > m_window->max_focus())
m_focus = 0;
@@ -121,7 +121,7 @@ ElementTransferList::receive_next() {
void
ElementTransferList::receive_prev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTransferList::receive_prev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTransferList::receive_prev(...) called on a disabled object");
if (m_focus > 0)
--m_focus;
@@ -134,7 +134,7 @@ ElementTransferList::receive_prev() {
void
ElementTransferList::receive_pagenext() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTransferList::receive_pagenext(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTransferList::receive_pagenext(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
@@ -152,7 +152,7 @@ ElementTransferList::receive_pagenext() {
void
ElementTransferList::receive_pageprev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementTransferList::receive_pageprev(...) called on a disabled object");
throw torrent::internal_error("ui::ElementTransferList::receive_pageprev(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
+2 -2
View File
@@ -194,7 +194,7 @@ Root::adjust_up_throttle(int throttle) {
void
Root::enable_input(const std::string& title, input::TextInput* input) {
if (m_windowInput->input() != NULL)
throw torrent::client_error("Root::enable_input(...) m_windowInput->input() != NULL.");
throw torrent::internal_error("Root::enable_input(...) m_windowInput->input() != NULL.");
input->slot_dirty(sigc::mem_fun(m_windowInput, &WInput::mark_dirty));
@@ -215,7 +215,7 @@ Root::enable_input(const std::string& title, input::TextInput* input) {
void
Root::disable_input() {
if (m_windowInput->input() == NULL)
throw torrent::client_error("Root::disable_input() m_windowInput->input() == NULL.");
throw torrent::internal_error("Root::disable_input() m_windowInput->input() == NULL.");
m_windowInput->input()->slot_dirty(sigc::slot0<void>());