I've been getting two types of warnings that are starting to bother me. The most common of which is with my "LoadFile" function. I'm seeing this warning a lot and it's bogging down the list of warnings making it hard to search for where syntax errors are occurring. Thing is, I don't understand what the warning means (the ending part in particular).
Code:
char LoadFile(const char FileName[64], char FileType, BITMAPINFOHEADER *BMPInfo,
unsigned char *BMPData, char FogUsed, double ObjectScaling,
char LoadType)
...
LoadFile("HillsBG.tga", 2, &HillsInfo, &HillsData, 1, Hills.Scaling, 0);
That's the function header and how it's called. This is the warning I'm getting, taking up about half of the list of warnings I've got:
c:\my documents\my programs\interactive animation\interactive animation\interactive animation.c(1779) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'unsigned char (*__w64 )[163840]'
c:\my documents\my programs\interactive animation\interactive animation\interactive animation.c(1779) : warning C4024: 'LoadFile' : different types for formal and actual parameter 4
The one referenced is the HillsData (when called) and BMPData (in the function parameter list). The BMPData is an array of a variable size. The image is 1024x40 and 32-bit color so the image data uses 163840 bytes, the reason for that array size. The mountains are 1024x128 and 32-bit color and thus use 524,288 as the array length. The sky is 640x240 and 24-bit color so it has 460,800. In other words, it's all over the place. What does this warning mean? I understand the "unsigned char *" part of it (a pointer to an unsigned char type), but what about the "unsigned char (*__w64 )[163840]" part? How do I fix this?
The other warnings occur every time I use strcpy, sprintf, and some other common C things. This warning is:
c:\my documents\my programs\interactive animation\interactive animation\interactive animation.c(1130) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(345) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
What is wrong with using strcpy or sprintf? Why is it deprecated? These types of things take up about 2/5 of the warnings, most of which from using sprintf.
Ignoring these, I have very few warnings - only 5. Otherwise, I have 67 at the moment (!).