Skip to content

Commit

Permalink
Fix several CodeQL alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosame committed Sep 5, 2023
1 parent c3bf110 commit 906fbb2
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# config-file: ./.github/workflows/codeql/codeql-config.yml

- name: Set up JDK
uses: actions/setup-java@v3
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/codeql/codeql-config.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/codeql/custom-queries.qls

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ protected void sampledAtUnitTime(float unitTime, int repeatIteration) {
if (rotateAuto) {
ang = pathLength.angleAtLength(point);
if (rotateAutoReverse) {
ang += Math.PI;
ang += (float) Math.PI;
}
} else {
ang = rotateAngle;
Expand All @@ -269,7 +269,7 @@ protected void sampledAtUnitTime(float unitTime, int repeatIteration) {
if (rotateAuto) {
ang = pathLength.angleAtLength(pathLength.lengthOfPath());
if (rotateAutoReverse) {
ang += Math.PI;
ang += (float) Math.PI;
}
} else {
ang = rotateAngle;
Expand All @@ -282,7 +282,7 @@ protected void sampledAtUnitTime(float unitTime, int repeatIteration) {
if (rotateAuto) {
ang = pathLength.angleAtLength(pathLength.lengthOfPath());
if (rotateAutoReverse) {
ang += Math.PI;
ang += (float) Math.PI;
}
} else {
ang = rotateAngle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ else if (g >= 1)
pixels[off++] = grad[idx >> 16];
idx += step;
}
g += dgdX * stepsD;
g += (float) (dgdX * stepsD);
gradIdx++;
}
} else {
Expand Down Expand Up @@ -278,7 +278,7 @@ else if (g >= 1)
pixels[off++] = grad[idx >> 16];
idx += step;
}
g += dgdX * stepsD;
g += (float) (dgdX * stepsD);
gradIdx--;
}
}
Expand All @@ -303,7 +303,7 @@ protected void fillSimpleNoCycle(int[] pixels, int off, int adjust, int x, int y
// initialize current value to be start.
float g = initConst + dgdY * (y + i);
g *= fastGradientArraySize;
g += 0.5; // rounding factor...
g += 0.5f; // rounding factor...

final int rowLimit = off + w; // end of row iteration

Expand Down Expand Up @@ -399,7 +399,7 @@ protected void fillSimpleRepeat(int[] pixels, int off, int adjust, int x, int y,

// scale for gradient array...
g *= fastGradientArraySize;
g += 0.5; // rounding factor
g += 0.5f; // rounding factor
final int rowLimit = off + w; // end of row iteration
while (off < rowLimit) {
int idx = (int) g;
Expand Down Expand Up @@ -441,14 +441,14 @@ protected void fillSimpleReflect(int[] pixels, int off, int adjust, int x, int y
// (which has no affect due to the cylcle) to move
// all negative step values into the positive
// side.
step = step - 2 * ((int) step / 2.0f);
if (step < 0)
step += 2.0;
step = step - 2f * ((int) step / 2f);
if (step < 0f)
step += 2f;
final int reflectMax = 2 * fastGradientArraySize;

// Scale for gradient array.
g *= fastGradientArraySize;
g += 0.5;
g += 0.5f;
step *= fastGradientArraySize;
final int rowLimit = off + w; // end of row iteration
while (off < rowLimit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ protected final void calculateGradientFractions(Color[] loColors, Color[] hiColo
// estimate the size of the entire gradients array.
// This is to prevent a tiny interval from causing the size of array to
// explode. If the estimated size is too large, break to using
// seperate arrays for each interval, and using an indexing scheme at
// separate arrays for each interval, and using an indexing scheme at
// look-up time.
int estimatedSize = 0;

Expand All @@ -351,7 +351,7 @@ protected final void calculateGradientFractions(Color[] loColors, Color[] hiColo
hasDiscontinuity = true;
} else {
for (float aWorkTbl : workTbl) {
estimatedSize += (aWorkTbl / Imin) * GRADIENT_SIZE;
estimatedSize += (int) (aWorkTbl / Imin * GRADIENT_SIZE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ protected void initialise() {
pi.next();
break;
case PathIterator.SEG_LINETO:
pathLength += Point2D.distance(currentX, currentY, seg[0], seg[1]);
pathLength += (float) Point2D.distance(currentX, currentY, seg[0], seg[1]);
segments.add(new PathSegment(segType, seg[0], seg[1], pathLength, origIndex));
currentX = seg[0];
currentY = seg[1];
index++;
pi.next();
break;
case PathIterator.SEG_CLOSE:
pathLength += Point2D.distance(currentX, currentY, lastMoveX, lastMoveY);
pathLength += (float) Point2D.distance(currentX, currentY, lastMoveX, lastMoveY);
segments.add(new PathSegment(PathIterator.SEG_LINETO, lastMoveX, lastMoveY, pathLength, origIndex));
currentX = lastMoveX;
currentY = lastMoveY;
Expand All @@ -169,7 +169,7 @@ protected void initialise() {
while (!fpi.isDone()) {
segType = fpi.currentSegment(seg);
if (segType == PathIterator.SEG_LINETO) {
pathLength += Point2D.distance(currentX, currentY, seg[0], seg[1]);
pathLength += (float) Point2D.distance(currentX, currentY, seg[0], seg[1]);
segments.add(new PathSegment(segType, seg[0], seg[1], pathLength, origIndex));
currentX = seg[0];
currentY = seg[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2311,8 +2311,8 @@ protected Point2D getStartPoint(CharacterInformation info) {
// apply the glyph transformation to the start point
glyphTransform.transform(result, result);

result.x += b.getX();
result.y += b.getY();
result.x += (float) b.getX();
result.y += (float) b.getY();
return result;
}

Expand Down Expand Up @@ -2362,8 +2362,8 @@ protected Point2D getEndPoint(CharacterInformation info) {
if (glyphTransform != null)
glyphTransform.transform(result, result);

result.x += b.getX();
result.y += b.getY();
result.x += (float) b.getX();
result.y += (float) b.getY();
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ public static Rectangle2D convertFilterChainRegion(Element filterElement, Elemen
protected static Rectangle2D extendRegion(String dxStr, String dyStr, String dwStr, String dhStr, short unitsType,
GraphicsNode filteredNode, Rectangle2D region, UnitProcessor.Context uctx) {

float dx, dy, dw, dh;
double dx, dy, dw, dh;
switch (unitsType) {
case USER_SPACE_ON_USE:
dx = UnitProcessor.svgHorizontalCoordinateToUserSpace(dxStr, SVG12Constants.SVG_MX_ATRIBUTE, uctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,8 @@ protected Point2D adjustChunkOffsets(Point2D location, List<TextRun> textRuns, T
layout.setOffset(new Point2D.Float(absX, absY));

Point2D ladv = layout.getAdvance2D();
absX += ladv.getX();
absY += ladv.getY();
absX += (float) ladv.getX();
absY += (float) ladv.getY();
} else {
layout.setOffset(new Point2D.Float(tpShiftX, tpShiftY));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public LineInfo newLine(Point2D.Float loc, float lineWidth, boolean partial, Poi
nextLSI = idx + 1;
for (int ci = lineIdx; ci <= idx; ci++) {
if (ci == nextLSI) {
leftShift += leftShiftAmt[lsi++];
leftShift += (int) leftShiftAmt[lsi++];
if (lsi < leftShiftIdx.length)
nextLSI = leftShiftIdx[lsi];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public short getXCoordinate(int i) {
int n = i - c.getFirstIndex();
int x = gd.getXCoordinate(n);
int y = gd.getYCoordinate(n);
short x1 = (short) c.scaleX(x, y);
int x1 = c.scaleX(x, y);
x1 += c.getXTranslate();
return x1;
return (short) x1;
}
return 0;
}
Expand All @@ -126,9 +126,9 @@ public short getYCoordinate(int i) {
int n = i - c.getFirstIndex();
int x = gd.getXCoordinate(n);
int y = gd.getYCoordinate(n);
short y1 = (short) c.scaleY(x, y);
int y1 = c.scaleY(x, y);
y1 += c.getYTranslate();
return y1;
return (short) y1;
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ else if (c1 >= 'A' && c1 <= 'Z')
b = (byte) (c1 - 'A' + 10);
else
break;
b *= 16;
b *= (byte) 16;

char c2 = s.charAt(i);
if (c2 >= '0' && c2 <= '9')
Expand Down
Binary file modified test-references/samples/tests/spec/fonts/fontOnPath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-references/samples/tests/spec/scripting/text_content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-references/samples/tests/spec/text/textOnPath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-references/samples/tests/spec/text/textOnPath2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-references/samples/tests/spec/text/textOnPathSpaces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 906fbb2

Please sign in to comment.