C language > Beginner questions

ImageShop32 - Missing prototype for... What is that?

(1/2) > >>

localmotion34:
LOADGIF.C(58): warning #2027: Missing prototype for 'Header' is what i get, along with 10 other prototype errors in a C source code.

I am trying to compile the ImageShop32 source by John F., and both Pelles and LccWin32 give the EXACT same errors. 


--- Quote ---H:\Pelles and C ex\ImageShop\LOADGIF.C(58): warning #2027: Missing prototype for 'Header'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(75): warning #2114: Local 'lp' is not referenced.
H:\Pelles and C ex\ImageShop\LOADGIF.C(193): warning #2027: Missing prototype for 'IsNewDibFormat'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(203): warning #2027: Missing prototype for 'DIBNumColours'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(231): warning #2027: Missing prototype for 'ColourTableSize'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(246): warning #2027: Missing prototype for 'CreateDIB'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(300): error #2168: Operands of = have incompatible types 'struct tagRGBQUAD *' and 'unsigned char *'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(336): warning #2027: Missing prototype for 'OutLine'.
H:\Pelles and C ex\ImageShop\LOADGIF.C(455): warning #2114: Local 'lp' is not referenced.
H:\Pelles and C ex\ImageShop\LOADGIF.C(536): error #2120: Redeclaration of 'LoadGIF' previously declared at H:\Pelles and C ex\ImageShop\loadgif.h(17): found 'void * __cdecl function' expected 'void * __stdcall function(char *)'.
--- End quote ---

Now LccWin32 did spit out OBJ files for all the C sources, in which i tried using the LoadGIF.OBJ in actually loading Gifs.  What i found was that it could load EVERY gif that i had, a task most GIF decoders i have source for MISERABLY fail at. 

However, the routine LoadGif would ONLY work when called in the MAIN code, and not nested inside a procedure call. 

            hglobal=loadGIF(LPZfilename)
            BITMAPINFO bmpinfo =hglobal
            LONG BitmapBits= bmpinfo+32+8 *16
            HDC hScreenDc = GetDC(0)
            HBITMAP newBitmap = CreateDIBitmap(hScreenDc, bmpinfo->bmiHeader, CBM_INIT,BitmapBits, bmpinfo, DIB_RGB_COLORS)
            ReleaseDC(0,hScreenDc)
            SendMessage(IDC_Static, STM_SETIMAGE,IMAGE_BITMAP,newBitmap)

I have tried using the OBJ file in a simple C program, as well as PureBasic, and they both crash when the LoadGIF is called from a procedure.  My question is:

Are the errors from the compiler causing the function to crash? Why does the compiler create the OBJ file if these appear to be critical errors. 

Finally, this is the ABSOLUTE BEST gif loading routine i have ever seen written, HANDS DOWN.  Being that my goal is to create a full featured completely FREE image library for use in all languages, i have studied many, many routines.  It has NEVER failed when called from the main code section.  And i have used GIFs created from the web, Photoshop, Corel, AVD graphics studio ect. 


Is there something i am missing here? The files LoadGIF.c and LoadGIF.h are attached.  Is there something about the whole ImageShop32 package that cant be compiled on either LCC or Pelles?

JohnF:
Attached is a project that uses your PCX stuff plus I added the gif loader.

There shouldn't be a problem with the gif loader. I'll have to investigate ImageShop32.

John

localmotion34:
Wow, it works with your example.  You changed the LoadGIF to a HDIB from a HGLOBAL, i did notice that.  The OBJ file still crashes my program from PureBasic, and using it linked with a test app in PellesC. 

If it does not crash, the the Gif color table gets corrupted it looks like. 

Why did you create a HGLOBAL before, and not a HBITMAP? 

Additionally, if i set the compiler flags to Level 2, these errors are reported for the LoadGIF module:


--- Quote ---H:\Temp\LoadGif.c(95): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(144): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(146): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(242): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
H:\Temp\LoadGif.c(431): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(447): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(489): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(515): warning #2216: Return value from function is never used.
H:\Temp\LoadGif.c(550): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
H:\Temp\LoadGif.c(571): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
H:\Temp\LoadGif.c(590): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
H:\Temp\LoadGif.c(596): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
H:\Temp\LoadGif.c(637): warning #2216: Return value from function is never used.
--- End quote ---

I am finding all of this a little hard to understand.  Why, in your example does the GIF load perfectly, but when linking it to another example with the SAME OBJ file, does it crash?

JohnF:
>>Why did you create a HGLOBAL before, and not a HBITMAP? 

Most of these windows types are in fact pointers to void so it doesn't make a difference.

>> Additionally, if i set the compiler flags to Level 2, these errors are reported for the LoadGIF module:

Warning like these can be corrected - give it a go.

Edit: the warning of "Return value from function is never used" - these can't be corrected, don't know why they are reported really.

>>The OBJ file still crashes my program from PureBasic, and using it linked with a test app in PellesC.

I can't comment on this as PureBasic is out of my league.

John

JohnF:
Concerning the colours, there is a bug in CreateDIB in DibUtils.c

Where you have, at approx line 168

  lpRgbQ = ((RGBQUAD*)hDIB + sizeof(bi));

it should be

 lpRgbQ = (RGBQUAD*)((LPBYTE)hDIB + sizeof(bi));

John

Navigation

[0] Message Index

[#] Next page

Go to full version