Problems with GetConfigureInfo, ListConfigureInfo etc.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Problems with GetConfigureInfo, ListConfigureInfo etc.

Post by el_supremo »

I'm using 6.2.6 on Win XP Pro system.
The GetConfigureInfo function doesn't seem to be returning the correct info.
The configure.xml file contains eight configure entries but the GetConfigureInfo function says that there are 16 and when I list them, it has each of those eight entries duplicated.
This code (with appropriate declarations and Initialize and Destroy Magick around it):

Code: Select all

		p = GetConfigureList("*",&no,&exception);
		f = fopen("configlist.txt","w");
		fprintf(f,"%ld\n",no);
		while(*p != NULL) {
			fprintf(f,"%s\n",*p++);
		}
		fclose(f);
produces this in configlist.txt:
16
COPYRIGHT
COPYRIGHT
HOST
HOST
LIB_VERSION
LIB_VERSION
LIB_VERSION_NUMBER
LIB_VERSION_NUMBER
NAME
NAME
RELEASE_DATE
RELEASE_DATE
VERSION
VERSION
WEBSITE
WEBSITE

If I use that same code but call GetCoderList instead, it generates the correct info.
While trying to sort out why this was happening I decided to try ListConfigureInfo:

Code: Select all

		file = fopen("coderopts.txt","w");
		if(file != NULL) {
			ListConfigureInfo(file,&exception);
			fclose(file);
		}
This crashes and later on I found that ListCoderInfo also crashes - both trying to write to address 00000010 in strcmpi.
GetTypeList works but ListTypeInfo crashes.

I haven't been able to find the problem yet.

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We assume you declared *p as char **p? We tried your code under Windows XP with ImageMagick 6.2.6-1 and the GetConfigureList() method properly returned the configure list as expected without complaint or fault.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

We assume you declared *p as char **p?

Yes.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

I installed 6.2.6-1 from the windows binary and tried it again (I was previously using my own compiled version).
GetConfigureList now correctly returns 8 items but ListTypeInfo, ListCoderInfo and ListConfigureInfo all crash when used as shown in the second code snippet in my original message. I vaguely remembered that I've had problems with this type of thing before so I also tried IdentifyImage as shown below and it also crashes in the same way.

Code: Select all

FILE *file;
ExceptionInfo exception;
MagickPixelPacket pixel;
Image *image;
ImageInfo *imageInfo;

InitializeMagick(NULL);
GetExceptionInfo(&exception);
imageInfo = CloneImageInfo(NULL);
QueryMagickColor("red", &pixel, &exception);
image = NewMagickImage(imageInfo, 400, 400, &pixel);
SetImageOpacity(image, (Quantum)(MaxRGB*0.5));
strcpy(image->filename, "test1.png");
WriteImage(imageInfo, image);

file = fopen("identify.txt","wt");
if(file != NULL) {
	IdentifyImage(image,file,MagickFalse);
	fclose(file);
}
DestroyImage(image);

The file is created but empty.
Maybe there's something amiss with my program or my system but I can't figure out what's going wrong.

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We tried your code with ImageMagick 6.2.6-1 under Windows compiled with Visual C++ 2003 .Net and it worked without complaint. It produced a file with the image attributes in it as expected.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

That's the compiler I'm using now.
Is there some way you could post or email me the code, .sln file etc. for me to try?

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

To test your code we just cut-n-pasted your code snippet into the button project you find in c:\Program Files\ImageMagick-6.2.6-Q16\Magick++_Demos. When you get an undefined symbol just add MagickLib:: in front of it to tell the C++ compiler to look in the MagickLib namespace.
Post Reply