QPdf: consolidate usage of uint
Objects in QPdf are indexed by uint. In a couple of places (incl. QFontSubset) int were used instead, causing sign conversion warnings (turned into errors by -Werror). Use uint instead. Change-Id: Ie0436c8aff3b67d8ef95a5f26fc16403e7e02bd1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
c554f9ef0a
commit
8ff197cd11
@ -784,7 +784,7 @@ QPdfPage::QPdfPage()
|
||||
{
|
||||
}
|
||||
|
||||
void QPdfPage::streamImage(int w, int h, int object)
|
||||
void QPdfPage::streamImage(int w, int h, uint object)
|
||||
{
|
||||
*this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n";
|
||||
if (!images.contains(object))
|
||||
@ -2714,7 +2714,7 @@ int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
|
||||
{
|
||||
if (brushAlpha == 255 && penAlpha == 255)
|
||||
return 0;
|
||||
int object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0);
|
||||
uint object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0);
|
||||
if (!object) {
|
||||
object = addXrefEntry(-1);
|
||||
QByteArray alphaDef;
|
||||
|
@ -86,6 +86,7 @@ namespace QPdf {
|
||||
ByteStream &operator <<(const ByteStream &src);
|
||||
ByteStream &operator <<(qreal val);
|
||||
ByteStream &operator <<(int val);
|
||||
ByteStream &operator <<(uint val) { return (*this << int(val)); }
|
||||
ByteStream &operator <<(qint64 val) { return (*this << int(val)); }
|
||||
ByteStream &operator <<(const QPointF &p);
|
||||
// Note that the stream may be invalidated by calls that insert data.
|
||||
@ -154,7 +155,7 @@ public:
|
||||
QList<uint> fonts;
|
||||
QList<uint> annotations;
|
||||
|
||||
void streamImage(int w, int h, int object);
|
||||
void streamImage(int w, int h, uint object);
|
||||
|
||||
QSize pageSize;
|
||||
private:
|
||||
|
@ -201,7 +201,7 @@ QList<int> QFontSubset::getReverseMap() const
|
||||
{
|
||||
QList<int> reverseMap(0x10000, 0);
|
||||
for (uint uc = 0; uc < 0x10000; ++uc) {
|
||||
int idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
|
||||
auto idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
|
||||
if (idx >= 0 && !reverseMap.at(idx))
|
||||
reverseMap[idx] = uc;
|
||||
}
|
||||
@ -300,14 +300,14 @@ QByteArray QFontSubset::createToUnicodeMap() const
|
||||
return touc;
|
||||
}
|
||||
|
||||
int QFontSubset::addGlyph(int index)
|
||||
int QFontSubset::addGlyph(uint index)
|
||||
{
|
||||
int idx = glyph_indices.indexOf(index);
|
||||
qsizetype idx = glyph_indices.indexOf(index);
|
||||
if (idx < 0) {
|
||||
idx = glyph_indices.size();
|
||||
glyph_indices.append(index);
|
||||
}
|
||||
return idx;
|
||||
return (int)idx;
|
||||
}
|
||||
|
||||
#endif // QT_NO_PDF
|
||||
|
@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QFontSubset
|
||||
{
|
||||
public:
|
||||
explicit QFontSubset(QFontEngine *fe, int obj_id = 0)
|
||||
explicit QFontSubset(QFontEngine *fe, uint obj_id = 0)
|
||||
: object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false)
|
||||
{
|
||||
fontEngine->ref.ref();
|
||||
@ -81,12 +81,12 @@ public:
|
||||
|
||||
static QByteArray glyphName(unsigned short unicode, bool symbol);
|
||||
|
||||
int addGlyph(int index);
|
||||
int addGlyph(uint index);
|
||||
#endif
|
||||
const int object_id;
|
||||
const uint object_id;
|
||||
bool noEmbed;
|
||||
QFontEngine *fontEngine;
|
||||
QList<int> glyph_indices;
|
||||
QList<uint> glyph_indices;
|
||||
mutable int downloaded_glyphs;
|
||||
mutable bool standard_font;
|
||||
int nGlyphs() const { return glyph_indices.size(); }
|
||||
|
Loading…
Reference in New Issue
Block a user