Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package jpegoptim for openSUSE:Factory checked in at 2023-01-25 17:43:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/jpegoptim (Old) and /work/SRC/openSUSE:Factory/.jpegoptim.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jpegoptim" Wed Jan 25 17:43:11 2023 rev:6 rq:1060792 version:1.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/jpegoptim/jpegoptim.changes 2022-10-03 13:47:41.585736304 +0200 +++ /work/SRC/openSUSE:Factory/.jpegoptim.new.32243/jpegoptim.changes 2023-01-25 17:48:34.185790190 +0100 @@ -1,0 +2,10 @@ +Sat Jan 21 09:30:24 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to v1.5.1: + * fix logging to stdout when --stdout is used *thanks to Eta + * update --treshold option accept decimal numbers as parameter + * fix crashes when processing certain broken JPEG images + * fix memory leaks + * fix (logging) output in parallel processing mode + +------------------------------------------------------------------- Old: ---- jpegoptim-1.5.0.tar.gz jpegoptim-1.5.0.tar.gz.asc New: ---- jpegoptim-1.5.1.tar.gz jpegoptim-1.5.1.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ jpegoptim.spec ++++++ --- /var/tmp/diff_new_pack.JKHONl/_old 2023-01-25 17:48:34.629792562 +0100 +++ /var/tmp/diff_new_pack.JKHONl/_new 2023-01-25 17:48:34.633792583 +0100 @@ -1,7 +1,7 @@ # # spec file for package jpegoptim # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: jpegoptim -Version: 1.5.0 +Version: 1.5.1 Release: 0 Summary: Utility for Optimizing JPEG Files License: GPL-2.0-or-later ++++++ jpegoptim-1.5.0.tar.gz -> jpegoptim-1.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/.github/workflows/compile.yml new/jpegoptim-1.5.1/.github/workflows/compile.yml --- old/jpegoptim-1.5.0/.github/workflows/compile.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/jpegoptim-1.5.1/.github/workflows/compile.yml 2023-01-05 04:43:58.000000000 +0100 @@ -0,0 +1,47 @@ +name: compile +on: [push, workflow_dispatch] + +jobs: + job: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: windows-latest + triplet: x64-windows + - os: ubuntu-latest + triplet: x64-linux + - os: macos-latest + triplet: x64-osx + steps: + - uses: actions/checkout@v3 + + # Install CMake + - uses: lukka/get-cmake@v3.24.2 # CMake 3.24.2, Ninja 1.11.1 + # Install NASM + - uses: ilammy/setup-nasm@v1 + # Launch the MSVC Tools Command Prompt (Windows) + - uses: ilammy/msvc-dev-cmd@v1 + + # Initialize the CMake directory and build + - name: Build + run: | + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_NO_SUBFOLDERS=1 + cmake --build build --config Release + + # Gather documentation and executables to a common directory + # Ignore copying errors from only one of build/jpegoptim or build/jpegoptim.exe existing + - name: Prepare files + run: | + mkdir build/dist + cp build/jpegoptim build/jpegoptim.exe COPYRIGHT LICENSE README build/dist/ 2>/dev/null || true + shell: bash + + # Upload the compiled binary + - uses: actions/upload-artifact@v3 + with: + name: jpegoptim-${{ matrix.triplet }} + path: build/dist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/CMake/Default.cmake new/jpegoptim-1.5.1/CMake/Default.cmake --- old/jpegoptim-1.5.0/CMake/Default.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/jpegoptim-1.5.1/CMake/Default.cmake 2023-01-05 04:43:58.000000000 +0100 @@ -0,0 +1,65 @@ +################################################################################ +# Command for variable_watch. This command issues error message, if a variable +# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens +# variable_watch(<variable> property_reader_guard) +################################################################################ +function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) + if("${PROPERTY_READER_GUARD_DISABLED}") + return() + endif() + + if("${ACCESS}" STREQUAL "MODIFIED_ACCESS") + message(FATAL_ERROR + " Variable ${VARIABLE} is not supposed to be changed.\n" + " It is used only for reading target property ${VARIABLE}.\n" + " Use\n" + " set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}\" \"<value>\")\n" + " or\n" + " set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}_<CONFIG>\" \"<value>\")\n" + " instead.\n") + endif() +endfunction() + +################################################################################ +# Create variable <name> with generator expression that expands to value of +# target property <name>_<CONFIG>. If property is empty or not set then property +# <name> is used instead. Variable <name> has watcher property_reader_guard that +# doesn't allow to edit it. +# create_property_reader(<name>) +# Input: +# name - Name of watched property and output variable +################################################################################ +function(create_property_reader NAME) + set(PROPERTY_READER_GUARD_DISABLED TRUE) + set(CONFIG_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}_$<UPPER_CASE:$<CONFIG>>>>") + set(IS_CONFIG_VALUE_EMPTY "$<STREQUAL:${CONFIG_VALUE},>") + set(GENERAL_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}>>") + set("${NAME}" "$<IF:${IS_CONFIG_VALUE_EMPTY},${GENERAL_VALUE},${CONFIG_VALUE}>" PARENT_SCOPE) + variable_watch("${NAME}" property_reader_guard) +endfunction() + +################################################################################ +# Set property $<name>_${PROPS_CONFIG_U} of ${PROPS_TARGET} to <value> +# set_config_specific_property(<name> <value>) +# Input: +# name - Prefix of property name +# value - New value +################################################################################ +function(set_config_specific_property NAME VALUE) + set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") +endfunction() + +################################################################################ + +create_property_reader("TARGET_NAME") +create_property_reader("OUTPUT_DIRECTORY") + +set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") +set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") + +set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/CMake/DefaultCXX.cmake new/jpegoptim-1.5.1/CMake/DefaultCXX.cmake --- old/jpegoptim-1.5.0/CMake/DefaultCXX.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/jpegoptim-1.5.1/CMake/DefaultCXX.cmake 2023-01-05 04:43:58.000000000 +0100 @@ -0,0 +1,12 @@ +include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") + +set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$<NOT:$<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") + +if(MSVC) + create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") + create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") + + set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") + set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/CMake/Utils.cmake new/jpegoptim-1.5.1/CMake/Utils.cmake --- old/jpegoptim-1.5.0/CMake/Utils.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/jpegoptim-1.5.1/CMake/Utils.cmake 2023-01-05 04:43:58.000000000 +0100 @@ -0,0 +1,233 @@ +# utils file for projects came from visual studio solution with cmake-converter. + +################################################################################ +# Wrap each token of the command with condition +################################################################################ +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) +macro(prepare_commands) + unset(TOKEN_ROLE) + unset(COMMANDS) + foreach(TOKEN ${ARG_COMMANDS}) + if("${TOKEN}" STREQUAL "COMMAND") + set(TOKEN_ROLE "KEYWORD") + elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD") + set(TOKEN_ROLE "CONDITION") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(TOKEN_ROLE "COMMAND") + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + set(TOKEN_ROLE "ARG") + endif() + + if("${TOKEN_ROLE}" STREQUAL "KEYWORD") + list(APPEND COMMANDS "${TOKEN}") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(CONDITION ${TOKEN}) + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + list(APPEND COMMANDS "$<$<NOT:${CONDITION}>:${DUMMY}>$<${CONDITION}:${TOKEN}>") + elseif("${TOKEN_ROLE}" STREQUAL "ARG") + list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>") + endif() + endforeach() +endmacro() +cmake_policy(POP) + +################################################################################ +# Transform all the tokens to absolute paths +################################################################################ +macro(prepare_output) + unset(OUTPUT) + foreach(TOKEN ${ARG_OUTPUT}) + if(IS_ABSOLUTE ${TOKEN}) + list(APPEND OUTPUT "${TOKEN}") + else() + list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}") + endif() + endforeach() +endmacro() + +################################################################################ +# Parse add_custom_command_if args. +# +# Input: +# PRE_BUILD - Pre build event option +# PRE_LINK - Pre link event option +# POST_BUILD - Post build event option +# TARGET - Target +# OUTPUT - List of output files +# DEPENDS - List of files on which the command depends +# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND +# condition2 commannd2 args2 ...) +# Output: +# OUTPUT - Output files +# DEPENDS - Files on which the command depends +# COMMENT - Comment +# PRE_BUILD - TRUE/FALSE +# PRE_LINK - TRUE/FALSE +# POST_BUILD - TRUE/FALSE +# TARGET - Target name +# COMMANDS - Prepared commands(every token is wrapped in CONDITION) +# NAME - Unique name for custom target +# STEP - PRE_BUILD/PRE_LINK/POST_BUILD +################################################################################ +function(add_custom_command_if_parse_arguments) + cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN}) + + if(WIN32) + set(DUMMY "cd.") + elseif(UNIX) + set(DUMMY "true") + endif() + + prepare_commands() + prepare_output() + + set(DEPENDS "${ARG_DEPENDS}") + set(COMMENT "${ARG_COMMENT}") + set(PRE_BUILD "${ARG_PRE_BUILD}") + set(PRE_LINK "${ARG_PRE_LINK}") + set(POST_BUILD "${ARG_POST_BUILD}") + set(TARGET "${ARG_TARGET}") + if(PRE_BUILD) + set(STEP "PRE_BUILD") + elseif(PRE_LINK) + set(STEP "PRE_LINK") + elseif(POST_BUILD) + set(STEP "POST_BUILD") + endif() + set(NAME "${TARGET}_${STEP}") + + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) + set(DEPENDS "${DEPENDS}" PARENT_SCOPE) + set(COMMENT "${COMMENT}" PARENT_SCOPE) + set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE) + set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE) + set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE) + set(TARGET "${TARGET}" PARENT_SCOPE) + set(COMMANDS "${COMMANDS}" PARENT_SCOPE) + set(STEP "${STEP}" PARENT_SCOPE) + set(NAME "${NAME}" PARENT_SCOPE) +endfunction() + +################################################################################ +# Add conditional custom command +# +# Generating Files +# The first signature is for adding a custom command to produce an output: +# add_custom_command_if( +# <OUTPUT output1 [output2 ...]> +# <COMMANDS> +# <COMMAND condition command1 [args1...]> +# [COMMAND condition command2 [args2...]] +# [DEPENDS [depends...]] +# [COMMENT comment] +# +# Build Events +# add_custom_command_if( +# <TARGET target> +# <PRE_BUILD | PRE_LINK | POST_BUILD> +# <COMMAND condition command1 [args1...]> +# [COMMAND condition command2 [args2...]] +# [COMMENT comment] +# +# Input: +# output - Output files the command is expected to produce +# condition - Generator expression for wrapping the command +# command - Command-line(s) to execute at build time. +# args - Command`s args +# depends - Files on which the command depends +# comment - Display the given message before the commands are executed at +# build time. +# PRE_BUILD - Run before any other rules are executed within the target +# PRE_LINK - Run after sources have been compiled but before linking the +# binary +# POST_BUILD - Run after all other rules within the target have been +# executed +################################################################################ +function(add_custom_command_if) + add_custom_command_if_parse_arguments(${ARGN}) + + if(OUTPUT AND TARGET) + message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.") + endif() + + if(OUTPUT) + add_custom_command(OUTPUT ${OUTPUT} + ${COMMANDS} + DEPENDS ${DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + elseif(TARGET) + if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio") + add_custom_target( + ${NAME} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + add_dependencies(${TARGET} ${NAME}) + else() + add_custom_command( + TARGET ${TARGET} + ${STEP} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + endif() + else() + message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.") + endif() +endfunction() + +################################################################################ +# Use props file for a target and configs +# use_props(<target> <configs...> <props_file>) +# Inside <props_file> there are following variables: +# PROPS_TARGET - <target> +# PROPS_CONFIG - One of <configs...> +# PROPS_CONFIG_U - Uppercase PROPS_CONFIG +# Input: +# target - Target to apply props file +# configs - Build configurations to apply props file +# props_file - CMake script +################################################################################ +macro(use_props TARGET CONFIGS PROPS_FILE) + set(PROPS_TARGET "${TARGET}") + foreach(PROPS_CONFIG ${CONFIGS}) + string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U) + + get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + if(EXISTS "${ABSOLUTE_PROPS_FILE}") + include("${ABSOLUTE_PROPS_FILE}") + else() + message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist") + endif() + endforeach() +endmacro() + +################################################################################ +# Add compile options to source file +# source_file_compile_options(<source_file> [compile_options...]) +# Input: +# source_file - Source file +# compile_options - Options to add to COMPILE_FLAGS property +################################################################################ +function(source_file_compile_options SOURCE_FILE) + if("${ARGC}" LESS_EQUAL "1") + return() + endif() + + get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS) + + if(COMPILE_OPTIONS) + list(APPEND COMPILE_OPTIONS ${ARGN}) + else() + set(COMPILE_OPTIONS "${ARGN}") + endif() + + set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}") +endfunction() + +################################################################################ +# Default properties of visual studio projects +################################################################################ +set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/CMakeLists.txt new/jpegoptim-1.5.1/CMakeLists.txt --- old/jpegoptim-1.5.0/CMakeLists.txt 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/CMakeLists.txt 2023-01-05 04:43:58.000000000 +0100 @@ -1,19 +1,449 @@ -cmake_minimum_required(VERSION 2.8) -project(jpegoptim) +cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) -#Dependency on libJPEG. -set(LIBJPEG_INCLUDE_DIR "" CACHE PATH "Path to directory containing header files of libJPEG (e.g. jpeglib.h).") -set(LIBJPEG_LIBRARY_DIR "" CACHE FILEPATH "Path to static library file of libJPEG (e.g. libjpeg.a).") -include_directories(${LIBJPEG_INCLUDE_DIR}) -add_library(libjpeg STATIC IMPORTED) -set_target_properties(libjpeg PROPERTIES IMPORTED_LOCATION ${LIBJPEG_LIBRARY_DIR}) - -#Source files. -file(GLOB jpegoptim_SRC "*.c") #Adds all .c files in the source directory. - -#Header files. -include_directories("${PROJECT_SOURCE_DIR}") #Adds all .h files in the source directory. - -#Build the binary! -add_executable(jpegoptim ${jpegoptim_SRC}) -target_link_libraries(jpegoptim libjpeg) \ No newline at end of file +project(jpegoptim C) + +# LIBJPEG_INCLUDE_DIR and LIBJPEG_LIBRARY must both be specified if a custom libjpeg implementation is desired. +option(WITH_ARITH "Enable arithmetic coding (if supported by the libjpeg implementation)" 1) +option(USE_MOZJPEG "Download, build, and link with MozJPEG rather than the system libjpeg. Build with NASM installed for SIMD support." 1) +set(LIBJPEG_INCLUDE_DIR "" CACHE PATH "Custom libjpeg header directory") +set(LIBJPEG_LIBRARY "" CACHE FILEPATH "Custom libjpeg library binary") +if(MSVC) + option(BUILD_NO_SUBFOLDERS "Flatten the compiled program's output path") +endif() + +# If LIBJPEG_INCLUDE_DIR and LIBJPEG_LIBRARY are set, USE_MOZJPEG is disabled. +if(LIBJPEG_INCLUDE_DIR AND LIBJPEG_LIBRARY) + set(USE_MOZJPEG 0) +endif() + +# Set target architecture if empty. CMake's Visual Studio generator provides it, but others may not. + +if(MSVC) + if(NOT CMAKE_VS_PLATFORM_NAME) + set(CMAKE_VS_PLATFORM_NAME "x64") + endif() + message("${CMAKE_VS_PLATFORM_NAME} architecture in use") +else() + add_compile_definitions(HOST_TYPE="${CMAKE_HOST_SYSTEM_NAME}") +endif() + + +# Global configuration types + +set(CMAKE_CONFIGURATION_TYPES + "Debug" + "Release" + CACHE STRING "" FORCE +) + + +# Global compiler options + +if(MSVC) + # remove default compiler flags provided with CMake for MSVC + set(CMAKE_C_FLAGS "") + set(CMAKE_C_FLAGS_DEBUG "") + set(CMAKE_C_FLAGS_RELEASE "") +endif() + + +# Global linker options + +if(MSVC) + # remove default linker flags provided with CMake for MSVC + set(CMAKE_EXE_LINKER_FLAGS "") + set(CMAKE_MODULE_LINKER_FLAGS "") + set(CMAKE_SHARED_LINKER_FLAGS "") + set(CMAKE_STATIC_LINKER_FLAGS "") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}") +endif() + + +# Common utils + +include(CMake/Utils.cmake) + + +# Additional Global Settings (add specific info there) + +include(CMake/GlobalSettingsInclude.cmake OPTIONAL) + + +# Use solution folders feature + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + +# Source groups + +file(GLOB SOURCE_FILES *.c) +source_group("Source Files" FILES ${SOURCE_FILES}) + + +# Target + +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) + +if(MSVC) + use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) +endif() + + +# Output directory + +if(MSVC) + if(BUILD_NO_SUBFOLDERS) + set(BINARY_OUTPUT_PATH ".") + else() + set(BINARY_OUTPUT_PATH "$<CONFIG>/${CMAKE_VS_PLATFORM_NAME}") + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${BINARY_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${BINARY_OUTPUT_PATH} + ) +endif() + + +# Interprocedural optimization (LTCG) + +set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" +) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(${PROJECT_NAME} PUBLIC + -fuse-linker-plugin + ) +endif() + + +# MSVC runtime library + +if(MSVC) + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$<CONFIG:Debug>: + MultiThreadedDebug + > + $<$<CONFIG:Release>: + MultiThreaded + > + $<$<NOT:$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() + + +# Include directories + +target_include_directories(${PROJECT_NAME} PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}" +) + + +# Compile definitions + +target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$<CONFIG:Debug>:" + "_DEBUG;" + "DEBUG" + ">" + "$<$<CONFIG:Release>:" + "NDEBUG" + ">" +) + +if(MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE + "WIN32;" + "_WIN64;" + "WIN64;" + "_WINDOWS;" + "UNICODE;" + "_UNICODE" + ) +endif() + + +# Compile and link options + +if(MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE + $<$<CONFIG:Debug>: + /Od; # Disable optimization + /RTC1 # Enable stack frame run-time error checking and reporting when a variable is used without having been initialized. + > + $<$<CONFIG:Release>: + /MP; # Build with multiple processes + /O2; # Optimize for speed + /GF # Enable string pooling + > + /Gy; # Link per-function + /W3; # Warning level + /Zi; # Emit debug info in a separate PDB + /TC; # Compile all source files as C source code regardles of extension + /wd4996; # Suppress deprecation warnings + ${DEFAULT_CXX_EXCEPTION_HANDLING}; + /GS; # Enable security checks against buffer overruns + /Y- # Disable precompiled headers + ) + target_link_options(${PROJECT_NAME} PRIVATE + $<$<CONFIG:Debug>: + /INCREMENTAL # Enable incremental linking (faster builds, larger filesize) + > + $<$<CONFIG:Release>: + /OPT:REF; # Don't link unused functions + /OPT:ICF; # Remove duplicate function definitions + /INCREMENTAL:NO # Disable incremental linking + > + /MANIFEST; # Generate a manifest file + /DEBUG:FULL; # Generate debugging symbols (in a separate PDB file) + /MACHINE:${CMAKE_VS_PLATFORM_NAME}; + /SUBSYSTEM:CONSOLE; # Not a driver or GUI program + /NXCOMPAT; # Support Windows Data Execution Prevention + /DYNAMICBASE # Use address space layout randomization + ) + + # Link with setargv for command line wildcard support + # See https://learn.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments + + target_link_options(${PROJECT_NAME} PRIVATE + setargv.obj + ) +endif() + + +# Header and function checks + +include(CheckIncludeFile) +check_include_file(config.h HAVE_CONFIG_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(getopt.h HAVE_GETOPT_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(libgen.h HAVE_LIBGEN_H) +check_include_file(math.h HAVE_MATH_H) +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(dirent.h HAVE_DIRENT_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(sys/wait.h HAVE_SYS_WAIT_H) + +include(CheckSymbolExists) +check_symbol_exists(mkstemps "stdlib.h" HAVE_MKSTEMPS) +check_symbol_exists(labs "stdlib.h" HAVE_LABS) +check_symbol_exists(fileno "stdio.h" HAVE_FILENO) +check_symbol_exists(utimensat "sys/stat.h" HAVE_UTIMENSAT) +check_symbol_exists(fork "unistd.h" HAVE_FORK) +check_symbol_exists(wait "sys/wait.h" HAVE_WAIT) +check_symbol_exists(getopt "unistd.h" HAVE_GETOPT) +check_symbol_exists(getopt_long "getopt.h" HAVE_GETOPT_LONG) + +include(CheckStructHasMember) + +if(HAVE_SYS_STAT_H) + check_struct_has_member( + "struct stat" st_mtim "sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C + ) +endif() + +target_compile_definitions(${PROJECT_NAME} PRIVATE + $<$<BOOL:${HAVE_CONFIG_H}>:HAVE_CONFIG_H> + $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H> + $<$<BOOL:${HAVE_GETOPT_H}>:HAVE_GETOPT_H> + $<$<BOOL:${HAVE_STRING_H}>:HAVE_STRING_H> + $<$<BOOL:${HAVE_LIBGEN_H}>:HAVE_LIBGEN_H> + $<$<BOOL:${HAVE_MATH_H}>:HAVE_MATH_H> + $<$<BOOL:${HAVE_FCNTL_H}>:HAVE_FCNTL_H> + $<$<BOOL:${HAVE_DIRENT_H}>:HAVE_DIRENT_H> + $<$<BOOL:${HAVE_SYS_STAT_H}>:HAVE_SYS_STAT_H> + $<$<BOOL:${HAVE_SYS_TYPES_H}>:HAVE_SYS_TYPES_H> + $<$<BOOL:${HAVE_SYS_WAIT_H}>:HAVE_SYS_WAIT_H> + $<$<BOOL:${HAVE_MKSTEMPS}>:HAVE_MKSTEMPS> + $<$<BOOL:${HAVE_LABS}>:HAVE_LABS> + $<$<BOOL:${HAVE_FILENO}>:HAVE_FILENO> + $<$<BOOL:${HAVE_UTIMENSAT}>:HAVE_UTIMENSAT> + $<$<BOOL:${HAVE_FORK}>:HAVE_FORK> + $<$<BOOL:${HAVE_WAIT}>:HAVE_WAIT> + $<$<BOOL:${HAVE_GETOPT}>:HAVE_GETOPT> + $<$<BOOL:${HAVE_GETOPT_LONG}>:HAVE_GETOPT_LONG> + $<$<BOOL:${HAVE_STRUCT_STAT_ST_MTIM}>:HAVE_STRUCT_STAT_ST_MTIM> +) + + +# Attach a manifest file to support UTF-8 on compatible Windows systems (see https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) + +if(MSVC) + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND "mt.exe" -nologo -manifest \"${CMAKE_CURRENT_SOURCE_DIR}/jpegoptim.manifest\" -outputresource:"${CMAKE_CURRENT_BINARY_DIR}/${BINARY_OUTPUT_PATH}/jpegoptim.exe"\;\#1 + COMMENT "Adding manifest..." + ) +endif() + + +# Dependencies + +if(USE_MOZJPEG) + # Link with mozjpeg. + # Version tree: https://github.com/mozilla/mozjpeg/tree/fd569212597dcc249752bd38ea58a4e2072da24f + + include(ExternalProject) + + if(WITH_ARITH) + set(ARITH_FLAGS -DWITH_ARITH_DEC=1 -DWITH_ARITH_ENC=1) + set(JPEGLIB_SUPPORTS_ARITH_CODE 1) + endif() + + ExternalProject_Add(mozjpeg_lib + GIT_REPOSITORY https://github.com/mozilla/mozjpeg.git + GIT_TAG fd569212597dcc249752bd38ea58a4e2072da24f + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mozjpeg + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/mozjpeg -DPNG_SUPPORTED=0 -DWITH_TURBOJPEG=0 -DENABLE_SHARED=0 ${ARITH_FLAGS} + ) + + + # Building and linking mozjpeg as a library, as explained here https://mirkokiefer.com/cmake-by-example-f95eb47d45b1 + + ExternalProject_Get_Property(mozjpeg_lib install_dir) + add_library(mozjpeg STATIC IMPORTED) + if(MSVC) + set_property(TARGET mozjpeg PROPERTY IMPORTED_LOCATION ${install_dir}/lib/jpeg-static.lib) + else() + target_link_libraries(mozjpeg INTERFACE m) + set_property(TARGET mozjpeg PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libjpeg.a) + endif() + add_dependencies(mozjpeg mozjpeg_lib) + target_include_directories(${PROJECT_NAME} BEFORE PRIVATE ${install_dir}/include) + target_link_libraries(${PROJECT_NAME} mozjpeg) + add_dependencies(${PROJECT_NAME} mozjpeg) + + # Note: check_include_file, check_symbol_exists, check_struct_has_member, and check_c_source_compiles + # cannot be used on ExternalProject dependencies because they are not compiled until build time, while check_* + # functions run during the initial CMake configuration step. + # Since the version is hardcoded above, feature checks may be set as constants as a workaround. + + set(HAVE_JINT_DC_SCAN_OPT_MODE 1) + +else() + if(LIBJPEG_INCLUDE_DIR AND LIBJPEG_LIBRARY) + # Link with custom libjpeg + add_library(libjpeg STATIC IMPORTED) + if(NOT MSVC) + target_link_libraries(libjpeg INTERFACE m) + endif() + set_target_properties(libjpeg PROPERTIES IMPORTED_LOCATION ${LIBJPEG_LIBRARY}) + target_include_directories(${PROJECT_NAME} BEFORE PRIVATE ${LIBJPEG_INCLUDE_DIR}) + target_link_libraries(${PROJECT_NAME} libjpeg) + add_dependencies(${PROJECT_NAME} libjpeg) + else() + # Link with system libjpeg + include(FindJPEG) + if(NOT JPEG_FOUND) + message(FATAL_ERROR "Could not automatically locate libjpeg. Either specify -DUSE_MOZJPEG=1 to download and build with MozJPEG, or -DLIBJPEG_INCLUDE_DIR=... and -DLIBJPEG_LIBRARY=... to the appropriate paths to build with a custom libjpeg implementation.") + endif() + message(STATUS "Include dirs: ${JPEG_INCLUDE_DIRS}") + target_include_directories(${PROJECT_NAME} PRIVATE ${JPEG_INCLUDE_DIRS}) + target_link_libraries(${PROJECT_NAME} JPEG::JPEG) + endif() + + # Use all include directories and linked libraries as the main project for feature tests + get_target_property(CMAKE_REQUIRED_LIBRARIES ${PROJECT_NAME} LINK_LIBRARIES) + get_target_property(CMAKE_REQUIRED_INCLUDES ${PROJECT_NAME} INCLUDE_DIRECTORIES) + + # check_include_file, check_symbol_exists, and check_struct_has_member cannot be used with libjpeg.h + # because libjpeg.h requires stdio.h to be included before it to not throw an unrelated compilation error. + + include(CheckCSourceCompiles) + check_c_source_compiles( + " + #include <stdio.h> + #include <jpeglib.h> + int main(void) + { + return sizeof (&jpeg_read_header); + } + " + HAVE_APPROPRIATE_LIBJPEG_VERSION + ) + + if(NOT HAVE_APPROPRIATE_LIBJPEG_VERSION) + message(FATAL_ERROR "Invalid version: libjpeg version 6 or later is required.") + endif() + + check_c_source_compiles( + " + #include <stdio.h> + #include <jpeglib.h> + METHODDEF(void) foo(void) {}; + int main(void) + { + return 0; + } + " + WORKING_METHODDEF + ) + + if(NOT WORKING_METHODDEF) + target_compile_definitions(${PROJECT_NAME} PRIVATE -DBROKEN_METHODDEF) + endif() + + if(WITH_ARITH) + # Check for arithmetic coding support + + check_c_source_compiles( + " + #include <stdio.h> + #include <jpeglib.h> + int main(void) + { + return sizeof (((struct jpeg_compress_struct *)0)->arith_code); + } + " + JPEGLIB_SUPPORTS_ARITH_CODE + ) + endif() + + # Check for MozJPEG's JINT_DC_SCAN_OPT_MODE extension + + check_c_source_compiles( + " + #include <stdio.h> + #include <jpeglib.h> + int main(void) + { + struct jpeg_compress_struct cinfo; + if (jpeg_c_int_param_supported(&cinfo, JINT_DC_SCAN_OPT_MODE)) + jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1); + return 0; + } + " + HAVE_JINT_DC_SCAN_OPT_MODE + ) +endif() + +target_compile_definitions(${PROJECT_NAME} PRIVATE + $<$<BOOL:${HAVE_JINT_DC_SCAN_OPT_MODE}>:HAVE_JINT_DC_SCAN_OPT_MODE> +) + + +if(WITH_ARITH AND JPEGLIB_SUPPORTS_ARITH_CODE) + set(ARITH_ENABLED 1) + target_compile_definitions(${PROJECT_NAME} PRIVATE -DHAVE_ARITH_CODE) +endif() + +if(ARITH_ENABLED) + message(STATUS "Arithmetic Coding: Enabled") +else() + message(STATUS "Arithmetic Coding: Disabled") +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/Makefile.in new/jpegoptim-1.5.1/Makefile.in --- old/jpegoptim-1.5.0/Makefile.in 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/Makefile.in 2023-01-05 04:43:58.000000000 +0100 @@ -1,9 +1,9 @@ ######################################################################### -# $Id: 921fc6c96a7881e0107fbbdab6ee8c0a7ffb85fc $ +# $Id: 227a8116f9dbf1cd5be439ac209ed2384014a664 $ # # Makefile for jpegoptim # -Version = 1.4.8 +Version = 1.5.1 PKGNAME = jpegoptim SHELL = /bin/sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/README new/jpegoptim-1.5.1/README --- old/jpegoptim-1.5.0/README 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/README 2023-01-05 04:43:58.000000000 +0100 @@ -1,5 +1,5 @@ -Jpegoptim v1.5.0 - Copyright (C) Timo Kokkonen, 1996-2022. All Rights Reserved. +Jpegoptim v1.5.1 - Copyright (C) Timo Kokkonen, 1996-2023. All Rights Reserved. REQUIREMENTS @@ -9,9 +9,8 @@ TESTED PLATFORMS Linux - Solaris - Darwin/OS X j - Windows (setargv.obj "link option" may be needed for wildcards expansion to work) + MacOS + Windows (setargv.obj "link option" is needed for wildcards expansion to work) INSTALLATION @@ -19,8 +18,8 @@ tar file, make necessary changes to the Makefile, and then compile the program. You may wanna do something like this: - tar xzvf jpegoptim-1.5.0.tar.gz - cd jpegoptim-1.5.0 + tar xzvf jpegoptim-1.5.1.tar.gz + cd jpegoptim-1.5.1 ./configure make make strip @@ -28,13 +27,18 @@ HISTORY + v1.5.1 - fix logging to stdout when --stdout is used *thanks to Eta, + update --treshold option accept decimal numbers as parameter, + fix crashes when processing certain broken JPEG images, + fix memory leaks, + fix (logging) output in parallel processing mode v1.5.0 - add --workers=<max> option to enable parallel processing - fix --stding option, + fix --stdin option, other minor fixes v1.4.7 - experimental support for arithmetic coding (enable with configure option --with-arith), add option --nofix, - add suupport for JFIF Extension (JFXX) markers, + add support for JFIF Extension (JFXX) markers, support for nanosecond timestamps (thanks to GerbilSoft), optimization now works same with stdin as with standard files, fixed --size (-S) option not working correctly when processing @@ -54,7 +58,7 @@ v1.4.2 - add option -P, --preserve-perms, some minor fixes v1.4.1 - fix --stdin option (assume -f when reading from stdin), - workaround to bug in libjpeg-turboi (v1.3.1) triggered + workaround to bug in libjpeg-turbo (v1.3.1) triggered when option -V or --version was used, other minor fixes v1.4.0 - use memory (instead of temporary files) during optimization, @@ -109,14 +113,19 @@ https://github.com/tjko/jpegoptim +ACKNOWLEDGEMENT + + This software is based in part on the work of the Independent JPEG Group. + + SPONSORS Special thanks for following Github Sponsors that have supported jpegoptim: - midir99 - + Timo <t...@iki.fi> -14-Sep-2022 +04-Jan-2023 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/config.h.in new/jpegoptim-1.5.1/config.h.in --- old/jpegoptim-1.5.0/config.h.in 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/config.h.in 2023-01-05 04:43:58.000000000 +0100 @@ -1,5 +1,5 @@ /* config.h.in. - * $Id: 2da09dc617e8f2e789fb9c2dcfae17a0600e0e45 $ + * $Id: d27f30621d7576dfa51741672524466192f56241 $ * */ @@ -7,7 +7,7 @@ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS -/* The number of bytes in a int. */ +/* The number of bytes in an int. */ #undef SIZEOF_INT /* The number of bytes in a long. */ @@ -64,9 +64,12 @@ /* Define if you have the jpeg library (-ljpeg). */ #undef HAVE_LIBJPEG -/* Define if jpeg library support Arithmetic coding */ +/* Define if jpeg library supports Arithmetic coding */ #undef HAVE_ARITH_CODE +/* Define if jpeg library supports the MozJPEG extension setting JINT_DC_SCAN_OPT_MODE */ +#undef HAVE_JINT_DC_SCAN_OPT_MODE + /* Define if you have broken jmorecfg.h (SGI's usually have this problem) */ #undef BROKEN_METHODDEF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/configure.in new/jpegoptim-1.5.1/configure.in --- old/jpegoptim-1.5.0/configure.in 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/configure.in 2023-01-05 04:43:58.000000000 +0100 @@ -1,4 +1,4 @@ -dnl $Id: 6aa8d34dd63cb6e24c9aa34723062d1feb01e070 $ +dnl $Id: e641db7d9e3f6469fdad0a6ede57dbc39fbd92d8 $ dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(jpegoptim.c) @@ -122,6 +122,31 @@ echo "Arithmetic Coding: $arith_code_status" +AC_MSG_CHECKING([Extension settings in JPEG library]) +AC_CACHE_VAL(jpegoptim_cv_extension_settings, +[AC_TRY_RUN([ +#include <stdio.h> +#include <jpeglib.h> +int main(void) +{ + struct jpeg_compress_struct cinfo; + if (jpeg_c_int_param_supported(&cinfo, JINT_DC_SCAN_OPT_MODE)) + jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1); + return 0; +} +], +jpegoptim_cv_extension_settings=yes, +jpegoptim_cv_extension_settings=no, +jpegoptim_cv_extension_settings=no)]) +if test $jpegoptim_cv_extension_settings = yes; then + extension_settings_status="Present" + AC_DEFINE(HAVE_JINT_DC_SCAN_OPT_MODE) +else + extension_settings_status="Absent" +fi + +echo "Extension settings: $extension_settings_status" + AC_OUTPUT(Makefile) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/jpegoptim.c new/jpegoptim-1.5.1/jpegoptim.c --- old/jpegoptim-1.5.0/jpegoptim.c 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/jpegoptim.c 2023-01-05 04:43:58.000000000 +0100 @@ -32,7 +32,9 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#if HAVE_DIRENT_H #include <dirent.h> +#endif #if HAVE_FCNTL_H #include <fcntl.h> #endif @@ -61,8 +63,8 @@ #include "jpegoptim.h" -#define VERSIO "1.5.0" -#define COPYRIGHT "Copyright (C) 1996-2022, Timo Kokkonen" +#define VERSIO "1.5.1" +#define COPYRIGHT "Copyright (C) 1996-2023, Timo Kokkonen" #if HAVE_WAIT && HAVE_FORK #define PARALLEL_PROCESSING @@ -117,7 +119,7 @@ int save_adobe = 0; int save_jfxx = 0; int strip_none = 0; -int threshold = -1; +double threshold = -1.0; int csv = 0; int all_normal = 0; int all_progressive = 0; @@ -390,8 +392,8 @@ break; case 'T': { - int tmpvar; - if (sscanf(optarg,"%d",&tmpvar) == 1) { + double tmpvar; + if (sscanf(optarg,"%lf", &tmpvar) == 1) { threshold=tmpvar; if (threshold < 0) threshold=0; if (threshold > 100) threshold=100; @@ -402,7 +404,7 @@ case 'S': { unsigned int tmpvar; - if (sscanf(optarg,"%u",&tmpvar) == 1) { + if (sscanf(optarg,"%u", &tmpvar) == 1) { if (tmpvar > 0 && tmpvar < 100 && optarg[strlen(optarg)-1] == '%' ) { target_size=-tmpvar; @@ -555,6 +557,7 @@ int j; int oldquality, searchcount, searchdone; double ratio; + int res = -1; jpeg_log_fh = log_fh; @@ -581,7 +584,8 @@ if (filename) { if ((infile = fopen(filename, "rb")) == NULL) { warn("cannot open file: %s", filename); - return 1; + res = 1; + goto exit_point; } } else { infile = stdin; @@ -593,16 +597,13 @@ abort_decompress: jpeg_abort_decompress(&dinfo); fclose(infile); - if (inbuffer) - free(inbuffer); - if (outbuffer) - free(outbuffer); if (buf) FREE_LINE_BUF(buf,dinfo.output_height); if (!quiet_mode || csv) fprintf(log_fh,csv ? ",,,,,error\n" : " [ERROR]\n"); jderr.jump_set=0; - return 1; + res = 1; + goto exit_point; } else { jderr.jump_set=1; } @@ -613,7 +614,7 @@ } /* prepare to decompress */ - if (stdin_mode) { + if (stdin_mode || stdout_mode) { if (inbuffer) free(inbuffer); inbuffersize=65536; @@ -707,6 +708,11 @@ } } else { coef_arrays = jpeg_read_coefficients(&dinfo); + if (!coef_arrays) { + if (!quiet_mode) + fprintf(log_fh, " (failed to read coefficients) "); + goto abort_decompress; + } } inpos=ftell(infile); @@ -746,14 +752,11 @@ fclose(infile); if (!quiet_mode) fprintf(log_fh," [Compress ERROR: %s]\n",last_error); - if (inbuffer) - free(inbuffer); - if (outbuffer) - free(outbuffer); if (buf) FREE_LINE_BUF(buf,dinfo.output_height); jcerr.jump_set=0; - return 2; + res = 2; + goto exit_point; } else { jcerr.jump_set=1; } @@ -791,6 +794,10 @@ cinfo.image_height=dinfo.image_height; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo,quality,TRUE); +#ifdef HAVE_JINT_DC_SCAN_OPT_MODE + if (jpeg_c_int_param_supported(&cinfo, JINT_DC_SCAN_OPT_MODE)) + jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1); +#endif if (all_normal) { /* Explicitly disables progressive if libjpeg had it on by default */ cinfo.scan_info = NULL; @@ -804,7 +811,7 @@ cinfo.arith_code = (arith_mode > 0 ? TRUE : FALSE); #endif if (dinfo.saw_Adobe_marker && (save_adobe || strip_none)) { - /* If outputting Adobe marker, dont write JFIF marker... */ + /* If outputting Adobe marker, don't write JFIF marker... */ cinfo.write_JFIF_header = FALSE; } @@ -824,6 +831,10 @@ /* lossless "optimization" ... */ jpeg_copy_critical_parameters(&dinfo, &cinfo); +#ifdef HAVE_JINT_DC_SCAN_OPT_MODE + if (jpeg_c_int_param_supported(&cinfo, JINT_DC_SCAN_OPT_MODE)) + jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1); +#endif if (all_normal) { /* Explicitly disables progressive if libjpeg had it on by default */ cinfo.scan_info = NULL; @@ -837,7 +848,7 @@ cinfo.arith_code = (arith_mode > 0 ? TRUE : FALSE); #endif if (dinfo.saw_Adobe_marker && (save_adobe || strip_none)) { - /* If outputting Adobe marker, dont write JFIF marker... */ + /* If outputting Adobe marker, don't write JFIF marker... */ cinfo.write_JFIF_header = FALSE; } @@ -928,8 +939,10 @@ } if (!quiet_mode || csv) fprintf(log_fh,csv ? "optimized\n" : "optimized.\n"); - if (noaction) - return 0; + if (noaction) { + res = 0; + goto exit_point; + } if (stdout_mode) { outfname=NULL; @@ -1048,18 +1061,22 @@ } } + res = 0; + exit_point: if (inbuffer) free(inbuffer); if (outbuffer) free(outbuffer); + jpeg_destroy_compress(&cinfo); + jpeg_destroy_decompress(&dinfo); - return 0; + return res; } #ifdef PARALLEL_PROCESSING -int wait_for_worker() +int wait_for_worker(FILE *log_fh) { FILE *p; struct worker *w; @@ -1089,7 +1106,7 @@ if (WIFEXITED(wstatus)) { e = WEXITSTATUS(wstatus); if (verbose_mode) - fprintf(stderr, "worker[%d] [slot=%d] exited: %d\n", + fprintf(log_fh, "worker[%d] [slot=%d] exited: %d\n", pid, j, e); if (e == 0) { //average_count++; @@ -1108,7 +1125,7 @@ if (!p) fatal("fdopen failed()"); while (fgets(buf, sizeof(buf), p)) { if (verbose_mode > 2) - printf("PIPE: %s", buf); + fprintf(log_fh, "worker[%d] PIPE: %s", pid, buf); if (state == 0 && buf[0] == '\n') { state=1; continue; @@ -1133,7 +1150,7 @@ continue; } if (state == 0) - printf("%s", buf); + fprintf(log_fh, "%s", buf); } close(w->read_pipe); w->pid = -1; @@ -1155,6 +1172,7 @@ volatile int i; int res; double rate, saved; + FILE *log_fh; #ifdef PARALLEL_PROCESSING struct worker *w; int pipe_fd[2]; @@ -1176,26 +1194,26 @@ /* parse command line parameters */ parse_arguments(argc, argv, dest_path); - + log_fh = (stdout_mode ? stderr : stdout); if (verbose_mode) { - if (quality>=0 && target_size==0) - fprintf(stderr,"Image quality limit set to: %d\n", quality); - if (threshold>=0) - fprintf(stderr,"Compression threshold (%%) set to: %d\n", threshold); + if (quality >= 0 && target_size == 0) + fprintf(log_fh, "Image quality limit set to: %d\n", quality); + if (threshold >= 0) + fprintf(log_fh, "Compression threshold (%%) set to: %0.1lf\n", threshold); if (all_normal) - fprintf(stderr,"All output files will be non-progressive\n"); + fprintf(log_fh, "All output files will be non-progressive\n"); if (all_progressive) - fprintf(stderr,"All output files will be progressive\n"); + fprintf(log_fh, "All output files will be progressive\n"); if (target_size > 0) - fprintf(stderr,"Target size for output files set to: %d Kbytes.\n", + fprintf(log_fh, "Target size for output files set to: %d Kbytes.\n", target_size); if (target_size < 0) - fprintf(stderr,"Target size for output files set to: %d%%\n", + fprintf(log_fh, "Target size for output files set to: %d%%\n", -target_size); #ifdef PARALLEL_PROCESSING if (max_workers > 0) - fprintf(stderr,"Using maximum of %d parallel threads\n", max_workers); + fprintf(log_fh, "Using maximum of %d parallel threads\n", max_workers); #endif } @@ -1222,7 +1240,7 @@ if (i >= argc || filename[0] == 0) continue; if (verbose_mode > 1) - printf("processing file: %s\n", filename); + fprintf(log_fh, "processing file: %s\n", filename); if (strlen(filename) >= MAXPATHLEN) { warn("skipping too long filename: %s", filename); continue; @@ -1262,7 +1280,7 @@ if (worker_count >= max_workers) { // wait for a worker to exit... - wait_for_worker(); + wait_for_worker(log_fh); } if (pipe(pipe_fd) < 0) fatal("failed to open pipe"); @@ -1298,7 +1316,7 @@ w->read_pipe = pipe_fd[0]; worker_count++; if (verbose_mode > 0) - fprintf(stderr, "worker[%d] [slot=%d] started\n", pid, j);; + fprintf(log_fh, "worker[%d] [slot=%d] started\n", pid, j);; } } else @@ -1306,7 +1324,7 @@ { /* Single process mode, process one file at a time... */ - res = optimize(stdout, filename, newname, tmpdir, &file_stat, &rate, &saved); + res = optimize(log_fh, filename, newname, tmpdir, &file_stat, &rate, &saved); if (res == 0) { average_count++; average_rate += rate; @@ -1325,17 +1343,17 @@ /* Wait for any child processes to exit... */ if (max_workers > 1) { if (verbose_mode) { - fprintf(stderr,"Waiting for %d workers to finish...\n", worker_count); + fprintf(log_fh, "Waiting for %d workers to finish...\n", worker_count); } - while ((pid = wait_for_worker()) > 0) { + while ((pid = wait_for_worker(log_fh)) > 0) { if (verbose_mode > 2) - fprintf(stderr, "worker[%d] done\n", pid); + fprintf(log_fh, "worker[%d] done\n", pid); } } #endif if (totals_mode && !quiet_mode) - printf("Average ""compression"" (%ld files): %0.2f%% (total saved %0.0fk)\n", + fprintf(log_fh, "Average ""compression"" (%ld files): %0.2f%% (total saved %0.0fk)\n", average_count, average_rate/average_count, total_save); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/jpegoptim.manifest new/jpegoptim-1.5.1/jpegoptim.manifest --- old/jpegoptim-1.5.0/jpegoptim.manifest 1970-01-01 01:00:00.000000000 +0100 +++ new/jpegoptim-1.5.1/jpegoptim.manifest 2023-01-05 04:43:58.000000000 +0100 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> + </requestedPrivileges> + </security> + </trustInfo> + <application> + <windowsSettings> + <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage> + </windowsSettings> + </application> +</assembly> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/jpegsrc.c new/jpegoptim-1.5.1/jpegsrc.c --- old/jpegoptim-1.5.0/jpegsrc.c 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/jpegsrc.c 2023-01-05 04:43:58.000000000 +0100 @@ -155,6 +155,7 @@ src->pub.init_source = custom_init_source; src->pub.fill_input_buffer = custom_fill_input_buffer; src->pub.resync_to_restart = jpeg_resync_to_restart; + src->pub.skip_input_data = custom_skip_input_data; src->pub.term_source = custom_term_source; src->infile = infile; src->pub.bytes_in_buffer = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jpegoptim-1.5.0/redhat/jpegoptim.spec new/jpegoptim-1.5.1/redhat/jpegoptim.spec --- old/jpegoptim-1.5.0/redhat/jpegoptim.spec 2022-09-15 05:41:14.000000000 +0200 +++ new/jpegoptim-1.5.1/redhat/jpegoptim.spec 2023-01-05 04:43:58.000000000 +0100 @@ -1,6 +1,6 @@ Summary: Utility for optimizing/compressing JPEG files. Name: jpegoptim -Version: 1.5.0 +Version: 1.5.1 Release: 1 License: GPL Group: Applications/Multimedia