mirror of https://github.com/vitalif/grive2
Oops. I was thinking auto_ptr is smart_ptr O_o. Sorry. Also fix #33
parent
dc8e172a27
commit
f288c559c6
|
@ -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() ) ;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -31,11 +31,10 @@ namespace gr {
|
|||
|
||||
using namespace http ;
|
||||
|
||||
AuthAgent::AuthAgent( OAuth2& auth, std::auto_ptr<Agent> 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
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace gr {
|
|||
class AuthAgent : public http::Agent
|
||||
{
|
||||
public :
|
||||
AuthAgent( OAuth2& auth, std::auto_ptr<http::Agent> 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<http::Agent> m_agent ;
|
||||
http::Agent* m_agent ;
|
||||
} ;
|
||||
|
||||
} // end of namespace
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace gr {
|
|||
const std::string token_url = "https://accounts.google.com/o/oauth2/token" ;
|
||||
|
||||
OAuth2::OAuth2(
|
||||
std::auto_ptr<http::Agent>& 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<http::Agent>& agent,
|
||||
http::Agent* agent,
|
||||
const std::string& client_id,
|
||||
const std::string& client_secret ) :
|
||||
m_agent( agent ),
|
||||
|
|
|
@ -33,11 +33,11 @@ public :
|
|||
|
||||
public :
|
||||
OAuth2(
|
||||
std::auto_ptr<http::Agent>& agent,
|
||||
http::Agent* agent,
|
||||
const std::string& client_id,
|
||||
const std::string& client_secret ) ;
|
||||
OAuth2(
|
||||
std::auto_ptr<http::Agent>& 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<http::Agent> m_agent ;
|
||||
http::Agent* m_agent ;
|
||||
|
||||
const std::string m_client_id ;
|
||||
const std::string m_client_secret ;
|
||||
|
|
Loading…
Reference in New Issue