Add block parameter to various ArrayList functions#1656
Add block parameter to various ArrayList functions#1656peace-maker merged 6 commits intoalliedmodders:masterfrom
Conversation
|
I like this. Would also be nice to have block param for (G/S)et(String/Array), too |
That sounds like a great addition. I'll get around to it in the coming days. I don't really mind if it's in this PR or another.
|
|
I've added the block parameter to (G/S)et(String/Array) and updated the PR name/description. |
|
If I'm not missing something, your code has a major bug. For SetString you don't prevent actually prevent writing past the string's buffer. enum struct SomeStruct
{
int a;
char textLong[16];
int b;
char textShort[4];
int c;
}
// ...
list.SetString(0, "Some string that is very much too large for this buffer", SomeStruct::textLong); |
|
@Mikusch can you rebase and fix the buffer overflow @sirdigbot mentioned please? |
|
Hi @peace-maker, I apologize for how long it's taken me to update this PR. bb918f2 adds an optional |
|
I think the last thing missing to really get off of the wasteful iteration of struct arrays is a start index parameter for FindString/FindValue -- to handle the instances where members can have identical values. (along with case insensivity option for FindString perhaps) Edit: Looking into it |
This PR adds the
blockparameter to the following functions:ArrayList.FindStringArrayList.GetArrayArrayList.SetArrayArrayList.GetStringArrayList.SetStringDefault value is 0.
This can be useful especially when operating on enum structs: