Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) lib: getPatternSizeInfo() #58

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/src/main/java/org/pcre4j/Pcre2Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,27 @@
* @return the size information as long
*/
private long getPatternSizeInfo(int info) {
final var infoSize = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE);
final var infoSize = api.patternInfo(handle, info);

Check warning on line 189 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L189

Added line #L189 was not covered by tests

if (infoSize == 4) {
final var where = new int[1];
final var error = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE, where);
final var error = api.patternInfo(handle, info, where);

Check warning on line 193 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L193

Added line #L193 was not covered by tests
if (error != 0) {
throw new IllegalStateException(Pcre4jUtils.getErrorMessage(api, error));
}

return where[0];
} else if (infoSize == 8) {
final var where = new long[1];
final var error = api.patternInfo(handle, IPcre2.INFO_FRAMESIZE, where);
final var error = api.patternInfo(handle, info, where);

Check warning on line 201 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L201

Added line #L201 was not covered by tests
if (error != 0) {
throw new IllegalStateException(Pcre4jUtils.getErrorMessage(api, error));
}

return where[0];
}

throw new Pcre2PatternInfoSizeError(Pcre2PatternInfo.valueOf(IPcre2.INFO_FRAMESIZE).orElseThrow(), infoSize);
throw new Pcre2PatternInfoSizeError(Pcre2PatternInfo.valueOf(info).orElseThrow(), infoSize);

Check warning on line 209 in lib/src/main/java/org/pcre4j/Pcre2Code.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/org/pcre4j/Pcre2Code.java#L209

Added line #L209 was not covered by tests
}

/**
Expand Down