Fix a crash in fc::process when not capturing all three stdin/out/err
Quiet a few 64-bit warnings.
This commit is contained in:
parent
439232f750
commit
2f066e4adf
5 changed files with 21 additions and 18 deletions
|
|
@ -66,10 +66,10 @@ class sha256
|
|||
|
||||
uint32_t pop_count()
|
||||
{
|
||||
return __builtin_popcountll(_hash[0]) +
|
||||
__builtin_popcountll(_hash[1]) +
|
||||
__builtin_popcountll(_hash[2]) +
|
||||
__builtin_popcountll(_hash[3]);
|
||||
return (uint32_t)(__builtin_popcountll(_hash[0]) +
|
||||
__builtin_popcountll(_hash[1]) +
|
||||
__builtin_popcountll(_hash[2]) +
|
||||
__builtin_popcountll(_hash[3]));
|
||||
}
|
||||
|
||||
uint64_t _hash[4];
|
||||
|
|
|
|||
|
|
@ -180,9 +180,9 @@ namespace fc {
|
|||
|
||||
// std::vector<char>
|
||||
template<typename Stream> inline void pack( Stream& s, const std::vector<char>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
if( value.size() )
|
||||
s.write( &value.front(), value.size() );
|
||||
s.write( &value.front(), (uint32_t)value.size() );
|
||||
}
|
||||
template<typename Stream> inline void unpack( Stream& s, std::vector<char>& value ) {
|
||||
unsigned_int size; unpack( s, size );
|
||||
|
|
@ -194,7 +194,7 @@ namespace fc {
|
|||
|
||||
// fc::string
|
||||
template<typename Stream> inline void pack( Stream& s, const fc::string& v ) {
|
||||
pack( s, unsigned_int(v.size()) );
|
||||
pack( s, unsigned_int((uint32_t)v.size()));
|
||||
if( v.size() ) s.write( v.c_str(), v.size() );
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ namespace fc {
|
|||
|
||||
template<typename Stream, typename T>
|
||||
inline void pack( Stream& s, const std::unordered_set<T>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
auto itr = value.begin();
|
||||
auto end = value.end();
|
||||
while( itr != end ) {
|
||||
|
|
@ -349,7 +349,7 @@ namespace fc {
|
|||
|
||||
template<typename Stream, typename K, typename V>
|
||||
inline void pack( Stream& s, const std::unordered_map<K,V>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
auto itr = value.begin();
|
||||
auto end = value.end();
|
||||
while( itr != end ) {
|
||||
|
|
@ -373,7 +373,7 @@ namespace fc {
|
|||
}
|
||||
template<typename Stream, typename K, typename V>
|
||||
inline void pack( Stream& s, const std::map<K,V>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
auto itr = value.begin();
|
||||
auto end = value.end();
|
||||
while( itr != end ) {
|
||||
|
|
@ -398,7 +398,7 @@ namespace fc {
|
|||
|
||||
template<typename Stream, typename T>
|
||||
inline void pack( Stream& s, const std::vector<T>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
auto itr = value.begin();
|
||||
auto end = value.end();
|
||||
while( itr != end ) {
|
||||
|
|
@ -422,7 +422,7 @@ namespace fc {
|
|||
|
||||
template<typename Stream, typename T>
|
||||
inline void pack( Stream& s, const std::set<T>& value ) {
|
||||
pack( s, unsigned_int(value.size()) );
|
||||
pack( s, unsigned_int((uint32_t)value.size()) );
|
||||
auto itr = value.begin();
|
||||
auto end = value.end();
|
||||
while( itr != end ) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace fc { namespace raw {
|
|||
template<typename Stream>
|
||||
inline void pack( Stream& s, const variant_object& v )
|
||||
{
|
||||
unsigned_int vs = v.size();
|
||||
unsigned_int vs = (uint32_t)v.size();
|
||||
pack( s, vs );
|
||||
for( auto itr = v.begin(); itr != v.end(); ++itr )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ unsigned aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned
|
|||
std::vector<char> aes_encrypt( const fc::sha512& key, const std::vector<char>& plain_text )
|
||||
{
|
||||
std::vector<char> cipher_text(plain_text.size()+16);
|
||||
auto cipher_len = aes_encrypt( (unsigned char*)plain_text.data(), plain_text.size(),
|
||||
auto cipher_len = aes_encrypt( (unsigned char*)plain_text.data(), (int)plain_text.size(),
|
||||
(unsigned char*)&key, ((unsigned char*)&key)+32,
|
||||
(unsigned char*)cipher_text.data() );
|
||||
FC_ASSERT( cipher_len <= cipher_text.size() );
|
||||
|
|
@ -330,7 +330,7 @@ std::vector<char> aes_encrypt( const fc::sha512& key, const std::vector<char>& p
|
|||
std::vector<char> aes_decrypt( const fc::sha512& key, const std::vector<char>& cipher_text )
|
||||
{
|
||||
std::vector<char> plain_text( cipher_text.size() );
|
||||
auto plain_len = aes_decrypt( (unsigned char*)cipher_text.data(), cipher_text.size(),
|
||||
auto plain_len = aes_decrypt( (unsigned char*)cipher_text.data(), (int)cipher_text.size(),
|
||||
(unsigned char*)&key, ((unsigned char*)&key)+32,
|
||||
(unsigned char*)plain_text.data() );
|
||||
plain_text.resize(plain_len);
|
||||
|
|
|
|||
|
|
@ -145,9 +145,12 @@ iprocess& process::exec( const fc::path& exe,
|
|||
("message", boost::system::system_error(ec).what())) ) ) );
|
||||
}
|
||||
});
|
||||
my->_in = std::make_shared<buffered_ostream>(std::make_shared<fc::asio::ostream<bp::pipe>>(my->_inp));
|
||||
my->_out = std::make_shared<buffered_istream>(std::make_shared<fc::asio::istream<bp::pipe>>(my->_outp));
|
||||
my->_err = std::make_shared<buffered_istream>(std::make_shared<fc::asio::istream<bp::pipe>>(my->_errp));
|
||||
if( opt & open_stdin )
|
||||
my->_in = std::make_shared<buffered_ostream>(std::make_shared<fc::asio::ostream<bp::pipe>>(my->_inp));
|
||||
if( opt & open_stdout )
|
||||
my->_out = std::make_shared<buffered_istream>(std::make_shared<fc::asio::istream<bp::pipe>>(my->_outp));
|
||||
if( opt & open_stderr )
|
||||
my->_err = std::make_shared<buffered_istream>(std::make_shared<fc::asio::istream<bp::pipe>>(my->_errp));
|
||||
my->_exited = p;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue