mirror of
https://git.code.sf.net/p/zint/code
synced 2026-06-10 07:33:43 +00:00
GUI: suppress some more "-Wshorten-64-to-32" warnings (qt5/6 diff)
AZTEC: better assert BWIPP: latest
This commit is contained in:
+1
-1
@@ -489,7 +489,7 @@ static void az_state_free(struct az_state *state) {
|
||||
|
||||
/* Check that there's enough room for `extra` more tokens in `state` */
|
||||
static int az_tokens_add_chk(struct az_state *state, const int extra) {
|
||||
assert(extra < AZ_MIN_TOKENS_SIZE);
|
||||
assert(extra > 0 && extra < AZ_MIN_TOKENS_SIZE);
|
||||
if (!state->tokens.tokens) {
|
||||
const unsigned short size = AZ_MIN_TOKENS_SIZE;
|
||||
if (!(state->tokens.tokens = (struct az_token *) malloc(sizeof(struct az_token) * size))) {
|
||||
|
||||
Binary file not shown.
@@ -43,6 +43,12 @@
|
||||
#define QSL QStringLiteral
|
||||
#define QSEmpty QLatin1String("")
|
||||
|
||||
#if QT_VERSION < 0x60000
|
||||
#define QZINT_SIZETYPE int
|
||||
#else
|
||||
#define QZINT_SIZETYPE qsizetype
|
||||
#endif
|
||||
|
||||
namespace Zint {
|
||||
static const int maxSegs = 256;
|
||||
static const int maxCLISegs = 10; /* CLI restricted to 10 segments (including main data) */
|
||||
@@ -98,9 +104,9 @@ namespace Zint {
|
||||
QColor color;
|
||||
int r, g, b, a;
|
||||
if (text.contains(',')) {
|
||||
qsizetype comma1 = text.indexOf(',');
|
||||
qsizetype comma2 = text.indexOf(',', comma1 + 1);
|
||||
qsizetype comma3 = text.indexOf(',', comma2 + 1);
|
||||
QZINT_SIZETYPE comma1 = text.indexOf(',');
|
||||
QZINT_SIZETYPE comma2 = text.indexOf(',', comma1 + 1);
|
||||
QZINT_SIZETYPE comma3 = text.indexOf(',', comma2 + 1);
|
||||
int black = 100 - text.mid(comma3 + 1).toInt();
|
||||
int val = 100 - text.mid(0, comma1).toInt();
|
||||
r = (int) roundf((0xFF * val * black) / 10000.0f);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -31,6 +31,12 @@
|
||||
// Shorthand
|
||||
#define QSL QStringLiteral
|
||||
|
||||
#if QT_VERSION < 0x60000
|
||||
#define QZINT_SIZETYPE int
|
||||
#else
|
||||
#define QZINT_SIZETYPE qsizetype
|
||||
#endif
|
||||
|
||||
static const int tempMessageTimeout = 2000;
|
||||
|
||||
DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid(false), Escaped(false),
|
||||
@@ -56,7 +62,7 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
|
||||
// Substitute escaped Line Feeds with actual Line Feeds
|
||||
QString out;
|
||||
out.reserve(input.length());
|
||||
int lastPosn = 0;
|
||||
QZINT_SIZETYPE lastPosn = 0;
|
||||
QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfreGR\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}"
|
||||
"|U[0-9A-Fa-f]{6})"));
|
||||
QRegularExpressionMatchIterator matchI = escRE.globalMatch(input);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -31,6 +31,12 @@
|
||||
#define QSL QStringLiteral
|
||||
#define QSEmpty QLatin1String("")
|
||||
|
||||
#if QT_VERSION < 0x60000
|
||||
#define QZINT_SIZETYPE int
|
||||
#else
|
||||
#define QZINT_SIZETYPE qsizetype
|
||||
#endif
|
||||
|
||||
ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
|
||||
: m_bc(bc), m_output_data(output_data), m_lines(0)
|
||||
{
|
||||
@@ -66,7 +72,7 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data)
|
||||
connect(btnDestPath, SIGNAL(clicked(bool)), SLOT(get_directory()));
|
||||
|
||||
m_dataList = m_output_data.split('\n');
|
||||
m_lines = m_dataList.size();
|
||||
m_lines = (int) m_dataList.size();
|
||||
if (m_lines && m_dataList[m_lines - 1].isEmpty()) {
|
||||
m_lines--;
|
||||
}
|
||||
@@ -131,7 +137,7 @@ void ExportWindow::process()
|
||||
}
|
||||
|
||||
QString suffix;
|
||||
int suffixIdx = cmbFileType->currentText().lastIndexOf(QSL("(*."));
|
||||
QZINT_SIZETYPE suffixIdx = cmbFileType->currentText().lastIndexOf(QSL("(*."));
|
||||
if (suffixIdx == -1) {
|
||||
suffix = m_bc->bc.noPng() ? QSL(".gif") : QSL(".png");
|
||||
} else {
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
#define QSL QStringLiteral
|
||||
#define QSEmpty QLatin1String("")
|
||||
|
||||
#if QT_VERSION < 0x60000
|
||||
#define QZINT_SIZETYPE int
|
||||
#else
|
||||
#define QZINT_SIZETYPE qsizetype
|
||||
#endif
|
||||
|
||||
static const int tempMessageTimeout = 2000;
|
||||
|
||||
// Use on Windows also (i.e. not using QKeySequence::Quit)
|
||||
@@ -90,9 +96,9 @@ static QColor str_to_qcolor(const QString &str)
|
||||
QColor color;
|
||||
int r, g, b, a;
|
||||
if (str.contains(',')) {
|
||||
int comma1 = str.indexOf(',');
|
||||
int comma2 = str.indexOf(',', comma1 + 1);
|
||||
int comma3 = str.indexOf(',', comma2 + 1);
|
||||
QZINT_SIZETYPE comma1 = str.indexOf(',');
|
||||
QZINT_SIZETYPE comma2 = str.indexOf(',', comma1 + 1);
|
||||
QZINT_SIZETYPE comma3 = str.indexOf(',', comma2 + 1);
|
||||
int black = 100 - str.mid(comma3 + 1).toInt();
|
||||
int val = 100 - str.mid(0, comma1).toInt();
|
||||
r = (int) roundf((0xFF * val * black) / 10000.0f);
|
||||
@@ -204,13 +210,13 @@ static const struct bstyle_item bstyle_items[] = {
|
||||
void MainWindow::mac_hack_vLayouts(QWidget *win)
|
||||
{
|
||||
QList<QVBoxLayout *> vlayouts = win->findChildren<QVBoxLayout *>();
|
||||
for (int i = 0, vcnt = vlayouts.size(); i < vcnt; i++) {
|
||||
for (int i = 0, vcnt = (int) vlayouts.size(); i < vcnt; i++) {
|
||||
if (vlayouts[i]->objectName() == "vLayoutData" || vlayouts[i]->objectName() == "vLayoutComposite"
|
||||
|| vlayouts[i]->objectName() == "vLayoutSegs") {
|
||||
vlayouts[i]->setSpacing(2);
|
||||
// If set spacing on QVBoxLayout then it seems its QHBoxLayout children inherit this so undo
|
||||
QList<QHBoxLayout *> hlayouts = vlayouts[i]->findChildren<QHBoxLayout *>();
|
||||
for (int j = 0, hcnt = hlayouts.size(); j < hcnt; j++) {
|
||||
for (int j = 0, hcnt = (int) hlayouts.size(); j < hcnt; j++) {
|
||||
hlayouts[j]->setSpacing(8);
|
||||
}
|
||||
}
|
||||
@@ -223,7 +229,7 @@ void MainWindow::mac_hack_statusBars(QWidget *win, const char* name)
|
||||
QList<QStatusBar *> sbars = name ? win->findChildren<QStatusBar *>(name) : win->findChildren<QStatusBar *>();
|
||||
QColor bgColor = QGuiApplication::palette().window().color();
|
||||
QString sbarSS = QSL("QStatusBar {background-color:") + bgColor.name() + QSL(";}");
|
||||
for (int i = 0, cnt = sbars.size(); i < cnt; i++) {
|
||||
for (int i = 0, cnt = (int) sbars.size(); i < cnt; i++) {
|
||||
sbars[i]->setStyleSheet(sbarSS);
|
||||
}
|
||||
}
|
||||
@@ -751,7 +757,7 @@ bool MainWindow::save()
|
||||
}
|
||||
|
||||
QString nativePathname = QDir::toNativeSeparators(pathname);
|
||||
int lastSeparator = nativePathname.lastIndexOf(QDir::separator());
|
||||
QZINT_SIZETYPE lastSeparator = nativePathname.lastIndexOf(QDir::separator());
|
||||
QString dirname = nativePathname.mid(0, lastSeparator);
|
||||
if (dirname.isEmpty()) {
|
||||
/*: %1 is path saved to */
|
||||
@@ -1447,13 +1453,13 @@ void MainWindow::filter_symbologies()
|
||||
/* QString::split() only introduced Qt 5.14, so too new for us to use */
|
||||
QStringList filter_list;
|
||||
if (!filter.isEmpty()) {
|
||||
int i, j;
|
||||
QZINT_SIZETYPE i, j;
|
||||
for (i = 0; (j = filter.indexOf(' ', i)) != -1; i = j + 1) {
|
||||
filter_list << filter.mid(i, j - i);
|
||||
}
|
||||
filter_list << filter.mid(i);
|
||||
}
|
||||
int filter_cnt = filter_list.size();
|
||||
int filter_cnt = (int) filter_list.size();
|
||||
int cnt = ARRAY_SIZE(bstyle_items);
|
||||
|
||||
if (filter_cnt) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Zint Barcode Generator - the open source barcode generator
|
||||
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -91,8 +91,8 @@ QString SequenceWindow::apply_format(const QString& raw_number)
|
||||
QChar format_qchar;
|
||||
|
||||
format = linSeqFormat->text();
|
||||
input_len = raw_number.length();
|
||||
format_len = format.length();
|
||||
input_len = (int) raw_number.length();
|
||||
format_len = (int) format.length();
|
||||
|
||||
inpos = input_len;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user