]> granicus.if.org Git - graphviz/log
graphviz
2 years agomm2gv SparseMatrix_import_matrix_market: use cgraph wrappers for allocation
Matthew Fernandez [Sun, 28 Aug 2022 15:48:00 +0000 (08:48 -0700)]
mm2gv SparseMatrix_import_matrix_market: use cgraph wrappers for allocation

The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

This change also fixes a number of unchecked allocation failures where `malloc`
was being called directly and the result was not checked.

2 years agoMerge branch 'smattr/7b19e8e0-5168-4010-9e8a-b84c871acf38' into 'main'
Matthew Fernandez [Tue, 30 Aug 2022 03:54:44 +0000 (03:54 +0000)]
Merge branch 'smattr/7b19e8e0-5168-4010-9e8a-b84c871acf38' into 'main'

gvpr: fix unchecked allocation failures

See merge request graphviz/graphviz!2816

2 years agogvpr addCase: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:31:59 +0000 (15:31 -0700)]
gvpr addCase: fix unchecked allocation failure

2 years agogvpr addBlock: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:31:04 +0000 (15:31 -0700)]
gvpr addBlock: fix unchecked allocation failure

2 years agogvpr scanArgs: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:30:16 +0000 (15:30 -0700)]
gvpr scanArgs: fix unchecked allocation failure

2 years agogvpr addBindings: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:29:00 +0000 (15:29 -0700)]
gvpr addBindings: fix unchecked allocation failure

2 years agogvpr compileProg: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:27:54 +0000 (15:27 -0700)]
gvpr compileProg: fix unchecked allocation failure

2 years agogvpr mkStmts: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:26:58 +0000 (15:26 -0700)]
gvpr mkStmts: fix unchecked allocation failure

2 years agogvpr fullColor: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 22:25:02 +0000 (15:25 -0700)]
gvpr fullColor: fix unchecked allocation failure

2 years agoMerge branch 'smattr/55b87137-b443-4540-845a-6cdae948b213' into 'main'
Matthew Fernandez [Tue, 30 Aug 2022 02:52:43 +0000 (02:52 +0000)]
Merge branch 'smattr/55b87137-b443-4540-845a-6cdae948b213' into 'main'

cgraph fix unchecked allocation failures

See merge request graphviz/graphviz!2814

2 years agocgraph storeFileName: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 15:50:12 +0000 (08:50 -0700)]
cgraph storeFileName: fix unchecked allocation failure

2 years agocgraph concatPort: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 15:49:00 +0000 (08:49 -0700)]
cgraph concatPort: fix unchecked allocation failure

2 years agocgraph concat: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 15:48:37 +0000 (08:48 -0700)]
cgraph concat: fix unchecked allocation failure

2 years agocgraph memresize: fix out-of-bounds write on allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 15:45:31 +0000 (08:45 -0700)]
cgraph memresize: fix out-of-bounds write on allocation failure

Callers of this function appear to anticipate the possibility of failure, e.g.
`agrealloc`. But the function itself was attempting to zero newly allocated
memory even if the allocation call failed.

2 years agocgraph aglasterr: fix unchecked allocation failure
Matthew Fernandez [Sat, 27 Aug 2022 15:42:47 +0000 (08:42 -0700)]
cgraph aglasterr: fix unchecked allocation failure

2 years agocgraph agapply: remove unreachable 'break'
Matthew Fernandez [Sat, 27 Aug 2022 15:38:36 +0000 (08:38 -0700)]
cgraph agapply: remove unreachable 'break'

2 years agocgraph: abbreviate tag initialization
Matthew Fernandez [Sat, 27 Aug 2022 15:34:12 +0000 (08:34 -0700)]
cgraph: abbreviate tag initialization

It is not clear to me exactly what “warnings about initialization” were being
suppressed here, but I am assuming something well before C99. In C99, we have a
simpler and more concise way of doing zero initialization.

2 years agoMerge branch 'smattr/e3aab83d-a89d-4698-a6c8-a7458f971751' into 'main'
Matthew Fernandez [Tue, 30 Aug 2022 00:57:29 +0000 (00:57 +0000)]
Merge branch 'smattr/e3aab83d-a89d-4698-a6c8-a7458f971751' into 'main'

smyrna: drop 'HAVE_GTS' and 'HAVE_TRIANGLE' from the Windows builds

See merge request graphviz/graphviz!2812

2 years agosmyrna: drop 'HAVE_GTS' and 'HAVE_TRIANGLE' from the Windows builds
Matthew Fernandez [Sat, 27 Aug 2022 01:31:01 +0000 (18:31 -0700)]
smyrna: drop 'HAVE_GTS' and 'HAVE_TRIANGLE' from the Windows builds

This appears to have been a mistake in 3c8cf3624f6a8b82434115177471b6e7092f8365
that added these files. This occurred long after triangle.[ch] were removed
(ca31e3197ad25c174bd0c9d133c5479e9f3a56a1). And as of now, GTS is only available
on Windows through Vcpkg, a package manager that did not exist at the time of
3c8cf3624f6a8b82434115177471b6e7092f8365. So it seems safe to conclude Windows
really did not `HAVE_GTS` nor `HAVE_TRIANGLE` at this time.

This caused no ill-effects because defining these within Smyrna is a no-op. All
use of these macros occurs outside cmd/smyrna, in the libraries on which Smyrna
depends. But defining these unused macros was creating unnecessary confusion.

2 years agoMerge branch 'smattr/dacd6f5f-0f17-4a6b-bb5b-d4638da7c6af' into 'main'
Matthew Fernandez [Mon, 29 Aug 2022 16:29:22 +0000 (16:29 +0000)]
Merge branch 'smattr/dacd6f5f-0f17-4a6b-bb5b-d4638da7c6af' into 'main'

de-dupe common 'openFile' function into a shared header

See merge request graphviz/graphviz!2811

2 years agocmd/tools: unify common 'openFile' function into a header
Matthew Fernandez [Thu, 25 Aug 2022 15:28:22 +0000 (08:28 -0700)]
cmd/tools: unify common 'openFile' function into a header

This also addresses a number of inconsistencies between these duplicated
functions, like `sccmap` calling itself `gvpack` in its error message.

2 years agographml2gv: remove unused macros
Matthew Fernandez [Thu, 25 Aug 2022 15:01:25 +0000 (08:01 -0700)]
graphml2gv: remove unused macros

None of these have ever been in use.

2 years agoMerge branch 'doc' into 'main'
Matthew Fernandez [Mon, 29 Aug 2022 15:31:57 +0000 (15:31 +0000)]
Merge branch 'doc' into 'main'

add doxygen comments to snode

See merge request graphviz/graphviz!2629

2 years agoadd doxygen comments to snode
Costa Shulyupin [Sun, 24 Apr 2022 07:34:59 +0000 (10:34 +0300)]
add doxygen comments to snode

and make doxygen comments from regular.

2 years agosgraph: remove trailing spaces
Costa Shulyupin [Sun, 24 Apr 2022 07:20:26 +0000 (10:20 +0300)]
sgraph: remove trailing spaces

2 years agoMerge branch 'smattr/gitlab-2258' into 'main'
Matthew Fernandez [Mon, 29 Aug 2022 14:38:16 +0000 (14:38 +0000)]
Merge branch 'smattr/gitlab-2258' into 'main'

fix 'id' attribute in SVG output omitting input graph id

Closes #2258

See merge request graphviz/graphviz!2815

2 years agofix 'id' attribute in SVG output omitting input graph id
Matthew Fernandez [Sat, 27 Aug 2022 22:17:09 +0000 (15:17 -0700)]
fix 'id' attribute in SVG output omitting input graph id

When using an ID attribute on the input graph,¹ this attribute would only be
propagated to some output elements. In particular, generated `linearGradient`
and `radialGradient` elements in SVGs would be missing the ID.

Gitlab: fixes #2258

¹ https://graphviz.org/docs/attrs/id/

2 years agoMerge branch 'smattr/c56365b2-f72e-45ff-a098-d7bd1fa1f5bc' into 'main'
Matthew Fernandez [Fri, 26 Aug 2022 16:28:04 +0000 (16:28 +0000)]
Merge branch 'smattr/c56365b2-f72e-45ff-a098-d7bd1fa1f5bc' into 'main'

improve the robustness of Show_boxes

See merge request graphviz/graphviz!2809

2 years agouse 'gv_strdup' instead of 'strdup' in 'Show_boxes'
Matthew Fernandez [Wed, 24 Aug 2022 04:15:09 +0000 (21:15 -0700)]
use 'gv_strdup' instead of 'strdup' in 'Show_boxes'

This fixes some unchecked allocation failures.

2 years agouse 'agxbprint' to round points instead of casting in 'Show_boxes'
Matthew Fernandez [Wed, 24 Aug 2022 04:10:10 +0000 (21:10 -0700)]
use 'agxbprint' to round points instead of casting in 'Show_boxes'

This has the advantage of avoiding relying on values fitting in the range of an
int. Going through C stdio this way, the full range of doubles can be preserved.

2 years agouse agxbbuf for dynamic 'Show_boxes' string construction
Matthew Fernandez [Wed, 24 Aug 2022 04:02:54 +0000 (21:02 -0700)]
use agxbbuf for dynamic 'Show_boxes' string construction

We have some recent evidence¹ people are using this debug feature. This change
makes some allocations it does more robust (they now exit on failure) and
abbreviates construction in a stack buffer and then duplication into a heap
buffer into direct construction in a heap buffer.

¹ https://forum.graphviz.org/t/how-to-use-the-showboxes-attribute/1287

2 years agoMerge branch 'smattr/49d1c184-6733-4cdb-9b33-b3fba389f344' into 'main'
Matthew Fernandez [Thu, 25 Aug 2022 01:01:36 +0000 (01:01 +0000)]
Merge branch 'smattr/49d1c184-6733-4cdb-9b33-b3fba389f344' into 'main'

pathplan warning squashing

See merge request graphviz/graphviz!2803

2 years agopathplan isdiagonal: remove shadowing of globals
Matthew Fernandez [Sun, 21 Aug 2022 19:53:12 +0000 (12:53 -0700)]
pathplan isdiagonal: remove shadowing of globals

2 years agopathplan triangulate: remove shadowing of globals
Matthew Fernandez [Sun, 21 Aug 2022 19:48:41 +0000 (12:48 -0700)]
pathplan triangulate: remove shadowing of globals

2 years agopathplan Pshortestpath: use longs instead of ints for index variables
Matthew Fernandez [Sun, 21 Aug 2022 19:40:55 +0000 (12:40 -0700)]
pathplan Pshortestpath: use longs instead of ints for index variables

Within this function, these indices are sometimes calculated using pointer
arithmetic which has a long (technically `ptrdiff_t`) result. Using a long type
for these variables squashes 2 -Wconversion warnings and reduces the likelihood
of arithmetic overflows.

In future, it is possible we should convert this code to `ptrdiff_t` instead. It
is unclear if this would be an improvement, given interaction with the
surrounding code and cases where these indices are set to literals like `-1`.
Changing to `ptrdiff_t` would also be more invasive than just widening the value
range as done by this change. On most contemporary platforms, `long` and
`ptrdiff_t` are the same type, so perhaps the difference is academic.

2 years agoMerge branch 'smattr/2D929B35-2BD5-48C0-8648-38B31C6BC15F' into 'main'
Matthew Fernandez [Wed, 24 Aug 2022 16:46:49 +0000 (16:46 +0000)]
Merge branch 'smattr/2D929B35-2BD5-48C0-8648-38B31C6BC15F' into 'main'

gvmap: remove and inline some constant function parameters

See merge request graphviz/graphviz!2807

2 years agogvmap: remove 'seed' parameter from 'map_palette_optimal_coloring'
Matthew Fernandez [Sat, 28 May 2022 05:47:51 +0000 (22:47 -0700)]
gvmap: remove 'seed' parameter from 'map_palette_optimal_coloring'

This is always passed as -10.

2 years agogvmap: remove 'accuracy' parameter from 'map_palette_optimal_coloring'
Matthew Fernandez [Sat, 28 May 2022 05:45:54 +0000 (22:45 -0700)]
gvmap: remove 'accuracy' parameter from 'map_palette_optimal_coloring'

This is always passed as 0.01.

2 years agogvmap: remove 'lightness' parameter from 'map_palette_optimal_coloring'
Matthew Fernandez [Sat, 28 May 2022 05:43:30 +0000 (22:43 -0700)]
gvmap: remove 'lightness' parameter from 'map_palette_optimal_coloring'

This is always passed as "0,100".

2 years agoMerge branch 'smattr/354B5E18-2096-4F8B-B09E-32C5E9E5E1F7' into 'main'
Matthew Fernandez [Wed, 24 Aug 2022 15:05:04 +0000 (15:05 +0000)]
Merge branch 'smattr/354B5E18-2096-4F8B-B09E-32C5E9E5E1F7' into 'main'

sparse simplification

See merge request graphviz/graphviz!2806

2 years agosparse: remove unnecessary casts in 'SparseMatrix_sum_repeat_entries'
Matthew Fernandez [Mon, 23 May 2022 14:41:08 +0000 (07:41 -0700)]
sparse: remove unnecessary casts in 'SparseMatrix_sum_repeat_entries'

2 years agosparse: remove unused 'what_to_sum' from 'SparseMatrix_sum_repeat_entries'
Matthew Fernandez [Mon, 23 May 2022 14:39:23 +0000 (07:39 -0700)]
sparse: remove unused 'what_to_sum' from 'SparseMatrix_sum_repeat_entries'

This function is never called with `what_to_sum` equal to `SUM_REPEATED_NONE`.

2 years agosparse: remove always true branch in 'SparseMatrix_sum_repeat_entries'
Matthew Fernandez [Mon, 23 May 2022 14:37:07 +0000 (07:37 -0700)]
sparse: remove always true branch in 'SparseMatrix_sum_repeat_entries'

`what_to_sum` can only take on two values, `SUM_REPEATED_NONE` and
`SUM_REPEATED_ALL`. If it is `SUM_REPEATED_NONE` there is an early exit at the
beginning of this function.

2 years agoMerge branch 'smattr/9cac6136-572d-4e70-a9c9-ec277f91ba27' into 'main'
Matthew Fernandez [Wed, 24 Aug 2022 05:12:22 +0000 (05:12 +0000)]
Merge branch 'smattr/9cac6136-572d-4e70-a9c9-ec277f91ba27' into 'main'

graphml2gv: remove unused struct members

See merge request graphviz/graphviz!2801

2 years agographml2gv: remove unused 'listen'
Matthew Fernandez [Sat, 20 Aug 2022 15:58:05 +0000 (08:58 -0700)]
graphml2gv: remove unused 'listen'

This member was always false.

2 years agographml2gv: remove unused 'globalAttrType'
Matthew Fernandez [Sat, 20 Aug 2022 15:56:16 +0000 (08:56 -0700)]
graphml2gv: remove unused 'globalAttrType'

This member was always `TAG_NONE`.

2 years agographml2gv: remove unused 'compositeReadState'
Matthew Fernandez [Sat, 20 Aug 2022 15:54:01 +0000 (08:54 -0700)]
graphml2gv: remove unused 'compositeReadState'

It has never been possible to set this member to true.

2 years agoMerge branch 'smattr/30318de1-0ce7-42b7-b0cc-f7ef55fa1321' into 'main'
Matthew Fernandez [Wed, 24 Aug 2022 01:33:48 +0000 (01:33 +0000)]
Merge branch 'smattr/30318de1-0ce7-42b7-b0cc-f7ef55fa1321' into 'main'

API BREAK: libxdot: use size_t instead of int where appropriate

See merge request graphviz/graphviz!2802

2 years agoAPI BREAK: libxdot: use size_t instead of int for stats and polygon line points
Matthew Fernandez [Sun, 21 Aug 2022 02:46:02 +0000 (19:46 -0700)]
API BREAK: libxdot: use size_t instead of int for stats and polygon line points

This allows exceeding counts of 2³¹ - 1, which is not particularly likely. But
its more important effect is to make arithmetic operations less error prone and
make it impossible by-construction to arrive at a negative count in these fields.

There is some interaction between the stats fields and polygon line points
fields, so doing these two separately would have meant an intermediate state
with lots of casting. It seemed simpler and less error prone to do this all at
once.

There is still casting back to int for the `gvrender_*` functions. Modifying
these would have been too invasive. Surprisingly the call to `gvrender_polyline`
affected in this commit is the only instance of a call to it with a non-literal
point count. But modifying it to take a size_t would still have required
too-invasive changes due to other functions it calls.

For lines that would have been changed anyway, this commit also fixes white
space and tightens variable scoping where possible.

2 years agoclang-format lib/cgraph/prisize_t.h
Matthew Fernandez [Sun, 21 Aug 2022 18:13:58 +0000 (11:13 -0700)]
clang-format lib/cgraph/prisize_t.h

This file was so close to compliant already, we may as well pull it in line.

2 years agocgraph: Doxygen-ize and further explain 'PRISIZE_T'
Matthew Fernandez [Sun, 21 Aug 2022 02:15:57 +0000 (19:15 -0700)]
cgraph: Doxygen-ize and further explain 'PRISIZE_T'

2 years agoAPI BREAK: libxdot: use size_t instead of int for op sizes/counts
Matthew Fernandez [Sun, 21 Aug 2022 01:58:20 +0000 (18:58 -0700)]
API BREAK: libxdot: use size_t instead of int for op sizes/counts

This allows exceeding operation counts of 2³¹ - 1, which is not particularly
likely. But its more important effect is to make arithmetic operations less
error prone and make it impossible by-construction to arrive at a negative
operation size or count.

Doing this as a single sweeping change seemed less error prone and clearer,
despite how large the resulting diff is.

For lines that would have been changed anyway, this commit also fixes white
space and tightens variable scoping where possible.

2 years agoMerge branch 'smattr/9d85d7f5-9526-40da-9753-4d6253b74495' into 'main'
Matthew Fernandez [Tue, 23 Aug 2022 16:33:58 +0000 (16:33 +0000)]
Merge branch 'smattr/9d85d7f5-9526-40da-9753-4d6253b74495' into 'main'

remove setup and checking of 'sort' in the Windows build

See merge request graphviz/graphviz!2805

2 years agoremove setup and checking of 'sort' in the Windows build
Matthew Fernandez [Tue, 23 Aug 2022 00:17:00 +0000 (17:17 -0700)]
remove setup and checking of 'sort' in the Windows build

Building Graphviz has not required the `sort` utility since
ea6b4c99ec32127619b6e5c3a5ff58be51aa4829.

2 years agoMerge branch 'smattr/9882daff-1ca0-45b3-ba75-4e7d308ef6f2' into 'main'
Matthew Fernandez [Tue, 23 Aug 2022 15:26:58 +0000 (15:26 +0000)]
Merge branch 'smattr/9882daff-1ca0-45b3-ba75-4e7d308ef6f2' into 'main'

sfio: remove unused 'SF_APPEND'

See merge request graphviz/graphviz!2804

2 years agosfio: remove unused 'SF_APPEND'
Matthew Fernandez [Sun, 21 Aug 2022 19:22:54 +0000 (12:22 -0700)]
sfio: remove unused 'SF_APPEND'

The last use of this was removed in 052e514170a70a549abbc25199504ae6a58dea27.

2 years agoMerge branch 'extend-svg-analyzer-with-graphviz-awareness' into 'main'
Magnus Jacobsson [Tue, 23 Aug 2022 07:12:24 +0000 (07:12 +0000)]
Merge branch 'extend-svg-analyzer-with-graphviz-awareness' into 'main'

Extend the SVG analyzer with Graphviz awareness

See merge request graphviz/graphviz!2797

2 years agotests: test_rankdir: add checking of relative position of edge and each node
Magnus Jacobsson [Wed, 17 Aug 2022 20:10:28 +0000 (22:10 +0200)]
tests: test_rankdir: add checking of relative position of edge and each node

2 years agotests: SvgAnalyzer: GraphvizEdge add retrieval of center position
Magnus Jacobsson [Wed, 17 Aug 2022 20:05:54 +0000 (22:05 +0200)]
tests: SvgAnalyzer: GraphvizEdge add retrieval of center position

2 years agotests: SvgAnalyzer: GraphvizEdge: add retrieval of bounding box
Magnus Jacobsson [Wed, 17 Aug 2022 19:59:30 +0000 (21:59 +0200)]
tests: SvgAnalyzer: GraphvizEdge: add retrieval of bounding box

2 years agotests: SvgAnalyzer: GraphvizGraph: add retrieval of edge by edgeop
Magnus Jacobsson [Wed, 17 Aug 2022 19:49:03 +0000 (21:49 +0200)]
tests: SvgAnalyzer: GraphvizGraph: add retrieval of edge by edgeop

2 years agotests: test_rankdir: add checking of relative position of nodes
Magnus Jacobsson [Wed, 17 Aug 2022 12:59:04 +0000 (14:59 +0200)]
tests: test_rankdir: add checking of relative position of nodes

2 years agotests: SvgAnalyzer: SVGPoint: add checking of relative position to other point
Magnus Jacobsson [Wed, 17 Aug 2022 12:57:43 +0000 (14:57 +0200)]
tests: SvgAnalyzer: SVGPoint: add checking of relative position to other point

2 years agotests: SvgAnalyzer: GraphvizNode add retrieval of center position
Magnus Jacobsson [Wed, 17 Aug 2022 12:55:18 +0000 (14:55 +0200)]
tests: SvgAnalyzer: GraphvizNode add retrieval of center position

2 years agotests: SvgAnalyzer: GraphvizNode: add retrieval of bounding box
Magnus Jacobsson [Tue, 16 Aug 2022 13:14:27 +0000 (15:14 +0200)]
tests: SvgAnalyzer: GraphvizNode: add retrieval of bounding box

2 years agotests: SvgAnalyzer: SVGElement: add retrieval of bounding box
Magnus Jacobsson [Tue, 16 Aug 2022 13:14:27 +0000 (15:14 +0200)]
tests: SvgAnalyzer: SVGElement: add retrieval of bounding box

2 years agotests: SvgAnalyzer: GraphvizGraph: add retrieval of node by node_id
Magnus Jacobsson [Tue, 16 Aug 2022 13:55:53 +0000 (15:55 +0200)]
tests: SvgAnalyzer: GraphvizGraph: add retrieval of node by node_id

2 years agotests: add new test_rankdir test skeleton
Magnus Jacobsson [Tue, 16 Aug 2022 13:38:28 +0000 (15:38 +0200)]
tests: add new test_rankdir test skeleton

2 years agotests: SvgAnalyzer: add support for retrieving Graphviz components
Magnus Jacobsson [Wed, 17 Aug 2022 10:59:08 +0000 (12:59 +0200)]
tests: SvgAnalyzer: add support for retrieving Graphviz components

2 years agotests: SvgAnalyzer: add a graphvizGraph class
Magnus Jacobsson [Wed, 17 Aug 2022 10:54:36 +0000 (12:54 +0200)]
tests: SvgAnalyzer: add a graphvizGraph class

2 years agotests: SvgAnalyzer: add a graphvizEdge class
Magnus Jacobsson [Wed, 17 Aug 2022 10:52:20 +0000 (12:52 +0200)]
tests: SvgAnalyzer: add a graphvizEdge class

2 years agotests: SvgAnalyzer: add a graphvizNode class
Magnus Jacobsson [Mon, 25 Jul 2022 12:30:05 +0000 (14:30 +0200)]
tests: SvgAnalyzer: add a graphvizNode class

2 years agoMerge branch 'smattr/3544c517-02cf-4433-8cf5-e58b7eb35fa3' into 'main'
Matthew Fernandez [Tue, 23 Aug 2022 05:32:49 +0000 (05:32 +0000)]
Merge branch 'smattr/3544c517-02cf-4433-8cf5-e58b7eb35fa3' into 'main'

common, dotgen: fix truncation to int in intermediate calculations

See merge request graphviz/graphviz!2796

2 years agodotgen flat_limits: fix truncation to int during intermediate calculations
Matthew Fernandez [Thu, 18 Aug 2022 02:52:55 +0000 (19:52 -0700)]
dotgen flat_limits: fix truncation to int during intermediate calculations

Like the prior commits, the problem fixed in this commit seems to have been a
mistake in ebd6191b0eec6e23d96c92aaa06212de339207e3 in not updating these
variables to doubles when transitioning to double-based points. Squashes 3
-Wfloat-conversion warnings.

2 years agodotgen make_flat_labeled_edge: fix truncation to int during intermediate ops
Matthew Fernandez [Thu, 18 Aug 2022 02:46:02 +0000 (19:46 -0700)]
dotgen make_flat_labeled_edge: fix truncation to int during intermediate ops

Like the prior commits, the problem fixed in this commit seems to have been a
mistake in ebd6191b0eec6e23d96c92aaa06212de339207e3 in not updating these
variables to doubles when transitioning to double-based points. Squashes 1
-Wfloat-conversion warnings.

2 years agodotgen make_flat_adj_edges: fix truncation to int during intermediate calculations
Matthew Fernandez [Thu, 18 Aug 2022 02:38:58 +0000 (19:38 -0700)]
dotgen make_flat_adj_edges: fix truncation to int during intermediate calculations

Like the prior commits, the problem fixed in this commit seems to have been a
mistake in ebd6191b0eec6e23d96c92aaa06212de339207e3 in not updating these
variables to doubles when transitioning to double-based points. Squashes 4
-Wfloat-conversion warnings.

2 years agodotgen _dot_splines: fix truncation to int during intermediate calculations
Matthew Fernandez [Thu, 18 Aug 2022 02:31:44 +0000 (19:31 -0700)]
dotgen _dot_splines: fix truncation to int during intermediate calculations

Like the prior commit, the problem fixed in this commit seems to have been a
mistake in ebd6191b0eec6e23d96c92aaa06212de339207e3 in not updating these
variables to doubles when transitioning to double-based points. Squashes 5
-Wfloat-conversion warnings.

2 years agocommon record_path: fix truncation to int during path calculation
Matthew Fernandez [Thu, 18 Aug 2022 02:17:34 +0000 (19:17 -0700)]
common record_path: fix truncation to int during path calculation

This looks to have been a typo in ebd6191b0eec6e23d96c92aaa06212de339207e3 that
switched this code to operate on double points instead of int points, in that it
did not also update the local temporaries used in this calculation. As a result,
this function produced inaccurate answers due to rounding when points were too
close together and downright wrong answers when points did not fit in an int
data type. Squashes 4 -Wfloat-conversion warnings.

2 years agocommon pos_reclbl: treat 'sides' uniformly as an unsigned char
Matthew Fernandez [Thu, 18 Aug 2022 02:03:42 +0000 (19:03 -0700)]
common pos_reclbl: treat 'sides' uniformly as an unsigned char

Squashes a -Wconversion warning.

2 years agocommon point_gencode: tighter scope and stack-allocate 'AF'
Matthew Fernandez [Thu, 18 Aug 2022 01:52:13 +0000 (18:52 -0700)]
common point_gencode: tighter scope and stack-allocate 'AF'

`AF` was being dynamically allocated as if it needed to contain an arbitrary
(potentially large) number of points. However its only use is in being passed to
`gvrender_ellipse` which only looks at the first two points. So we can simplify
and optimize this code by simply stack-allocating 2 entries.

2 years agoremove unnecessary casts around 'ND_shape_info'
Matthew Fernandez [Thu, 18 Aug 2022 01:40:09 +0000 (18:40 -0700)]
remove unnecessary casts around 'ND_shape_info'

2 years agocommon emit_html_rules: perform base calculation uniformly on doubles
Matthew Fernandez [Thu, 18 Aug 2022 01:28:15 +0000 (18:28 -0700)]
common emit_html_rules: perform base calculation uniformly on doubles

It is unclear to me why 070d24215a27219b33581c96c39e6e8811ba52a7 chose to
perform these intermediate calculations truncating to unsigned char. This
resulted in loss of accuracy and multiple possibilities for overflow. This
change makes the computation more natural, squashing 7 compiler warnings.

2 years agocommon size_html_cell: squash a -Wsign-conversion warning
Matthew Fernandez [Thu, 18 Aug 2022 01:10:41 +0000 (18:10 -0700)]
common size_html_cell: squash a -Wsign-conversion warning

`parent->cb` is known non-negative here.

2 years agogvc gvprintpointflist: take number of points as a size_t
Matthew Fernandez [Thu, 18 Aug 2022 00:51:39 +0000 (17:51 -0700)]
gvc gvprintpointflist: take number of points as a size_t

This is a more appropriate type for the length of an array.

2 years agogvc gvprintpointflist: rewrite for clarity
Matthew Fernandez [Thu, 18 Aug 2022 00:42:35 +0000 (17:42 -0700)]
gvc gvprintpointflist: rewrite for clarity

The unusual structure of the loop in this function made it appear as if it was
intending to cope with e.g. an `n` of 0 but still print the first element of
`p`. Surveying the callers of `gvprintpointflist`, we can see it is never used
this way. So we can write it simpler and more readably.

2 years agoMerge branch 'smattr/921086b7-d71e-45a0-b85e-66a3a5f41532' into 'main'
Matthew Fernandez [Sun, 21 Aug 2022 18:47:03 +0000 (18:47 +0000)]
Merge branch 'smattr/921086b7-d71e-45a0-b85e-66a3a5f41532' into 'main'

GD plugin warninig squashing

See merge request graphviz/graphviz!2799

2 years agoGD plugin gd_loadimage_cairo: realign some types with their values
Matthew Fernandez [Sat, 20 Aug 2022 04:15:49 +0000 (21:15 -0700)]
GD plugin gd_loadimage_cairo: realign some types with their values

Squashes 4 -Wsign-conversion warnings that were occurring from mixing signed and
unsigned ints.

2 years agoGD plugin: squash -Wmissing-prototypes warnings for 'gd_psfontResolve'
Matthew Fernandez [Sat, 20 Aug 2022 04:02:37 +0000 (21:02 -0700)]
GD plugin: squash -Wmissing-prototypes warnings for 'gd_psfontResolve'

2 years agoGD plugin doSphere: remove unused parameters
Matthew Fernandez [Sat, 20 Aug 2022 03:52:10 +0000 (20:52 -0700)]
GD plugin doSphere: remove unused parameters

2 years agoGD plugin doSphere: remove commented out code
Matthew Fernandez [Sat, 20 Aug 2022 03:48:14 +0000 (20:48 -0700)]
GD plugin doSphere: remove commented out code

2 years agoGD plugin: squash -Wunused-parameter warnings
Matthew Fernandez [Sat, 20 Aug 2022 03:46:19 +0000 (20:46 -0700)]
GD plugin: squash -Wunused-parameter warnings

These functions are used as callbacks, so their parameters cannot easily be
removed.

2 years agoGD plugin: squash -Wmissing-prototypes warning
Matthew Fernandez [Sat, 20 Aug 2022 03:42:52 +0000 (20:42 -0700)]
GD plugin: squash -Wmissing-prototypes warning

2 years agoGD plugin gdgen_missingfont: remove unused 'err' parameter
Matthew Fernandez [Sat, 20 Aug 2022 03:30:13 +0000 (20:30 -0700)]
GD plugin gdgen_missingfont: remove unused 'err' parameter

2 years agoGD plugin gdgen_end_page: squash -Wswitch-default warning
Matthew Fernandez [Sat, 20 Aug 2022 03:28:42 +0000 (20:28 -0700)]
GD plugin gdgen_end_page: squash -Wswitch-default warning

This switch is exhaustive.

2 years agoGD plugin gdgen_end_page: squash -Wmissing-field-initializers warning
Matthew Fernandez [Sat, 20 Aug 2022 03:26:21 +0000 (20:26 -0700)]
GD plugin gdgen_end_page: squash -Wmissing-field-initializers warning

2 years agoMerge branch 'smattr/gitlab-2257' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 17:28:25 +0000 (17:28 +0000)]
Merge branch 'smattr/gitlab-2257' into 'main'

remove $GV_FILE_PATH support

Closes #2257

See merge request graphviz/graphviz!2794

2 years agoremove $GV_FILE_PATH support
Matthew Fernandez [Tue, 16 Aug 2022 02:19:29 +0000 (19:19 -0700)]
remove $GV_FILE_PATH support

The `$GV_FILE_PATH` environment variable could be set to sandbox Graphviz’
ability to read and write to the file system. This made sense once upon a time,
but the world around Graphviz has shifted. Sandboxing yourself is no longer as
valuable a proposition as an external sandboxer that can be more easily audited.
Platforms’ ecosystems have matured to support this use case (Capsicum on
FreeBSD, Seccomp on Linux, App Sandbox on macOS, Pledge on OpenBSD, …).

This change makes any attempt to use `$GV_FILE_PATH` “fail-closed,” in the
sense that execution will be aborted. This may be surprising and not what the
user intended, but this conservatively guarantees safety: you can never think
you have enabled `$GV_FILE_PATH`-based sandboxing and be instead running
unguarded.

Gitlab: closes #2257

2 years agoadd a test case for #2257
Matthew Fernandez [Tue, 16 Aug 2022 01:22:32 +0000 (18:22 -0700)]
add a test case for #2257

2 years agoMerge branch 'smattr/c33cd902-b3b8-4865-847d-ad832d997c4f' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 16:29:09 +0000 (16:29 +0000)]
Merge branch 'smattr/c33cd902-b3b8-4865-847d-ad832d997c4f' into 'main'

start 6.0.0 development

See merge request graphviz/graphviz!2800

2 years agostart 6.0.0 development
Matthew Fernandez [Sat, 20 Aug 2022 14:42:29 +0000 (07:42 -0700)]
start 6.0.0 development

This starts 6.0.0 rather than 5.0.2 because we know we are immediately about to
merge something breaking (`$GV_FILE_PATH` removal).