ObjFW  Diff

Differences From Artifact [0b8584dc8f]:

  • File src/OFArray_adjacent.m — part of check-in [4dbca9fc06] at 2014-04-08 17:01:53 on branch trunk — OFArray_adjacent: Optimize fast enumeration

    This restores the previous behaviour for OFArray_adjacent. It was lost
    when OFArray's fast enumeration was changed to be better optimized for
    huge arrays that aren't adjacent in memory. I forgot that
    OFArray_adjacent just used the implementation from OFArray, as OFArray
    had the ideal implementation for OFArray_adjacent, but now that OFArray
    is optimized for huge, non-adjacent arrays, this wasn't the case
    anymore. (user: js, size: 7146) [annotate] [blame] [check-ins using]

To Artifact [794a332a64]:

  • File src/OFArray_adjacent.m — part of check-in [4e59d2692f] at 2014-04-26 00:40:17 on branch trunk — Fix a few issues on LLP64 and Win64

    LLP64 was mostly fast enumeration using an unsigned long for the state,
    which can't store a pointer or a size_t on LLP64. This is now solved by
    either throwing an OFOutOfRangeException if the value of the size_t is
    bigger than ULONG_MAX or storing the pointer in the extra field (copied
    using memcpy, as it's an array of unsigned long, which again would be
    too small to store a pointer).

    Win64 was mostly Microsoft not being able to decide whether a length is
    a size_t, a DWORD, an int or an unsigned int (thus the different types
    in places that seem to be almost the same). But since that would not be
    confusing enough, a file descriptor is an int if it's for a file, but a
    long long if it is for a socket. But of course, for ReadFile and friends
    it's a DWORD instead of an int then. (user: js, size: 7161) [annotate] [blame] [check-ins using]


345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
		return [super countByEnumeratingWithState: state
						  objects: objects
						    count: count_];

	if (state->state >= count)
		return 0;

	state->state = count;
	state->itemsPtr = [_array items];
	state->mutationsPtr = (unsigned long*)self;

	return (int)count;
}

#ifdef OF_HAVE_BLOCKS







|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
		return [super countByEnumeratingWithState: state
						  objects: objects
						    count: count_];

	if (state->state >= count)
		return 0;

	state->state = (unsigned long)count;
	state->itemsPtr = [_array items];
	state->mutationsPtr = (unsigned long*)self;

	return (int)count;
}

#ifdef OF_HAVE_BLOCKS