mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 05:02:31 +00:00
Fixed some compile issues.
This commit is contained in:
+13
-7
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <tr1/functional>
|
||||
#include <rak/algorithm.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
@@ -332,6 +333,9 @@ Frame::balance_window(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
inline Frame::extent_type dynamic_min_height(const Frame::dynamic_type& value) { return value.second.min_height(); }
|
||||
inline Frame::extent_type dynamic_min_width(const Frame::dynamic_type& value) { return value.second.min_width(); }
|
||||
|
||||
inline void
|
||||
Frame::balance_row(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
// Find the size of the static frames. The dynamic frames are added
|
||||
@@ -355,16 +359,17 @@ Frame::balance_row(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
remaining -= bounds.minHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
// following frames.
|
||||
//
|
||||
// Else if we're short, only give each what they require.
|
||||
std::sort(dynamicFrames, dynamicFrames + dynamicSize,
|
||||
rak::greater2(rak::on(rak::const_mem_ref(&dynamic_type::second), rak::const_mem_ref(&Frame::bounds_type::minHeight)),
|
||||
rak::on(rak::const_mem_ref(&dynamic_type::second), rak::const_mem_ref(&Frame::bounds_type::minHeight))));
|
||||
std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
|
||||
std::tr1::bind(std::greater<extent_type>(),
|
||||
std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_1),
|
||||
std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_2)));
|
||||
|
||||
bool retry;
|
||||
|
||||
@@ -436,9 +441,10 @@ Frame::balance_column(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
|
||||
// following frames.
|
||||
//
|
||||
// Else if we're short, only give each what they require.
|
||||
std::sort(dynamicFrames, dynamicFrames + dynamicSize,
|
||||
rak::greater2(rak::on(rak::const_mem_ref(&dynamic_type::second), rak::const_mem_ref(&Frame::bounds_type::minWidth)),
|
||||
rak::on(rak::const_mem_ref(&dynamic_type::second), rak::const_mem_ref(&Frame::bounds_type::minWidth))));
|
||||
std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
|
||||
std::tr1::bind(std::greater<extent_type>(),
|
||||
std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_1),
|
||||
std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_2)));
|
||||
|
||||
bool retry;
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ public:
|
||||
bounds_type(extent_type minW, extent_type minH, extent_type maxW, extent_type maxH) :
|
||||
minWidth(minW), minHeight(minH), maxWidth(maxW), maxHeight(maxH) {}
|
||||
|
||||
extent_type min_width() const { return minWidth; }
|
||||
extent_type min_height() const { return minHeight; }
|
||||
|
||||
extent_type minWidth;
|
||||
extent_type minHeight;
|
||||
|
||||
|
||||
+4
-1
@@ -36,9 +36,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/http.h>
|
||||
#include <torrent/torrent.h>
|
||||
@@ -954,7 +957,7 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) {
|
||||
|
||||
printf("Torrent name: '%s'.\n", result.download.info()->name().c_str());
|
||||
printf("File name: '%s'.\n", result.file_path);
|
||||
printf("File offset: %llu.\n", result.file_offset);
|
||||
printf("File offset: %" PRIu64 ".\n", result.file_offset);
|
||||
printf("Chunk index: %u.\n", result.chunk_index);
|
||||
printf("Chunk offset: %u.\n", result.chunk_offset);
|
||||
|
||||
|
||||
+11
-9
@@ -55,17 +55,19 @@ namespace rpc {
|
||||
int
|
||||
ExecFile::execute(const char* file, char* const* argv, int flags) {
|
||||
// Write the execued command and its parameters to the log fd.
|
||||
int __UNUSED result;
|
||||
|
||||
if (m_logFd != -1) {
|
||||
for (char* const* itr = argv; *itr != NULL; itr++) {
|
||||
if (itr == argv)
|
||||
write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
result = write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
else
|
||||
write(m_logFd, " ", 1);
|
||||
result = write(m_logFd, " ", 1);
|
||||
|
||||
write(m_logFd, *itr, std::strlen(*itr));
|
||||
result = write(m_logFd, *itr, std::strlen(*itr));
|
||||
}
|
||||
|
||||
write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
result = write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
}
|
||||
|
||||
int pipeFd[2];
|
||||
@@ -87,7 +89,7 @@ ExecFile::execute(const char* file, char* const* argv, int flags) {
|
||||
|
||||
if (detached_pid != 0) {
|
||||
if (m_logFd != -1)
|
||||
write(m_logFd, "\n--- Background task ---\n", sizeof("\n--- Background task ---\n"));
|
||||
result = write(m_logFd, "\n--- Background task ---\n", sizeof("\n--- Background task ---\n"));
|
||||
|
||||
_exit(0);
|
||||
}
|
||||
@@ -148,8 +150,8 @@ ExecFile::execute(const char* file, char* const* argv, int flags) {
|
||||
::close(pipeFd[0]);
|
||||
|
||||
if (m_logFd != -1) {
|
||||
write(m_logFd, "Captured output:\n", sizeof("Captured output:\n"));
|
||||
write(m_logFd, m_capture.data(), m_capture.length());
|
||||
result = write(m_logFd, "Captured output:\n", sizeof("Captured output:\n"));
|
||||
result = write(m_logFd, m_capture.data(), m_capture.length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,9 +170,9 @@ ExecFile::execute(const char* file, char* const* argv, int flags) {
|
||||
// Check return value?
|
||||
if (m_logFd != -1) {
|
||||
if (status == 0)
|
||||
write(m_logFd, "\n--- Success ---\n", sizeof("\n--- Success ---\n"));
|
||||
result = write(m_logFd, "\n--- Success ---\n", sizeof("\n--- Success ---\n"));
|
||||
else
|
||||
write(m_logFd, "\n--- Error ---\n", sizeof("\n--- Error ---\n"));
|
||||
result = write(m_logFd, "\n--- Error ---\n", sizeof("\n--- Error ---\n"));
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -177,10 +177,12 @@ SCgiTask::event_read() {
|
||||
worker_thread->poll()->insert_write(this);
|
||||
|
||||
if (m_parent->log_fd() >= 0) {
|
||||
int __UNUSED result;
|
||||
|
||||
// Clean up logging, this is just plain ugly...
|
||||
// write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
write(m_parent->log_fd(), m_buffer, m_bufferSize);
|
||||
write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
|
||||
result = write(m_parent->log_fd(), m_buffer, m_bufferSize);
|
||||
result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
|
||||
}
|
||||
|
||||
lt_log_print(torrent::LOG_RPC_DEBUG, "---\n%*s\n---", m_bufferSize - std::distance(m_buffer, m_body), m_body);
|
||||
@@ -237,10 +239,11 @@ SCgiTask::receive_write(const char* buffer, uint32_t length) {
|
||||
std::memcpy(m_buffer + headerSize, buffer, length);
|
||||
|
||||
if (m_parent->log_fd() >= 0) {
|
||||
int __UNUSED result;
|
||||
// Clean up logging, this is just plain ugly...
|
||||
// write(m_logFd, "\n---\n", sizeof("\n---\n"));
|
||||
write(m_parent->log_fd(), m_buffer, m_bufferSize);
|
||||
write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
|
||||
result = write(m_parent->log_fd(), m_buffer, m_bufferSize);
|
||||
result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
|
||||
}
|
||||
|
||||
lt_log_print(torrent::LOG_RPC_DEBUG, "---\n%*s\n---", m_bufferSize, m_buffer);
|
||||
|
||||
@@ -99,7 +99,7 @@ Lockfile::try_lock() {
|
||||
|
||||
if (pos == 0) {
|
||||
::snprintf(buf + std::strlen(buf), 255, ":+%i\n", ::getpid());
|
||||
::write(fd, buf, std::strlen(buf));
|
||||
int __UNUSED result = ::write(fd, buf, std::strlen(buf));
|
||||
}
|
||||
|
||||
::close(fd);
|
||||
|
||||
Reference in New Issue
Block a user