diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-27 11:12:09 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-02-03 02:48:03 +0000 |
commit | 42d2b5add560ad9a14f36c5f628e83a39ac89f47 (patch) | |
tree | 2c28bd39b5fee5c3d496790784a56bc60d01b247 | |
parent | 87b05995a861f75e38b889659a56b13485e58ce2 (diff) |
bitscale.c: ensure SCORE2 macro expands properly
Handles warning from Oracle Parfait 11.2 static analyzer:
Error: Misleading macro
Misleading macro [misleading-macro]:
misleading evaluation of '/' operator in expansion of macro SCORE2 due to missing parentheses
at line 299 of src/bitmap/bitscale.c.
'/' operator has lower precedence than '/' operator inside macro body at line 438
low precedence '/' operator is hidden by expansion of macro argument m at line 299
Misleading macro [misleading-macro]:
misleading evaluation of '/' operator in expansion of macro SCORE2 due to missing parentheses
at line 299 of src/bitmap/bitscale.c.
binary '*' operator has lower precedence than '/' operator inside macro body at line 440
low precedence binary '*' operator is hidden by expansion of macro argument m at line 299
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/bitmap/bitscale.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index e29ba96..4f6d266 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -295,10 +295,10 @@ if (m >= 1.0) { \ /* don't need to favor enlargement when looking for bitmap that can be used unscalable */ #define SCORE2(m,s) \ -if (m >= 1.0) \ - score += (int)(((double)(8 * s)) / m); \ +if ((m) >= 1.0) \ + score += (int)(((double)(8 * (s))) / (m)); \ else \ - score += (int)(((double)(8 * s)) * m); + score += (int)(((double)(8 * (s))) * (m)); static FontEntryPtr FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry, |