Skip to content

Commit 27d60e2

Browse files
nobumatzbot
authored andcommitted
[ruby/resolv] Fix warnings on cygwin
ruby/resolv@075e76f997
1 parent 159430e commit 27d60e2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ext/win32/resolv/resolv.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ w32error_make_error(DWORD e)
2121
FORMAT_MESSAGE_IGNORE_INSERTS, &source, e,
2222
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
2323
buffer, sizeof(buffer), NULL)) {
24-
snprintf(buffer, sizeof(buffer), "Unknown Error %u", (unsigned long)e);
24+
snprintf(buffer, sizeof(buffer), "Unknown Error %lu", (unsigned long)e);
2525
}
2626
p = buffer;
2727
while ((p = strpbrk(p, "\r\n")) != NULL) {
@@ -149,7 +149,6 @@ reg_each_key(VALUE self)
149149
{
150150
WCHAR wname[256];
151151
HKEY hkey = DATA_PTR(self);
152-
rb_encoding *utf8 = rb_utf8_encoding();
153152
VALUE k = TypedData_Wrap_Struct(CLASS_OF(self), &hkey_type, NULL);
154153
DWORD i, e, n;
155154
for (i = 0; n = numberof(wname), (e = RegEnumKeyExW(hkey, i, wname, &n, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS; i++) {
@@ -187,20 +186,20 @@ reg_value(VALUE self, VALUE name)
187186
case REG_DWORD: case REG_DWORD_BIG_ENDIAN:
188187
{
189188
DWORD d;
190-
if (size != sizeof(d)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", size);
189+
if (size != sizeof(d)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", (unsigned long)size);
191190
w32error_check(RegGetValueW(hkey, NULL, wname, RRF_RT_REG_DWORD, &type, &d, &size));
192191
if (type == REG_DWORD_BIG_ENDIAN) d = swap_dw(d);
193192
return ULONG2NUM(d);
194193
}
195194
case REG_QWORD:
196195
{
197196
QWORD q;
198-
if (size != sizeof(q)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", size);
197+
if (size != sizeof(q)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", (unsigned long)size);
199198
w32error_check(RegGetValueW(hkey, NULL, wname, RRF_RT_REG_QWORD, &type, &q, &size));
200199
return ULL2NUM(q);
201200
}
202201
case REG_SZ: case REG_MULTI_SZ: case REG_EXPAND_SZ:
203-
if (size % sizeof(WCHAR)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", size);
202+
if (size % sizeof(WCHAR)) rb_raise(rb_eRuntimeError, "invalid size returned: %lu", (unsigned long)size);
204203
buffer = ALLOCV_N(char, value_buffer, size);
205204
break;
206205
default:
@@ -211,7 +210,6 @@ reg_value(VALUE self, VALUE name)
211210
switch (type) {
212211
case REG_MULTI_SZ: {
213212
const WCHAR *w = (WCHAR *)buffer;
214-
rb_encoding *utf8 = rb_utf8_encoding();
215213
result = rb_ary_new();
216214
size /= sizeof(WCHAR);
217215
size -= 1;

0 commit comments

Comments
 (0)