only: EPIC: Improve toolset for default tune canned tune generation #4871

This commit is contained in:
Andrey 2024-03-09 17:19:08 -05:00
parent 4096a61a7e
commit 7ddc622d35
1 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.opensr5.ini.field;
import com.opensr5.ConfigurationImage;
import com.rusefi.tune.xml.Constant;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedList;
@ -22,6 +23,19 @@ public class StringIniField extends IniField {
public String getValue(ConfigurationImage image) {
String value = new String(image.getContent(), getOffset(), size);
value = value.trim();
value = trimAtZeroSymbol(value);
return value;
}
@NotNull
private static String trimAtZeroSymbol(String value) {
for (int i = 0; i < value.length(); i++) {
// C/C++ zero string is terminated but java XML looks for all 'size' of symbols, let's convert
if (value.charAt(i) == 0) {
value = value.substring(0, i);
break;
}
}
return value;
}