Page 1 of 1

Label and extension list broken when format plugin loaded.

Posted: Sun Aug 23, 2009 12:50 pm
by epi
Hi,

I am writing a plugin for viewing 8-bit Atari images and there is quite big number of extensions that need to be supported at once (currently 19).
I've found that XnView 1.74 provides 64 bytes for both label and extension in gfpGetPluginInfo, and 1.96 provides 128 bytes. I do copying using the same method strlcpy does, and just before returning from gfpGetPluginInfo both copied label and extension are proven to be ok (not longer than *_max_size, and always null-terminated).
However, in 1.74, only first 10 extensions work, and in 1.96 - only first 12. When I open Info > Supported formats..., information set by my plugin appears to be broken - here are screenshots from 1.96 (1.74 does similar thing, but at least it doesn't damage label):

Image

Image

Source:

Code: Select all

#ifndef XNVIEW_FAIL_EXT
#define XNVIEW_FAIL_EXT "rip;gr8;mic;hip;tip;int;inp;apc;ap3;gr9;pic;cpr;cin;cci;fnt;sxs;hr;plm;ilc"
#endif

static size_t strlcpy(char *dst, const char *src, size_t size)
{
	int i;
	for (i = 0; i < size - 1 && src[i] != '\0'; i++)
		dst[i] = src[i];
	dst[i] = '\0';
	while  (src[i] != '\0')
		i++;
	return i;
}

DLL_EXPORT BOOL API gfpGetPluginInfo(DWORD version, LPSTR label, INT label_max_size, LPSTR extension, INT extension_max_size, INT *support)
{
	static const char* fail_label = "First Atari Image Library";
	static const char* fail_ext = XNVIEW_FAIL_EXT;

	if (version != 0x0002)
		return FALSE;
	strlcpy(label, fail_label, label_max_size);
	strlcpy(extension, fail_ext, extension_max_size);

	*support = GFP_READ;

	return TRUE;
}
Is there any way to make it work correctly?

Re: Label and extension list broken when format plugin loaded.

Posted: Mon Aug 24, 2009 9:01 am
by xnview
epi wrote: I am writing a plugin for viewing 8-bit Atari images and there is quite big number of extensions that need to be supported at once (currently 19).
You have some Atari formats that XnView don't support?? I'm very interested if you can send me samples?
Else currently, there is a limitation. Only 10 extensions can be used by a plugin...

Re: Label and extension list broken when format plugin loaded.

Posted: Tue Aug 25, 2009 5:20 pm
by epi
Thank you for your quick response. We decided to make two plugins supporting different extensions. The project has just been released at sf.net and here you can download examples.

You may also be interested in the fact, that XnView is likely to crash when you change the name of existing plugin file in "Plugins" directory, or put a new plugin supporting already supported extension, until xnview.ini is deleted.