Skip to content

Commit

Permalink
clean code: remove \n in parameter of GD_DPRINTF
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jun 2, 2022
1 parent f015ff5 commit 6649900
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 2 additions & 5 deletions article_netmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ QNetworkReply * ArticleNetworkAccessManager::getArticleReply( QNetworkRequest co

QUrl refererUrl = QUrl::fromEncoded( referer );

//GD_DPRINTF( "Considering %s vs %s\n", getHostBase( req.url() ).toUtf8().data(),
// getHostBase( refererUrl ).toUtf8().data() );

if ( !url.host().endsWith( refererUrl.host() ) &&
getHostBaseFromUrl( url ) != getHostBaseFromUrl( refererUrl ) && !url.scheme().startsWith("data") )
{
Expand Down Expand Up @@ -449,15 +446,15 @@ qint64 ArticleResourceReply::readData( char * out, qint64 maxSize )
qint64 left = avail - alreadyRead;

qint64 toRead = maxSize < left ? maxSize : left;
GD_DPRINTF( "====reading %d bytes\n", (int)toRead );
GD_DPRINTF( "====reading %d bytes", (int)toRead );

try
{
req->getDataSlice( alreadyRead, toRead, out );
}
catch( std::exception & e )
{
qWarning( "getDataSlice error: %s\n", e.what() );
qWarning( "getDataSlice error: %s", e.what() );
}

alreadyRead += toRead;
Expand Down
7 changes: 4 additions & 3 deletions articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,8 @@ void ArticleView::contextMenuRequested( QPoint const & pos )

if(text.size())
{
saveBookmark = new QAction( tr( "Save &Bookmark \"%1\"" ).arg( text.left( 60 ) ), &menu );
// avoid too long in the menu ,use left 30 characters.
saveBookmark = new QAction( tr( "Save &Bookmark \"%1...\"" ).arg( text.left( 30 ) ), &menu );
menu.addAction( saveBookmark );
}

Expand Down Expand Up @@ -1952,10 +1953,10 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
QDesktopServices::openUrl( targetUrl );
else
if ( result == lookupSelection )
showDefinition( selectedText, getGroup( ui.definition->url() ), getCurrentArticle() );
showDefinition( text, getGroup( ui.definition->url() ), getCurrentArticle() );
else if( result == saveBookmark )
{
emit saveBookmarkSignal( selectedText );
emit saveBookmarkSignal( text.left( 60 ) );
}
else if( result == sendToAnkiAction )
{
Expand Down
6 changes: 3 additions & 3 deletions indexedzip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )

if ( !ZipFile::readLocalHeader( zip, header ) )
{
GD_DPRINTF( "Failed to load header\n" );
GD_DPRINTF( "Failed to load header" );
return false;
}

Expand All @@ -73,13 +73,13 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )
switch( header.compressionMethod )
{
case ZipFile::Uncompressed:
GD_DPRINTF( "Uncompressed\n" );
GD_DPRINTF( "Uncompressed" );
data.resize( header.uncompressedSize );
return (size_t) zip.read( &data.front(), data.size() ) == data.size();

case ZipFile::Deflated:
{
GD_DPRINTF( "Deflated\n" );
GD_DPRINTF( "Deflated" );

// Now do the deflation

Expand Down

0 comments on commit 6649900

Please sign in to comment.