Skip to content

0.3.1: MINIPSD_STATIC without warnings, a build of one part, typed setters, pixel aspect ratio - #12

Merged
ShadobaDev merged 7 commits into
masterfrom
fix/0.3.1
Oct 24, 2026
Merged

ShadobaDev merged 7 commits into
masterfrom
fix/0.3.1

Conversation

@ShadobaDev

Copy link
Copy Markdown
Owner
  • MINIPSD_STATIC: the functions a file does not call no longer warn
    (GNU's unused attribute, [[maybe_unused]] in C++17, C4505 off in MSVC).
  • MINIPSD_NO_READER / MINIPSD_NO_WRITER: a build with only the writer
    or only the reader. The shared helpers in detail/ are marked
    possibly unused only then, so the full build still reports dead code;
    the single-file release keeps them whichever part is left out.
  • Typed setters (S6.20), the mirror of the typed views: version info,
    grid and guides, alpha channel names and identifiers, the transparency
    index, into the caller's buffer, measured first, with size constants for
    one call. A layer's settings are set in the blocks it has: replaced where
    they are, added only when missing. Resource 1005 stays dpi's
    (new MINIPSD_ERR_USE_DOC_FIELD). minipsd_blocks_settings reads a
    document layer's settings.
  • Release workflow: checks that CI passed on the tagged commit on
    master instead of running it again.
  • Pixel aspect ratio (S6.21): read into minipsd_info (1.0 without
    resource 1064), written from minipsd_doc (0: none of the writer's own);
    floats compared within a tolerance (detail/floats.h).

…running it

CI runs on every push to master, so the release no longer calls it. It
checks that the commit is on master and has a successful CI run, and
otherwise fails asking to wait for CI and re-run the job. ci.yml loses
workflow_call, which nothing uses now.
Each leaves out one part, its types and functions; minipsd_read needs
both, and both together are an #error. The detail/ helpers both parts
share are marked MPSD__SHARED, possibly unused only in such a build, so
a full build still reports dead code. minipsd.h includes detail/ before
either part, so the single-file release keeps them whichever part is
left out. part_check builds both variants, also from the single file.
minipsd_write_fn and MINIPSD_CH_* move out of the parts' sections.

Each public function is marked possibly unused: GNU's attribute in gcc
and clang, [[maybe_unused]] in C++17, and in MSVC warning C4505 is off
for the implementation (C has no such attribute; push/pop around it is
enough). tests/part_check.c builds a program that calls only
minipsd_write, as C99 and C++17, with warnings as errors and none
silenced.
…E (S6.20, 1)

The typed setters mirror the typed views: a struct in, the bytes the view
reads out, counted first and written into the caller's buffer when it
holds them (MINIPSD_MORE otherwise). builders.h goes with the writer.
minipsd_resource_make_version_info takes the view's struct as it is;
minipsd_utf8_to_utf16be is the converse of minipsd_utf16be_to_utf8.
Resource 1005 is never made: minipsd_resource_make_resolution_info
returns the new MINIPSD_ERR_USE_DOC_FIELD, the resolution being
minipsd_doc.dpi. The views' structs move to a section both parts keep,
and MINIPSD_TRANSPARENCY_INDEX_SIZE is public.
…S6.20, 2)

The lists take arrays and a count. Alpha names go in as UTF-8: 1045 as
UTF-16, 1006 as Pascal strings in ASCII, '?' for each other character
and at most 255 bytes, through mpsd__legacy_name, now shared with the
writer's legacy layer name. MINIPSD_GRID_AND_GUIDES_SIZE(n) and
MINIPSD_ALPHA_IDENTIFIERS_SIZE(n) size the buffer for one call; the
guides' layout constants derive from them.
….20, 3)

minipsd_layer_make_block_settings edits a run instead of only making
one: the first block of each key present asks for is replaced where it
is, keeping its signature; one the run lacks is added at the end; every
other block is copied as it is. Appending would not work, since readers
take the first block of a key. MINIPSD_BLOCK_SETTINGS_MAX bounds what the
run grows by. minipsd_blocks_settings reads the same values from the
bytes alone, such as a document's additional_info, and
minipsd_layer_block_settings now calls it. The blocks' table moves to
format.h with each data length (lclr 8, the others 4, as psd-tools'
files hold them), shared by the view and the setter.
…6.20, 4)

roundtrip.py writes a document with every setter's resources and a layer's blocks; psd-tools reads the values given, and check_decoded compares minipsd's views with it. mpsd__made skips the writing pass when there is nothing to write, as clang-analyzer could not see that memcpy then never runs.
minipsd_info.pixel_aspect_ratio reads resource 1064, 1.0 without it, so a
program can find or refuse non-square pixels. minipsd_doc.pixel_aspect_ratio
writes it: at 0 none of the writer's own; above 0 a kept 1064 that says
the same stays where it is, otherwise the writer's own (version 2) comes
after 1039. minipsd_read keeps the file's, 0 without one; the resolution
stays square. detail/floats.h compares doubles within a tolerance and
checks they are finite, without libm; the tests compare floats with
EXPECT_FLOAT_EQ/EXPECT_DOUBLE_EQ instead of EXPECT_EQ. The version is 0.3.1.
@ShadobaDev
ShadobaDev merged commit 3338589 into master Oct 24, 2026
9 checks passed
@ShadobaDev
ShadobaDev deleted the fix/0.3.1 branch October 27, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant