mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-07 22:59:21 +00:00
Cleaned up xmlrpc-c string sanitization.
This commit is contained in:
+14
-49
@@ -1,47 +1,12 @@
|
||||
// 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 "display/frame.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include <rak/algorithm.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "frame.h"
|
||||
#include "window.h"
|
||||
#include "display/window.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
@@ -137,7 +102,7 @@ Frame::preferred_size() const {
|
||||
|
||||
for (size_type i = 0; i < m_containerSize; ++i) {
|
||||
bounds_type p = m_container[i]->preferred_size();
|
||||
|
||||
|
||||
accum.minWidth += p.minWidth;
|
||||
accum.minHeight += p.minHeight;
|
||||
|
||||
@@ -221,7 +186,7 @@ Frame::clear() {
|
||||
m_window->set_offscreen(true);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case TYPE_ROW:
|
||||
case TYPE_COLUMN:
|
||||
for (size_type i = 0; i < m_containerSize; ++i) {
|
||||
@@ -335,10 +300,10 @@ Frame::balance_row(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
dynamic_type dynamicFrames[max_size];
|
||||
|
||||
int remaining = height;
|
||||
|
||||
|
||||
for (Frame **itr = m_container, **last = m_container + m_containerSize; itr != last; ++itr) {
|
||||
bounds_type bounds = (*itr)->preferred_size();
|
||||
|
||||
|
||||
if ((*itr)->is_height_dynamic()) {
|
||||
(*itr)->m_height = 0;
|
||||
dynamicFrames[dynamicSize++] = std::make_pair(*itr, bounds);
|
||||
@@ -367,11 +332,11 @@ Frame::balance_row(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
|
||||
for (dynamic_type *itr = dynamicFrames, *last = dynamicFrames + dynamicSize; itr != last; ++itr) {
|
||||
uint32_t adjust = (std::max(remaining, 0) + std::distance(itr, last) - 1) / std::distance(itr, last);
|
||||
|
||||
|
||||
adjust += itr->first->m_height;
|
||||
adjust = std::max(adjust, itr->second.minHeight);
|
||||
adjust = std::min(adjust, itr->second.maxHeight);
|
||||
|
||||
|
||||
remaining -= adjust - itr->first->m_height;
|
||||
|
||||
retry = retry || itr->first->m_height != adjust;
|
||||
@@ -410,10 +375,10 @@ Frame::balance_column(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
dynamic_type dynamicFrames[max_size];
|
||||
|
||||
int remaining = width;
|
||||
|
||||
|
||||
for (Frame **itr = m_container, **last = m_container + m_containerSize; itr != last; ++itr) {
|
||||
bounds_type bounds = (*itr)->preferred_size();
|
||||
|
||||
|
||||
if ((*itr)->is_width_dynamic()) {
|
||||
(*itr)->m_width = 0;
|
||||
dynamicFrames[dynamicSize++] = std::make_pair(*itr, bounds);
|
||||
@@ -423,7 +388,7 @@ Frame::balance_column(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
remaining -= bounds.minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sort the dynamic frames by the min size in the direction we are
|
||||
// interested in. Then try to satisfy the largest first, and if we
|
||||
// have any remaining space we can use that to extend it and any
|
||||
@@ -442,11 +407,11 @@ Frame::balance_column(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
|
||||
for (dynamic_type *itr = dynamicFrames, *last = dynamicFrames + dynamicSize; itr != last; ++itr) {
|
||||
uint32_t adjust = (std::max(remaining, 0) + std::distance(itr, last) - 1) / std::distance(itr, last);
|
||||
|
||||
|
||||
adjust += itr->first->m_width;
|
||||
adjust = std::max(adjust, itr->second.minWidth);
|
||||
adjust = std::min(adjust, itr->second.maxWidth);
|
||||
|
||||
|
||||
remaining -= adjust - itr->first->m_width;
|
||||
|
||||
retry = retry || itr->first->m_width != adjust;
|
||||
|
||||
Reference in New Issue
Block a user