forked from premiere/premiere-libtorrent
fix some of the build errors in examples
This commit is contained in:
parent
d308dce99b
commit
a3b18b8a41
|
@ -15,7 +15,7 @@ endif
|
||||||
EXTRA_PROGRAMS = $(example_programs)
|
EXTRA_PROGRAMS = $(example_programs)
|
||||||
EXTRA_DIST = Jamfile
|
EXTRA_DIST = Jamfile
|
||||||
|
|
||||||
client_test_SOURCES = client_test.cpp
|
client_test_SOURCES = client_test.cpp print.cpp session_view.cpp torrent_view.cpp
|
||||||
#client_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
#client_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
||||||
|
|
||||||
stats_counters_SOURCES = stats_counters.cpp
|
stats_counters_SOURCES = stats_counters.cpp
|
||||||
|
|
|
@ -702,17 +702,19 @@ void print_alert(libtorrent::alert const* a, std::string& str)
|
||||||
|
|
||||||
int save_file(std::string const& filename, std::vector<char>& v)
|
int save_file(std::string const& filename, std::vector<char>& v)
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
FILE* f = fopen(filename.c_str(), "wb");
|
||||||
|
if (f == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// TODO: don't use internal file type here. use fopen()
|
int w = fwrite(&v[0], 1, v.size(), f);
|
||||||
file f;
|
if (w < 0)
|
||||||
error_code ec;
|
{
|
||||||
if (!f.open(filename, file::write_only, ec)) return -1;
|
fclose(f);
|
||||||
if (ec) return -1;
|
return -1;
|
||||||
file::iovec_t b = {&v[0], v.size()};
|
}
|
||||||
size_type written = f.writev(0, &b, 1, ec);
|
|
||||||
if (written != int(v.size())) return -3;
|
if (w != int(v.size())) return -3;
|
||||||
if (ec) return -3;
|
fclose(f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,16 +136,19 @@ std::string const& progress_bar(int progress, int width)
|
||||||
|
|
||||||
int save_file(std::string const& filename, std::vector<char>& v)
|
int save_file(std::string const& filename, std::vector<char>& v)
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
FILE* f = fopen(filename.c_str(), "wb");
|
||||||
|
if (f == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
file f;
|
int w = fwrite(&v[0], 1, v.size(), f);
|
||||||
error_code ec;
|
if (w < 0)
|
||||||
if (!f.open(filename, file::write_only, ec)) return -1;
|
{
|
||||||
if (ec) return -1;
|
fclose(f);
|
||||||
file::iovec_t b = {&v[0], v.size()};
|
return -1;
|
||||||
size_type written = f.writev(0, &b, 1, ec);
|
}
|
||||||
if (written != int(v.size())) return -3;
|
|
||||||
if (ec) return -3;
|
if (w != int(v.size())) return -3;
|
||||||
|
fclose(f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue