clean code: remove \n in parameter of GD_DPRINTF

This commit is contained in:
Xiao YiFang 2022-06-01 23:40:00 +08:00
parent f015ff555f
commit 66499007f6
3 changed files with 9 additions and 11 deletions

View file

@ -198,9 +198,6 @@ QNetworkReply * ArticleNetworkAccessManager::getArticleReply( QNetworkRequest co
QUrl refererUrl = QUrl::fromEncoded( referer ); 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() ) && if ( !url.host().endsWith( refererUrl.host() ) &&
getHostBaseFromUrl( url ) != getHostBaseFromUrl( refererUrl ) && !url.scheme().startsWith("data") ) getHostBaseFromUrl( url ) != getHostBaseFromUrl( refererUrl ) && !url.scheme().startsWith("data") )
{ {
@ -449,7 +446,7 @@ qint64 ArticleResourceReply::readData( char * out, qint64 maxSize )
qint64 left = avail - alreadyRead; qint64 left = avail - alreadyRead;
qint64 toRead = maxSize < left ? maxSize : left; qint64 toRead = maxSize < left ? maxSize : left;
GD_DPRINTF( "====reading %d bytes\n", (int)toRead ); GD_DPRINTF( "====reading %d bytes", (int)toRead );
try try
{ {
@ -457,7 +454,7 @@ qint64 ArticleResourceReply::readData( char * out, qint64 maxSize )
} }
catch( std::exception & e ) catch( std::exception & e )
{ {
qWarning( "getDataSlice error: %s\n", e.what() ); qWarning( "getDataSlice error: %s", e.what() );
} }
alreadyRead += toRead; alreadyRead += toRead;

View file

@ -1849,7 +1849,8 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
if(text.size()) 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 ); menu.addAction( saveBookmark );
} }
@ -1952,10 +1953,10 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
QDesktopServices::openUrl( targetUrl ); QDesktopServices::openUrl( targetUrl );
else else
if ( result == lookupSelection ) if ( result == lookupSelection )
showDefinition( selectedText, getGroup( ui.definition->url() ), getCurrentArticle() ); showDefinition( text, getGroup( ui.definition->url() ), getCurrentArticle() );
else if( result == saveBookmark ) else if( result == saveBookmark )
{ {
emit saveBookmarkSignal( selectedText ); emit saveBookmarkSignal( text.left( 60 ) );
} }
else if( result == sendToAnkiAction ) else if( result == sendToAnkiAction )
{ {

View file

@ -64,7 +64,7 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )
if ( !ZipFile::readLocalHeader( zip, header ) ) if ( !ZipFile::readLocalHeader( zip, header ) )
{ {
GD_DPRINTF( "Failed to load header\n" ); GD_DPRINTF( "Failed to load header" );
return false; return false;
} }
@ -73,13 +73,13 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )
switch( header.compressionMethod ) switch( header.compressionMethod )
{ {
case ZipFile::Uncompressed: case ZipFile::Uncompressed:
GD_DPRINTF( "Uncompressed\n" ); GD_DPRINTF( "Uncompressed" );
data.resize( header.uncompressedSize ); data.resize( header.uncompressedSize );
return (size_t) zip.read( &data.front(), data.size() ) == data.size(); return (size_t) zip.read( &data.front(), data.size() ) == data.size();
case ZipFile::Deflated: case ZipFile::Deflated:
{ {
GD_DPRINTF( "Deflated\n" ); GD_DPRINTF( "Deflated" );
// Now do the deflation // Now do the deflation