summaryrefslogtreecommitdiffstats
path: root/redhat/applications
diff options
context:
space:
mode:
Diffstat (limited to 'redhat/applications')
-rw-r--r--redhat/applications/koffice/kexi-fix-possible-crash-in-buffered-mode-sqlite-2.patch27
-rw-r--r--redhat/applications/koffice/kexi-fix-support-for-boolean-types-in-migration.patch22
-rw-r--r--redhat/applications/koffice/kexi-fix-support-for-boolean-types.patch23
-rw-r--r--redhat/applications/koffice/kexi-fp_expressions-1.1.3.patch21
-rw-r--r--redhat/applications/koffice/kexi-hide_hourglass-1.1.3-2.patch23
-rw-r--r--redhat/applications/koffice/kexi-mysql_migrate_long_text-1.1.3.patch16
-rw-r--r--redhat/applications/koffice/kexi-thoushand_objects_support-1.1.3-2.patch258
-rw-r--r--redhat/applications/koffice/koffice-3.5.13-chalk_gmagick.patch129
8 files changed, 519 insertions, 0 deletions
diff --git a/redhat/applications/koffice/kexi-fix-possible-crash-in-buffered-mode-sqlite-2.patch b/redhat/applications/koffice/kexi-fix-possible-crash-in-buffered-mode-sqlite-2.patch
new file mode 100644
index 000000000..0be9764e3
--- /dev/null
+++ b/redhat/applications/koffice/kexi-fix-possible-crash-in-buffered-mode-sqlite-2.patch
@@ -0,0 +1,27 @@
+--- kexi/kexidb/drivers/sqlite/sqlitecursor.cpp 2006/10/26 19:25:03 599352
++++ kexi/kexidb/drivers/sqlite/sqlitecursor.cpp 2007/10/01 19:29:39 719720
+@@ -324,19 +324,21 @@
+ }
+
+ //debug
+-/*
+- if (m_result == FetchOK && d->curr_coldata) {
++/* if (((int)m_result == (int)FetchOK) && d->curr_coldata) {
+ for (uint i=0;i<m_fieldCount;i++) {
+ KexiDBDrvDbg<<"col."<< i<<": "<< d->curr_colname[i]<<" "<< d->curr_colname[m_fieldCount+i]
+ << " = " << (d->curr_coldata[i] ? TQString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl;
+ }
+-// KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl;
++ KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl;
+ }*/
+ }
+
+ void SQLiteCursor::drv_appendCurrentRecordToBuffer()
+ {
+ // KexiDBDrvDbg << "SQLiteCursor::drv_appendCurrentRecordToBuffer():" <<endl;
++ if (!d->curr_coldata)
++ return;
++
+ if (!d->cols_pointers_mem_size)
+ d->cols_pointers_mem_size = m_fieldCount * sizeof(char*);
+ const char **record = (const char**)malloc(d->cols_pointers_mem_size);
diff --git a/redhat/applications/koffice/kexi-fix-support-for-boolean-types-in-migration.patch b/redhat/applications/koffice/kexi-fix-support-for-boolean-types-in-migration.patch
new file mode 100644
index 000000000..7509946b2
--- /dev/null
+++ b/redhat/applications/koffice/kexi-fix-support-for-boolean-types-in-migration.patch
@@ -0,0 +1,22 @@
+--- kexi/migration/pqxx/pqxxmigrate.cpp 2006/12/17 21:08:15 614463
++++ kexi/migration/pqxx/pqxxmigrate.cpp 2008/04/30 09:54:43 802697
+@@ -538,10 +538,18 @@
+ int index = 0;
+ for ( i = R.begin(); i != end; ++i, index++) {
+ if (fieldsExpanded.at(index)->field->type()==KexiDB::Field::BLOB || fieldsExpanded.at(index)->field->type()==KexiDB::Field::LongText)
++ {
+ vals.append( KexiDB::pgsqlByteaToByteArray((*i).c_str(), (*i).size()) );
+- else
++ }
++ else if (fieldsExpanded.at(index)->field->type()==KexiDB::Field::Boolean )
++ {
++ vals.append(QString((*i).c_str()).lower() == "t" ? QVariant(true, 1) : QVariant(false, 1));
++ }
++ else
++ {
+ vals.append( KexiDB::cstringToVariant((*i).c_str(),
+ fieldsExpanded.at(index)->field, (*i).size()) );
++ }
+ }
+ if (!destConn->insertRecord(*dstTable, vals))
+ return false;
diff --git a/redhat/applications/koffice/kexi-fix-support-for-boolean-types.patch b/redhat/applications/koffice/kexi-fix-support-for-boolean-types.patch
new file mode 100644
index 000000000..dd8ee6ae7
--- /dev/null
+++ b/redhat/applications/koffice/kexi-fix-support-for-boolean-types.patch
@@ -0,0 +1,23 @@
+--- kexi/kexidb/drivers/pqxx/pqxxcursor.cpp 2007/10/25 14:56:36 729302
++++ kexi/kexidb/drivers/pqxx/pqxxcursor.cpp 2008/04/30 09:54:43 802697
+@@ -236,12 +236,20 @@
+ {
+ return (*m_res)[at()][pos].as(double());
+ }
++ else if (f->type() == Field::Boolean )
++ {
++ return QString((*m_res)[at()][pos].c_str()).lower() == "t" ? QVariant(true, 1) : QVariant(false, 1);
++ }
+ else if (f->typeGroup() == Field::BLOBGroup)
+ {
+ // pqxx::result::field r = (*m_res)[at()][pos];
+ // kdDebug() << r.name() << ", " << r.c_str() << ", " << r.type() << ", " << r.size() << endl;
+ return ::pgsqlByteaToByteArray((*m_res)[at()][pos]);
+ }
++ else
++ {
++ return pgsqlCStrToVariant((*m_res)[at()][pos]);
++ }
+ }
+ else // We probably have a raw type query so use pqxx to determin the column type
+ {
diff --git a/redhat/applications/koffice/kexi-fp_expressions-1.1.3.patch b/redhat/applications/koffice/kexi-fp_expressions-1.1.3.patch
new file mode 100644
index 000000000..9147ffad2
--- /dev/null
+++ b/redhat/applications/koffice/kexi-fp_expressions-1.1.3.patch
@@ -0,0 +1,21 @@
+Index: kexi/kexidb/expression.cpp
+===================================================================
+--- kexi/kexidb/expression.cpp (revision 742153)
++++ kexi/kexidb/expression.cpp (working copy)
+@@ -400,14 +400,10 @@
+ if (ltInt && rtInt)
+ return KexiDB::maximumForIntegerTypes(lt, rt);
+
+- if (Field::isFPNumericType(lt) && rtInt)
++ if (Field::isFPNumericType(lt) && (rtInt || lt==rt))
+ return lt;
+- if (Field::isFPNumericType(rt) && ltInt)
++ if (Field::isFPNumericType(rt) && (ltInt || lt==rt))
+ return rt;
+- if ((lt==Field::Double || lt==Field::Float) && rtInt)
+- return lt;
+- if ((rt==Field::Double || rt==Field::Float) && ltInt)
+- return rt;
+
+ return Field::Boolean;
+ }
diff --git a/redhat/applications/koffice/kexi-hide_hourglass-1.1.3-2.patch b/redhat/applications/koffice/kexi-hide_hourglass-1.1.3-2.patch
new file mode 100644
index 000000000..eddfc24ce
--- /dev/null
+++ b/redhat/applications/koffice/kexi-hide_hourglass-1.1.3-2.patch
@@ -0,0 +1,23 @@
+Index: kexi/kexiutils/utils.cpp
+===================================================================
+--- kexi/kexiutils/utils.cpp (revision 716273)
++++ kexi/kexiutils/utils.cpp (working copy)
+@@ -57,7 +57,7 @@
+ TQApplication::restoreOverrideCursor();
+ }
+ void DelayedCursorHandler::show() {
+- TQApplication::setOverrideCursor( KCursor::waitCursor() );
++ TQApplication::setOverrideCursor( KCursor::waitCursor(), true/*replace*/ );
+ }
+
+ DelayedCursorHandler _delayedCursorHandler;
+@@ -89,7 +89,8 @@
+
+ WaitCursorRemover::~WaitCursorRemover()
+ {
+- _delayedCursorHandler.start(true);
++ if (m_reactivateCursor)
++ _delayedCursorHandler.start(true);
+ }
+
+ //--------------------------------------------------------------------------------
diff --git a/redhat/applications/koffice/kexi-mysql_migrate_long_text-1.1.3.patch b/redhat/applications/koffice/kexi-mysql_migrate_long_text-1.1.3.patch
new file mode 100644
index 000000000..70a0bab67
--- /dev/null
+++ b/redhat/applications/koffice/kexi-mysql_migrate_long_text-1.1.3.patch
@@ -0,0 +1,16 @@
+Index: kexi/migration/mysql/mysqlmigrate.cpp
+===================================================================
+--- kexi/migration/mysql/mysqlmigrate.cpp (revision 714726)
++++ kexi/migration/mysql/mysqlmigrate.cpp (working copy)
+@@ -420,9 +420,9 @@
+ if(mysqlType.contains("blob", false) != 0) {
+ // Doesn't matter how big it is, it's binary
+ kexiType = KexiDB::Field::BLOB;
+- } else if(mysqlType.contains("text", false) != 0) {
++/* } else if(mysqlType.contains("text", false) != 0) {
+ // All the TEXT types are too big for Kexi text.
+- kexiType = KexiDB::Field::BLOB;
++ kexiType = KexiDB::Field::BLOB;*/
+ } else if(fld->length < 200) {
+ kexiType = KexiDB::Field::Text;
+ } else {
diff --git a/redhat/applications/koffice/kexi-thoushand_objects_support-1.1.3-2.patch b/redhat/applications/koffice/kexi-thoushand_objects_support-1.1.3-2.patch
new file mode 100644
index 000000000..37d13523a
--- /dev/null
+++ b/redhat/applications/koffice/kexi-thoushand_objects_support-1.1.3-2.patch
@@ -0,0 +1,258 @@
+Index: kexi/plugins/forms/kexidataprovider.cpp
+===================================================================
+--- kexi/plugins/forms/kexidataprovider.cpp (revision 688747)
++++ kexi/plugins/forms/kexidataprovider.cpp (revision 688748)
+@@ -153,7 +153,7 @@
+ count = it_dup.data();
+ tmpDuplicatedItems.insert( it.current()->columnInfo()->field, ++count );
+ }
+- m_duplicatedItems = new TQPtrDict<char>(101);
++ m_duplicatedItems = new TQPtrDict<char>(1009);
+ for (it_dup = tmpDuplicatedItems.begin(); it_dup!=tmpDuplicatedItems.end(); ++it_dup) {
+ if (it_dup.data() > 1) {
+ m_duplicatedItems->insert( it_dup.key(), (char*)1 );
+@@ -260,7 +260,7 @@
+ // m_fieldNumbersForDataItems = newFieldNumbersForDataItems;
+
+ //update data sources set (some of them may be removed)
+- TQDict<char> tmpUsedDataSources(1013);
++ TQDict<char> tmpUsedDataSources(1009);
+
+ if (query)
+ query->debug();
+Index: kexi/plugins/tables/kexitabledesignerview.cpp
+===================================================================
+--- kexi/plugins/tables/kexitabledesignerview.cpp (revision 688747)
++++ kexi/plugins/tables/kexitabledesignerview.cpp (revision 688748)
+@@ -1262,7 +1262,7 @@
+ KoProperty::Set *b = 0;
+ bool no_fields = true;
+ int i;
+- TQDict<char> names(101, false);
++ TQDict<char> names(1009, false);
+ char dummy;
+ for (i=0;i<(int)d->sets->size();i++) {
+ b = d->sets->at(i);
+Index: kexi/plugins/queries/kexiquerydesignerguieditor.cpp
+===================================================================
+--- kexi/plugins/queries/kexiquerydesignerguieditor.cpp (revision 688747)
++++ kexi/plugins/queries/kexiquerydesignerguieditor.cpp (revision 688748)
+@@ -77,7 +77,7 @@
+ {
+ public:
+ Private()
+- : fieldColumnIdentifiers(101, false/*case insens.*/)
++ : fieldColumnIdentifiers(1009, false/*case insens.*/)
+ {
+ droppedNewItem = 0;
+ slotTableAdded_enabled = true;
+@@ -809,7 +809,7 @@
+ //2. Collect information about criterias
+ // --this must be top level chain of AND's
+ // --this will also show joins as: [table1.]field1 = [table2.]field2
+- TQDict<KexiDB::BaseExpr> criterias(101, false);
++ TQDict<KexiDB::BaseExpr> criterias(1009, false);
+ KexiDB::BaseExpr* e = query->whereExpression();
+ KexiDB::BaseExpr* eItem = 0;
+ while (e) {
+@@ -877,7 +877,7 @@
+ //3. show fields (including * and table.*)
+ uint row_num = 0;
+ KexiDB::Field *field;
+- TQPtrDict<char> usedCriterias(101); // <-- used criterias will be saved here
++ TQPtrDict<char> usedCriterias(1009); // <-- used criterias will be saved here
+ // so in step 4. we will be able to add
+ // remaining invisible columns with criterias
+ for (KexiDB::Field::ListIterator it(*query->fields());
+@@ -1270,7 +1270,7 @@
+ const TQCString expStr
+ = i18n("short for 'expression' word (only latin letters, please)", "expr").latin1();
+ //TODO: optimization: cache it?
+- TQAsciiDict<char> aliases(101);
++ TQAsciiDict<char> aliases(1009);
+ for (int r = 0; r<(int)d->sets->size(); r++) {
+ KoProperty::Set *set = d->sets->at(r);
+ if (set) {
+Index: kexi/widget/tableview/kexidataawarepropertyset.cpp
+===================================================================
+--- kexi/widget/tableview/kexidataawarepropertyset.cpp (revision 688747)
++++ kexi/widget/tableview/kexidataawarepropertyset.cpp (revision 688748)
+@@ -24,7 +24,7 @@
+ #include <koproperty/property.h>
+ #include <kexiviewbase.h>
+
+-#define MAX_FIELDS 101 //nice prime number (default prop. set vector size)
++#define MAX_FIELDS 1009 //nice prime number (default prop. set vector size)
+
+ KexiDataAwarePropertySet::KexiDataAwarePropertySet(KexiViewBase *view,
+ KexiDataAwareObjectInterface* dataObject)
+Index: kexi/widget/utils/kexisharedactionclient.cpp
+===================================================================
+--- kexi/widget/utils/kexisharedactionclient.cpp (revision 688747)
++++ kexi/widget/utils/kexisharedactionclient.cpp (revision 688748)
+@@ -22,7 +22,7 @@
+ #include <kaction.h>
+
+ KexiSharedActionClient::KexiSharedActionClient()
+- : m_sharedActions(101, false)
++ : m_sharedActions(1009, false)
+ {
+ }
+
+Index: kexi/main/keximainwindowimpl.cpp
+===================================================================
+--- kexi/main/keximainwindowimpl.cpp (revision 688747)
++++ kexi/main/keximainwindowimpl.cpp (revision 688748)
+@@ -4203,8 +4203,10 @@
+ data = new KexiProjectData(*d->prj->data()); // a copy
+ drv = d->prj->dbConnection()->driver();
+ const tristate res = closeProject();
+- if (~res || !res)
++ if (~res || !res) {
++ delete data;
+ return;
++ }
+ }
+
+ if (!drv->adminTools().vacuum(*data->connectionData(), data->databaseName())) {
+@@ -4212,10 +4214,9 @@
+ showErrorMessage( &drv->adminTools() );
+ }
+
+- if (data && projectWasOpened) {
++ if (projectWasOpened)
+ openProject(*data);
+- delete data;
+- }
++ delete data;
+ }
+
+ tristate KexiMainWindowImpl::showProjectMigrationWizard(
+Index: kexi/core/kexidbconnectionset.cpp
+===================================================================
+--- kexi/core/kexidbconnectionset.cpp (revision 688747)
++++ kexi/core/kexidbconnectionset.cpp (revision 688748)
+@@ -30,7 +30,7 @@
+ {
+ public:
+ KexiDBConnectionSetPrivate()
+- : dataForFilenames(101)
++ : dataForFilenames(1009)
+ {
+ list.setAutoDelete(true);
+ maxid=-1;
+Index: kexi/migration/keximigrate.cpp
+===================================================================
+--- kexi/migration/keximigrate.cpp (revision 688747)
++++ kexi/migration/keximigrate.cpp (revision 688748)
+@@ -491,7 +491,6 @@
+ // Prompt the user to choose a field type
+ KexiDB::Field::Type KexiMigrate::userType(const TQString& fname)
+ {
+- KInputDialog *dlg;
+ TQStringList types;
+ TQString res;
+
+@@ -509,7 +508,7 @@
+ types << "Long Text";
+ types << "Binary Large Object";
+
+- res = dlg->getItem( i18n("Field Type"),
++ res = KInputDialog::getItem( i18n("Field Type"),
+ i18n("The data type for %1 could not be determined. "
+ "Please select one of the following data "
+ "types").tqarg(fname),
+Index: kexi/kexidb/connection.cpp
+===================================================================
+--- kexi/kexidb/connection.cpp (revision 688747)
++++ kexi/kexidb/connection.cpp (revision 688748)
+@@ -83,10 +83,10 @@
+ ConnectionPrivate(Connection* const conn, ConnectionData &conn_data)
+ : conn(conn)
+ , conn_data(&conn_data)
+- , tableSchemaChangeListeners(101)
++ , tableSchemaChangeListeners(1009)
+ , m_parser(0)
+- , tables_byname(101, false)
+- , queries_byname(101, false)
++ , tables_byname(1009, false)
++ , queries_byname(1009, false)
+ , kexiDBSystemTables(101)
+ , dont_remove_transactions(false)
+ , skip_databaseExists_check_in_useDatabase(false)
+@@ -104,8 +104,8 @@
+ queries_byname.setAutoDelete(false);//queries is owner, not me
+
+ //reasonable sizes: TODO
+- tables.resize(101);
+- queries.resize(101);
++ tables.resize(1009);
++ queries.resize(1009);
+ }
+ ~ConnectionPrivate()
+ {
+Index: kexi/kexidb/fieldvalidator.cpp
+===================================================================
+--- kexi/kexidb/fieldvalidator.cpp (revision 688747)
++++ kexi/kexidb/fieldvalidator.cpp (revision 688748)
+@@ -36,7 +36,7 @@
+ if (field.isIntegerType()) {
+ TQValidator *validator = 0;
+ const bool u = field.isUnsigned();
+- int bottom, top;
++ int bottom = 0, top = 0;
+ if (t==Field::Byte) {
+ bottom = u ? 0 : -0x80;
+ top = u ? 0xff : 0x7f;
+Index: kexi/kexidb/alter.cpp
+===================================================================
+--- kexi/kexidb/alter.cpp (revision 688747)
++++ kexi/kexidb/alter.cpp (revision 688748)
+@@ -223,7 +223,7 @@
+ static AlterTableHandler::ActionDict* createActionDict(
+ AlterTableHandler::ActionDictDict &fieldActions, int forFieldUID )
+ {
+- AlterTableHandler::ActionDict* dict = new AlterTableHandler::ActionDict(101, false);
++ AlterTableHandler::ActionDict* dict = new AlterTableHandler::ActionDict(1009, false);
+ dict->setAutoDelete(true);
+ fieldActions.insert( forFieldUID, dict );
+ return dict;
+Index: kexi/kexidb/queryschema.cpp
+===================================================================
+--- kexi/kexidb/queryschema.cpp (revision 688747)
++++ kexi/kexidb/queryschema.cpp (revision 688748)
+@@ -1439,7 +1439,7 @@
+ }
+
+ //remove duplicates for lookup fields
+- TQDict<uint> lookup_dict(101); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue()
++ TQDict<uint> lookup_dict(1009); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue()
+ // (a mapping from table.name string to uint* lookupFieldIndex
+ lookup_dict.setAutoDelete(true);
+ i=0;
+Index: kexi/kexidb/fieldlist.cpp
+===================================================================
+--- kexi/kexidb/fieldlist.cpp (revision 688747)
++++ kexi/kexidb/fieldlist.cpp (revision 688748)
+@@ -28,7 +28,7 @@
+
+ FieldList::FieldList(bool owner)
+ //reasonable sizes: TODO
+- : m_fields_by_name(101, false)
++ : m_fields_by_name(1009, false)
+ {
+ m_fields.setAutoDelete( owner );
+ m_fields_by_name.setAutoDelete( false );
+Index: kexi/formeditor/widgetlibrary.cpp
+===================================================================
+--- kexi/formeditor/widgetlibrary.cpp (revision 688747)
++++ kexi/formeditor/widgetlibrary.cpp (revision 688748)
+@@ -55,7 +55,7 @@
+ {
+ public:
+ WidgetLibraryPrivate()
+- : widgets(101)
++ : widgets(1009)
+ // , alternateWidgets(101)
+ , services(101, false)
+ , supportedFactoryGroups(17, false)
diff --git a/redhat/applications/koffice/koffice-3.5.13-chalk_gmagick.patch b/redhat/applications/koffice/koffice-3.5.13-chalk_gmagick.patch
new file mode 100644
index 000000000..d497a96e7
--- /dev/null
+++ b/redhat/applications/koffice/koffice-3.5.13-chalk_gmagick.patch
@@ -0,0 +1,129 @@
+diff --git a/filters/chalk/gmagick/kis_image_magick_converter.cc b/filters/chalk/gmagick/kis_image_magick_converter.cc
+index 5bce37b..eea8000 100644
+--- a/filters/chalk/gmagick/kis_image_magick_converter.cc
++++ b/filters/chalk/gmagick/kis_image_magick_converter.cc
+@@ -182,6 +182,7 @@ namespace {
+
+ image -> addAnnotation(annotation);
+ }
++#if 0
+ for(int i = 0; i < src->generic_profiles; i++)
+ {
+ TQByteArray rawdata;
+@@ -193,6 +194,7 @@ namespace {
+
+ image -> addAnnotation(annotation);
+ }
++#endif
+
+ const ImageAttribute* imgAttr = GetImageAttribute(src, NULL);
+ while(imgAttr)
+@@ -480,7 +482,7 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ TQ_UINT8 opacity = OPACITY_OPAQUE;
+ const ImageAttribute * attr = GetImageAttribute(image, "[layer-opacity]");
+ if (attr != 0) {
+- opacity = TQ_UINT8_MAX - Downscale(TQString(attr->value).toInt());
++ opacity = TQ_UINT8_MAX - ScaleQuantumToChar(TQString(attr->value).toInt());
+ }
+
+ KisPaintLayerSP layer = 0;
+@@ -534,17 +536,17 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ while (!hiter.isDone())
+ {
+ TQ_UINT8 *ptr= hiter.rawData();
+- *(ptr++) = Downscale(pp->red); // cyan
+- *(ptr++) = Downscale(pp->green); // magenta
+- *(ptr++) = Downscale(pp->blue); // yellow
+- *(ptr++) = Downscale(indexes[x]); // Black
++ *(ptr++) = ScaleQuantumToChar(pp->red); // cyan
++ *(ptr++) = ScaleQuantumToChar(pp->green); // magenta
++ *(ptr++) = ScaleQuantumToChar(pp->blue); // yellow
++ *(ptr++) = ScaleQuantumToChar(indexes[x]); // Black
+ // XXX: Warning! This ifdef messes up the paren matching big-time!
+ #ifdef HAVE_MAGICK6
+ if (image->matte != MagickFalse) {
+ #else
+ if (image->matte == true) {
+ #endif
+- *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++ *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+ }
+ else {
+ *(ptr++) = OPACITY_OPAQUE;
+@@ -578,10 +580,10 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ {
+ TQ_UINT8 *ptr= hiter.rawData();
+ // XXX: not colorstrategy and bitdepth independent
+- *(ptr++) = Downscale(pp->blue);
+- *(ptr++) = Downscale(pp->green);
+- *(ptr++) = Downscale(pp->red);
+- *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++ *(ptr++) = ScaleQuantumToChar(pp->blue);
++ *(ptr++) = ScaleQuantumToChar(pp->green);
++ *(ptr++) = ScaleQuantumToChar(pp->red);
++ *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+
+ pp++;
+ ++hiter;
+@@ -608,8 +610,8 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ {
+ TQ_UINT8 *ptr= hiter.rawData();
+ // XXX: not colorstrategy and bitdepth independent
+- *(ptr++) = Downscale(pp->blue);
+- *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
++ *(ptr++) = ScaleQuantumToChar(pp->blue);
++ *(ptr++) = OPACITY_OPAQUE - ScaleQuantumToChar(pp->opacity);
+
+ pp++;
+ ++hiter;
+@@ -812,13 +814,12 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ while (!it.isDone()) {
+
+ TQ_UINT8 * d = it.rawData();
+- pp -> red = Upscale(d[PIXEL_CYAN]);
+- pp -> green = Upscale(d[PIXEL_MAGENTA]);
+- pp -> blue = Upscale(d[PIXEL_YELLOW]);
++ pp -> red = ScaleCharToQuantum(d[PIXEL_CYAN]);
++ pp -> green = ScaleCharToQuantum(d[PIXEL_MAGENTA]);
++ pp -> blue = ScaleCharToQuantum(d[PIXEL_YELLOW]);
+ if (alpha)
+- pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_CMYK_ALPHA]);
+-
+- indexes[x]= Upscale(d[PIXEL_BLACK]);
++ pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_CMYK_ALPHA]);
++ indexes[x]= ScaleCharToQuantum(d[PIXEL_BLACK]);
+
+ x++;
+ pp++;
+@@ -848,11 +849,11 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ while (!it.isDone()) {
+
+ TQ_UINT8 * d = it.rawData();
+- pp -> red = Upscale(d[PIXEL_RED]);
+- pp -> green = Upscale(d[PIXEL_GREEN]);
+- pp -> blue = Upscale(d[PIXEL_BLUE]);
++ pp -> red = ScaleCharToQuantum(d[PIXEL_RED]);
++ pp -> green = ScaleCharToQuantum(d[PIXEL_GREEN]);
++ pp -> blue = ScaleCharToQuantum(d[PIXEL_BLUE]);
+ if (alpha)
+- pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_ALPHA]);
++ pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_ALPHA]);
+
+ pp++;
+ ++it;
+@@ -879,11 +880,11 @@ KisImageBuilder_Result KisImageMagickConverter::decode(const KURL& uri, bool isB
+ else {
+ while (!it.isDone()) {
+ TQ_UINT8 * d = it.rawData();
+- pp -> red = Upscale(d[PIXEL_GRAY]);
+- pp -> green = Upscale(d[PIXEL_GRAY]);
+- pp -> blue = Upscale(d[PIXEL_GRAY]);
++ pp -> red = ScaleCharToQuantum(d[PIXEL_GRAY]);
++ pp -> green = ScaleCharToQuantum(d[PIXEL_GRAY]);
++ pp -> blue = ScaleCharToQuantum(d[PIXEL_GRAY]);
+ if (alpha)
+- pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_GRAY_ALPHA]);
++ pp -> opacity = ScaleCharToQuantum(OPACITY_OPAQUE - d[PIXEL_GRAY_ALPHA]);
+
+ pp++;
+ ++it;