Revert unneeded and code style changes

progressbar_old
Vitaliy Filippov 2016-09-28 12:35:55 +03:00
parent c192d530e8
commit 33c39a5c6e
12 changed files with 35 additions and 48 deletions

View File

@ -45,7 +45,6 @@
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
const std::string client_id = "22314510474.apps.googleusercontent.com" ; const std::string client_id = "22314510474.apps.googleusercontent.com" ;
const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ; const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ;
@ -184,7 +183,6 @@ int Main( int argc, char **argv )
config.Save() ; config.Save() ;
} }
std::string refresh_token ; std::string refresh_token ;
try try
{ {
@ -221,7 +219,6 @@ int Main( int argc, char **argv )
drive.Update() ; drive.Update() ;
pb->SetShowProgressBar( false ) ; pb->SetShowProgressBar( false ) ;
drive.UpdateChangeStamp();
drive.SaveState() ; drive.SaveState() ;
} }
else else

View File

@ -92,8 +92,8 @@ void Drive::DetectChanges()
m_state.ResolveEntry() ; m_state.ResolveEntry() ;
} }
size_t Drive::getTotalChanges()
size_t Drive::getTotalChanges() { {
return m_state.getTotalChanges(); return m_state.getTotalChanges();
} }
@ -120,6 +120,8 @@ void Drive::Update()
{ {
Log( "Synchronizing files", log::info ) ; Log( "Synchronizing files", log::info ) ;
m_state.Sync( m_syncer, m_options ) ; m_state.Sync( m_syncer, m_options ) ;
UpdateChangeStamp( ) ;
} }
void Drive::DryRun() void Drive::DryRun()

View File

@ -44,7 +44,6 @@ public :
void Update() ; void Update() ;
void DryRun() ; void DryRun() ;
void SaveState() ; void SaveState() ;
void UpdateChangeStamp() ;
struct Error : virtual Exception {} ; struct Error : virtual Exception {} ;
@ -54,6 +53,7 @@ private :
void ReadChanges() ; void ReadChanges() ;
void FromRemote( const Entry& entry ) ; void FromRemote( const Entry& entry ) ;
void FromChange( const Entry& entry ) ; void FromChange( const Entry& entry ) ;
void UpdateChangeStamp( ) ;
private : private :
Syncer *m_syncer ; Syncer *m_syncer ;

View File

@ -81,7 +81,8 @@ void State::FromLocal( const fs::path& p )
FromLocal( p, m_res.Root(), m_st.Item( "tree" ) ) ; FromLocal( p, m_res.Root(), m_st.Item( "tree" ) ) ;
} }
size_t State::getTotalChanges() { size_t State::getTotalChanges()
{
return m_res.Root()->size(); return m_res.Root()->size();
} }
@ -209,7 +210,6 @@ void State::FromChange( const Entry& e )
m_res.Update( res, e ) ; m_res.Update( res, e ) ;
} }
bool State::Update( const Entry& e ) bool State::Update( const Entry& e )
{ {
assert( !e.IsChange() ) ; assert( !e.IsChange() ) ;

View File

@ -66,12 +66,9 @@ void Entry2::Update( const Val& item )
m_is_removed = file["labels"]["trashed"].Bool() ; m_is_removed = file["labels"]["trashed"].Bool() ;
if ( file.Has( "fileSize" ) ) if ( file.Has( "fileSize" ) )
{
m_size = file["fileSize"].U64() ; m_size = file["fileSize"].U64() ;
} else else
{
m_size = 0; m_size = 0;
}
if ( !m_is_dir ) if ( !m_is_dir )
{ {

View File

@ -140,8 +140,6 @@ std::string to_string( uint64_t n )
return s.str(); return s.str();
} }
bool Syncer2::Upload( Resource *res, bool new_rev ) bool Syncer2::Upload( Resource *res, bool new_rev )
{ {
Val meta; Val meta;

View File

@ -20,7 +20,6 @@
#include "Agent.hh" #include "Agent.hh"
#include "Header.hh" #include "Header.hh"
#include "util/StringStream.hh" #include "util/StringStream.hh"
#include <iostream>
namespace gr { namespace gr {

View File

@ -27,8 +27,6 @@
#include "util/File.hh" #include "util/File.hh"
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
@ -144,7 +142,6 @@ std::size_t CurlAgent::HeaderCallback( void *ptr, size_t size, size_t nmemb, Cur
std::size_t CurlAgent::Receive( void* ptr, size_t size, size_t nmemb, CurlAgent *pthis ) std::size_t CurlAgent::Receive( void* ptr, size_t size, size_t nmemb, CurlAgent *pthis )
{ {
assert( pthis != 0 ) ; assert( pthis != 0 ) ;
if ( pthis->m_log.get() ) if ( pthis->m_log.get() )
pthis->m_log->Write( (const char*)ptr, size*nmemb ); pthis->m_log->Write( (const char*)ptr, size*nmemb );
@ -163,14 +160,12 @@ std::size_t CurlAgent::Receive( void* ptr, size_t size, size_t nmemb, CurlAgent
return pthis->m_pimpl->dest->Write( static_cast<char*>(ptr), size * nmemb ) ; return pthis->m_pimpl->dest->Write( static_cast<char*>(ptr), size * nmemb ) ;
} }
int CurlAgent::progress_callback( void *ptr, curl_off_t totalDownloadSize, curl_off_t finishedDownloadSize, curl_off_t totalToUpload, curl_off_t finishedUploaded ) int CurlAgent::progress_callback( void *ptr, curl_off_t totalDownloadSize, curl_off_t finishedDownloadSize, curl_off_t totalToUpload, curl_off_t finishedUploaded )
{ {
((CurlAgent*)ptr)->m_pb->PrintProgressBar(totalDownloadSize, finishedDownloadSize, totalToUpload, finishedUploaded); ((CurlAgent*)ptr)->m_pb->PrintProgressBar(totalDownloadSize, finishedDownloadSize, totalToUpload, finishedUploaded);
return 0; return 0;
} }
long CurlAgent::ExecCurl( long CurlAgent::ExecCurl(
const std::string& url, const std::string& url,
DataStream *dest, DataStream *dest,
@ -229,7 +224,6 @@ long CurlAgent::Request(
const Header& hdr, const Header& hdr,
const long downloadFileBytes ) const long downloadFileBytes )
{ {
Trace("HTTP %1% \"%2%\"", method, url ) ; Trace("HTTP %1% \"%2%\"", method, url ) ;
Init() ; Init() ;