r16955 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:31:51 UTC 2011
Author: jghali
Date: Sat Nov 5 01:31:51 2011
New Revision: 16955
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16955
Log:
#10355: Reading of the PS part size and length from an EPSF is broken
Modified:
branches/Version135/Scribus/scribus/pslib.cpp
branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
branches/Version135/Scribus/scribus/util_math.cpp
branches/Version135/Scribus/scribus/util_math.h
Modified: branches/Version135/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16955&path=/branches/Version135/Scribus/scribus/pslib.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pslib.cpp (original)
+++ branches/Version135/Scribus/scribus/pslib.cpp Sat Nov 5 01:31:51 2011
@@ -1443,11 +1443,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
@@ -1528,7 +1528,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: branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16955&path=/branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp (original)
+++ branches/Version135/Scribus/scribus/scimgdataloader_ps.cpp Sat Nov 5 01:31:51 2011
@@ -147,7 +147,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: branches/Version135/Scribus/scribus/util_math.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16955&path=/branches/Version135/Scribus/scribus/util_math.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/util_math.cpp (original)
+++ branches/Version135/Scribus/scribus/util_math.cpp Sat Nov 5 01:31:51 2011
@@ -30,7 +30,7 @@
-uint getDouble(QString in, bool raw)
+uint getDouble(const QByteArray in, bool raw)
{
QByteArray bb(4, ' ');
if (raw)
@@ -40,10 +40,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
{
@@ -52,10 +52,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: branches/Version135/Scribus/scribus/util_math.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16955&path=/branches/Version135/Scribus/scribus/util_math.h
==============================================================================
--- branches/Version135/Scribus/scribus/util_math.h (original)
+++ branches/Version135/Scribus/scribus/util_math.h Sat Nov 5 01:31:51 2011
@@ -13,7 +13,7 @@
#include <cmath>
#include <vector>
-#include <QString>
+#include <QByteArray>
#include <QPolygon>
#include <QList>
#include <QPainterPath>
@@ -35,7 +35,7 @@
QPolygon SCRIBUS_API FlattenPath(const FPointArray& ina, QList<uint> &Segs);
QList<QPainterPath> SCRIBUS_API decomposePath(QPainterPath &path);
QPainterPath SCRIBUS_API RegularPolygon(double w, double h, uint c, bool star, double factor, double rota, double factor2 = 0.0);
-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