Compare commits

...

2 Commits

Author SHA1 Message Date
Gianluca Recchia 843c7e6093
Merge a85ab1cf2d into 6901fbb169 2021-12-26 07:56:55 +03:30
Gianluca Recchia a85ab1cf2d
Fix unused variables warning 2019-10-30 17:53:08 +01:00
1 changed files with 16 additions and 5 deletions

View File

@ -79,13 +79,13 @@ bool Syncer2::Create( Resource *res )
assert( res->Parent()->IsFolder() ) ; assert( res->Parent()->IsFolder() ) ;
assert( res->Parent()->GetState() == Resource::sync ) ; assert( res->Parent()->GetState() == Resource::sync ) ;
assert( res->ResourceID().empty() ) ; assert( res->ResourceID().empty() ) ;
if ( !res->Parent()->IsEditable() ) if ( !res->Parent()->IsEditable() )
{ {
Log( "Cannot upload %1%: parent directory read-only. %2%", res->Name(), res->StateStr(), log::warning ) ; Log( "Cannot upload %1%: parent directory read-only. %2%", res->Name(), res->StateStr(), log::warning ) ;
return false ; return false ;
} }
return Upload( res, false ); return Upload( res, false );
} }
@ -122,7 +122,10 @@ bool Syncer2::Move( Resource* res, Resource* newParentRes, std::string newFilena
hdr2.Add( "Content-Type: application/json" ); hdr2.Add( "Content-Type: application/json" );
http::ValResponse vrsp ; http::ValResponse vrsp ;
// Don't change modified date because we're only moving // Don't change modified date because we're only moving
long http_code = m_http->Put( #ifndef NDEBUG
const long http_code =
#endif
m_http->Put(
feeds::files + "/" + res->ResourceID() + "?modifiedDateBehavior=noChange" + addRemoveParents, feeds::files + "/" + res->ResourceID() + "?modifiedDateBehavior=noChange" + addRemoveParents,
json_meta, &vrsp, hdr2 json_meta, &vrsp, hdr2
) ; ) ;
@ -164,11 +167,19 @@ bool Syncer2::Upload( Resource *res, bool new_rev )
http::Header hdr2 ; http::Header hdr2 ;
hdr2.Add( "Content-Type: application/json" ); hdr2.Add( "Content-Type: application/json" );
http::ValResponse vrsp ; http::ValResponse vrsp ;
#ifndef NDEBUG
long http_code = 0; long http_code = 0;
#endif
if ( res->ResourceID().empty() ) if ( res->ResourceID().empty() )
http_code = m_http->Post( feeds::files, json_meta, &vrsp, hdr2 ) ; #ifndef NDEBUG
http_code =
#endif
m_http->Post( feeds::files, json_meta, &vrsp, hdr2 ) ;
else else
http_code = m_http->Put( feeds::files + "/" + res->ResourceID(), json_meta, &vrsp, hdr2 ) ; #ifndef NDEBUG
http_code =
#endif
m_http->Put( feeds::files + "/" + res->ResourceID(), json_meta, &vrsp, hdr2 ) ;
valr = vrsp.Response(); valr = vrsp.Response();
assert( http_code == 200 && !( valr["id"].Str().empty() ) ); assert( http_code == 200 && !( valr["id"].Str().empty() ) );
} }