1
0
mirror of https://github.com/glennrp/libpng.git synced 2026-10-24 08:39:18 +03:00

31 Commits

Author SHA1 Message Date
Cosmin Truta
d9e9c6d3a0 refactor: Replace deprecated pointer typedefs (part 2)
Following up on commit 7c67f70da1:

Replace 22 deprecated pointer typedefs with their underlying types.
The typedefs replaced are:

1. Core structure types:
   - png_structp, png_structrp, png_structpp and const variants
   - png_infop, png_inforp, png_infopp and const variants

2. Utility structure types:
   - png_row_infop, png_row_infopp
   - png_imagep, png_imagepp
   - png_controlp

3. Color structure types:
   - png_colorp, png_colorpp and const variants
   - png_color_8p, png_color_8pp and const variants
   - png_color_16p, png_color_16pp and const variants

4. Text and time structure types:
   - png_textp, png_textpp and const variants
   - png_timep, png_timepp and const variants

5. Chunk structure types:
   - png_unknown_chunkp, png_unknown_chunkpp and const variants
   - png_sPLT_tp, png_sPLT_tpp and const variants
   - png_sPLT_entryp, png_sPLT_entrypp and const variants

6. Internal types:
   - png_compression_bufferp
   - png_dsortp, png_dsortpp

Remove all remaining uses of spurious PNG_RESTRICT qualifiers.
Non-aliasing has already been guaranteed by the type-based aliasing
rules combined with the libpng usage pattern of a single pointer per
type.

Update the user manual accordingly.

This completes the systematic replacement of deprecated pointer
typedefs across the entire libpng codebase. The typedef declarations
remain in png.h for backward compatibility, marked as deprecated.

Reviewed-by: Chris Blume <ProgramMax@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-11-03 10:30:49 +02:00
Cosmin Truta
7c67f70da1 refactor: Replace deprecated pointer typedefs (part 1)
Following up on commit ddce3ff853:

1. Replace 28 deprecated pointer typedefs with their underlying types.
   The typedefs replaced are:
   - Basic: png_voidp, png_charp and const variants
   - Byte: png_bytep, png_const_bytep, png_bytepp
   - Numeric:
     - Integer: 16/32-bit integer pointer variants
     - Fixed-point: png_fixed_point_p and variants
     - Floating-point: png_doublep and variants

2. Remove a spurious PNG_RESTRICT qualifier. Non-aliasing has already
   been guaranteed by the type-based aliasing rules.

3. Update the user manual accordingly.

Reviewed-by: Chris Blume <ProgramMax@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-10-29 09:20:20 +02:00
John Bowler
ed689982c2 Update the support for target-specific code
The change removes the need for build configuration of target specific
code such as SIMD enhancements.

The extensible framework is based on checks in the new file named
pngtarget.h and allows per target description of requirements and
capabilities using macros with the prefix PNG_TARGET_.  These macros are
interpreted by the core libpng code in a target independent way.

The PNG_TARGET_ prefixed macros describe the target specific
implementation and document how to include it.  The actual inclusion of
the code is done, at present, by a single target independent core file
named pngsimd.c.

This approach ensures that no special configuration in the build system
is required on any system.  It is not required on a system which is
compiling for the build host where we can reasonably assume that the
compiler is correctly set up.  Neither is it required for cross builds
so long as the toolchain is correctly set up.  In this case the
toolchain means the cross build system and any ancilliary programs it
requires.

More details of the implementation are included in the source files
named pngtarget.h and pngsimd.c.  These files document in C comments how
additional target specific code might be added.

The changes consist primarily of movement of target specific code from
the core libpng source files to the existing target specific
subdirectories such as the ones named intel and arm.  This isolates the
code into the corresponding subdirectory and eliminates the requirement
for changes across the libpng structure.

As part of this the ARM processor NEON instruction set specific palette
to RGB code has been generalised to allow implementation in other
architectures.  The resultant updated version of the original (ARM Ltd)
implementation has been moved to the subdirectory named arm.

In addition some selected changes have been included to allow testing
with higher warning levels than the typical compiler defaults.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-10 21:28:34 +03:00
Cosmin Truta
4191872d0d chore: Update the .editorconfig files and pacify editorconfig-checker 2024-02-15 18:29:26 +02:00
Cosmin Truta
2d7da9db8a chore: Add .editorconfig files 2024-01-31 13:04:26 +02:00
Cosmin Truta
94429a335b Remove the "last changed" version information from source comments 2018-09-04 00:58:55 -04:00
Cosmin Truta
ceb327789b Remove top-level const from function-scope variables
As per the const correctness rules, top-level const-ness of data
in automatic scopes does not propagate outside of these scopes
(unlike const-ness at lower levels, such as pointers to const data).

Previously, const was used liberally, but inconsistently across the
libpng codebase. Using const wherever applicable is not incorrect.
However, _consistent_ use of const is difficult to maintain in such
conditions.

In conclusion, we shall continue to use const only where doing so is
strictly necessary:

1. If a function guarantees that it will not modify an argument
   passed by pointer, the corresponding function parameter should be
   a pointer-to-const (const T *).

2. Static data should not be modified, therefore it should be const.

Reference:
Google C++ Style Guide
https://google.github.io/styleguide/cppguide.html#Use_of_const
2018-08-18 22:47:16 -04:00
Cosmin Truta
a74aa9a002 [libpng16] Replace the remaining uses of png_size_t with size_t
In v1.6.0, size_t became a required type. It should be used
consistently. To maintain backwards compatibility, png_size_t
is still maintained in deprecated form.
2018-06-17 22:37:44 -04:00
Glenn Randers-Pehrson
2239961279 [libpng16] Fix "last changed" dates in powerpc/*.c 2017-03-21 19:37:27 -05:00
Glenn Randers-Pehrson
03a6f3f9c9 [libpng16] Bump version to 1.6.30beta01 2017-03-16 10:40:01 -05:00
Glenn Randers-Pehrson
d42e88d5b3 [libpng16] Imported from libpng-1.6.29.tar 2017-03-16 07:26:33 -05:00
Glenn Randers-Pehrson
b475d0593c [libpng16] Update credits and copyright information about powerpc-vsx code 2017-02-22 15:14:22 -06:00
Vadim Barkov
a343882c74 Made VSX code pedantic strict C90 compliant
Fixed signed/unsigned comparations, png_byte and summations. Also
fixed combound literals which are permited by C90.
2017-02-11 21:33:32 +00:00
Vadim Barkov
483bcad21d Changed minimum supported PowerPC CPU comment
Changed it from POWER8 to POWER7 due to the last one
supports VSX too.
2017-02-10 07:33:06 +00:00
Vadim Barkov
310dee21f7 Refactoring
Now all defines in filter VSX file are prefixed with VSX
and have more clear names
2017-02-10 07:20:59 +00:00
Vadim Barkov
d1c12e85c1 Added support for ppc64 big endian for filter_paeth VSX 2017-02-09 19:11:31 +00:00
Vadim Barkov
99d7285f20 Fixed filter_paeth for PowerPC VSX
Now all tests are fine for ppc64le
2017-02-09 18:57:53 +00:00
Vadim Barkov
d4bdca45b3 Fixed multiple bugs in VSX filter functions
Now up,sub and avg filter VSX functions pass tests
2017-02-08 14:02:44 +00:00
Vadim Barkov
58e9d5d59d Refactoring 2017-02-02 22:37:36 +00:00
Vadim Barkov
ae15e839d9 Small bugfix 2017-02-02 04:51:56 +00:00
Vadim Barkov
9bd58f9387 Removed PNG_ALIGN check in VSX code since it is not used 2017-01-31 12:15:45 +00:00
Vadim Barkov
bea573d370 Added auxv-based VSX detection method for PowerPC and enabled it by default 2017-01-31 11:59:11 +00:00
Vadim Barkov
acb155d893 Implemented filter_paeth PowerPC VSX variant 2017-01-31 04:05:19 +03:00
Vadim Barkov
c43aaa8b20 Implemented filter_avg for PowerPC VXS 2017-01-29 18:44:54 +03:00
Vadim Barkov
6ddcd33daa Fixed potential align errors for PowerPC VSX filter functions
The problem is that row and prev_row may not be aligned to the same
byte count. This situation leaded to undefined behaviour.
2017-01-29 18:37:53 +03:00
Vadim Barkov
adbf1d6d1c Fixed missing defines for VSX filter_sub 2017-01-19 18:12:13 +03:00
Vadim Barkov
9b0311a4d8 Implemented filter_sub optimisation for PowerPC VSX 2017-01-19 02:11:34 +03:00
Vadim Barkov
b455622aa8 Fixed potential bug on align calculation for VSX filter_up 2017-01-19 01:29:24 +03:00
Vadim Barkov
ccef5edbfe Fixed bug with unaligned input on VSX filter_up 2017-01-16 19:45:17 +03:00
Vadim Barkov
91acd4baf8 Implemented png_read_filter_up_vsx 2017-01-15 20:20:29 +03:00
Vadim Barkov
2b6e59d968 Added initial code for PowerPC VSX optimisation 2017-01-14 16:05:33 +03:00