r16956 by jghali - #10355: Reading of the PS part size and length from an EPSF is broken
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 5 01:33:05 UTC 2011
Author: jghali
Date: Sat Nov 5 01:33:05 2011
New Revision: 16956
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16956
Log:
#10355: Reading of the PS part size and length from an EPSF is broken
Modified:
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/scimgdataloader_ps.cpp
trunk/Scribus/scribus/util_math.cpp
trunk/Scribus/scribus/util_math.h
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16956&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Sat Nov 5 01:33:05 2011
@@ -1056,11 +1056,11 @@
{
PutStream("currentfile 1 (%ENDEPSDATA) /SubFileDecode filter /ReusableStreamDecode filter\n");
PutStream("%%BeginDocument: " + fi.fileName() + "\n");
- if (getDouble(QString(tmp.mid(0, 4)), true) == 0xC5D0D3C6)
+ if (getDouble(tmp.mid(0, 4), true) == 0xC5D0D3C6)
{
char* data = tmp.data();
- uint startPos = getDouble(QString(tmp.mid(4, 4)), false);
- uint length = getDouble(QString(tmp.mid(8, 4)), false);
+ uint startPos = getDouble(tmp.mid(4, 4), false);
+ uint length = getDouble(tmp.mid(8, 4), false);
PutStream(data+startPos, length, false);
}
else
@@ -1150,7 +1150,7 @@
else
{
PutStream("%%BeginDocument: " + fi.fileName() + "\n");
- if (getDouble(QString(tmp.mid(0, 4)), true) == 0xC5D0D3C6)
+ if (getDouble(tmp.mid(0, 4), true) == 0xC5D0D3C6)
{
char* data = tmp.data();
uint startPos = getDouble(tmp.mid(4, 4), false);
Modified: trunk/Scribus/scribus/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16956&path=/trunk/Scribus/scribus/scimgdataloader_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/scimgdataloader_ps.cpp (original)
+++ trunk/Scribus/scribus/scimgdataloader_ps.cpp Sat Nov 5 01:33:05 2011
@@ -148,7 +148,7 @@
{
QByteArray tempBuf(9, ' ');
f.read(tempBuf.data(), 8);
- if (getDouble(QString(tempBuf.mid(0, 4)), true) == 0xC5D0D3C6)
+ if (getDouble(tempBuf.mid(0, 4), true) == 0xC5D0D3C6)
{
startPos = getDouble(tempBuf.mid(4, 4), false);
if (doThumbnail)
Modified: trunk/Scribus/scribus/util_math.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16956&path=/trunk/Scribus/scribus/util_math.cpp
==============================================================================
--- trunk/Scribus/scribus/util_math.cpp (original)
+++ trunk/Scribus/scribus/util_math.cpp Sat Nov 5 01:33:05 2011
@@ -31,7 +31,7 @@
-uint getDouble(QString in, bool raw)
+uint getDouble(const QByteArray in, bool raw)
{
QByteArray bb(4, ' ');
if (raw)
@@ -41,10 +41,10 @@
bb[2] = static_cast<uchar>(QChar(in.at(1)));
bb[1] = static_cast<uchar>(QChar(in.at(2)));
bb[0] = static_cast<uchar>(QChar(in.at(3)));*/
- bb = bb.insert(3, in.at(0));
- bb = bb.insert(2, in.at(1));
- bb = bb.insert(1, in.at(2));
- bb = bb.insert(0, in.at(3));
+ bb[3] = in.at(0);
+ bb[2] = in.at(1);
+ bb[1] = in.at(2);
+ bb[0] = in.at(3);
}
else
{
@@ -53,10 +53,10 @@
// bb[1] = static_cast<uchar>(QChar(in.at(1)));
// bb[2] = static_cast<uchar>(QChar(in.at(2)));
// bb[3] = static_cast<uchar>(QChar(in.at(3)));
- bb = bb.insert(0, in.at(0));
- bb = bb.insert(1, in.at(1));
- bb = bb.insert(2, in.at(2));
- bb = bb.insert(3, in.at(3));
+ bb[0] = in.at(0);
+ bb[1] = in.at(1);
+ bb[2] = in.at(2);
+ bb[3] = in.at(3);
}
uint ret;
ret = bb[0] & 0xff;
Modified: trunk/Scribus/scribus/util_math.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16956&path=/trunk/Scribus/scribus/util_math.h
==============================================================================
--- trunk/Scribus/scribus/util_math.h (original)
+++ trunk/Scribus/scribus/util_math.h Sat Nov 5 01:33:05 2011
@@ -13,7 +13,7 @@
#include <cmath>
#include <vector>
-#include <QString>
+#include <QByteArray>
#include <QPolygon>
#include <QList>
#include <QPainterPath>
@@ -36,7 +36,7 @@
QList<QPainterPath> SCRIBUS_API decomposePath(QPainterPath &path);
QPainterPath SCRIBUS_API RegularPolygonPath(double w, double h, uint c, bool star, double factor, double rota, double factor2 = 0.0, double innerRot = 0.0, double factor3 = 0.0);
QPainterPath SCRIBUS_API SpiralPath(double spiralWidth, double spiralHeight, double spiralStartAngle, double spiralEndAngle, double spiralFactor);
-uint SCRIBUS_API getDouble(QString in, bool raw);
+uint SCRIBUS_API getDouble(const QByteArray in, bool raw);
inline double SCRIBUS_API sind(double);
inline double SCRIBUS_API cosd(double);
inline double SCRIBUS_API square(double);
More information about the scribus-commit
mailing list