View Issue Details

IDProjectCategoryView StatusLast Update
0002442ScribusOS-Win32public2005-09-25 20:51
Reporterjghali Assigned Tofschmid  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindowsOS Version2000 SP4
Product Version1.3.1cvs 
Fixed in Version1.3.1cvs 
Summary0002442: Patches for ps and pdf export (win32 compatibility)
DescriptionHere are three patches which improves libpdf and libpostscript compatibility on win32 :
- import and export needed symbols for win32 linking
- avoid compiler bug in util.cpp (PDF ? ~u : u always return u)
- correct some QString operator+= (char) bad behavior
The most noticeable modification reside in PDFLib:PutDoc where the line :
t.writeRawBytes(in, in.length());
has been modified to :
t.writeRawBytes(in.latin1(), in.length());
This should works as the modified line implicitly suppose argument in is composed of characters whose values is strictly inferior to 256. This one should be carefully tested.
TagsNo tags attached.
Patch

Relationships

child of 0000015 closedjghali Windows Port 

Activities

2005-08-16 22:29

 

pspdf_pdflib_win32compat.diff (5,045 bytes)   
Index: pdflib.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/libpdf/pdflib.cpp,v
retrieving revision 1.78.2.124
diff -u -r1.78.2.124 pdflib.cpp
--- pdflib.cpp	15 Aug 2005 15:11:05 -0000	1.78.2.124
+++ pdflib.cpp	16 Aug 2005 21:43:50 -0000
@@ -19,6 +19,7 @@
 #include "pdflib.moc"
 
 #include "scconfig.h"
+#include "pluginapi.h"
 
 #include <qstring.h>
 #include <qrect.h>
@@ -48,7 +49,7 @@
 using namespace std;
 
 #ifdef HAVE_CMS
-extern bool CMSuse;
+extern bool SCRIBUS_API CMSuse;
 #endif
 #ifdef HAVE_TIFF
 	#include <tiffio.h>
@@ -56,7 +57,7 @@
 
 ScribusApp *pdflibScApp;
 
-extern "C" bool Run(ScribusApp *plug, QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2);
+extern "C" PLUGIN_API bool Run(ScribusApp *plug, QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2);
 
 bool Run(ScribusApp *plug, QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2)
 {
@@ -175,7 +176,7 @@
 void PDFlib::PutDoc(QString in)
 {
 	QTextStream t(&Spool);
-	t.writeRawBytes(in, in.length());
+	t.writeRawBytes(in.latin1(), in.length());
 	Spool.flush();
 	Dokument += in.length();
 }
@@ -238,7 +239,7 @@
  		rc4_encrypt(&rc4, reinterpret_cast<uchar*>(us.data()), reinterpret_cast<uchar*>(ou.data()), tmp.length());
 		QString uk = "";
 		for (uint cl = 0; cl < tmp.length(); ++cl)
-			uk += ou[cl];
+			uk += QChar(ou[cl]);
 		tmp = uk;
 	}
 	else
@@ -279,7 +280,7 @@
   		rc4_encrypt(&rc4, reinterpret_cast<uchar*>(us.data()), reinterpret_cast<uchar*>(ou.data()), tmp.length());
 		QString uk = "";
 		for (uint cl = 0; cl < tmp.length(); ++cl)
-			uk += ou[cl];
+			uk += QChar(ou[cl]);
 		tmp = "<"+String2Hex(&uk, false)+">";
 	}
 	else
@@ -294,7 +295,7 @@
 	{
 		uint l = pw.length();
 		for (uint a = 0; a < 32 - l; ++a)
-			pw.append(KeyGen[a]);
+			pw += QChar(KeyGen[a]);
 	}
 	else
 		pw = pw.left(32);
@@ -356,11 +357,11 @@
 	perm[2] = perm_value >> 16;
 	perm[3] = perm_value >> 24;
 	for (uint a = 0; a < 32; ++a)
-		pw += OwnerKey[a];
+		pw += QChar(OwnerKey[a]);
 	for (uint a1 = 0; a1 < 4; ++a1)
-		pw += perm[a1];
+		pw += QChar(perm[a1]);
 	for (uint a3 = 0; a3 < 16; ++a3)
-		pw += FileID[a3];
+		pw += QChar(FileID[a3]);
 	step1 = ComputeMD5(pw);
 	if (KeyLen > 5)
 	{
@@ -374,9 +375,9 @@
 	{
 		QString pr2 = "";
 		for (int kl3 = 0; kl3 < 32; ++kl3)
-			pr2 += KeyGen[kl3];
+			pr2 += QChar(KeyGen[kl3]);
 		for (uint a4 = 0; a4 < 16; ++a4)
-			pr2 += FileID[a4];
+			pr2 += QChar(FileID[a4]);
 		step1 = ComputeMD5(pr2);
 		QByteArray enk(16);
 		for (uint a3 = 0; a3 < 16; ++a3)
@@ -479,18 +480,18 @@
 		CalcOwnerKey(Options->PassOwner, Options->PassUser);
 		CalcUserKey(Options->PassUser, Options->Permissions);
 		for (uint cl2 = 0; cl2 < 32; ++cl2)
-			ok += OwnerKey[cl2];
+			ok += QChar(OwnerKey[cl2]);
 		if (KeyLen > 5)
 		{
 			for (uint cl3 = 0; cl3 < 16; ++cl3)
-				uk += UserKey[cl3];
+				uk += QChar(UserKey[cl3]);
 			for (uint cl3r = 0; cl3r < 16; ++cl3r)
-				uk += KeyGen[cl3r];
+				uk += QChar(KeyGen[cl3r]);
 		}
 		else
 		{
 			for (uint cl = 0; cl < 32; ++cl)
-				uk += UserKey[cl];
+				uk += QChar(UserKey[cl]);
 		}
 	}
 	QDate d = QDate::currentDate();
@@ -637,7 +638,7 @@
 				{
 					if ((bb[posi] == static_cast<char>(0x80)) && (static_cast<int>(bb[posi+1]) == 2))
 						break;
-					fon += bb[posi];
+					fon += QChar(bb[posi]);
 				}
 				int len1 = fon.length();
 				uint ulen;
@@ -649,7 +650,7 @@
 					ulen = bb.size()-7;
 				posi += 6;
 				for (uint j = 0; j < ulen; ++j)
-					fon += bb[posi++];
+					fon += QChar(bb[posi++]);
 				posi += 6;
 				int len2 = fon.length()-len1;
 				for (uint j = posi; j < bb.size(); ++j)
@@ -659,7 +660,7 @@
 					if (bb[j] == '\r')
 						fon += "\n";
 					else
-						fon += bb[j];
+						fon += QChar(bb[j]);
 				}

 				int len3 = fon.length()-len2-len1;
 				if ((Options->Compress) && (CompAvail))
@@ -719,7 +720,7 @@
 				AllFonts[it.key()]->RawData(bb);
 				//AV: += and append() dont't work because they stop at '\0' :-(
 				for (unsigned int i=0; i < bb.size(); i++)
-					fon += bb[i];
+					fon += QChar(bb[i]);
 				int len = fon.length();
 				if ((Options->Compress) && (CompAvail))
 					fon = CompressStr(&fon);
@@ -4142,7 +4143,7 @@
 						{
 							ts >> tc;
 							if ((tc != '\n') && (tc != '\r'))
-								tmp += tc;
+								tmp += QChar(tc);
 						}
 						if (tmp.startsWith("%%BoundingBox:"))
 						{
@@ -4879,7 +4880,7 @@
 	PutDoc("trailer\n<<\n/Size "+IToStr(XRef.count()+1)+"\n");
 	QString IDs ="";
 	for (uint cl = 0; cl < 16; ++cl)
-		IDs += FileID[cl];
+		IDs += QChar(FileID[cl]);
 	IDs = String2Hex(&IDs);
 	PutDoc("/Root 1 0 R\n/Info 2 0 R\n/ID [<"+IDs+"><"+IDs+">]\n");
 	if (Options->Encrypt)
pspdf_pdflib_win32compat.diff (5,045 bytes)   

2005-08-16 22:29

 

pspdf_pslib_win32compat.diff (869 bytes)   
Index: pslib.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/libpostscript/pslib.cpp,v
retrieving revision 1.24.2.83
diff -u -r1.24.2.83 pslib.cpp
--- pslib.cpp	7 Aug 2005 20:04:02 -0000	1.24.2.83
+++ pslib.cpp	11 Aug 2005 08:53:07 -0000
@@ -24,6 +24,7 @@
 #include <qregexp.h>
 
 #include "scconfig.h"
+#include "pluginapi.h"
 
 #include "pslib.h"
 #include "scribusdoc.h"
@@ -33,7 +34,7 @@
 #include "util.h"
 #include "scfontmetrics.h"
 
-extern "C" void* Run(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf);
+extern "C" PLUGIN_API void* Run(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf);
 
 void* Run(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf)
 {

2005-08-16 22:30

 

pspdf_scimage_util_win32compat.diff (1,167 bytes)   
Index: scimage.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/scimage.cpp,v
retrieving revision 1.1.2.37
diff -u -r1.1.2.37 scimage.cpp
--- scimage.cpp	14 Aug 2005 12:04:39 -0000	1.1.2.37
+++ scimage.cpp	16 Aug 2005 20:56:49 -0000
@@ -1063,7 +1063,8 @@
 		for( int xi=0; xi < w2; ++xi )
 		{
 			u = *(s+xi);
-			ImgStr[i++] = (PDF ? ~u : u);
+			if(PDF) u = ~u;
+			ImgStr[i++] = u;
 		}
 	}
 	return ImgStr;
@@ -2636,7 +2637,8 @@
 			for( int xi=0; xi < w2; ++xi )
 			{
 				u = *(s+xi);
-				retS[i++] = (PDF ? ~u : u);
+				if(PDF) u = ~u;
+				retS[i++] = u;
 			}
 		}
 	}
Index: util.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/util.cpp,v
retrieving revision 1.52.2.111
diff -u -r1.52.2.111 util.cpp
--- util.cpp	7 Aug 2005 20:04:02 -0000	1.52.2.111
+++ util.cpp	16 Aug 2005 20:56:49 -0000
@@ -494,7 +494,7 @@
 		f.readBlock(bb.data(), f.size());
 		f.close();
 		for (uint posi = 0; posi < bb.size(); ++posi)
-			*Buffer += bb[posi];
+			*Buffer += QChar(bb[posi]);
 		ret = true;
 	}
 	else

fschmid

2005-08-17 00:03

administrator   ~0006134

Patches are applied. Peter, please test the PDF-Export intensive.

plinnell

2005-08-24 21:45

viewer   ~0006212

nothing yet to report, except PDF exports are no posing issues from what i can see

cbradney

2005-09-07 20:50

administrator   ~0006462

leaving open for mrdocs to test more

Issue History

Date Modified Username Field Change
2005-08-16 22:29 jghali New Issue
2005-08-16 22:29 jghali File Added: pspdf_pdflib_win32compat.diff
2005-08-16 22:29 jghali File Added: pspdf_pslib_win32compat.diff
2005-08-16 22:30 jghali File Added: pspdf_scimage_util_win32compat.diff
2005-08-16 22:36 jghali Relationship added child of 0000015
2005-08-16 23:37 plinnell Status new => assigned
2005-08-16 23:37 plinnell Assigned To => fschmid
2005-08-17 00:03 fschmid Status assigned => resolved
2005-08-17 00:03 fschmid Fixed in Version => 1.3.1cvs
2005-08-17 00:03 fschmid Resolution open => fixed
2005-08-17 00:03 fschmid Note Added: 0006134
2005-08-24 21:45 plinnell Note Added: 0006212
2005-09-07 20:46 cbradney Status resolved => closed
2005-09-07 20:50 cbradney Status closed => resolved
2005-09-07 20:50 cbradney Note Added: 0006462
2005-09-25 20:14 plinnell Status resolved => closed
2005-09-25 20:51 cbradney Category Internal => Win32
2014-10-08 18:38 Kunda Category Win32 => OS-Win32