fixed uninitialized change stamp

pull/40/head
Nestal Wan 2012-06-05 00:59:14 +08:00
parent 935ac608ff
commit cbf40e9b90
3 changed files with 15 additions and 11 deletions

View File

@ -160,10 +160,10 @@ int main( int argc, char **argv )
OAuth2 token( refresh_token, client_id, client_secret ) ;
Drive drive( token, options ) ;
// drive.Update() ;
// drive.SaveState() ;
//
// config.Save() ;
drive.Update() ;
drive.SaveState() ;
config.Save() ;
}
catch ( gr::Exception& e )
{

View File

@ -91,12 +91,15 @@ Drive::Drive( OAuth2& auth, const Json& options ) :
} while ( feed.GetNext( &http, m_http_hdr ) ) ;
// pull the changes feed
boost::format changes_uri( "https://docs.google.com/feeds/default/private/changes?start-index=%1%" ) ;
http::ResponseLog log2( "changes-", ".xml", &xrsp ) ;
http.Get( (changes_uri%(prev_stamp+1)).str(), &log2, m_http_hdr ) ;
Feed changes( xrsp.Response() ) ;
std::for_each( changes.begin(), changes.end(), boost::bind( &Drive::FromChange, this, _1 ) ) ;
if ( prev_stamp != -1 )
{
boost::format changes_uri( "https://docs.google.com/feeds/default/private/changes?start-index=%1%" ) ;
http::ResponseLog log2( "changes-", ".xml", &xrsp ) ;
http.Get( (changes_uri%(prev_stamp+1)).str(), &log2, m_http_hdr ) ;
Feed changes( xrsp.Response() ) ;
std::for_each( changes.begin(), changes.end(), boost::bind( &Drive::FromChange, this, _1 ) ) ;
}
}
void Drive::FromRemote( const Entry& entry )

View File

@ -39,7 +39,8 @@
namespace gr {
State::State( const fs::path& filename, const Json& options )
State::State( const fs::path& filename, const Json& options ) :
m_cstamp( -1 )
{
Read( filename ) ;