1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* fix type warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-11-11 12:30:39 +00:00
parent a5eb40b999
commit 8a7aad9952
8 changed files with 23 additions and 25 deletions

View file

@ -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) {

View file

@ -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)));

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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)

View file

@ -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);
}
}

View file

@ -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;