mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-06 09:21:01 +00:00
[set] Check for 0 count correctly
I don't know what I was thinking when I checked for 0 count for resizing the set. Attempting to add/remove 0 elements results in adding/removing 4G elements. Oops.
This commit is contained in:
parent
09a3e257e8
commit
04e26a7b9f
1 changed files with 8 additions and 2 deletions
|
@ -194,7 +194,10 @@ _set_remove (set_t *set, unsigned x)
|
|||
static inline void
|
||||
_set_add_range (set_t *set, unsigned start, unsigned count)
|
||||
{
|
||||
if (!count || start + count > set->size) {
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
if (start + count > set->size) {
|
||||
set_expand (set, start + count);
|
||||
}
|
||||
unsigned end = start + count - 1;
|
||||
|
@ -216,7 +219,10 @@ _set_add_range (set_t *set, unsigned start, unsigned count)
|
|||
static inline void
|
||||
_set_remove_range (set_t *set, unsigned start, unsigned count)
|
||||
{
|
||||
if (!count || start >= set->size) {
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
if (start >= set->size) {
|
||||
return;
|
||||
}
|
||||
if (start + count > set->size) {
|
||||
|
|
Loading…
Reference in a new issue