]> granicus.if.org Git - graphviz/log
graphviz
2 years agotests: test_utilities: declare unmodified parameter const
Magnus Jacobsson [Tue, 23 Aug 2022 11:52:45 +0000 (13:52 +0200)]
tests: test_utilities: declare unmodified parameter const

2 years agotests: SVGAnalyzer: add handling of the 'fill-opacity' attribute
Magnus Jacobsson [Wed, 10 Aug 2022 14:40:44 +0000 (16:40 +0200)]
tests: SVGAnalyzer: add handling of the 'fill-opacity' attribute

2 years agotests: SVGAnalyzer: add support for retrieving the Graphviz edge color
Magnus Jacobsson [Tue, 23 Aug 2022 08:55:14 +0000 (10:55 +0200)]
tests: SVGAnalyzer: add support for retrieving the Graphviz edge color

2 years agotests: SVGAnalyzer: add support for retrieving the Graphviz node color
Magnus Jacobsson [Wed, 10 Aug 2022 13:54:00 +0000 (15:54 +0200)]
tests: SVGAnalyzer: add support for retrieving the Graphviz node color

2 years agotests: SVGAnalyzer: factor out rgb_to_hex() and add support for opacity
Magnus Jacobsson [Thu, 11 Aug 2022 18:51:55 +0000 (20:51 +0200)]
tests: SVGAnalyzer: factor out rgb_to_hex() and add support for opacity

2 years agotests: SVGAnalyzer: clarify comment
Magnus Jacobsson [Tue, 23 Aug 2022 11:26:37 +0000 (13:26 +0200)]
tests: SVGAnalyzer: clarify comment

2 years agotests: SVGAnalyzer: add handling of the 'stroke-opacity' attribute
Magnus Jacobsson [Wed, 10 Aug 2022 12:33:02 +0000 (14:33 +0200)]
tests: SVGAnalyzer: add handling of the 'stroke-opacity' attribute

2 years agotests: SVGAnalyzer: add support for retrieving the Graphviz edge penwidth
Magnus Jacobsson [Tue, 23 Aug 2022 08:26:24 +0000 (10:26 +0200)]
tests: SVGAnalyzer: add support for retrieving the Graphviz edge penwidth

2 years agotests: SVGAnalyzer: add support for retrieving the Graphviz node penwidth
Magnus Jacobsson [Wed, 10 Aug 2022 09:26:23 +0000 (11:26 +0200)]
tests: SVGAnalyzer: add support for retrieving the Graphviz node penwidth

2 years agotests: SVGAnalyzer: add handling of the 'stroke-width' attribute
Magnus Jacobsson [Wed, 10 Aug 2022 07:36:08 +0000 (09:36 +0200)]
tests: SVGAnalyzer: add handling of the 'stroke-width' attribute

2 years agotests: SVGAnalyzer: add 're_create_and_verify_svg' method and use in test_svg_analyzer
Magnus Jacobsson [Sat, 20 Aug 2022 16:12:54 +0000 (18:12 +0200)]
tests: SVGAnalyzer: add 're_create_and_verify_svg' method and use in test_svg_analyzer

Upcoming commits will extend the SVG analyzer's ability to handle new
SVG attributes and add new test cases verifying its ability to
re-create correct SVG containing those attributes. This change will
facilitate the creation of those tests and keep the code DRY.

2 years agotests: SVGAnalyzer: extend 'make_from_dot' method and use in test_svg_analyzer
Magnus Jacobsson [Sat, 20 Aug 2022 16:12:54 +0000 (18:12 +0200)]
tests: SVGAnalyzer: extend 'make_from_dot' method and use in test_svg_analyzer

This change adds support to the SVGAnalyzer for saving a
copy of the Graphviz version and build ID which are needed to exactly
re-create the SVG document.

Upcoming commits will extend the SVG analyzer's ability to handle new
SVG attributes and add new test cases verifying its ability to
re-create correct SVG containing those attributes. This change will
facilitate the creation of those tests and keep the code DRY.

2 years agotests: SVGAnalyzer: save a copy of the original SVG and give access to it
Magnus Jacobsson [Fri, 2 Sep 2022 09:57:40 +0000 (11:57 +0200)]
tests: SVGAnalyzer: save a copy of the original SVG and give access to it

This is needed to be able to verify the SVG re-creating capablility of
the SVGAnalyzer.

Upcoming commits will extend the SVG analyzer's ability to handle new
SVG attributes and add new test cases verifying its ability to
re-create correct SVG containing those attributes. This change will
facilitate the creation of those tests and keep the code DRY.

The copying is necessary since the original SVG is modified by the XML
parser in destructive mode. See
http://rapidxml.sourceforge.net/manual.html#namespacerapidxml_1destructive_non_destructive
and we don't want to use the non-destructive mode since no entity
reference translation is done then and we want to avoid having to do
that ourselves.

2 years agotests: SVGAnalyzer: add 'make_from_dot' static method and use in test_rankdir
Magnus Jacobsson [Tue, 23 Aug 2022 07:11:02 +0000 (09:11 +0200)]
tests: SVGAnalyzer: add 'make_from_dot' static method and use in test_rankdir

Upcoming commits will add several new test cases doing exactly
that. This change will keep those tests short and DRY.

2 years agoMerge branch 'minor-cleanup-of-svg-analyzer' into 'main'
Magnus Jacobsson [Tue, 30 Aug 2022 21:12:13 +0000 (21:12 +0000)]
Merge branch 'minor-cleanup-of-svg-analyzer' into 'main'

Minor cleanup of the SVG analyzer

See merge request graphviz/graphviz!2810

2 years agotests: SVGAnalyzer: use fmt::format instead of string concatenation
Magnus Jacobsson [Wed, 24 Aug 2022 11:00:56 +0000 (13:00 +0200)]
tests: SVGAnalyzer: use fmt::format instead of string concatenation

2 years agotests: SVGAnalyzer: correct comment
Magnus Jacobsson [Wed, 24 Aug 2022 11:00:30 +0000 (13:00 +0200)]
tests: SVGAnalyzer: correct comment

2 years agotests: SVGAnalyzer: avoid string copy by taking reference instead
Magnus Jacobsson [Wed, 24 Aug 2022 11:00:07 +0000 (13:00 +0200)]
tests: SVGAnalyzer: avoid string copy by taking reference instead

2 years agotests: test_svg_analyzer: remove useless string copy
Magnus Jacobsson [Wed, 17 Aug 2022 18:30:26 +0000 (20:30 +0200)]
tests: test_svg_analyzer: remove useless string copy

Despite its name, 'shape_char_ptr' was already a std::string.

2 years agotests: test_svg_analyzer: Update test description
Magnus Jacobsson [Sat, 20 Aug 2022 21:11:10 +0000 (23:11 +0200)]
tests: test_svg_analyzer: Update test description

2 years agotests: test_svg_analyzer: remove useless include of graphviz_graph.h
Magnus Jacobsson [Fri, 26 Aug 2022 11:19:08 +0000 (13:19 +0200)]
tests: test_svg_analyzer: remove useless include of graphviz_graph.h

2 years agotests: rename variables '.*svgAnalyzer' to '.*svg_analyzer'
Magnus Jacobsson [Sat, 20 Aug 2022 21:16:06 +0000 (23:16 +0200)]
tests: rename variables '.*svgAnalyzer' to '.*svg_analyzer'

Almost no other variables use camel case.

2 years agotests: SVGAnalyzer: add some comments
Magnus Jacobsson [Tue, 23 Aug 2022 15:18:17 +0000 (17:18 +0200)]
tests: SVGAnalyzer: add some comments

2 years agotests: SVGAnalyzer: use fmt::format instead of string concatenation
Magnus Jacobsson [Tue, 23 Aug 2022 15:20:50 +0000 (17:20 +0200)]
tests: SVGAnalyzer: use fmt::format instead of string concatenation

2 years agotests: test_rankdir: remove useless generation of copy
Magnus Jacobsson [Tue, 23 Aug 2022 19:09:44 +0000 (21:09 +0200)]
tests: test_rankdir: remove useless generation of copy

The generator expression will not outlive the scope of
'node_shapes_without_svg_shape' or 'all_node_shapes' which both live
in the global scope, so copying is unnecessary.

For details, see
https://github.com/catchorg/Catch2/blob/devel/docs/generators.md#provided-generators.

2 years agoMerge branch 'smattr/cc0c1b4c-ccdf-48a9-adc6-8c301067068a' into 'main'
Matthew Fernandez [Tue, 30 Aug 2022 15:51:20 +0000 (15:51 +0000)]
Merge branch 'smattr/cc0c1b4c-ccdf-48a9-adc6-8c301067068a' into 'main'

gvpr: fix: wrap members needing cleanup in a struct and outline

Closes #1801

See merge request graphviz/graphviz!2817

2 years agogvpr: more tightly scope 'nextg'
Matthew Fernandez [Sun, 28 Aug 2022 03:18:07 +0000 (20:18 -0700)]
gvpr: more tightly scope 'nextg'

This squashes a -Wclobbered compiler warning. Though, as discussed in the prior
commit, I believe this to be a false positive.

As of this commit, Graphviz builds free of -Wclobbered warnings.

Gitlab: closes #1801

2 years agogvpr: fix: wrap members needing cleanup in a struct and outline
Matthew Fernandez [Sun, 28 Aug 2022 03:04:07 +0000 (20:04 -0700)]
gvpr: fix: wrap members needing cleanup in a struct and outline

When seeing this code, the compiler emitted numerous warnings like:

  gvpr.c: In function ‘gvpr’:
  gvpr.c:929:17: warning: variable ‘prog’ might be clobbered by
    ‘longjmp’ or ‘vfork’ [-Wclobbered]
       parse_prog *prog = 0;
                   ^~~~

What it is trying to tell us is that this code violates the assumptions of
`setjmp`/`longjmp`. Referencing any non-volatile stack-allocated variable after
a `longjmp` is undefined behavior.¹

This change extracts all the members that need to be referenced after `longjmp`
into a wrapper function. This basically puts a function call boundary in a place
such that the code no longer violates assumptions of the C standard. It is a
little awkward that we have to do this by hand, as the transformation is
mechanical and the compiler technically has enough information to do this for
us. But `setjmp`/`longjmp` come from the old world and are low level mechanisms.
If the compiler sees a call to them, it assumes you are doing something unusual
and want to do it exactly as you wrote.

While making this adjustment, some white space is adjusted and some coercion to
boolean is changed to explicit comparisons against `NULL`.

I do not understand why, but after this change the compiler still believes
`nextg` can be clobbered by a `longjmp`. While this is true, `nextg` is not used
after `longjmp`-ing back to `gvpr_core`, so I do not know why the compiler
thinks it needs to warn us about this.

Gitlab: #1801

¹ This restriction stems from how `setjmp`/`longjmp` work on certain platforms.
  If a variable is live in a register instead of on the stack, it is not
  guaranteed to be restored during a `longjmp`. Hence why the value of such
  variables is undefined after a `longjmp`.

2 years agoMerge branch 'smattr/bdd2e8b6-9a48-4e33-815d-2c049a7ca7f2' into 'main'
Matthew Fernandez [Tue, 30 Aug 2022 14:52:56 +0000 (14:52 +0000)]
Merge branch 'smattr/bdd2e8b6-9a48-4e33-815d-2c049a7ca7f2' into 'main'

cmd/tools: use cgraph wrappers for allocation

See merge request graphviz/graphviz!2818

2 years agogml2gv gmlparse: fix unchecked allocation failures
Matthew Fernandez [Sun, 28 Aug 2022 16:10:32 +0000 (09:10 -0700)]
gml2gv gmlparse: fix unchecked allocation failures

2 years agogml2gv gmlscan: fix unchecked allocation failures
Matthew Fernandez [Sun, 28 Aug 2022 16:09:10 +0000 (09:09 -0700)]
gml2gv gmlscan: fix unchecked allocation failures

2 years agodijkstra init: fix unchecked allocation failure
Matthew Fernandez [Sun, 28 Aug 2022 16:08:00 +0000 (09:08 -0700)]
dijkstra init: fix unchecked allocation failure

2 years agogvcolor color: fix unchecked allocation failure
Matthew Fernandez [Sun, 28 Aug 2022 16:04:12 +0000 (09:04 -0700)]
gvcolor color: fix unchecked allocation failure

2 years agogxl2gv endElementHandler: use cgraph wrapper for allocation
Matthew Fernandez [Sun, 28 Aug 2022 15:59:58 +0000 (08:59 -0700)]
gxl2gv endElementHandler: use cgraph wrapper 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.

2 years agogml2gv mkAttr: fix unchecked allocation failures
Matthew Fernandez [Sun, 28 Aug 2022 15:52:50 +0000 (08:52 -0700)]
gml2gv mkAttr: fix unchecked allocation failures

2 years agogml2gv mkEdge: fix unchecked allocation failure
Matthew Fernandez [Sun, 28 Aug 2022 15:52:24 +0000 (08:52 -0700)]
gml2gv mkEdge: fix unchecked allocation failure

2 years agogml2gv mkNode: fix unchecked allocation failure
Matthew Fernandez [Sun, 28 Aug 2022 15:51:53 +0000 (08:51 -0700)]
gml2gv mkNode: fix unchecked allocation failure

2 years agogml2gv pushG: fix unchecked allocation failuregml2gv pushG: fix unchecked allocation...
Matthew Fernandez [Sun, 28 Aug 2022 15:51:21 +0000 (08:51 -0700)]
gml2gv pushG: fix unchecked allocation failuregml2gv pushG: fix unchecked allocation failure

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