summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-05-11 17:41:22 +0200
committerSlávek Banko <slavek.banko@axis.cz>2019-05-12 16:30:30 +0200
commitc0263d89c688f750a6e68a7f77257b2be0c55990 (patch)
tree47b1f49338ff6ff2706681de80753613f9c8a27e
parentf0a3534123e54a962a4c7de7ebd332e6eae658d1 (diff)
downloadkchmviewer-c0263d89c688f750a6e68a7f77257b2be0c55990.tar.gz
kchmviewer-c0263d89c688f750a6e68a7f77257b2be0c55990.zip
Added controlled conversions to char* instead of automatic ascii conversions.
The definition of -UTQT_NO_ASCII_CAST is no longer needed. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt2
-rw-r--r--lib/libchmfile/libchmfileimpl.cpp4
-rw-r--r--lib/libchmfile/libchmfileimpl.h4
-rw-r--r--lib/libchmfile/libchmurlfactory.h2
-rw-r--r--src/kchmmainwindow.cpp8
5 files changed, 10 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5d79d6..ebd32a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,7 +61,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings
-add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST )
+add_definitions( -DHAVE_CONFIG_H )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
diff --git a/lib/libchmfile/libchmfileimpl.cpp b/lib/libchmfile/libchmfileimpl.cpp
index a5ad04c..51bd7b4 100644
--- a/lib/libchmfile/libchmfileimpl.cpp
+++ b/lib/libchmfile/libchmfileimpl.cpp
@@ -864,7 +864,7 @@ TQCString LCHMFileImpl::convertSearchWord( const TQString & src )
};
if ( !m_textCodec )
- return (TQCString) src.lower();
+ return src.lower().utf8();
TQCString dest = m_textCodec->fromUnicode (src);
@@ -996,7 +996,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const TQString & file, QT34VECTOR< LCH
else if ( tagword == "/object" && in_object )
{
// a topic entry closed. Add a tree item
- if ( entry.name )
+ if ( !entry.name.isEmpty() )
{
if ( !root_indent_offset_set )
{
diff --git a/lib/libchmfile/libchmfileimpl.h b/lib/libchmfile/libchmfileimpl.h
index c0a606f..d596d81 100644
--- a/lib/libchmfile/libchmfileimpl.h
+++ b/lib/libchmfile/libchmfileimpl.h
@@ -109,7 +109,7 @@ class LCHMFileImpl
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
inline TQString encodeWithCurrentCodec (const TQString& str) const
{
- return (m_textCodec ? m_textCodec->toUnicode (str) : str);
+ return (m_textCodec ? m_textCodec->toUnicode (str.utf8()) : str);
}
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
@@ -122,7 +122,7 @@ class LCHMFileImpl
//! Or return as-is, if not.
inline TQString encodeInternalWithCurrentCodec (const TQString& str) const
{
- return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str) : str);
+ return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str.utf8()) : str);
}
//! Encode the string from internal files with the currently selected text codec, if possible.
diff --git a/lib/libchmfile/libchmurlfactory.h b/lib/libchmfile/libchmurlfactory.h
index a897138..fba5614 100644
--- a/lib/libchmfile/libchmurlfactory.h
+++ b/lib/libchmfile/libchmurlfactory.h
@@ -113,7 +113,7 @@ static inline bool handleFileType( const TQString& link, TQString& generated )
if ( !link.endsWith( intext ) )
return false;
- TQString filelink = link.left( link.length() - strlen( intext ) );
+ TQString filelink = link.left( link.length() - intext.length() );
generated = "<html><body><img src=\"" + filelink + "\"></body></html>";
return true;
}
diff --git a/src/kchmmainwindow.cpp b/src/kchmmainwindow.cpp
index 9778b1c..157b7d4 100644
--- a/src/kchmmainwindow.cpp
+++ b/src/kchmmainwindow.cpp
@@ -632,7 +632,7 @@ bool KCHMMainWindow::parseCmdLineArgs( )
search_index = args->getOption ("sindex");
if ( args->count() > 0 )
- filename = args->arg(0);
+ filename = TQString::fromLocal8Bit(args->arg(0));
#else
// argv[0] in TQt is still a program name
for ( int i = 1; i < tqApp->argc(); i++ )
@@ -651,13 +651,13 @@ bool KCHMMainWindow::parseCmdLineArgs( )
exit (1);
}
else
- filename = tqApp->argv()[i];
+ filename = TQSTring::fromLocal8Bit(tqApp->argv()[i]);
}
#endif
if ( !filename.isEmpty() )
{
- if ( !loadChmFile( TQString::fromLocal8Bit( filename )) )
+ if ( !loadChmFile( filename ) )
return true; // skip the latest checks, but do not exit from the program
if ( !search_index.isEmpty() )
@@ -667,7 +667,7 @@ bool KCHMMainWindow::parseCmdLineArgs( )
tqApp->postEvent( this, new KCHMUserEvent( "findInIndex", event_args ) );
}
- if ( !search_query.isEmpty() )
+ if ( !search_query.isEmpty() )
{
TQStringList event_args;
event_args.push_back( search_query );