mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +00:00
* Casting printf input to match the format type.
* Properly clear the queued events during closing of a socket by checking for the file descriptor, not the ptr. * SCGI m_task queue could overflow since the check was not working. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1246 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -246,7 +246,7 @@ log_vmmap_dump(const std::string& str) {
|
||||
FILE* log_file = fopen(str.c_str(), "w");
|
||||
|
||||
for (std::vector<torrent::vm_mapping>::iterator itr = all_mappings.begin(), last = all_mappings.end(); itr != last; itr++) {
|
||||
fprintf(log_file, "%8p-%8p [%5llxk]\n", itr->ptr, (char*)itr->ptr + itr->length, itr->length / 1024);
|
||||
fprintf(log_file, "%8p-%8p [%5llxk]\n", itr->ptr, (char*)itr->ptr + itr->length, (long long unsigned int)(itr->length / 1024));
|
||||
}
|
||||
|
||||
fclose(log_file);
|
||||
|
||||
@@ -241,7 +241,7 @@ int64_t
|
||||
cg_get_index(const torrent::Object& raw_args) {
|
||||
const torrent::Object& arg = (raw_args.is_list() && !raw_args.as_list().empty()) ? raw_args.as_list().front() : raw_args;
|
||||
|
||||
int64_t index = 0;
|
||||
size_t index = 0;
|
||||
|
||||
if (arg.is_string()) {
|
||||
if (!rpc::parse_whole_value_nothrow(arg.as_string().c_str(), &index))
|
||||
@@ -322,7 +322,7 @@ cg_get_index(const torrent::Object& raw_args) {
|
||||
if (index < 0)
|
||||
index = (int64_t)cg_list_hack.size() + index;
|
||||
|
||||
if (index >= cg_list_hack.size())
|
||||
if ((size_t)index >= cg_list_hack.size())
|
||||
throw torrent::input_error("Choke group not found.");
|
||||
|
||||
return index;
|
||||
@@ -332,7 +332,7 @@ torrent::choke_group*
|
||||
cg_get_group(const torrent::Object& raw_args) {
|
||||
int64_t index = cg_get_index(raw_args);
|
||||
|
||||
if (index >= cg_list_hack.size())
|
||||
if ((size_t)index >= cg_list_hack.size())
|
||||
throw torrent::input_error("Choke group not found.");
|
||||
|
||||
return cg_list_hack.at(index);
|
||||
|
||||
@@ -66,7 +66,7 @@ cmd_scheduler_simple_removed(core::Download* download) {
|
||||
core::View* viewActive = *control->view_manager()->find("active");
|
||||
int64_t maxActive = rpc::call_command("scheduler.max_active", torrent::Object()).as_value();
|
||||
|
||||
if (viewActive->size_visible() >= maxActive)
|
||||
if ((int64_t)viewActive->size_visible() >= maxActive)
|
||||
return torrent::Object();
|
||||
|
||||
// The 'started' view contains all the views we may choose amongst.
|
||||
|
||||
@@ -264,8 +264,8 @@ DhtManager::log_statistics(bool force) {
|
||||
stats.queries_received - m_dhtPrevQueriesReceived,
|
||||
stats.queries_sent - m_dhtPrevQueriesSent,
|
||||
stats.replies_received - m_dhtPrevRepliesReceived,
|
||||
stats.down_rate.total() - m_dhtPrevBytesDown,
|
||||
stats.up_rate.total() - m_dhtPrevBytesUp,
|
||||
(long long unsigned int)(stats.down_rate.total() - m_dhtPrevBytesDown),
|
||||
(long long unsigned int)(stats.up_rate.total() - m_dhtPrevBytesUp),
|
||||
stats.num_nodes,
|
||||
stats.num_buckets,
|
||||
stats.num_peers,
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
void set_attr(unsigned int x, unsigned int y, unsigned int n, int attr, int color) { mvwchgat(m_window, y, x, n, attr, color, NULL); }
|
||||
|
||||
void set_default_attributes(int attr) { wattrset(m_window, attr); }
|
||||
void set_default_attributes(int attr) { (void)wattrset(m_window, attr); }
|
||||
|
||||
// Initialize stdscr.
|
||||
static void initialize();
|
||||
|
||||
@@ -122,7 +122,7 @@ TextElementCommand::print(char* first, char* last, Canvas::attributes_list* attr
|
||||
}
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
{
|
||||
first += std::min<ptrdiff_t>(std::max(snprintf(first, last - first + 1, "%lld", result.as_value()), 0), last - first + 1);
|
||||
first += std::min<ptrdiff_t>(std::max(snprintf(first, last - first + 1, "%lld", (long long int)result.as_value()), 0), last - first + 1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -124,7 +124,7 @@ TextElementValueBase::print(char* first, char* last, Canvas::attributes_list* at
|
||||
first += std::min<ptrdiff_t>(std::max(snprintf(first, last - first + 1, "%2d:%02d:%02d", u->tm_hour, u->tm_min, u->tm_sec), 0), last - first + 1);
|
||||
|
||||
} else {
|
||||
first += std::min<ptrdiff_t>(std::max(snprintf(first, last - first + 1, "%lld", val), 0), last - first + 1);
|
||||
first += std::min<ptrdiff_t>(std::max(snprintf(first, last - first + 1, "%lld", (long long int)val), 0), last - first + 1);
|
||||
}
|
||||
|
||||
push_attribute(attributes, Attributes(first, baseAttribute));
|
||||
|
||||
+3
-3
@@ -274,7 +274,7 @@ convert_to_string(const torrent::Object& rawSrc) {
|
||||
switch (src.type()) {
|
||||
case torrent::Object::TYPE_VALUE: {
|
||||
char buffer[64];
|
||||
snprintf(buffer, 64, "%lli", src.as_value());
|
||||
snprintf(buffer, 64, "%lli", (long long int)src.as_value());
|
||||
return std::string(buffer);
|
||||
}
|
||||
case torrent::Object::TYPE_STRING: return src.as_string();
|
||||
@@ -449,7 +449,7 @@ print_object(char* first, char* last, const torrent::Object* src, int flags) {
|
||||
}
|
||||
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
return std::min(first + snprintf(first, std::distance(first, last), "%lli", src->as_value()), last);
|
||||
return std::min(first + snprintf(first, std::distance(first, last), "%lli", (long long int)src->as_value()), last);
|
||||
|
||||
case torrent::Object::TYPE_LIST:
|
||||
if (first != last)
|
||||
@@ -491,7 +491,7 @@ print_object_std(std::string* dest, const torrent::Object* src, int flags) {
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
{
|
||||
char buffer[64];
|
||||
snprintf(buffer, 64, "%lli", src->as_value());
|
||||
snprintf(buffer, 64, "%lli", (long long int)src->as_value());
|
||||
|
||||
*dest += buffer;
|
||||
return;
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ SCgi::event_read() {
|
||||
while ((fd = get_fd().accept(&sa)).is_valid()) {
|
||||
SCgiTask* task = std::find_if(m_task, m_task + max_tasks, std::mem_fun_ref(&SCgiTask::is_available));
|
||||
|
||||
if (task == task + max_tasks) {
|
||||
if (task == m_task + max_tasks) {
|
||||
// Ergh... just closing for now.
|
||||
fd.close();
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user