-
-
Notifications
You must be signed in to change notification settings - Fork 463
Add block parameter to various ArrayList functions #1656
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
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 |
peace-maker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
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: