Label and extension list broken when format plugin loaded.
Posted: Sun Aug 23, 2009 12:50 pm
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):


Source:
Is there any way to make it work correctly?
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):
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;
}