diff --git a/grive/src/main.cc b/grive/src/main.cc index a6efff5..f0147ba 100644 --- a/grive/src/main.cc +++ b/grive/src/main.cc @@ -153,7 +153,7 @@ int Main( int argc, char **argv ) if ( vm.count( "auth" ) ) { - OAuth2 token( http, client_id, client_secret ) ; + OAuth2 token( http.get(), client_id, client_secret ) ; std::cout << "-----------------------\n" @@ -189,8 +189,8 @@ int Main( int argc, char **argv ) return -1; } - OAuth2 token( http, refresh_token, client_id, client_secret ) ; - AuthAgent agent( token, http ) ; + OAuth2 token( http.get(), refresh_token, client_id, client_secret ) ; + AuthAgent agent( token, http.get() ) ; v2::Syncer2 syncer( &agent ); Drive drive( &syncer, config.GetAll() ) ; diff --git a/libgrive/src/json/ValBuilder.cc b/libgrive/src/json/ValBuilder.cc index 7a0068e..e3b1b0a 100644 --- a/libgrive/src/json/ValBuilder.cc +++ b/libgrive/src/json/ValBuilder.cc @@ -132,7 +132,7 @@ Val ValBuilder::Result() const if ( !m_ctx.size() ) BOOST_THROW_EXCEPTION( Error() << NoKey_( Val(std::string("")) ) ) ; Val r = m_ctx.top().val; - if ( m_ctx.size() > 0 ) + if ( m_ctx.size() > 1 ) BOOST_THROW_EXCEPTION( Error() << Unexpected_(m_ctx.top().val) ) ; return r; } diff --git a/libgrive/src/protocol/AuthAgent.cc b/libgrive/src/protocol/AuthAgent.cc index 145c05d..4e95d0c 100644 --- a/libgrive/src/protocol/AuthAgent.cc +++ b/libgrive/src/protocol/AuthAgent.cc @@ -31,11 +31,10 @@ namespace gr { using namespace http ; -AuthAgent::AuthAgent( OAuth2& auth, std::auto_ptr real_agent ) : +AuthAgent::AuthAgent( OAuth2& auth, Agent *real_agent ) : m_auth ( auth ), m_agent ( real_agent ) { - assert( m_agent.get() != 0 ) ; } http::ResponseLog* AuthAgent::GetLog() const diff --git a/libgrive/src/protocol/AuthAgent.hh b/libgrive/src/protocol/AuthAgent.hh index 4ceeaff..db65f44 100644 --- a/libgrive/src/protocol/AuthAgent.hh +++ b/libgrive/src/protocol/AuthAgent.hh @@ -34,7 +34,7 @@ namespace gr { class AuthAgent : public http::Agent { public : - AuthAgent( OAuth2& auth, std::auto_ptr real_agent ) ; + AuthAgent( OAuth2& auth, http::Agent* real_agent ) ; http::ResponseLog* GetLog() const ; void SetLog( http::ResponseLog *log ) ; @@ -86,7 +86,7 @@ private : private : OAuth2& m_auth ; - const std::auto_ptr m_agent ; + http::Agent* m_agent ; } ; } // end of namespace diff --git a/libgrive/src/protocol/OAuth2.cc b/libgrive/src/protocol/OAuth2.cc index be35516..cd3dd6a 100644 --- a/libgrive/src/protocol/OAuth2.cc +++ b/libgrive/src/protocol/OAuth2.cc @@ -33,7 +33,7 @@ namespace gr { const std::string token_url = "https://accounts.google.com/o/oauth2/token" ; OAuth2::OAuth2( - std::auto_ptr& agent, + http::Agent* agent, const std::string& refresh_code, const std::string& client_id, const std::string& client_secret ) : @@ -46,7 +46,7 @@ OAuth2::OAuth2( } OAuth2::OAuth2( - std::auto_ptr& agent, + http::Agent* agent, const std::string& client_id, const std::string& client_secret ) : m_agent( agent ), diff --git a/libgrive/src/protocol/OAuth2.hh b/libgrive/src/protocol/OAuth2.hh index 28e5bc7..e9a23da 100644 --- a/libgrive/src/protocol/OAuth2.hh +++ b/libgrive/src/protocol/OAuth2.hh @@ -33,11 +33,11 @@ public : public : OAuth2( - std::auto_ptr& agent, + http::Agent* agent, const std::string& client_id, const std::string& client_secret ) ; OAuth2( - std::auto_ptr& agent, + http::Agent* agent, const std::string& refresh_code, const std::string& client_id, const std::string& client_secret ) ; @@ -58,7 +58,7 @@ public : private : std::string m_access ; std::string m_refresh ; - std::auto_ptr m_agent ; + http::Agent* m_agent ; const std::string m_client_id ; const std::string m_client_secret ;