CMake: check for getopt_long_only() instead of just getopt()

so behaviour of CLI same
general: AIX compat, suppress some warnings
This commit is contained in:
gitlost 2024-01-17 21:55:11 +00:00
parent bead450f38
commit 1449866d18
9 changed files with 34 additions and 34 deletions

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -29,6 +29,8 @@
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include <limits.h>
#include "testcommon.h"
#include "../large.h"
@ -43,7 +45,7 @@
# elif defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wformat" /* Unfortunately doesn't seem to be way to only avoid non-ISO warnings */
# endif
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(__OpenBSD__) || __WORDSIZE == 32
#elif (defined(__WORDSIZE) && __WORDSIZE == 32) || (defined(ULONG_MAX) && ULONG_MAX <= 0xFFFFFFFF)
# define LX_FMT "ll"
#else
# define LX_FMT "l"

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -945,19 +945,18 @@ static void test_encode_file_unreadable(const testCtx *const p_ctx) {
/* #181 Nico Gunkel OSS-Fuzz (buffer not freed on fread() error) Note: unable to reproduce fread() error using this method */
static void test_encode_file_directory(const testCtx *const p_ctx) {
#ifndef __NetBSD__
int ret;
struct zint_symbol *symbol;
char dirname[] = "in_dir";
#endif
(void)p_ctx;
testStart("test_encode_file_directory");
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(_AIX)
/* Reading a directory works on NetBSD, and get `code128()` ZINT_ERROR_TOO_LONG instead */
testSkip("Test not implemented on NetBSD");
(void)ret; (void)symbol; (void)dirname;
testSkip("Test not implemented on NetBSD or AIX");
#else
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1590,7 +1590,7 @@ int testUtilCmpPngs(const char *png1, const char *png2) {
int width1, height1, width2, height2;
png_byte color_type1, color_type2;
png_byte bit_depth1, bit_depth2;
png_bytep row1 = NULL, row2 = NULL;
png_bytep row1, row2;
size_t rowbytes1, rowbytes2;
int r;
@ -1634,6 +1634,7 @@ int testUtilCmpPngs(const char *png1, const char *png2) {
return 7;
}
row1 = row2 = NULL; /* Init here to avoid potential "clobbered" warning */
if (setjmp(png_jmpbuf(png_ptr1))) {
if (row1) {
free(row1);
@ -4007,12 +4008,12 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
int maxi_len = 0;
if (symbol->option_2 >= 1 && symbol->option_2 <= 100) {
/* Suppress gcc warning null destination pointer [-Wformat-overflow=] false-positive */
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow="
#endif
sprintf(maxi, "[)>\03601\035%02d", symbol->option_2 - 1);
#if defined(__GNUC__) && !defined(__clang__)
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
maxi_len = (int) strlen(maxi);