Addressed warnings when compiling on MinGW/MSYS

Following warnings still remain so far.

src/tuxpaint.c:199:2: warning: #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" [-Wcpp]
  199 | #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR"
      |  ^~~~~~~

src/parse.gperf: In function 'parse_one_option':
src/parse.gperf:306:45: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
  306 |   memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); /* FIXME: This causes a warning; should it be 'sizeof(char)', or do we need to have the warning suppressed? -bjk 2021.10.14 */
      |                                             ^~~~

src/dirwalk.c: In function 'tp_ftw':
src/dirwalk.c:348:2: warning: #warning Failed to see DT_UNKNOWN [-Wcpp]
  348 | #warning Failed to see DT_UNKNOWN
      |  ^~~~~~~

src/get_fname.c: In function 'get_fname':
src/get_fname.c💯3: warning: 'dir' may be used uninitialized in this function [-Wmaybe-uninitialized]
  100 |   snprintf(f, sizeof(f),
      |   ^~~~~~~~~~~~~~~~~~~~~~
  101 |            "%s%c%s",
      |            ~~~~~~~~~
  102 |     dir, (*name) ? '/' : '\0', /* Some mkdir()'s don't like trailing slashes */
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103 |     name);
      |     ~~~~~

magic/src/cartoon.c:178:99: warning: unused parameter 'last' [-Wunused-parameter]
  178 | static void do_cartoon(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
      |                                                                                     ~~~~~~~~~~~~~~^~~~
This commit is contained in:
dolphin6k 2021-11-05 12:23:09 +09:00
parent ee83ee090e
commit 7c8f6bca80
4 changed files with 17 additions and 6 deletions

View file

@ -64,6 +64,9 @@
#include "debug.h"
#ifdef WIN32
extern char *strcasestr(const char *haystack, const char *needle);
#endif
/* Directory walking callers and callbacks */

View file

@ -66,6 +66,7 @@
#ifdef WIN32
#include "win32_print.h"
extern char *strcasestr(const char *haystack, const char *needle);
#endif
#if defined(__MACOS__)

View file

@ -14611,10 +14611,10 @@ static void do_png_embed_data(png_structp png_ptr)
#ifdef WIN32
iconv_t trans;
wchar_t *wch;
char *ch;
char *conv, *conv2;
size_t in, out;
in = out = 1;
conv = malloc(255);
trans = iconv_open("UTF-8", "WCHAR_T");
@ -14625,7 +14625,8 @@ static void do_png_embed_data(png_structp png_ptr)
in = 2;
out = 10;
wch = &current_node->save_texttool_str[i];
iconv(trans, (char **)&wch, &in, &conv, &out);
ch = (char *)wch;
iconv(trans, &ch, &in, &conv, &out);
conv[0] = '\0';
fprintf(lfi, "%s", conv2);
}

View file

@ -328,6 +328,7 @@ const char *SurfacePrint(SDL_Surface * surf, const char *printcfg, int showdialo
int nError;
SDL_SysWMinfo wminfo;
BITMAPINFOHEADER bmih;
BITMAPINFO bmi;
SDL_Surface *surf24 = NULL;
RECT rcDst;
float sX, sY;
@ -464,12 +465,13 @@ const char *SurfacePrint(SDL_Surface * surf, const char *printcfg, int showdialo
{
SetStretchBltMode(hDCprinter, COLORONCOLOR);
bmi.bmiHeader = bmih;
nError = StretchDIBits(hDCprinter, rcDst.left, rcDst.top,
rcDst.right - rcDst.left,
rcDst.bottom - rcDst.top,
0, 0, bmih.biWidth, bmih.biHeight,
surf24->pixels, (BITMAPINFO *) & bmih, DIB_RGB_COLORS, SRCCOPY);
if (nError == GDI_ERROR)
surf24->pixels, &bmi, DIB_RGB_COLORS, SRCCOPY);
if (nError == (int) GDI_ERROR)
{
res = "win32_print: StretchDIBits() failed.";
goto error;
@ -518,11 +520,13 @@ static HRESULT ReadRegistry(const char *key, const char *option, char *value, in
{
LONG res;
HKEY hKey = NULL;
DWORD _size;
_size = size;
res = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_READ, &hKey);
if (res != ERROR_SUCCESS)
goto err_exit;
res = RegQueryValueEx(hKey, option, NULL, NULL, (LPBYTE) value, (LPDWORD) & size);
res = RegQueryValueEx(hKey, option, NULL, NULL, (LPBYTE) value, &_size);
if (res != ERROR_SUCCESS)
goto err_exit;
res = ERROR_SUCCESS;
@ -603,6 +607,7 @@ char *GetSystemFontDir(void)
*
* @return user's image dir
*/
char *GetUserImageDir(void);
char *GetUserImageDir(void)
{
char path[MAX_PATH];
@ -624,7 +629,7 @@ char *GetUserImageDir(void)
*/
static char *GetUserTempDir(void)
{
char *temp = getenv("TEMP");
const char *temp = getenv("TEMP");
if (!temp)
{
@ -659,6 +664,7 @@ static int g_bWindowActive = 0;
/**
* FIXME
*/
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
int bEatKeystroke = 0;