Fix build
This commit is contained in:
@@ -2931,9 +2931,9 @@ DN_API DN_USize DN_Str8Split(DN_Str8 string, DN_Str8 delimiter, DN_Str8 *splits,
|
||||
DN_Str8FindResult find = DN_Str8FindStr8(DN_Str8Advance(it, 1), DN_Str8Lit("\""), DN_Str8EqCase_Sensitive);
|
||||
DN_Assert(find.found);
|
||||
item = find.start_to_before_match;
|
||||
it = DN_Str8BSplit(find.after_match_to_end_of_buffer, DN_Str8Lit(",")).rhs;
|
||||
it = DN_Str8BSplit(find.after_match_to_end_of_buffer, delimiter).rhs;
|
||||
} else {
|
||||
DN_Str8BSplitResult sub_split = DN_Str8BSplit(it, DN_Str8Lit(","));
|
||||
DN_Str8BSplitResult sub_split = DN_Str8BSplit(it, delimiter);
|
||||
item = sub_split.lhs;
|
||||
it = sub_split.rhs;
|
||||
}
|
||||
@@ -2948,7 +2948,7 @@ DN_API DN_USize DN_Str8Split(DN_Str8 string, DN_Str8 delimiter, DN_Str8 *splits,
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Str8SplitResult DN_Str8SplitArena(DN_Arena *arena, DN_Str8 string, DN_Str8 delimiter, DN_Str8SplitFlags mode)
|
||||
DN_API DN_Str8SplitResult DN_Str8SplitArena(DN_Str8 string, DN_Str8 delimiter, DN_Str8SplitFlags mode, DN_Arena *arena)
|
||||
{
|
||||
DN_Str8SplitResult result = {};
|
||||
DN_USize count = DN_Str8Split(string, delimiter, /*splits*/ nullptr, /*count*/ 0, mode);
|
||||
|
||||
@@ -943,12 +943,6 @@ struct DN_Allocator
|
||||
void* context;
|
||||
};
|
||||
|
||||
struct DN_ArenaStatsStr8x64
|
||||
{
|
||||
DN_Str8x64 info;
|
||||
DN_Str8x64 hwm;
|
||||
};
|
||||
|
||||
enum DN_ArenaReset
|
||||
{
|
||||
DN_ArenaReset_No,
|
||||
@@ -1106,6 +1100,7 @@ enum DN_Str8FindFlag_
|
||||
typedef DN_USize DN_Str8SplitFlags;
|
||||
enum DN_Str8SplitFlags_
|
||||
{
|
||||
DN_Str8SplitFlags_Nil = 0,
|
||||
DN_Str8SplitFlags_ExcludeEmptyStrings = 1 << 0,
|
||||
DN_Str8SplitFlags_HandleQuotedStrings = 1 << 1,
|
||||
};
|
||||
|
||||
@@ -114,12 +114,12 @@ DN_API DN_ArrayEraseResult DN_ArrayEraseRange(void *data, DN_USize *size, DN_USi
|
||||
// Compute the range to erase
|
||||
DN_USize start = 0, end = 0;
|
||||
if (count < 0) {
|
||||
// Erase backwards from begin_index, inclusive of begin_index
|
||||
// Range: [begin_index + count + 1, begin_index + 1)
|
||||
// Which is: [begin_index - abs(count) + 1, begin_index + 1)
|
||||
// Erase backwards from begin_index, not inclusive of begin_index
|
||||
// Range: [begin_index + count, begin_index)
|
||||
// Which is: [begin_index - abs(count), begin_index)
|
||||
DN_USize abs_count = DN_Abs(count);
|
||||
start = (begin_index + 1 > abs_count) ? (begin_index + 1 - abs_count) : 0;
|
||||
end = begin_index + 1;
|
||||
start = (begin_index > abs_count) ? (begin_index - abs_count) : 0;
|
||||
end = begin_index;
|
||||
} else {
|
||||
start = begin_index;
|
||||
end = begin_index + count;
|
||||
@@ -147,7 +147,14 @@ DN_API DN_ArrayEraseResult DN_ArrayEraseRange(void *data, DN_USize *size, DN_USi
|
||||
}
|
||||
|
||||
result.items_erased = erase_count;
|
||||
result.it_index = start ? start - 1 : start;
|
||||
// NOTE: If we are erasing from the current index of the iterator to the end of the array then
|
||||
// there's no more elements in the array to iterate. So the returned index should b
|
||||
// one-past-last index
|
||||
if (begin_index == start && end >= *size) {
|
||||
result.it_index = *size;
|
||||
} else {
|
||||
result.it_index = start ? start - 1 : 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user