HexEdit/Misc.cpp
static const unsigned char * memmem(const unsigned char * buf, size_t buflen, const unsigned char * to_find, size_t to_find_len)
{
	for (const unsigned char * pp = buf; pp < buf + buflen - to_find_len; ++pp)
		if (memcmp(pp, to_find, to_find_len) == 0)
			return pp;

	return NULL;
}
// Search memory for another chunk of memory (like strstr). Returns a pointer to the first byte or NULL if not found.
// Note: This may not be efficient - needs to be optimised (and inlined?) if used to search large blocks of memory

Search memory for another chunk of memory (like strstr). Returns a pointer to the first byte or NULL if not found.
Note: This may not be efficient - needs to be optimised (and inlined?) if used to search large blocks of memory
Search memory for another chunk of memory ( like strstr ) . Returns a pointer to the first byte or NULL if not found . Note : This may not be efficient - needs to be optimised ( and inlined? ) if used to search large blocks of memory
static const unsigned char * memmem(const unsigned char * buf, size_t buflen, const unsigned char * to_find, size_t to_find_len)
{
	for (const unsigned char * pp = buf; pp < buf + buflen - to_find_len; ++pp)
		if (memcmp(pp, to_find, to_find_len) == 0)
			return pp;
	return NULL;
}
static const unsigned char * memmem ( const unsigned char * buf , size_t buflen , const unsigned char * to_find , size_t to_find_len ) { for ( const unsigned char * pp = buf ; pp < buf + buflen - to_find_len ; ++ pp ) if ( memcmp ( pp , to_find , to_find_len ) == 0 ) return pp ; return NULL ; }
Search memory for another chunk of memory (like strstr).
Search memory for another chunk of memory ( like strstr ) .