made most examples build without exception support
This commit is contained in:
@@ -53,8 +53,10 @@ int main(int argc, char* argv[])
|
|||||||
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
|
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
std::ifstream in(argv[1], std::ios_base::binary);
|
std::ifstream in(argv[1], std::ios_base::binary);
|
||||||
in.unsetf(std::ios_base::skipws);
|
in.unsetf(std::ios_base::skipws);
|
||||||
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
||||||
@@ -98,11 +100,13 @@ int main(int argc, char* argv[])
|
|||||||
<< last << " ]\n";
|
<< last << " ]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << e.what() << "\n";
|
std::cout << e.what() << "\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -85,8 +85,10 @@ int main(int argc, char* argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
||||||
path full_path = complete(path(argv[3]));
|
path full_path = complete(path(argv[3]));
|
||||||
ofstream out(complete(path(argv[1])), std::ios_base::binary);
|
ofstream out(complete(path(argv[1])), std::ios_base::binary);
|
||||||
@@ -121,11 +123,13 @@ int main(int argc, char* argv[])
|
|||||||
// create the torrent and print it to out
|
// create the torrent and print it to out
|
||||||
entry e = t->create_torrent();
|
entry e = t->create_torrent();
|
||||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr << e.what() << "\n";
|
std::cerr << e.what() << "\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
|
||||||
|
|
||||||
#include "libtorrent/entry.hpp"
|
#include "libtorrent/entry.hpp"
|
||||||
#include "libtorrent/bencode.hpp"
|
#include "libtorrent/bencode.hpp"
|
||||||
#include "libtorrent/session.hpp"
|
#include "libtorrent/session.hpp"
|
||||||
@@ -57,7 +54,9 @@ int main(int argc, char* argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
session s;
|
session s;
|
||||||
s.listen_on(std::make_pair(6881, 6889));
|
s.listen_on(std::make_pair(6881, 6889));
|
||||||
@@ -72,9 +71,12 @@ int main(int argc, char* argv[])
|
|||||||
std::cin.unsetf(std::ios_base::skipws);
|
std::cin.unsetf(std::ios_base::skipws);
|
||||||
std::cin >> a;
|
std::cin >> a;
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::cout << e.what() << "\n";
|
std::cout << e.what() << "\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user