]> granicus.if.org Git - graphviz/log
graphviz
3 years agoadd a test case for #2082
Matthew Fernandez [Sat, 5 Jun 2021 01:10:17 +0000 (18:10 -0700)]
add a test case for #2082

3 years agoMerge branch 'smattr/604a7505-2c95-4af0-9355-93f51e2c5dbf' into 'main'
Matthew Fernandez [Sat, 5 Jun 2021 03:39:51 +0000 (03:39 +0000)]
Merge branch 'smattr/604a7505-2c95-4af0-9355-93f51e2c5dbf' into 'main'

fix: do not fclose(NULL) in gvmap

See merge request graphviz/graphviz!1981

3 years agofix: do not fclose(NULL) in gvmap
Matthew Fernandez [Sat, 29 May 2021 22:29:03 +0000 (15:29 -0700)]
fix: do not fclose(NULL) in gvmap

gvmap opens a debugging file to write timing information to if verbosity is
enabled. It tried to unconditionally close this file, regardless of whether
verbosity was enabled. The result was that, without verbosity enabled, it would
call fclose(NULL). The effect of this seems to vary across operating systems but
can result in a crash. This fix only tries to close the file if it was
previously opened. Related to #1822.

Unfortunately we cannot un-xfail test_gvmap_fclose because it fails for another
reason on some platforms.

3 years agoadd a test case for gvmap crash
Matthew Fernandez [Sat, 29 May 2021 22:42:19 +0000 (15:42 -0700)]
add a test case for gvmap crash

As discussed on #1822, gvmap currently crashes sometimes. It seems this is not
input dependent, but rather platform dependent. A fix will arrive in an upcoming
commit.

3 years agoremove some unused imports in test_regression.py
Matthew Fernandez [Sat, 29 May 2021 22:46:25 +0000 (15:46 -0700)]
remove some unused imports in test_regression.py

3 years agofix prior merge mistake
Matthew Fernandez [Sat, 5 Jun 2021 02:50:00 +0000 (19:50 -0700)]
fix prior merge mistake

3 years agoMerge branch 'smattr/8c949bd7-1fa9-4b34-bcb5-d838d72f676f' into 'main'
Matthew Fernandez [Sat, 5 Jun 2021 02:44:59 +0000 (02:44 +0000)]
Merge branch 'smattr/8c949bd7-1fa9-4b34-bcb5-d838d72f676f' into 'main'

test case for #2078 and gvplugin bug fixing

See merge request graphviz/graphviz!1980

3 years agosquash some -Wsign-conversion warnings in gvplugin_library_load
Matthew Fernandez [Sat, 29 May 2021 21:08:32 +0000 (14:08 -0700)]
squash some -Wsign-conversion warnings in gvplugin_library_load

3 years agoremove unused return value of gvplugin_activate
Matthew Fernandez [Sat, 29 May 2021 21:07:00 +0000 (14:07 -0700)]
remove unused return value of gvplugin_activate

3 years agomark name and plugin_path to gvplugin_activate as const
Matthew Fernandez [Sat, 29 May 2021 21:05:33 +0000 (14:05 -0700)]
mark name and plugin_path to gvplugin_activate as const

Neither of these are modified by the function.

3 years agoremove shadowing of path in gvplugin_activate
Matthew Fernandez [Sat, 29 May 2021 21:04:40 +0000 (14:04 -0700)]
remove shadowing of path in gvplugin_activate

This squashes a -Wshadow compiler warning.

3 years agosquash a -Wsign-compare warning in a gvplugin.c loop
Matthew Fernandez [Sat, 29 May 2021 21:02:42 +0000 (14:02 -0700)]
squash a -Wsign-compare warning in a gvplugin.c loop

3 years agoremove temporary buffer for the name of registered GVC plugins
Matthew Fernandez [Sat, 29 May 2021 20:59:31 +0000 (13:59 -0700)]
remove temporary buffer for the name of registered GVC plugins

Similar to the previous commit, this removes a temporary buffer that was only
being used for splitting a name on a ':' separator. Using the same strategy of
maintaining start and end as pointers into the original string, we can remove
the need for the temporary buffer and remove the limitation on ≤63 character
names.

3 years agoremove temporary buffer for name of the GVC plugin being loaded
Matthew Fernandez [Sat, 29 May 2021 20:47:55 +0000 (13:47 -0700)]
remove temporary buffer for name of the GVC plugin being loaded

The GVC plugin loading machinery copied the first 63 characters of the plugin
name to a temporary buffer in order to mutate it. However the mutation is simply
chopping up the plugin name based on a ':' separator. By tracking the start and
end of each component as pointers into the original sting, we can remove the
need for this temporary buffer.

Though this saves some stack memory, the primary motivation for this change is
to remove the truncation-to-63-characters behavior. There is no need to limit
plugin names to 63 characters. Note that the names of registered plugins are
still limited to 63 characters, so this does not fully remove the restriction.

3 years agofix out of bounds read when examining a registered plugin with a long name
Matthew Fernandez [Sat, 29 May 2021 20:15:54 +0000 (13:15 -0700)]
fix out of bounds read when examining a registered plugin with a long name

Similar to the previous commit, the GVC plugin loading code copies the names of
registered plugins to a temporary buffer as it iterates through them to allow
mutating the name. And just like the code for mutating the name of the plugin
begin loaded, it would fail to NUL-terminate this temporary buffer, causing a
following strchr to over-read.

The fix again is to simply zero-initialize the temporary buffer, so the
copied-in string is always NUL-terminated.

3 years agofix out of bounds read when loading a plugin with a long name
Matthew Fernandez [Sat, 29 May 2021 20:08:16 +0000 (13:08 -0700)]
fix out of bounds read when loading a plugin with a long name

The GVC plugin loading code copies the first 63 characters of the name of a
plugin to a temporary buffer in order to do various string manipulation on it.
However, this buffer was not initialized and never manually terminated. As a
result, a plugin name of 63 characters or more would result in the buffer
containing a non-terminated string. Subsequent strchr on this buffer would
over-read if it never saw a ':', resulting in unpredictable behavior.

This fix simply zero-initializes the buffer to begin with, so the copied-in
string is always NUL-terminated.

3 years agoadd a test case for #2078
Matthew Fernandez [Sat, 29 May 2021 19:52:59 +0000 (12:52 -0700)]
add a test case for #2078

3 years agoMerge branch 'smattr/A8D77CFB-89C5-4EC3-B3BB-5E95B152E225' into 'main'
Matthew Fernandez [Sat, 5 Jun 2021 01:32:15 +0000 (01:32 +0000)]
Merge branch 'smattr/A8D77CFB-89C5-4EC3-B3BB-5E95B152E225' into 'main'

some clean up in nop and lib/ingraphs

See merge request graphviz/graphviz!1979

3 years agomark nop’s command line parameter variables static
Matthew Fernandez [Sat, 29 May 2021 18:06:50 +0000 (11:06 -0700)]
mark nop’s command line parameter variables static

These are not used outside of their containing file.

3 years agouse a C99 bool for nop’s chkOnly flag
Matthew Fernandez [Sat, 29 May 2021 18:05:00 +0000 (11:05 -0700)]
use a C99 bool for nop’s chkOnly flag

The semantics of this flag were already a boolean value, so we can use the type
system to more obviously indicate this.

3 years agoremove an unnecessary cast
Matthew Fernandez [Sat, 29 May 2021 18:04:05 +0000 (11:04 -0700)]
remove an unnecessary cast

This pointer implicitly coerces.

3 years agouse a C99 bool for ingraph’s heap flag
Matthew Fernandez [Sat, 29 May 2021 18:03:13 +0000 (11:03 -0700)]
use a C99 bool for ingraph’s heap flag

The semantics of this flag were already a boolean value, so we can use the type
system to more obviously indicate this.

3 years agouse an unsigned value for ingraphs error count
Matthew Fernandez [Sat, 29 May 2021 18:00:32 +0000 (11:00 -0700)]
use an unsigned value for ingraphs error count

Obviously the number of errors that has occurred can never be negative. An
unsigned type more accurately indicates this. The only client of ingraphs that
actually checks the error count is nop, so this change has very little effect.

3 years agomore portable exit status from nop
Matthew Fernandez [Sat, 29 May 2021 17:56:34 +0000 (10:56 -0700)]
more portable exit status from nop

The exit status of nop was a bitwise-OR of two error counts. I do not see how
the actual value of this could ever be useful, except for being non-zero.
However, a non-zero exit status is not always an error. E.g. on VMS there are
some non-zero exit statuses that still indicate success.

This change causes nop to more reliably and portably exit with EXIT_FAILURE when
encountering errors.

3 years agomake nop usage string a constant array
Matthew Fernandez [Sat, 29 May 2021 17:48:35 +0000 (10:48 -0700)]
make nop usage string a constant array

The compiler could probably determine this already, but this makes it a little
more obvious that it can be inlined and the useString symbol can be the start of
the data rather than a pointer to the start of the data.

3 years agoremove an unnecessary open coded NULL
Matthew Fernandez [Sat, 29 May 2021 17:47:48 +0000 (10:47 -0700)]
remove an unnecessary open coded NULL

3 years agohandle unexpected getopt errors in nop
Matthew Fernandez [Sat, 29 May 2021 17:45:32 +0000 (10:45 -0700)]
handle unexpected getopt errors in nop

This case is never expected to be reachable. However, having a default case
helps catch when new options are introduced in the getopt call but not handled
in the switch. In a sense, this is a defensive coding measure. This also
squashes a -Wswitch-default compiler warning.

3 years agoreplace ingraphs header guard with more modern #pragma once
Matthew Fernandez [Sat, 29 May 2021 17:34:57 +0000 (10:34 -0700)]
replace ingraphs header guard with more modern #pragma once

3 years agoremove unused FREE_STATE
Matthew Fernandez [Sat, 29 May 2021 17:33:33 +0000 (10:33 -0700)]
remove unused FREE_STATE

This has been unused since the initial revision of this file. It is unclear what
purpose it was intended to serve.

3 years agoremove useless #include of config.h
Matthew Fernandez [Sat, 29 May 2021 17:31:52 +0000 (10:31 -0700)]
remove useless #include of config.h

The generated config.h only contains a number of #defines, so its inclusion at
the end of a file has no effect. All code following this line was removed in
7cc812f5c1b64832a0324a293cc8968ba044e0a4 which should have also removed this
line but did not.

3 years agoMerge branch 'smattr/1bbce952-8b1a-4e2b-bc72-3a4a5a53616a' into 'main'
Matthew Fernandez [Fri, 4 Jun 2021 05:55:09 +0000 (05:55 +0000)]
Merge branch 'smattr/1bbce952-8b1a-4e2b-bc72-3a4a5a53616a' into 'main'

clean up in lib/common

See merge request graphviz/graphviz!1978

3 years agoremove commented out code in mincross.c
Matthew Fernandez [Sat, 29 May 2021 03:06:20 +0000 (20:06 -0700)]
remove commented out code in mincross.c

3 years agoremove commented out code in shapes.c
Matthew Fernandez [Sat, 29 May 2021 03:06:05 +0000 (20:06 -0700)]
remove commented out code in shapes.c

3 years agoremove NOTDEF-guarded code
Matthew Fernandez [Sat, 29 May 2021 03:00:15 +0000 (20:00 -0700)]
remove NOTDEF-guarded code

This is not defined anywhere in the build.

3 years agoremove unused findAttrColor
Matthew Fernandez [Sat, 29 May 2021 02:57:03 +0000 (19:57 -0700)]
remove unused findAttrColor

3 years agoremove write_canonical_dot prototype for function that does not exist
Matthew Fernandez [Sat, 29 May 2021 02:54:54 +0000 (19:54 -0700)]
remove write_canonical_dot prototype for function that does not exist

This function was removed in d3760b95bd696ab130c26dd36927ed498f7aae37 but its
prototype was not.

3 years agoremove write_attributed_dot prototype for function that does not exist
Matthew Fernandez [Sat, 29 May 2021 02:53:37 +0000 (19:53 -0700)]
remove write_attributed_dot prototype for function that does not exist

This function was removed in d3760b95bd696ab130c26dd36927ed498f7aae37 but its
prototype was not.

3 years agoremove setup_graph prototype for function that does not exist
Matthew Fernandez [Sat, 29 May 2021 02:50:05 +0000 (19:50 -0700)]
remove setup_graph prototype for function that does not exist

This function was removed in ac9772156cea7cff4d8f1be7fd9396bdb6027505 but its
prototype was not.

3 years agoremove emit_jobs_eof prototype for function that does not exist
Matthew Fernandez [Sat, 29 May 2021 02:43:04 +0000 (19:43 -0700)]
remove emit_jobs_eof prototype for function that does not exist

This function was removed in 574e183b6caed4954702929a952c06c59a141a9e but its
prototype was not.

3 years agomark pps parameter to limitBoxes as const
Matthew Fernandez [Sat, 29 May 2021 01:01:18 +0000 (18:01 -0700)]
mark pps parameter to limitBoxes as const

To more obviously indicate this parameter is not modified.

3 years agoMerge branch 'smattr/839387A5-BAE4-43F2-88C1-C6818F406667'
Matthew Fernandez [Wed, 2 Jun 2021 01:26:04 +0000 (18:26 -0700)]
Merge branch 'smattr/839387A5-BAE4-43F2-88C1-C6818F406667'

3 years agoAdd --tag=CC when compiling quartz plugin
Ryan Schmidt [Sat, 8 May 2021 14:11:01 +0000 (14:11 +0000)]
Add --tag=CC when compiling quartz plugin

Edit by Matthew Fernandez: When compiling libraries, libtool infers a so called
“tag” indicating the language model it should use when creating objects.
The libtool docs¹ claim `CC` is inferred when no tag is explicitly given, but
empirically this does not seem to be true. On macOS, some versions of libtool
give up when seeing a .m file with the error:

  libtool: compile: unable to infer tagged configuration
  libtool:   error: specify a tag with '--tag'

To fix this, we now explicitly set the `CC` tag. Note that this is not guarded
to be macOS-only because this action needs to be taken in all environments with
Objective-C support that are building the Quartz plugin (if this is in fact
possible on anything other than macOS).

This commit also fixes a further problem where AM_LIBTOOLFLAGS was misspelled
as AM_LIBTOOLSFLAGS. It looks like 79aa7d77ef433d66c0142168d2817b4c7014d263
previously tried to fix this same problem but (1) the WITH_DARWIN9 guard is
insufficient for recent macOS versions and (2) the typo made this whole change
a no-op.

This issue was reported by downstream Macports users.

Fixes #2065.

¹ https://www.gnu.org/software/libtool/manual/html_node/Tags.html

3 years agoMerge branch 'smattr/E9ACDB7A-3EE0-4BF7-B2A8-14EB2AC31B99' into 'main'
Matthew Fernandez [Tue, 1 Jun 2021 15:01:32 +0000 (15:01 +0000)]
Merge branch 'smattr/E9ACDB7A-3EE0-4BF7-B2A8-14EB2AC31B99' into 'main'

some clean up in lib/expr

See merge request graphviz/graphviz!1976

3 years agoremove unused exrewind()
Matthew Fernandez [Wed, 26 May 2021 01:45:59 +0000 (18:45 -0700)]
remove unused exrewind()

3 years agoremove commented out Makefile directives
Matthew Fernandez [Wed, 26 May 2021 01:42:50 +0000 (18:42 -0700)]
remove commented out Makefile directives

The comments about libast’s usage of environ are legacy. This declaration was
removed in 3af3980dff0b6a8ca134ea0620b4ffb484906707.

3 years agoremove unused exstatement()
Matthew Fernandez [Wed, 26 May 2021 01:40:05 +0000 (18:40 -0700)]
remove unused exstatement()

3 years agoremove unused excc()
Matthew Fernandez [Wed, 26 May 2021 01:34:26 +0000 (18:34 -0700)]
remove unused excc()

3 years agoMerge branch 'smattr/10DDFB58-0439-439A-8BCD-0F5A630C9561' into 'main'
Matthew Fernandez [Mon, 31 May 2021 17:18:24 +0000 (17:18 +0000)]
Merge branch 'smattr/10DDFB58-0439-439A-8BCD-0F5A630C9561' into 'main'

a couple of minor clean ups

See merge request graphviz/graphviz!1974

3 years agoabbreviate a manual strdup
Matthew Fernandez [Tue, 25 May 2021 14:53:55 +0000 (07:53 -0700)]
abbreviate a manual strdup

3 years agoabbreviate a Smyrna path
Matthew Fernandez [Tue, 25 May 2021 14:53:04 +0000 (07:53 -0700)]
abbreviate a Smyrna path

SMYRNA is defined to the same string, so this makes no functional difference.
However, it makes the preceding allocation clearer in what it is doing.

3 years agoMerge branch 'fix-odr-violation-in-mm2gv' into 'main'
Magnus Jacobsson [Sun, 30 May 2021 15:53:46 +0000 (15:53 +0000)]
Merge branch 'fix-odr-violation-in-mm2gv' into 'main'

Fix ASan odr_violation in mm2gv

See merge request graphviz/graphviz!1975

3 years agoRevert "Disable detection of ODR violations in Ubuntu 21.04 ASan test"
Magnus Jacobsson [Tue, 25 May 2021 20:14:57 +0000 (22:14 +0200)]
Revert "Disable detection of ODR violations in Ubuntu 21.04 ASan test"

This reverts commit 5f6a0df735ea110e874df2f527cd73fa0a3d37a0.

3 years agoFix ASan odr_violation in mm2gv by not linking to libcommon
Magnus Jacobsson [Tue, 25 May 2021 19:43:32 +0000 (21:43 +0200)]
Fix ASan odr_violation in mm2gv by not linking to libcommon

libcommon is a static lib, but is already part of the dynamic libgvc.

The error message was:

==73343==ERROR: AddressSanitizer: odr-violation (0x555555789760):
  [1] size=8 'fdp_parms' /home/magjac/graphviz/lib/common/globals.c:30:20
  [2] size=8 'fdp_parms' /home/magjac/graphviz/lib/common/globals.c:30:20
These globals were registered at these points:
  [1]:
    #0 0x7ffff760d938 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
    #1 0x555555693361 in _sub_I_00099_1 (/home/magjac/build-graphviz-Desktop-Debug/cmd/tools/mm2gv+0x13f361)
    #2 0x55555569376c in __libc_csu_init (/home/magjac/build-graphviz-Desktop-Debug/cmd/tools/mm2gv+0x13f76c)

  [2]:
    #0 0x7ffff760d938 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
    #1 0x7ffff6f7de38 in _sub_I_00099_1 (/home/magjac/build-graphviz-Desktop-Debug/lib/gvc/libgvc.so.6+0x420e38)
    #2 0x7ffff7fda96d  (/lib64/ld-linux-x86-64.so.2+0x1196d)

==73343==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'fdp_parms' at /home/magjac/graphviz/lib/common/globals.c:30:20
==73343==ABORTING

3 years agoPrint output when test_tools fails
Magnus Jacobsson [Tue, 25 May 2021 19:57:17 +0000 (21:57 +0200)]
Print output when test_tools fails

3 years agoMerge branch 'smattr/4069e280-7a22-40cb-9dbc-cfc846561c66' into 'main'
Matthew Fernandez [Sat, 29 May 2021 03:58:38 +0000 (03:58 +0000)]
Merge branch 'smattr/4069e280-7a22-40cb-9dbc-cfc846561c66' into 'main'

remove build dependency on Perl

Closes #2067

See merge request graphviz/graphviz!1973

3 years agoremove commented out code in Autotools Perl detection
Matthew Fernandez [Tue, 25 May 2021 02:07:28 +0000 (19:07 -0700)]
remove commented out code in Autotools Perl detection

3 years agoremove Windows CI configuration of Perl
Matthew Fernandez [Sun, 23 May 2021 01:02:17 +0000 (18:02 -0700)]
remove Windows CI configuration of Perl

As of the previous commit, Perl is no longer necessary for CI on Windows.
Related to #2067.

3 years agoremove check for Perl in the CMake build
Matthew Fernandez [Sun, 23 May 2021 01:29:26 +0000 (18:29 -0700)]
remove check for Perl in the CMake build

Perl is no longer required for the CMake build. Related to #2067.

3 years agocommit generated ps_font_equiv.h and remove generator for this
Matthew Fernandez [Sat, 22 May 2021 23:37:41 +0000 (16:37 -0700)]
commit generated ps_font_equiv.h and remove generator for this

The header ps_font_equiv.h was generated from 3 files, fontmap.cfg,
ps_font_equiv.txt, and ps_fontmap.txt. The generator itself was the Perl file,
mksvgfonts.pl.

The generation process is deterministic and not dependent on the end user’s
system. In fact, ps_font_equiv.h is generated during CI and included in the
portable source tarball. Furthermore the main driving source for this,
ps_font_equiv.txt is no clearer or more commented than the generated header.
Finally, a copy of the generated header was actually already committed to the
repository under windows/include/ for the MSBuild work flow that does not want
to call Perl.

For these reasons, having this as a generated file was no advantage. In fact,
this was a net negative in the build process as it is the only thing in the
build that requires Perl. As of this commit, Perl is no longer required to
build Graphviz. Perl is still necessary for building some optional components
like the Graphviz bindings for Perl.

Closes #2067.

3 years agoMerge branch 'smattr/bc790f2b-e001-4add-8124-a94127742066' into 'main'
Matthew Fernandez [Sat, 29 May 2021 02:37:47 +0000 (02:37 +0000)]
Merge branch 'smattr/bc790f2b-e001-4add-8124-a94127742066' into 'main'

clean up in lib/glcomp

See merge request graphviz/graphviz!1967

3 years agostandardize on float literals for glColor4f and glVertex3f parameters
Matthew Fernandez [Wed, 19 May 2021 03:24:17 +0000 (20:24 -0700)]
standardize on float literals for glColor4f and glVertex3f parameters

Shorter and more readable than GLFloat casts.

3 years agoconsistently use float literals in glCompCalcWidget
Matthew Fernandez [Wed, 19 May 2021 03:17:38 +0000 (20:17 -0700)]
consistently use float literals in glCompCalcWidget

This is more reliable and predictable than the mixture of floats and implicit
conversion from ints that was happening previously.

3 years agoremove unused fs parameter from glCompSetAddNewTexture
Matthew Fernandez [Wed, 19 May 2021 03:09:11 +0000 (20:09 -0700)]
remove unused fs parameter from glCompSetAddNewTexture

3 years agoremove an open coded NULL
Matthew Fernandez [Wed, 19 May 2021 03:08:09 +0000 (20:08 -0700)]
remove an open coded NULL

3 years agoremove commented out code in glcomptexture.c
Matthew Fernandez [Wed, 19 May 2021 03:07:56 +0000 (20:07 -0700)]
remove commented out code in glcomptexture.c

3 years agoremove unused glCompSetClear
Matthew Fernandez [Wed, 19 May 2021 03:04:57 +0000 (20:04 -0700)]
remove unused glCompSetClear

3 years agoremove commented out code in glcompset.c
Matthew Fernandez [Wed, 19 May 2021 03:04:17 +0000 (20:04 -0700)]
remove commented out code in glcompset.c

3 years agoremove commented out change_fonts
Matthew Fernandez [Wed, 19 May 2021 03:02:26 +0000 (20:02 -0700)]
remove commented out change_fonts

3 years agoremove unused glCompSetText
Matthew Fernandez [Wed, 19 May 2021 03:00:14 +0000 (20:00 -0700)]
remove unused glCompSetText

3 years agoremove commented out code in glcompbutton.c
Matthew Fernandez [Wed, 19 May 2021 02:59:44 +0000 (19:59 -0700)]
remove commented out code in glcompbutton.c

3 years agoMerge branch 'smattr/791B36C7-46BD-41BA-A88F-DFC58E2C490A' into 'main'
Matthew Fernandez [Sat, 29 May 2021 01:45:09 +0000 (01:45 +0000)]
Merge branch 'smattr/791B36C7-46BD-41BA-A88F-DFC58E2C490A' into 'main'

squash all -Wfloat-conversion warnings in trackball.c

See merge request graphviz/graphviz!1965

3 years agoconsistently use float arithmetic in build_rotmatrix
Matthew Fernandez [Mon, 17 May 2021 02:39:19 +0000 (19:39 -0700)]
consistently use float arithmetic in build_rotmatrix

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes some -Wfloat-conversion
warnings.

3 years agoconsistently use float arithmetic in tb_project_to_sphere
Matthew Fernandez [Mon, 17 May 2021 02:37:25 +0000 (19:37 -0700)]
consistently use float arithmetic in tb_project_to_sphere

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes a -Wfloat-conversion warning.

3 years agorephrase some magic numbers in Smyrna into their originating computation
Matthew Fernandez [Wed, 26 May 2021 15:12:03 +0000 (08:12 -0700)]
rephrase some magic numbers in Smyrna into their originating computation

This removes the use of some double literals with implicit conversion to floats,
squashing some -Wfloat-conversion compiler warnings. It also makes the resulting
code clearer. The compiler constant-folds these at -O1 and above, so there is no
loss of performance. The resulting expressions are slightly different to the
original, but if anything they are a more accurate representation of the intent
here.

3 years agoconsistently use float arithmetic in axis_to_quat
Matthew Fernandez [Mon, 17 May 2021 02:33:11 +0000 (19:33 -0700)]
consistently use float arithmetic in axis_to_quat

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes some -Wfloat-conversion
warnings.

3 years agousing floats consistently in vscale
Matthew Fernandez [Mon, 17 May 2021 02:31:21 +0000 (19:31 -0700)]
using floats consistently in vscale

By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes a -Wfloat-conversion warning.

3 years agouse more appropriate square root function in vlength
Matthew Fernandez [Mon, 17 May 2021 02:30:00 +0000 (19:30 -0700)]
use more appropriate square root function in vlength

The square root functions sqrt and sqrtf compute on doubles and floats
respectively. Using the float version here avoids a lossy conversion from double
to float when returning from this function.

3 years agoabbreviate some manual fmaxf and fminf operations
Matthew Fernandez [Mon, 17 May 2021 02:29:07 +0000 (19:29 -0700)]
abbreviate some manual fmaxf and fminf operations

3 years agostandardize on float arithmetic in trackball()
Matthew Fernandez [Mon, 17 May 2021 02:27:01 +0000 (19:27 -0700)]
standardize on float arithmetic in trackball()

This function was mixing floats and doubles, leading to mixed precision issues.
Standardizing on float usage throughout leads to more predictable behavior and
removes a number of -Wfloat-conversion warnings.

3 years agoMerge branch 'smattr/d6fdb86c-db15-4eca-815a-07b90f549737' into 'main'
Matthew Fernandez [Sat, 29 May 2021 00:49:52 +0000 (00:49 +0000)]
Merge branch 'smattr/d6fdb86c-db15-4eca-815a-07b90f549737' into 'main'

more clean up of lib/vpsc

See merge request graphviz/graphviz!1972

3 years agopass Rectangles to generateYConstraints as vector of values instead of pointers
Matthew Fernandez [Sat, 22 May 2021 04:44:24 +0000 (21:44 -0700)]
pass Rectangles to generateYConstraints as vector of values instead of pointers

This allows a number of simplifications, most importantly removing manual
allocations in genYConstraints.

3 years agopass Rectangles to generateXConstraints as vector of values instead of pointers
Matthew Fernandez [Sat, 22 May 2021 04:39:30 +0000 (21:39 -0700)]
pass Rectangles to generateXConstraints as vector of values instead of pointers

This allows a number of simplifications, most importantly removing manual
allocations in genXConstraints.

3 years agomake the Rectangles input to generateYConstraints const
Matthew Fernandez [Sat, 22 May 2021 04:34:31 +0000 (21:34 -0700)]
make the Rectangles input to generateYConstraints const

This no longer needs to be mutable.

3 years agomake the Rectangles parameter to generateXConstraints const
Matthew Fernandez [Sat, 22 May 2021 04:33:41 +0000 (21:33 -0700)]
make the Rectangles parameter to generateXConstraints const

This no longer needs to be mutable.

3 years agoput VPSC’s Node class in an anonymous namespace
Matthew Fernandez [Sat, 22 May 2021 04:28:32 +0000 (21:28 -0700)]
put VPSC’s Node class in an anonymous namespace

This marks the class as unnecessary outside of its containing translation unit.
This further emphasizes that is is an implementation detail of the containing
file as well as allowing the compiler to aggressively optimize its layout.

3 years agomanage Node::r as a reference instead of a pointer
Matthew Fernandez [Sat, 22 May 2021 04:26:31 +0000 (21:26 -0700)]
manage Node::r as a reference instead of a pointer

Generally having class members that are references is an anti-pattern. However,
in this case the Node class is only used within generate-constraints.cpp with
all Node objects having limited lifetimes. It is essentially an implementation
detail of generate-constraints.cpp, irrelevant to the outside. Making its
Rectangle member a reference will ease some upcoming changes.

3 years agotake const references in Rectangle::overlap{X|Y} instead of mutable pointers
Matthew Fernandez [Sat, 22 May 2021 04:14:33 +0000 (21:14 -0700)]
take const references in Rectangle::overlap{X|Y} instead of mutable pointers

These functions do not handle nullptr and do not modify their parameter, so a
const reference is more appropriate. This change will ease some future work
towards removing manual memory management.

3 years agotake a vector in generateYConstraints instead of a size and C pointer
Matthew Fernandez [Sat, 22 May 2021 04:06:57 +0000 (21:06 -0700)]
take a vector in generateYConstraints instead of a size and C pointer

Like the previous commit, this is a step towards removing some manual memory
management.

3 years agotake a vector in generateXConstraints instead of size and C pointer
Matthew Fernandez [Sat, 22 May 2021 04:00:29 +0000 (21:00 -0700)]
take a vector in generateXConstraints instead of size and C pointer

This is a stepping stone to removing some manual memory management of the
Rectangles collection.

3 years agoremove unused removeRectangleOverlap()
Matthew Fernandez [Sat, 22 May 2021 03:28:06 +0000 (20:28 -0700)]
remove unused removeRectangleOverlap()

3 years agoMerge branch 'smattr/0C0ECC23-F355-438B-90B0-5CF0B0A7FF0F' into 'main'
Matthew Fernandez [Fri, 28 May 2021 15:35:56 +0000 (15:35 +0000)]
Merge branch 'smattr/0C0ECC23-F355-438B-90B0-5CF0B0A7FF0F' into 'main'

clean up in cmd/gvmap

See merge request graphviz/graphviz!1968

3 years agoremove commented out code in make_map.c
Matthew Fernandez [Thu, 20 May 2021 00:51:06 +0000 (17:51 -0700)]
remove commented out code in make_map.c

3 years agoremove useless flag parameter from get_polygons
Matthew Fernandez [Thu, 20 May 2021 00:46:39 +0000 (17:46 -0700)]
remove useless flag parameter from get_polygons

3 years agoremove some useless return statements
Matthew Fernandez [Thu, 20 May 2021 00:43:37 +0000 (17:43 -0700)]
remove some useless return statements

3 years agoremove useless flag parameter from get_tri
Matthew Fernandez [Thu, 20 May 2021 00:42:51 +0000 (17:42 -0700)]
remove useless flag parameter from get_tri

3 years agoremove unused max_string_length
Matthew Fernandez [Thu, 20 May 2021 00:37:05 +0000 (17:37 -0700)]
remove unused max_string_length

3 years agomake gvmap usage a const char array
Matthew Fernandez [Thu, 20 May 2021 00:35:25 +0000 (17:35 -0700)]
make gvmap usage a const char array

This makes it more obvious to the compiler that it can inline or otherwise
optimize usage of this string.

3 years agouse C99 bools for some boolean gvmap flags
Matthew Fernandez [Thu, 20 May 2021 00:34:15 +0000 (17:34 -0700)]
use C99 bools for some boolean gvmap flags

This leads to slightly clearer and more readable code.

3 years agorephrase an open-coded strdup
Matthew Fernandez [Thu, 20 May 2021 00:30:38 +0000 (17:30 -0700)]
rephrase an open-coded strdup

It is unclear why this was written this way or why it allocated more bytes than
necessary.

3 years agoremove unused (and shadowed) MAX_GRPS
Matthew Fernandez [Thu, 20 May 2021 00:17:02 +0000 (17:17 -0700)]
remove unused (and shadowed) MAX_GRPS