Exemple #1
0
unsigned char *MQRspec_newFrame(int version)
{
	unsigned char *frame;
	int width;

	if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL;

#ifdef HAVE_LIBPTHREAD
	pthread_mutex_lock(&frames_mutex);
#endif
	if(frames[version] == NULL) {
		frames[version] = MQRspec_createFrame(version);
	}
#ifdef HAVE_LIBPTHREAD
	pthread_mutex_unlock(&frames_mutex);
#endif
	if(frames[version] == NULL) return NULL;

	width = mqrspecCapacity[version].width;
	frame = (unsigned char *)malloc(width * width);
	if(frame == NULL) return NULL;
	memcpy(frame, frames[version], width * width);

	return frame;
}
Exemple #2
0
unsigned char *MQRspec_newFrame(int version)
{
	if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL;

	return MQRspec_createFrame(version);
}