1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-05-01 11:45:29 +00:00

postal/qzint: suppress some "-Wshorten-64-to-32" warnings

auspost: check z_zero_fill > 0 (pedantic)
This commit is contained in:
gitlost
2026-04-27 18:05:34 +01:00
parent 0959e273a6
commit b0b8c28380
3 changed files with 11 additions and 11 deletions

View File

@@ -139,7 +139,7 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
"Invalid character at position %d in DPID (digits only for Standard Customer Barcode)", "Invalid character at position %d in DPID (digits only for Standard Customer Barcode)",
not_all_digits); not_all_digits);
} }
if (z_zero_fill(source, length, src_buf, 8)) { if (z_zero_fill(source, length, src_buf, 8) > 0) {
source = src_buf; source = src_buf;
length = 8; length = 8;
} }
@@ -184,7 +184,7 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
"Invalid character at position %d in DPID (digits only)", i); "Invalid character at position %d in DPID (digits only)", i);
} }
/* Add leading zeros as required */ /* Add leading zeros as required */
if (z_zero_fill(source, length, src_buf, 8)) { if (z_zero_fill(source, length, src_buf, 8) > 0) {
source = src_buf; source = src_buf;
length = 8; length = 8;
} }

View File

@@ -154,7 +154,7 @@ INTERNAL int zint_postnet(struct zint_symbol *symbol, unsigned char source[], in
/* Stop character */ /* Stop character */
*d++ = ascender; *d++ = ascender;
h = d - dest; h = (unsigned int) (d - dest);
for (loopey = 0, writer = 0; loopey < h; loopey++, writer += 2) { for (loopey = 0, writer = 0; loopey < h; loopey++, writer += 2) {
if (dest[loopey] == ascender) { if (dest[loopey] == ascender) {
z_set_module(symbol, 0, writer); z_set_module(symbol, 0, writer);
@@ -390,7 +390,7 @@ static int rm4scc_enc(struct zint_symbol *symbol, const int *const posns, char *
/* Stop character */ /* Stop character */
*d++ = 0; /* Full */ *d++ = 0; /* Full */
*p_dest_len = d - dest; *p_dest_len = (int) (d - dest);
return KRSET[check_digit]; return KRSET[check_digit];
} }

View File

@@ -98,9 +98,9 @@ namespace Zint {
QColor color; QColor color;
int r, g, b, a; int r, g, b, a;
if (text.contains(',')) { if (text.contains(',')) {
int comma1 = text.indexOf(','); qsizetype comma1 = text.indexOf(',');
int comma2 = text.indexOf(',', comma1 + 1); qsizetype comma2 = text.indexOf(',', comma1 + 1);
int comma3 = text.indexOf(',', comma2 + 1); qsizetype comma3 = text.indexOf(',', comma2 + 1);
int black = 100 - text.mid(comma3 + 1).toInt(); int black = 100 - text.mid(comma3 + 1).toInt();
int val = 100 - text.mid(0, comma1).toInt(); int val = 100 - text.mid(0, comma1).toInt();
r = (int) roundf((0xFF * val * black) / 10000.0f); r = (int) roundf((0xFF * val * black) / 10000.0f);
@@ -302,7 +302,7 @@ namespace Zint {
QByteArray bstr = m_text.toUtf8(); QByteArray bstr = m_text.toUtf8();
/* Note do our own rotation */ /* Note do our own rotation */
m_error = ZBarcode_Encode_and_Buffer_Vector(m_zintSymbol, (unsigned char *) bstr.data(), m_error = ZBarcode_Encode_and_Buffer_Vector(m_zintSymbol, (unsigned char *) bstr.data(),
bstr.length(), 0); (int) bstr.length(), 0);
} else { } else {
struct zint_seg segs[maxSegs]; struct zint_seg segs[maxSegs];
std::vector<QByteArray> bstrs; std::vector<QByteArray> bstrs;
@@ -960,7 +960,7 @@ namespace Zint {
cpy_bytearray_left(m_zintSymbol->outfile, filename.toUtf8(), ARRAY_SIZE(m_zintSymbol->outfile) - 1); cpy_bytearray_left(m_zintSymbol->outfile, filename.toUtf8(), ARRAY_SIZE(m_zintSymbol->outfile) - 1);
if (m_segs.empty()) { if (m_segs.empty()) {
QByteArray bstr = m_text.toUtf8(); QByteArray bstr = m_text.toUtf8();
m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), bstr.length(), m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), (int) bstr.length(),
m_rotate_angle); m_rotate_angle);
} else { } else {
struct zint_seg segs[maxSegs]; struct zint_seg segs[maxSegs];
@@ -985,7 +985,7 @@ namespace Zint {
cpy_bytearray_left(m_zintSymbol->outfile, filename.toUtf8(), ARRAY_SIZE(m_zintSymbol->outfile) - 1); cpy_bytearray_left(m_zintSymbol->outfile, filename.toUtf8(), ARRAY_SIZE(m_zintSymbol->outfile) - 1);
if (m_segs.empty()) { if (m_segs.empty()) {
QByteArray bstr = m_text.toUtf8(); QByteArray bstr = m_text.toUtf8();
m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), bstr.length(), m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), (int) bstr.length(),
m_rotate_angle); m_rotate_angle);
} else { } else {
struct zint_seg segs[maxSegs]; struct zint_seg segs[maxSegs];
@@ -1044,7 +1044,7 @@ namespace Zint {
segs[i].eci = m_segs[i].m_eci; segs[i].eci = m_segs[i].m_eci;
bstrs.push_back(m_segs[i].m_text.toUtf8()); bstrs.push_back(m_segs[i].m_text.toUtf8());
segs[i].source = (unsigned char *) bstrs.back().data(); segs[i].source = (unsigned char *) bstrs.back().data();
segs[i].length = bstrs.back().length(); segs[i].length = (int) bstrs.back().length();
} }
return i; return i;
} }