summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-02-24 14:49:03 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-02-24 14:53:44 +0100
commit20a84daca2dfed6201373911a0c252f9d36c29c3 (patch)
treece4aee38bd95b0a2a536e92e2d3ba619cb20ceb1
parent62481690071ce35abc780ba582a292b82b35b350 (diff)
downloadkbarcode-20a84daca2dfed6201373911a0c252f9d36c29c3.zip
kbarcode-20a84daca2dfed6201373911a0c252f9d36c29c3.tar.gz
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--kbarcode/barcodedialog.cpp2
-rw-r--r--kbarcode/barkode.cpp8
-rw-r--r--kbarcode/batchprinter.cpp2
-rw-r--r--kbarcode/definition.cpp2
-rw-r--r--kbarcode/mimesources.cpp6
-rw-r--r--kbarcode/pixmapbarcode.cpp2
-rw-r--r--kbarcode/purepostscript.cpp2
-rw-r--r--kbarcode/tec.cpp4
-rw-r--r--kbarcode/tokenprovider.cpp2
10 files changed, 16 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78cc020..91dcc39 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,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/kbarcode/barcodedialog.cpp b/kbarcode/barcodedialog.cpp
index 3971548..3919f74 100644
--- a/kbarcode/barcodedialog.cpp
+++ b/kbarcode/barcodedialog.cpp
@@ -151,7 +151,7 @@ void BarCodeDialog::save()
bc.setTokenProvider( m_token );
bc.update( TQT_TQPAINTDEVICE(TDEApplication::desktop()) );
- if(!bc.pixmap().save( path, extension, 0 ))
+ if(!bc.pixmap().save( path, extension.utf8(), 0 ))
KMessageBox::error( this, i18n("An error occurred during saving the image") );
}
}
diff --git a/kbarcode/barkode.cpp b/kbarcode/barkode.cpp
index 337931f..82a9deb 100644
--- a/kbarcode/barkode.cpp
+++ b/kbarcode/barkode.cpp
@@ -605,8 +605,8 @@ const char* Barkode::typeFromName( const TQString & name )
{
for( unsigned int i = 0; i < s_info.count(); i++ )
if( s_info[i].name == name )
- return s_info[i].xml;
-
+ return s_info[i].xml.latin1();
+
return NULL;
}
@@ -614,8 +614,8 @@ const char* Barkode::nameFromType( const TQString & type )
{
for( unsigned int i = 0; i < s_info.count(); i++ )
if( s_info[i].xml == type )
- return s_info[i].name;
-
+ return s_info[i].name.latin1();
+
return NULL;
}
diff --git a/kbarcode/batchprinter.cpp b/kbarcode/batchprinter.cpp
index 9bea56a..2188112 100644
--- a/kbarcode/batchprinter.cpp
+++ b/kbarcode/batchprinter.cpp
@@ -308,7 +308,7 @@ void BatchPrinter::startImages()
c++;
}
- pixmap.save( filename, m_image_format );
+ pixmap.save( filename, m_image_format.utf8() );
if( !checkProgressDialog( progress ) )
{
diff --git a/kbarcode/definition.cpp b/kbarcode/definition.cpp
index fcc1866..ec34b12 100644
--- a/kbarcode/definition.cpp
+++ b/kbarcode/definition.cpp
@@ -306,7 +306,7 @@ bool Definition::openFile()
if( !TQFile::exists( fname ) || fname.isEmpty() )
return ( showFileError() ? openFile() : false );
- if(!filecopy( (const char*)fname, (const char*)f ))
+ if(!filecopy( fname.local8Bit(), f.local8Bit() ))
return ( showFileError() ? openFile() : false );
}
diff --git a/kbarcode/mimesources.cpp b/kbarcode/mimesources.cpp
index 23278bb..4767f3f 100644
--- a/kbarcode/mimesources.cpp
+++ b/kbarcode/mimesources.cpp
@@ -47,7 +47,7 @@ class DragCommand : public NewItemCommand {
DocumentItemDrag::DocumentItemDrag( TQWidget* dragSource, const char* name )
- : TQStoredDrag( DocumentItemDrag::mimeType(), dragSource, name )
+ : TQStoredDrag( DocumentItemDrag::mimeType().latin1(), dragSource, name )
{
}
@@ -83,12 +83,12 @@ void DocumentItemDrag::setDocumentItem( DocumentItemList* list )
bool DocumentItemDrag::canDecode( TQMimeSource* e )
{
- return e->provides( DocumentItemDrag::mimeType() );
+ return e->provides( DocumentItemDrag::mimeType().latin1() );
}
bool DocumentItemDrag::decode( TQMimeSource* mime, MyCanvasView* cv, TokenProvider* token, KCommandHistory* history )
{
- TQByteArray data = mime->encodedData( DocumentItemDrag::mimeType() );
+ TQByteArray data = mime->encodedData( DocumentItemDrag::mimeType().latin1() );
TQDomDocument doc( "KBarcodeClipboard" );
if( !doc.setContent( data ) )
return false;
diff --git a/kbarcode/pixmapbarcode.cpp b/kbarcode/pixmapbarcode.cpp
index dbe3a62..785441b 100644
--- a/kbarcode/pixmapbarcode.cpp
+++ b/kbarcode/pixmapbarcode.cpp
@@ -248,7 +248,7 @@ TQRect PixmapBarcode::bbox( const char* data, long size )
if( text.startsWith( bbox ) )
{
text = text.right( text.length() - len );
- sscanf( (const char*)text, "%d %d %d %d", &x, &y, &w, &h );
+ sscanf( text.latin1(), "%d %d %d %d", &x, &y, &w, &h );
s = TQRect( x, y, w, h );
break;
}
diff --git a/kbarcode/purepostscript.cpp b/kbarcode/purepostscript.cpp
index 0afc45e..3395dec 100644
--- a/kbarcode/purepostscript.cpp
+++ b/kbarcode/purepostscript.cpp
@@ -160,7 +160,7 @@ void PurePostscriptBarcode::initInfo( TBarcodeInfoList* info )
example = line.right( line.length() - TQString( EXAMPLE ).length() );
// we should have a complete encoder now.
- info->append( Barkode::createInfo( TQString("ps_") + encoder, description, PURE_POSTSCRIPT, PUREADV | COLORED ) );
+ info->append( Barkode::createInfo( TQString("ps_%1").arg(encoder).latin1(), description, PURE_POSTSCRIPT, PUREADV | COLORED ) );
}
}
}
diff --git a/kbarcode/tec.cpp b/kbarcode/tec.cpp
index 9cdfbc1..6d6dfa5 100644
--- a/kbarcode/tec.cpp
+++ b/kbarcode/tec.cpp
@@ -215,7 +215,7 @@ TQString tec452(const TQString &url, int count, const TQString &art, const TQStr
TQString convZeros( int count, int zeros )
{
TQString str= TQString("%1").arg(count);
-int l=strlen(str); //get the string length
+int l=strlen(str.latin1()); //get the string length
for(;l<zeros;l++) str = TQString("0") + str;
return str;
}
@@ -640,7 +640,7 @@ int fd, res;
char buf[1];
TQString result;
-fd = open(file, O_RDONLY);
+fd = open(file.local8Bit(), O_RDONLY);
if (fd <0) return "Port Error.";
res=read(fd,buf,1);
while (res == 1){
diff --git a/kbarcode/tokenprovider.cpp b/kbarcode/tokenprovider.cpp
index dfbe9a6..7cdc774 100644
--- a/kbarcode/tokenprovider.cpp
+++ b/kbarcode/tokenprovider.cpp
@@ -905,7 +905,7 @@ const TQString TokenProvider::createSerial()
tmpstr.setNum(splitit.cap(2).length());
TQString formatstring = "%0" + tmpstr + "lu";
- s = prenum + tmpstr.sprintf(formatstring, tmp) + postnum;
+ s = prenum + tmpstr.sprintf(formatstring.latin1(), tmp) + postnum;
m_update = true;
}