]> granicus.if.org Git - graphviz/log
graphviz
22 months agoMerge branch 'smattr/da153968-40d4-4aae-8523-b69db94f12b3' into 'main' main
Matthew Fernandez [Mon, 30 Jan 2023 16:33:36 +0000 (16:33 +0000)]
Merge branch 'smattr/da153968-40d4-4aae-8523-b69db94f12b3' into 'main'

remove some 'sprintf' usage

See merge request graphviz/graphviz!3071

22 months agodotgen: remove unnecessary parens
Matthew Fernandez [Sat, 28 Jan 2023 16:55:11 +0000 (08:55 -0800)]
dotgen: remove unnecessary parens

22 months agodotgen pf2s: replace 'sprintf' into a raw buffer with 'agxbprint'
Matthew Fernandez [Sat, 28 Jan 2023 16:51:55 +0000 (08:51 -0800)]
dotgen pf2s: replace 'sprintf' into a raw buffer with 'agxbprint'

Gitlab: #1950

22 months agocommon: remove unnecessary parens
Matthew Fernandez [Sat, 28 Jan 2023 16:48:50 +0000 (08:48 -0800)]
common: remove unnecessary parens

22 months agocommon emit_edge_label: abbreviate an 'UNREACHABLE' pattern
Matthew Fernandez [Sat, 28 Jan 2023 16:44:13 +0000 (08:44 -0800)]
common emit_edge_label: abbreviate an 'UNREACHABLE' pattern

22 months agocommon emit_edge_label: replace manual buffer allocation with an agxbuf
Matthew Fernandez [Sat, 28 Jan 2023 16:42:51 +0000 (08:42 -0800)]
common emit_edge_label: replace manual buffer allocation with an agxbuf

Gitlab: #1950

22 months agocommon fullColor: mark function inputs const
Matthew Fernandez [Sat, 28 Jan 2023 16:38:06 +0000 (08:38 -0800)]
common fullColor: mark function inputs const

22 months agocommon fullColor: use an agxbuf instead of a static buffer
Matthew Fernandez [Sat, 28 Jan 2023 16:36:48 +0000 (08:36 -0800)]
common fullColor: use an agxbuf instead of a static buffer

This improves safety by removing an `sprintf` usage as well as removing a long
lived static buffer that can prove problematic for tools like Valgrind and
Address Sanitizer.

Gitlab: #1950

22 months agomm2gv hue2rgb: write output to an agxbuf instead of a raw string
Matthew Fernandez [Sat, 28 Jan 2023 16:29:29 +0000 (08:29 -0800)]
mm2gv hue2rgb: write output to an agxbuf instead of a raw string

This allows removing an `sprintf` call as well as a further temporary buffer.

Gitlab: #1950

22 months agomm2gv makeDotGraph: use a C99 bool for 'first'
Matthew Fernandez [Sat, 28 Jan 2023 16:22:47 +0000 (08:22 -0800)]
mm2gv makeDotGraph: use a C99 bool for 'first'

22 months agomm2gv makeDotGraph: replace 'MAX', 'MIN' with standard 'fmax', 'fmin'
Matthew Fernandez [Sat, 28 Jan 2023 16:22:47 +0000 (08:22 -0800)]
mm2gv makeDotGraph: replace 'MAX', 'MIN' with standard 'fmax', 'fmin'

22 months agomm2gv makeDotGraph: replace 'sprintf' with 'agxbprint'
Matthew Fernandez [Sat, 28 Jan 2023 16:22:47 +0000 (08:22 -0800)]
mm2gv makeDotGraph: replace 'sprintf' with 'agxbprint'

Given this function already has an agxbuf that was not in use while needing to
construct these temporaries, we can reuse it to avoid allocating a separate
buffer on the stack. This also improves safety by avoiding `sprintf`.

Gitlab: #1950

22 months agoMerge branch 'smattr/0061fab9-9497-4b47-9037-9dae8b700455' into 'main'
Matthew Fernandez [Sun, 29 Jan 2023 22:16:45 +0000 (22:16 +0000)]
Merge branch 'smattr/0061fab9-9497-4b47-9037-9dae8b700455' into 'main'

more cgraph alloc wrapper migration, warning squashing

See merge request graphviz/graphviz!3068

22 months agoneatogen: remove unnecessary parens
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
neatogen: remove unnecessary parens

22 months agoneatogen scan_graph_mode: swap 'MAX' call for standard 'fmax'
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
neatogen scan_graph_mode: swap 'MAX' call for standard 'fmax'

22 months agoneatogen shortest_path: use cgraph wrapper for allocation
Matthew Fernandez [Mon, 26 Dec 2022 05:41:23 +0000 (21:41 -0800)]
neatogen shortest_path: 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.

22 months agoneatogen scan_graph_mode: use cgraph wrappers for allocation
Matthew Fernandez [Mon, 26 Dec 2022 05:41:23 +0000 (21:41 -0800)]
neatogen scan_graph_mode: 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.

22 months agoneatogen new_3array: use cgraph wrappers for allocation
Matthew Fernandez [Mon, 26 Dec 2022 05:41:23 +0000 (21:41 -0800)]
neatogen new_3array: 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.

22 months agoneatogen new_array: use cgraph wrappers for allocation
Matthew Fernandez [Mon, 26 Dec 2022 05:41:23 +0000 (21:41 -0800)]
neatogen new_array: 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.

22 months agosmyrna EmbedText: squash some compiler warnings
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
smyrna EmbedText: squash some compiler warnings

This switch is exhaustive. This change squashes the following warnings:

  draw.c:341:9: warning: switch missing default case [-Wswitch-default]
    341 |         switch (o->op.u.text.align)
        |         ^~~~~~
  draw.c:374:9: warning: ‘x’ may be used uninitialized in this function
    [-Wmaybe-uninitialized]
    374 |         glCompDrawText3D(o->font,x,y,view->Topview->global_z…
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~…

22 months agoneatogen makeObstacle: squash -Wmaybe-uninitialized warnings
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
neatogen makeObstacle: squash -Wmaybe-uninitialized warnings

This seems to be a false positive, but to figure this out requires non-trivial
reasoning about the control flow in this function. We may as well remove the
need to think about this. This squashes these warnings:

  neatosplines.c: In function ‘makeObstacle’:
  neatosplines.c:360:37: warning: ‘margin.y’ may be used uninitialized in this
    function [-Wmaybe-uninitialized]
    360 |                             ymargin = -margin.y;
        |                             ~~~~~~~~^~~~~~~~~~~
  neatosplines.c:351:37: warning: ‘margin.x’ may be used uninitialized in this
    function [-Wmaybe-uninitialized]
    351 |                             xmargin = -margin.x;
        |                             ~~~~~~~~^~~~~~~~~~~

22 months agoMerge branch 'smattr/7e644712-6315-410d-bc32-b5d6b2e26465' into 'main'
Matthew Fernandez [Sun, 29 Jan 2023 17:12:16 +0000 (17:12 +0000)]
Merge branch 'smattr/7e644712-6315-410d-bc32-b5d6b2e26465' into 'main'

dotgen: warning squashing and clean up

See merge request graphviz/graphviz!3069

22 months agocommon selfRight: remove useless 'return'
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
common selfRight: remove useless 'return'

22 months agocommon selfTop: remove useless 'return'
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
common selfTop: remove useless 'return'

22 months agodotgen cl_vninside: use a more appropriate return type
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen cl_vninside: use a more appropriate return type

22 months agodotgen cl_vninside: remove redundant casts
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen cl_vninside: remove redundant casts

ebd6191b0eec6e23d96c92aaa06212de339207e3 made these casts no-ops.

22 months agodotgen adjustregularpath: remove unnecessary use of comma operator
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen adjustregularpath: remove unnecessary use of comma operator

22 months agodotgen adjustregularpath: perform computation in double range
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen adjustregularpath: perform computation in double range

The truncation/rounding to `int` within this function appears unintentional.

22 months agodotgen adjustregularpath: remove misleading comment fragment
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen adjustregularpath: remove misleading comment fragment

This function has never contained any ifdef-ed section.

22 months agodotgen leftOf: remove incorrect description of this function as 'ccw'
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen leftOf: remove incorrect description of this function as 'ccw'

22 months agodotgen leftOf: use a more appropriate return type
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen leftOf: use a more appropriate return type

22 months agodotgen leftOf: perform computation in double range
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen leftOf: perform computation in double range

It is not clear to me why this code was implicitly converting the result of its
computation to `int`. Doing the entire thing in `double` is more precise and
squashes a compiler warning.

22 months agodotgen make_flat_bottom_edges: use a clearer type for 'use_splines'
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen make_flat_bottom_edges: use a clearer type for 'use_splines'

22 months agodotgen make_flat_bottom_edges: remove shadowing of 'splines' global
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen make_flat_bottom_edges: remove shadowing of 'splines' global

22 months agodotgen make_flat_adj_edges: remove shadowing of 'n' variable
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen make_flat_adj_edges: remove shadowing of 'n' variable

22 months agodotgen _dot_splines: remove micro-optimization for single edge
Matthew Fernandez [Thu, 8 Sep 2022 00:27:49 +0000 (17:27 -0700)]
dotgen _dot_splines: remove micro-optimization for single edge

This code was attempting to avoid heap allocation when dealing with a single
edge. This kind of micro-optimization is unnecessary with modern
allocators/compilers. The cost of anything here is most likely irrelevant
compared to the massive size of the containing function.

22 months agoMerge branch 'smattr/gitlab-1311' into 'main'
Matthew Fernandez [Sun, 29 Jan 2023 16:18:46 +0000 (16:18 +0000)]
Merge branch 'smattr/gitlab-1311' into 'main'

fix: exit when erroring during HTML lexing

Closes #1311

See merge request graphviz/graphviz!3072

22 months agofix: exit when erroring during HTML lexing
Matthew Fernandez [Sat, 28 Jan 2023 19:10:08 +0000 (11:10 -0800)]
fix: exit when erroring during HTML lexing

Labels can be either plain text or HTML-like labels (`<`, `>` delimited). When
parsing an HTML-like label, the lexer would return the same result for a warning
or an error. This meant the caller would attempt to fallback to a plain text
label in either case. But when the HTML lexer has errored, the input has been
determined unparseable. Falling back to parsing a plain text label is unlikely
to work, and even if it does it produces something that is certainly not what
the user intended. In most scenarios, this fallback behavior would go onto to
crash messily, now that labels were populated with garbage data.

This change simply teaches the calling code to notice the error and exit instead
of falling back. Exiting from within library code like this is not particularly
clean or desirable, but there is no easy elegant error path from this code.

Gitlab: fixes #1311
Reported-by: Google Autofuzz project
22 months agoMerge branch 'smattr/gitlab-510' into 'main'
Matthew Fernandez [Sun, 29 Jan 2023 15:29:30 +0000 (15:29 +0000)]
Merge branch 'smattr/gitlab-510' into 'main'

support an alpha channel when parsing HSV colors

Closes #510

See merge request graphviz/graphviz!3073

22 months agocommon colorxlate: replace a long lived buffer with an agxbuf
Matthew Fernandez [Sun, 29 Jan 2023 01:39:17 +0000 (17:39 -0800)]
common colorxlate: replace a long lived buffer with an agxbuf

This is not performance sensitive code. Using an agxbuf makes this logic clearer
and less error prone.

22 months agogvpr colorxlate: use a char for 'c'
Matthew Fernandez [Sun, 29 Jan 2023 01:39:17 +0000 (17:39 -0800)]
gvpr colorxlate: use a char for 'c'

Similar to the previous commit, this allows dropping some casts.

22 months agogvpr colorxlate: use a char pointer for 'p'
Matthew Fernandez [Sun, 29 Jan 2023 01:39:17 +0000 (17:39 -0800)]
gvpr colorxlate: use a char pointer for 'p'

It is not clear why this was an `unsigned char*`. Nothing in this function
relies on unsigned semantics. Making it a `const char*` allows dropping various
casts.

22 months agogvpr colorxlate: replace a long lived buffer with an agxbuf
Matthew Fernandez [Sun, 29 Jan 2023 01:39:17 +0000 (17:39 -0800)]
gvpr colorxlate: replace a long lived buffer with an agxbuf

This is not performance sensitive code. Using an agxbuf makes this logic clearer
and less error prone.

22 months agogvpr: remove unnecessary 'agxbinit' calls
Matthew Fernandez [Sun, 29 Jan 2023 01:29:46 +0000 (17:29 -0800)]
gvpr: remove unnecessary 'agxbinit' calls

Zero-initialization already does this work.

22 months agosupport an alpha channel when parsing HSV colors
Matthew Fernandez [Sun, 29 Jan 2023 01:26:44 +0000 (17:26 -0800)]
support an alpha channel when parsing HSV colors

Mysteriously c4205c6e132efe64f23211fe885ff37209bc6ac0 implemented this, but only
for GVPR programs. As a result, full HSVA colors could be used in GVPR programs
but specifying an HSVA color in DOT required manually translating the color to
RGBA.

This change aligns DOT color parsing with how GVPR color parsing works.

Gitlab: closes #510
Reported-by: Ryan Schmidt <gitlab@ryandesign.com>
22 months agoadd a test case for HSV with an alpha channel
Matthew Fernandez [Sun, 29 Jan 2023 01:18:51 +0000 (17:18 -0800)]
add a test case for HSV with an alpha channel

Gitlab: #510

22 months agoMerge remote-tracking branch 'refs/remotes/origin/main'
Stephen C North [Sat, 28 Jan 2023 21:40:14 +0000 (16:40 -0500)]
Merge remote-tracking branch 'refs/remotes/origin/main'

22 months agoEdit comments on support.
Stephen C North [Sat, 28 Jan 2023 21:34:51 +0000 (16:34 -0500)]
Edit comments on support.

22 months agoMerge branch 'smattr/879a891d-9d2b-4d71-921b-e53151dd180d' into 'main'
Matthew Fernandez [Sat, 28 Jan 2023 07:39:15 +0000 (07:39 +0000)]
Merge branch 'smattr/879a891d-9d2b-4d71-921b-e53151dd180d' into 'main'

graphml2gv, gv2gxl: 'sprintf' replacement and bug fixing

See merge request graphviz/graphviz!3066

22 months agogv2gxl createNodeId: replace char buffer with an agxbuf
Matthew Fernandez [Sun, 22 Jan 2023 18:57:40 +0000 (10:57 -0800)]
gv2gxl createNodeId: replace char buffer with an agxbuf

This removes an assumption that `SMALLBUF` is large enough to fit the printed
string. Performance should be unaffected as agxbuf can store a string of the
length printed here inline.

Gitlab: related to #1950

22 months agogv2gxl createGraphId: replace char buffer with an agxbuf
Matthew Fernandez [Sun, 22 Jan 2023 18:57:40 +0000 (10:57 -0800)]
gv2gxl createGraphId: replace char buffer with an agxbuf

This removes an assumption that `SMALLBUF` is large enough to fit the printed
string. Performance should be unaffected as agxbuf can store a string of the
length printed here inline.

Gitlab: related to #1950

22 months agogv2gxl: abbreviate some open coded 'startswith'
Matthew Fernandez [Sun, 22 Jan 2023 18:52:51 +0000 (10:52 -0800)]
gv2gxl: abbreviate some open coded 'startswith'

22 months agogv2gxl: remove unused 'GXL_ATTR_LEN'
Matthew Fernandez [Sun, 22 Jan 2023 18:50:50 +0000 (10:50 -0800)]
gv2gxl: remove unused 'GXL_ATTR_LEN'

This has never been used.

22 months agogv2gxl writeHdr: fix memory leak
Matthew Fernandez [Sun, 22 Jan 2023 18:48:50 +0000 (10:48 -0800)]
gv2gxl writeHdr: fix memory leak

Gitlab: #1950

22 months agogv2gxl writeHdr: fix use after free
Matthew Fernandez [Sun, 22 Jan 2023 18:43:41 +0000 (10:43 -0800)]
gv2gxl writeHdr: fix use after free

This call to `free` looked like it was deallocating the earlier allocation
within this function. But at this point `bp` points to the return value of a
call to `addid`. This return value is a `name` member of an item stored in the
`idList` dictionary that is still in use.

The original allocated memory of `bp` was and still is leaked.

22 months agogv2gxl createEdgeId: use an agxbuf to avoid 'sprintf'
Matthew Fernandez [Sun, 22 Jan 2023 18:34:31 +0000 (10:34 -0800)]
gv2gxl createEdgeId: use an agxbuf to avoid 'sprintf'

This leads to clearer and less error prone code.

Gitlab: #1950

22 months agographml2gv nameOf: use an agxbuf instead of raw char buffer for names
Matthew Fernandez [Sun, 15 Jan 2023 22:13:19 +0000 (14:13 -0800)]
graphml2gv nameOf: use an agxbuf instead of raw char buffer for names

This leads to slightly simpler code and fewer things to worry about. Tihs is the
equivalent of cd2f8dfd34d4a4ddae1bb94b72098c05d73cfd4e.

Gitlab: #1950

22 months agoMerge branch 'gts_link_libs' into 'main'
Matthew Fernandez [Fri, 27 Jan 2023 01:04:18 +0000 (01:04 +0000)]
Merge branch 'gts_link_libs' into 'main'

GTS Support: s/GTS_LIBRARIES/GTS_LINK_LIBRARIES/g

See merge request graphviz/graphviz!3067

22 months agoGTS Support: s/GTS_LIBRARIES/GTS_LINK_LIBRARIES/g
Nehal J Wani [Sun, 22 Jan 2023 13:00:34 +0000 (13:00 +0000)]
GTS Support: s/GTS_LIBRARIES/GTS_LINK_LIBRARIES/g

The argument to target_link_libraries() in lib/neatogen/CMakeLists.txt
uses GTS_LINK_LIBRARIES, not GTS_LIBRARIES

The FindGTS module was added in commit cef299eb
The issue was found while building Graphviz on Windows with GTS

22 months agoMerge branch 'smattr/540f82d6-7f1c-4304-82d9-7a4f002c85e7' into 'main'
Matthew Fernandez [Thu, 26 Jan 2023 04:09:23 +0000 (04:09 +0000)]
Merge branch 'smattr/540f82d6-7f1c-4304-82d9-7a4f002c85e7' into 'main'

remove legacy Dotty, Lefty, Lneato files

See merge request graphviz/graphviz!3065

22 months agoremove dead links to Dotty, Lefty, Lneato man page PDFs
Matthew Fernandez [Sun, 22 Jan 2023 00:56:34 +0000 (16:56 -0800)]
remove dead links to Dotty, Lefty, Lneato man page PDFs

The code that generates these files was removed in
b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove man page references to Dotty
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove man page references to Dotty

Dotty was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove lefty-grace contrib tool
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove lefty-grace contrib tool

This tool was an enhancement to Lefty that was removed in
b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove legacy Dotty docs
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove legacy Dotty docs

Dotty was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove legacy Lneato Windows files
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove legacy Lneato Windows files

Lneato was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove legacy Dotty Windows files
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove legacy Dotty Windows files

Dotty was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove legacy Lefty Windows files
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove legacy Lefty Windows files

Lefty was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoremove legacy Lefty docs
Matthew Fernandez [Sun, 22 Jan 2023 00:41:42 +0000 (16:41 -0800)]
remove legacy Lefty docs

Lefty was removed in b2f287ca315dd5bf689d9ce2ca71dbfe63fb8a61.

22 months agoMerge branch 'smattr/gitlab-799' into 'main'
Matthew Fernandez [Thu, 26 Jan 2023 02:37:23 +0000 (02:37 +0000)]
Merge branch 'smattr/gitlab-799' into 'main'

remove VML output renderer

Closes #799

See merge request graphviz/graphviz!3064

22 months agoremove VML output renderer
Matthew Fernandez [Sun, 22 Jan 2023 01:04:06 +0000 (17:04 -0800)]
remove VML output renderer

Gitlab: closes #799

22 months agoMerge branch 'libgd_cmake' into 'main'
Matthew Fernandez [Mon, 23 Jan 2023 17:07:14 +0000 (17:07 +0000)]
Merge branch 'libgd_cmake' into 'main'

CMake: Similar to 3fcf0968, use gdlib.pc if available

See merge request graphviz/graphviz!3044

22 months agoCMake: Similar to 3fcf0968, use gdlib.pc if available
Nehal J Wani [Mon, 2 Jan 2023 14:04:33 +0000 (14:04 +0000)]
CMake: Similar to 3fcf0968, use gdlib.pc if available

The gdlib-config program is no longer installed with the newer versions
of the library as it is deprecated. The CMake build on CI for Fedora
prints the following, which is no longer the case with this patch:

   CMake Warning at cmake/FindGD.cmake:63 (message):
     gdlib-config not found; skipping feature checks
   Call Stack (most recent call first):
     contrib/diffimg/CMakeLists.txt:1 (find_package)

xref: https://github.com/libgd/libgd/issues/376#issuecomment-276138975

Edits from Matthew Fernandez:
 - Wrap CMake line
 - Adjust #1786 work arounds

Gitlab: #1786

22 months agoCI: suppress leak checks for libfontconfig
Nehal J Wani [Sun, 15 Jan 2023 01:52:03 +0000 (01:52 +0000)]
CI: suppress leak checks for libfontconfig

For posterity, the reported leak is:
  =================================================================
  ==14034==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 256 byte(s) in 1 object(s) allocated from:
      #0 0x7ff0354c190f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
      #1 0x7ff03523e61f in FcPatternObjectInsertElt /root/fontconfig/src/fcpat.c:525
      #2 0x7ff035240846 in FcPatternObjectAddWithBinding /root/fontconfig/src/fcpat.c:711
      #3 0x7ff035245970 in FcPatternAppend /root/fontconfig/src/fcpat.c:1262
      #4 0x7ff035270c77 in FcParsePattern /root/fontconfig/src/fcxml.c:3110
      #5 0x7ff035271292 in FcEndElement /root/fontconfig/src/fcxml.c:3236
      #6 0x7ff02b099354  (/lib/x86_64-linux-gnu/libxml2.so.2+0x17d354)

  Indirect leak of 32 byte(s) in 1 object(s) allocated from:
      #0 0x7ff0354c12d7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
      #1 0x7ff035239d8b in FcValueListCreate /root/fontconfig/src/fcpat.c:136
      #2 0x7ff035240433 in FcPatternObjectAddWithBinding /root/fontconfig/src/fcpat.c:687
      #3 0x7ff035245970 in FcPatternAppend /root/fontconfig/src/fcpat.c:1262
      #4 0x7ff035270c77 in FcParsePattern /root/fontconfig/src/fcxml.c:3110
      #5 0x7ff035271292 in FcEndElement /root/fontconfig/src/fcxml.c:3236
      #6 0x7ff02b099354  (/lib/x86_64-linux-gnu/libxml2.so.2+0x17d354)

  SUMMARY: AddressSanitizer: 288 byte(s) leaked in 2 allocation(s).

xref: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/295#note_1033797

23 months agoMerge branch 'smattr/gitlab-2344' into 'main'
Matthew Fernandez [Sun, 22 Jan 2023 03:29:31 +0000 (03:29 +0000)]
Merge branch 'smattr/gitlab-2344' into 'main'

gv2gxl, gxl2gv: fix mode detection on Windows

Closes #2344

See merge request graphviz/graphviz!3058

23 months agogv2gxl, gxl2gv: fix mode detection on Windows
Matthew Fernandez [Wed, 18 Jan 2023 04:24:56 +0000 (20:24 -0800)]
gv2gxl, gxl2gv: fix mode detection on Windows

Gitlab: fixes #2344

23 months agouse 'which' when accessing gv2gxl, gxl2gv in the test suite
Matthew Fernandez [Mon, 16 Jan 2023 03:24:30 +0000 (19:24 -0800)]
use 'which' when accessing gv2gxl, gxl2gv in the test suite

When running the Graphviz test suite on an installation that was built without
some optional components, calls to these missing components can incorrectly
resolve to those from a prior Graphviz installation that happens to be in your
`$PATH`. This issue was partly addressed in
515c86a923601db5cb704da93046800df7da030a. This change takes things further,
ensuring that invocations of `gv2gxl` and `gxl2gv` also land on the right
version under test.

This requires temporarily xfailing the test due to an unrelated issue with these
tools.

Gitlab: #2201, #2344

23 months agoMerge branch 'smattr/a1b8e698-f7ad-4b30-a48b-c30ea6f334e0' into 'main'
Matthew Fernandez [Sun, 22 Jan 2023 02:18:25 +0000 (02:18 +0000)]
Merge branch 'smattr/a1b8e698-f7ad-4b30-a48b-c30ea6f334e0' into 'main'

some extended guidance on testing

See merge request graphviz/graphviz!3057

23 months agofix typo in test assertion message
Matthew Fernandez [Mon, 16 Jan 2023 03:15:54 +0000 (19:15 -0800)]
fix typo in test assertion message

This looks to have been a mistake in 74238e979cecadf64e67c6f5bb822eae88278de0.

23 months agoextend documentation on Graphviz testing
Matthew Fernandez [Mon, 16 Jan 2023 03:08:12 +0000 (19:08 -0800)]
extend documentation on Graphviz testing

23 months agoglcomp: remove 'DEFAULT_GLUT_FONT'
Matthew Fernandez [Mon, 16 Jan 2023 00:50:44 +0000 (16:50 -0800)]
glcomp: remove 'DEFAULT_GLUT_FONT'

The last use of this was removed in 46d9ed13a72f626a8c59ca119868e8755210d2e7.

23 months agoMerge branch 'smattr/5821b3b1-1f91-487f-85cf-2fcdffdfc033' into 'main'
Matthew Fernandez [Sun, 22 Jan 2023 01:21:38 +0000 (01:21 +0000)]
Merge branch 'smattr/5821b3b1-1f91-487f-85cf-2fcdffdfc033' into 'main'

mingle, neatogen compiler warning squashing

See merge request graphviz/graphviz!3059

23 months agoneatogen: make 'overlap_scaling' static
Matthew Fernandez [Wed, 18 Jan 2023 16:38:39 +0000 (08:38 -0800)]
neatogen: make 'overlap_scaling' static

This function is unused outside of its containing file.

23 months agoneatogen overlap.c: squash some -Wunused-parameter warnings
Matthew Fernandez [Wed, 18 Jan 2023 16:34:52 +0000 (08:34 -0800)]
neatogen overlap.c: squash some -Wunused-parameter warnings

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

23 months agoneatogen: squash a -Wundef warning for 'DEBUG'
Matthew Fernandez [Wed, 18 Jan 2023 16:33:01 +0000 (08:33 -0800)]
neatogen: squash a -Wundef warning for 'DEBUG'

23 months agoneatogen compute_new_weights: remove redundant zeroing
Matthew Fernandez [Wed, 18 Jan 2023 16:30:16 +0000 (08:30 -0800)]
neatogen compute_new_weights: remove redundant zeroing

The `gv_calloc` allocation does this for us.

23 months agoneatogen common_neighbors: fix comment typo
Matthew Fernandez [Wed, 18 Jan 2023 16:30:02 +0000 (08:30 -0800)]
neatogen common_neighbors: fix comment typo

23 months agoneatogen common_neighbors: remove unused 'v' parameter
Matthew Fernandez [Wed, 18 Jan 2023 16:29:46 +0000 (08:29 -0800)]
neatogen common_neighbors: remove unused 'v' parameter

23 months agomingle nearest_neighbor_graph: squash warnings when building without libANN
Matthew Fernandez [Wed, 18 Jan 2023 16:24:45 +0000 (08:24 -0800)]
mingle nearest_neighbor_graph: squash warnings when building without libANN

23 months agomingle nearest_neighbor_graph: fix typo in parameter name
Matthew Fernandez [Wed, 18 Jan 2023 16:24:14 +0000 (08:24 -0800)]
mingle nearest_neighbor_graph: fix typo in parameter name

23 months agomingle edge_bundling: squash compilation warnings when building without libANN
Matthew Fernandez [Wed, 18 Jan 2023 16:22:35 +0000 (08:22 -0800)]
mingle edge_bundling: squash compilation warnings when building without libANN

23 months agoMerge branch 'smattr/gitlab-2338' into 'main'
Matthew Fernandez [Sun, 22 Jan 2023 00:16:51 +0000 (00:16 +0000)]
Merge branch 'smattr/gitlab-2338' into 'main'

sfio: make 'Sfio_t' definition entirely internal

Closes #2338

See merge request graphviz/graphviz!3060

23 months agosfio: make 'Sfio_t' definition entirely internal
Matthew Fernandez [Thu, 19 Jan 2023 16:24:02 +0000 (08:24 -0800)]
sfio: make 'Sfio_t' definition entirely internal

The definition of `Sfio_t` was structured to give it a public part and a private
part:

  struct _sfio_s {
    … public members …

    _SFIO_PRIVATE; // ← only visible if sfio_t.h is included
  };

This works only as long as no user ever allocates a `Sfio_t` themselves. If they
do, they will allocate too few bytes, based on their view of the size of
`Sfio_t` missing its private members.

A side effect of link-time optimization is that the compiler can see through
this trickery and witness both with-private and without-private definitions at
once. Creating objects of this type or pointers to objects of this type is a
violation of C’s strict aliasing rule and the compiler can now see this. This
can cause the compiler to make unsafe optimizations, like concluding any code
involving `Sfio_t*` variables must be unreachable.

The safer way to do a public/private class like this is with two structs, the
private one containing the public one as a member:

  struct foo_public {
    … public members …
  };

  struct foo_private {
    struct foo_public *public;

    … private members …
  };

Public API functions then accept `struct foo_public*` parameters and internally
convert them to `struct foo_private*` variables in order to access the
internals:

  int foo_do_something(struct foo_public *foo) {
    // use something like the Linux kernel’s container_of
    struct foo_private *f = container_of(foo, public);
    …
  }

But instead of this, we can observe that the definition of `Sfio_t` does not
need to have any public members at all, and we can make the entire type private.
We need an exception for libexpr which reaches into sfio internals.

Gitlab: fixes #2338

23 months agosfio: remove macro implementations of character functions
Matthew Fernandez [Thu, 19 Jan 2023 16:17:29 +0000 (08:17 -0800)]
sfio: remove macro implementations of character functions

These were implemented as an optimization to allow inlining. This is no longer
necessary on contemporary compilers with link-time optimization. Removing them
will unblock fixing some strict aliasing problems with the `Sfio_t` type.

Gitlab: #2338

23 months agosfio: fix missing SFIO components
Matthew Fernandez [Thu, 19 Jan 2023 16:13:22 +0000 (08:13 -0800)]
sfio: fix missing SFIO components

These are present in the Autotools build system as a separate library, libsfiof,
linked into libsfio. They are also present in the MS Build build system inlined
into libsfio itself. This change copies the MS Build approach.

This did not cause problems because these sources only exist as fallback
implementations for functions that are also implemented as macros. All current
usages see the macro definitions so never call these functions.

Fixing this will allow removing the macro versions in an upcoming change.

23 months agosfio: remove some open coded nulls
Matthew Fernandez [Thu, 19 Jan 2023 15:59:51 +0000 (07:59 -0800)]
sfio: remove some open coded nulls

23 months agoMerge branch 'smattr/9a877cda-3948-40d1-8ddf-64d09bc05660' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 22:34:15 +0000 (22:34 +0000)]
Merge branch 'smattr/9a877cda-3948-40d1-8ddf-64d09bc05660' into 'main'

smyrna, gvmap warning squashing

See merge request graphviz/graphviz!3061

23 months agogvmap plot_dot_polygons: use a 'size_t' for 'maxlen'
Matthew Fernandez [Fri, 20 Jan 2023 16:25:15 +0000 (08:25 -0800)]
gvmap plot_dot_polygons: use a 'size_t' for 'maxlen'

Squashes some -Wsign-conversion warnings.

23 months agogvmap make_map_internal: remove shadowing of 'nz' local
Matthew Fernandez [Fri, 20 Jan 2023 16:10:23 +0000 (08:10 -0800)]
gvmap make_map_internal: remove shadowing of 'nz' local

23 months agogvmap make_map_internal: operate directly on 'xcombined' instead of 'xtemp'
Matthew Fernandez [Fri, 20 Jan 2023 16:05:58 +0000 (08:05 -0800)]
gvmap make_map_internal: operate directly on 'xcombined' instead of 'xtemp'

Nothing appears to alias `xcombined` within this block. So we can save an
intermediate allocation and the cost of data movement by simply writing results
into their final destination.

23 months agogvmap get_polygon_solids: remove unused 'x_poly' parameter
Matthew Fernandez [Fri, 20 Jan 2023 15:59:32 +0000 (07:59 -0800)]
gvmap get_polygon_solids: remove unused 'x_poly' parameter