summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/socket/ancdata.c2
-rw-r--r--ext/socket/unixsocket.c6
-rw-r--r--ext/syck/rubyext.c2
-rw-r--r--ext/syck/syck.h2
-rw-r--r--ext/win32ole/win32ole.c28
-rw-r--r--include/ruby/ruby.h2
-rw-r--r--vm_dump.c2
-rw-r--r--win32/win32.c4
8 files changed, 23 insertions, 25 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 045b68e..abaf19d 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1597,7 +1597,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (NIL_P(vmaxctllen) && (mh.msg_flags & MSG_CTRUNC)) {
#define BIG_ENOUGH_SPACE 65536
if (BIG_ENOUGH_SPACE < maxctllen &&
- mh.msg_controllen < maxctllen - BIG_ENOUGH_SPACE) {
+ mh.msg_controllen < (socklen_t)(maxctllen - BIG_ENOUGH_SPACE)) {
/* there are big space bug truncated.
* file descriptors limit? */
if (!gc_done) {
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 82893ab..25a2c1e 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -339,7 +339,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
rb_sys_fail("recvmsg(2)");
#if FD_PASSING_BY_MSG_CONTROL
- if (arg.msg.msg_controllen < sizeof(struct cmsghdr)) {
+ if (arg.msg.msg_controllen < (socklen_t)sizeof(struct cmsghdr)) {
rb_raise(rb_eSocket,
"file descriptor was not passed (msg_controllen=%d smaller than sizeof(struct cmsghdr)=%d)",
(int)arg.msg.msg_controllen, (int)sizeof(struct cmsghdr));
@@ -354,12 +354,12 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
"file descriptor was not passed (cmsg_type=%d, %d expected)",
cmsg.hdr.cmsg_type, SCM_RIGHTS);
}
- if (arg.msg.msg_controllen < CMSG_LEN(sizeof(int))) {
+ if (arg.msg.msg_controllen < (socklen_t)CMSG_LEN(sizeof(int))) {
rb_raise(rb_eSocket,
"file descriptor was not passed (msg_controllen=%d smaller than CMSG_LEN(sizeof(int))=%d)",
(int)arg.msg.msg_controllen, (int)CMSG_LEN(sizeof(int)));
}
- if (CMSG_SPACE(sizeof(int)) < arg.msg.msg_controllen) {
+ if ((socklen_t)CMSG_SPACE(sizeof(int)) < arg.msg.msg_controllen) {
rb_raise(rb_eSocket,
"file descriptor was not passed (msg_controllen=%d bigger than CMSG_SPACE(sizeof(int))=%d)",
(int)arg.msg.msg_controllen, (int)CMSG_SPACE(sizeof(int)));
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index 282f052..a5fb2a1 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -114,7 +114,7 @@ rb_syck_compile(VALUE self, VALUE port)
syck_parser_taguri_expansion( parser, 0 );
oid = syck_parse( parser );
if (!syck_lookup_sym( parser, oid, &data )) {
- rb_raise(rb_eSyntaxError, "root node <%lx> not found", oid);
+ rb_raise(rb_eSyntaxError, "root node <%p> not found", (void *)oid);
}
sav = data;
diff --git a/ext/syck/syck.h b/ext/syck/syck.h
index 2cf81a8..7fd97f1 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -69,7 +69,7 @@ void syck_assert( const char *, unsigned, const char * );
typedef long st_data_t;
#endif
-#define SYMID unsigned long
+#define SYMID st_data_t
typedef struct _syck_node SyckNode;
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 8066257..d308db7 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -1059,7 +1059,7 @@ static char *
ole_wc2mb(LPWSTR pw)
{
LPSTR pm;
- int size = 0;
+ UINT size = 0;
if (conv_51932(cWIN32OLE_cp)) {
#ifndef pIMultiLanguage
DWORD dw = 0;
@@ -1290,7 +1290,7 @@ ole_vstr2wc(VALUE vstr)
{
rb_encoding *enc;
int cp;
- int size = 0;
+ UINT size = 0;
LPWSTR pw;
st_data_t data;
enc = rb_enc_get(vstr);
@@ -1316,7 +1316,7 @@ ole_vstr2wc(VALUE vstr)
if (conv_51932(cp)) {
#ifndef pIMultiLanguage
DWORD dw = 0;
- int len = RSTRING_LEN(vstr);
+ UINT len = RSTRING_LENINT(vstr);
HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
&dw, cp, RSTRING_PTR(vstr), &len, NULL, &size);
if (FAILED(hr)) {
@@ -1341,13 +1341,13 @@ ole_vstr2wc(VALUE vstr)
static LPWSTR
ole_mb2wc(char *pm, int len)
{
- int size = 0;
+ UINT size = 0;
LPWSTR pw;
if (conv_51932(cWIN32OLE_cp)) {
#ifndef pIMultiLanguage
DWORD dw = 0;
- int n = len;
+ UINT n = len;
HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
&dw, cWIN32OLE_cp, pm, &n, NULL, &size);
if (FAILED(hr)) {
@@ -2336,23 +2336,23 @@ reg_get_val(HKEY hkey, const char *subkey)
{
char *pbuf;
DWORD dwtype = 0;
- LONG size = 0;
+ DWORD size = 0;
VALUE val = Qnil;
LONG err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, NULL, &size);
if (err == ERROR_SUCCESS) {
pbuf = ALLOC_N(char, size + 1);
- err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, pbuf, &size);
+ err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, (BYTE *)pbuf, &size);
if (err == ERROR_SUCCESS) {
pbuf[size] = '\0';
if (dwtype == REG_EXPAND_SZ) {
- char* pbuf2 = pbuf;
- DWORD len = ExpandEnvironmentStrings(pbuf2, NULL, 0);
- pbuf = ALLOC_N(char, len + 1);
- ExpandEnvironmentStrings(pbuf2, pbuf, len + 1);
- free(pbuf2);
+ char* pbuf2 = (char *)pbuf;
+ DWORD len = ExpandEnvironmentStrings(pbuf2, NULL, 0);
+ pbuf = ALLOC_N(char, len + 1);
+ ExpandEnvironmentStrings(pbuf2, pbuf, len + 1);
+ free(pbuf2);
}
- val = rb_str_new2(pbuf);
+ val = rb_str_new2((char *)pbuf);
}
free(pbuf);
}
@@ -2574,7 +2574,7 @@ clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid)
hr = HRESULT_FROM_WIN32(err);
else {
len = sizeof(clsid);
- err = RegQueryValueEx(hpid, (LPBYTE)"", NULL, &dwtype, clsid, &len);
+ err = RegQueryValueEx(hpid, "", NULL, &dwtype, (BYTE *)clsid, &len);
if (err == ERROR_SUCCESS && dwtype == REG_SZ) {
pbuf = ole_mb2wc(clsid, -1);
hr = CLSIDFromString(pbuf, pclsid);
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 02ff3c5..4e15517 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -316,7 +316,7 @@ rb_long2int(long n) {rb_long2int_internal(n, i); return i;}
#define NUM2GIDT(v) NUM2LONG(v)
#endif
-#define FIX2LONG(x) RSHIFT((SIGNED_VALUE)(x),1)
+#define FIX2LONG(x) (long)RSHIFT((SIGNED_VALUE)(x),1)
#define FIX2ULONG(x) ((((VALUE)(x))>>1)&LONG_MAX)
#define FIXNUM_P(f) (((SIGNED_VALUE)(f))&FIXNUM_FLAG)
#define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
diff --git a/vm_dump.c b/vm_dump.c
index c865386..2975001 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -745,7 +745,7 @@ dump_thread(void *arg)
line.SizeOfStruct = sizeof(line);
if (pSymGetLineFromAddr64(ph, addr, NULL, &line))
fprintf(stderr, " %s:%lu", line.FileName, line.LineNumber);
- fprintf(stderr, " [0x%"PRIxVALUE"]\n", addr);
+ fprintf(stderr, " [%p]\n", (void *)(VALUE)addr);
}
}
diff --git a/win32/win32.c b/win32/win32.c
index 5f5a550..e14ab49 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3819,8 +3819,6 @@ wlink(const WCHAR *from, const WCHAR *to)
static int myerrno = 0;
if (!pCreateHardLinkW && !myerrno) {
- HANDLE hKernel;
-
pCreateHardLinkW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES))get_proc_address("kernel32", "CreateHardLinkW", NULL);
if (!pCreateHardLinkW)
myerrno = ENOSYS;
@@ -4936,7 +4934,7 @@ rb_w32_pipe(int fds[2])
return _pipe(fds, 65536L, _O_NOINHERIT);
p = strchr(name, '0');
- snprintf(p, strlen(p) + 1, "%x-%lx", rb_w32_getpid(), serial++);
+ snprintf(p, strlen(p) + 1, "%"PRI_PIDT_PREFIX"x-%lx", rb_w32_getpid(), serial++);
sec.nLength = sizeof(sec);
sec.lpSecurityDescriptor = NULL;