Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about casting pointer from/to different size integer #773

Merged
merged 1 commit into from Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sciwrappers.c
Expand Up @@ -970,7 +970,7 @@ void sci_get_text_range(ScintillaObject *sci, gint start, gint end, gchar *text)
tr.chrg.cpMin = start;
tr.chrg.cpMax = end;
tr.lpstrText = text;
SSM(sci, SCI_GETTEXTRANGE, 0, (long) &tr);
SSM(sci, SCI_GETTEXTRANGE, 0, (sptr_t) &tr);
}


Expand Down
2 changes: 1 addition & 1 deletion src/win32.c
Expand Up @@ -816,7 +816,7 @@ static FILE *open_std_handle(DWORD handle, const char *mode)
if (hConHandle == -1)
{
gchar *err = g_win32_error_message(GetLastError());
g_warning("_open_osfhandle(%ld, _O_TEXT) failed: %s", (long)lStdHandle, err);
g_warning("_open_osfhandle(handle(%ld), _O_TEXT) failed: %s", (long)handle, err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because (a) the lStdHandle value does not carry any useful information, it may be anything, while handle is at least the constant numeric value of STD_INPUT/OUTPUT/ERROR_HANDLE, and (b) if lStdHandle is used, it should at least be cast properly, with HandleToLong() or something, instead of (long). Only the least significant 32-bits are used under Win64, so "%ld" is OK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

g_free(err);
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion tagmanager/src/tm_workspace.c
Expand Up @@ -398,7 +398,7 @@ static guint tm_file_inode_hash(gconstpointer key)
#ifdef TM_DEBUG
g_message ("Hash for '%s' is '%d'\n", filename, file_stat.st_ino);
#endif
return g_direct_hash ((gpointer)(gulong)file_stat.st_ino);
return g_direct_hash ((gpointer)(intptr_t)file_stat.st_ino);
} else {
return 0;
}
Expand Down