mirror of
https://github.com/asamy/ctorrent
synced 2025-10-05 23:52:41 +02:00
Fix compiler errors for CLang
This commit is contained in:
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ LIBS = -fopenmp -lboost_system -lboost_filesystem -lboost_program_options
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LIBS += -lws2_32 -lshlwapi
|
||||
else
|
||||
LIBS += -pthread -lcurses
|
||||
LIBS += -lpthread -lcurses
|
||||
endif
|
||||
|
||||
OBJ_DIR = obj
|
||||
|
@@ -358,7 +358,7 @@ void Peer::sendUnchoke()
|
||||
void Peer::sendBitfield(const uint8_t *bits, size_t size)
|
||||
{
|
||||
OutputMessage out(ByteOrder::BigEndian, 5 + size);
|
||||
out << 1UL + size;
|
||||
out << (uint32_t)(1UL + size);
|
||||
out << (uint8_t)MT_Bitfield;
|
||||
out.addBytes(bits, size);
|
||||
|
||||
@@ -371,7 +371,7 @@ void Peer::sendHave(uint32_t index)
|
||||
return;
|
||||
|
||||
OutputMessage out(ByteOrder::BigEndian, 9);
|
||||
out << 5UL; // length
|
||||
out << (uint32_t)5UL; // length
|
||||
out << (uint8_t)MT_Have;
|
||||
out << index;
|
||||
|
||||
@@ -381,7 +381,7 @@ void Peer::sendHave(uint32_t index)
|
||||
void Peer::sendPieceBlock(uint32_t index, uint32_t begin, const uint8_t *block, size_t length)
|
||||
{
|
||||
OutputMessage out(ByteOrder::BigEndian, 13 + length);
|
||||
out << 9UL + length; // length
|
||||
out << (uint32_t)(9UL + length); // length
|
||||
out << (uint8_t)MT_PieceBlock;
|
||||
out << index;
|
||||
out << begin;
|
||||
@@ -411,7 +411,7 @@ void Peer::sendPieceRequest(uint32_t index)
|
||||
void Peer::sendRequest(uint32_t index, uint32_t begin, uint32_t length)
|
||||
{
|
||||
OutputMessage out(ByteOrder::BigEndian, 17);
|
||||
out << 13UL; // length
|
||||
out << (uint32_t)13UL; // length
|
||||
out << (uint8_t)MT_Request;
|
||||
out << index;
|
||||
out << begin;
|
||||
@@ -440,7 +440,7 @@ void Peer::cancelPiece(Piece *p)
|
||||
void Peer::sendCancel(uint32_t index, uint32_t begin, uint32_t length)
|
||||
{
|
||||
OutputMessage out(ByteOrder::BigEndian, 17);
|
||||
out << 13UL; // length
|
||||
out << (uint32_t)13UL; // length
|
||||
out << (uint8_t)MT_Cancel;
|
||||
out << index;
|
||||
out << begin;
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include <random>
|
||||
|
||||
Torrent::Torrent()
|
||||
: m_listener(nullptr),
|
||||
|
@@ -39,7 +39,6 @@ struct TorrentFileInfo {
|
||||
typedef std::vector<TorrentFileInfo> TorrentFiles;
|
||||
|
||||
class Torrent;
|
||||
class TorrentFile;
|
||||
class TorrentFileManagerImpl;
|
||||
class TorrentFileManager {
|
||||
public:
|
||||
|
3
main.cpp
3
main.cpp
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
size_t eseed = 0;
|
||||
size_t started = 0;
|
||||
|
||||
Torrent torrents[total];
|
||||
Torrent *torrents = new Torrent[total]; // Workaround for CLang non-POD
|
||||
for (size_t i = 0; i < total; ++i) {
|
||||
std::string file = files[i];
|
||||
Torrent *t = &torrents[i];
|
||||
@@ -255,6 +255,7 @@ int main(int argc, char *argv[])
|
||||
#ifndef _WIN32
|
||||
endwin();
|
||||
#endif
|
||||
delete torrents;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user