Merge branch 'SKBotNL:main' into main

This commit is contained in:
NotAlexNoyle authored and GitHub committed 2026-04-09 15:03:42 -04:00
commit 77a48d0902
16 files changed
+31 -21

No files matched your search

+3 -4
View File
@@ -139,8 +139,8 @@ jint JNICALL fis_read0_hook(JNIEnv *env, jobject thiz) {
}
struct fis_file_data *fd = &file->value;
char read_byte = fd->data[fd->index++];
if (fd->data[fd->index] == '\0') {
jint read_byte = (unsigned char)fd->data[fd->index++];
if (fd->index >= fd->length) {
free(fd->data);
fd->data = NULL;
}
@@ -168,7 +168,7 @@ jlong JNICALL fis_length0_hook(JNIEnv *env, jobject thiz) {
jlong JNICALL fis_position0_hook(JNIEnv *env, jobject thiz) {
if (!has_tag(thiz)) {
return fis_real_length0(env, thiz);
return fis_real_position0(env, thiz);
}
jclass class = (*env)->GetObjectClass(env, thiz);
@@ -209,7 +209,6 @@ jlong JNICALL fis_skip0_hook(JNIEnv *env, jobject thiz, jlong n) {
if (skip == remaining) {
free(fd->data);
fd->data = NULL;
return skip;
}
return skip;
+11 -2
View File
@@ -47,7 +47,6 @@ char *substitute(const char *value, int prefix_char_matched_index, size_t i,
void parse_file(char **data_ptr, size_t fsize, const char *filename) {
char *data = *data_ptr;
int line_count = 1;
;
int begin_env_index = -1;
char env_var[4096];
env_var[0] = '\0';
@@ -59,6 +58,16 @@ void parse_file(char **data_ptr, size_t fsize, const char *filename) {
if ((c >= 48 && c <= 57) || (c >= 65 && c <= 90) ||
(c >= 97 && c <= 122) || c == 95) {
size_t len = strlen(env_var);
if (len + 1 >= 4096) {
fprintf(stderr,
"\033[0G\e[0;31m[SubstAgent] Failed to expand environment "
"variable \"%s\" in file %s on line %d because it is too "
"big\e[0m\n",
env_var, filename, line_count);
begin_env_index = -1;
env_var[0] = '\0';
continue;
}
env_var[len] = c;
env_var[len + 1] = '\0';
} else if (c == '}') {
@@ -113,7 +122,7 @@ void parse_file(char **data_ptr, size_t fsize, const char *filename) {
}
} else {
if (c == '^') {
if (data[i + 1] == '{') {
if (i + 1 < fsize && data[i + 1] == '{') {
begin_env_index = i;
i++;
}
+4 -2
View File
@@ -1,10 +1,12 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
// Test file that is not a config file
class Test13 {
static String correctString = "This is not a config file so ${SAME_LENGTH_ENV} shouldn't be substituted";
static String correctString = "This is not a config file so ^{SAME_LENGTH_ENV} shouldn't be substituted";
public static String toHexDump(String s) {
byte[] bytes = s.getBytes(java.nio.charset.StandardCharsets.UTF_8);
@@ -38,4 +40,4 @@ class Test13 {
throw e;
}
}
}
}
+1 -1
View File
@@ -1 +1 @@
Hello ${SAME_LENGTH_ENV}
Hello ^{SAME_LENGTH_ENV}
+1 -1
View File
@@ -1 +1 @@
According to all known laws of aviation, there is no way a bee should be able to fly ${SAME_LENGTH_ENV}
According to all known laws of aviation, there is no way a bee should be able to fly ^{SAME_LENGTH_ENV}
+1 -1
View File
@@ -1 +1 @@
According to all known laws of aviation, there is no way a bee should be able to fly ${SHORTER_ENV}
According to all known laws of aviation, there is no way a bee should be able to fly ^{SHORTER_ENV}
+1 -1
View File
@@ -1 +1 @@
${SHORTER_ENV}
^{SHORTER_ENV}
+1 -1
View File
@@ -1 +1 @@
This is not a config file so ${SAME_LENGTH_ENV} shouldn't be substituted
This is not a config file so ^{SAME_LENGTH_ENV} shouldn't be substituted
+1 -1
View File
@@ -1 +1 @@
Hello ${SHORTER_ENV}
Hello ^{SHORTER_ENV}
+1 -1
View File
@@ -1 +1 @@
Hello ${LONGER_ENV}
Hello ^{LONGER_ENV}
+1 -1
View File
@@ -1 +1 @@
Hi ${SAME_LENGTH_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{SAME_LENGTH_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
+1 -1
View File
@@ -1 +1 @@
Hi ${SHORTER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{SHORTER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
+1 -1
View File
@@ -1 +1 @@
Hi ${LONGER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{LONGER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
+1 -1
View File
@@ -1 +1 @@
Hi ${SAME_LENGTH_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{SAME_LENGTH_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
+1 -1
View File
@@ -1 +1 @@
Hi ${SHORTER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{SHORTER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
+1 -1
View File
@@ -1 +1 @@
Hi ${LONGER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly
Hi ^{LONGER_ENV} According to all known laws of aviation, there is no way a bee should be able to fly