Skip to content

Commit f93d2d1

Browse files
committed
* file.c (rb_file_s_rename): deleted code to get rid of a bug of
old Cygwin. * file.c (rb_file_truncate): added prototype of GetLastError() on cygwin. [ruby-dev:31239] * intern.h (is_ruby_native_thread): prototype. * missing/strftime.c (strftime): fix printf format and actual arguments. * ext/Win32API/Win32API.c (Win32API_initialize): ditto. * ext/tk/tcltklib.c (ip_finalize): ditto. * ext/dl/ptr.c (rb_dlptr_inspect): ditto. [ruby-dev:31268] * ext/dl/sym.c (rb_dlsym_inspect): ditto. * ext/socket/getnameinfo.c: include stdio.h always. * ext/win32ole/win32ole.c (ole_hresult2msg, folevariable_name, folevariable_ole_type, folevariable_ole_type_detail, folevariable_value, folemethod_visible): missing return value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 55dc6ed commit f93d2d1

File tree

10 files changed

+29
-29
lines changed

10 files changed

+29
-29
lines changed

ext/Win32API/Win32API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Win32API_initialize(self, dllname, proc, import, export)
108108
}
109109

110110
if (16 < RARRAY(a_import)->len) {
111-
rb_raise(rb_eRuntimeError, "too many parameters: %d\n", RARRAY(a_import)->len);
111+
rb_raise(rb_eRuntimeError, "too many parameters: %ld\n", RARRAY(a_import)->len);
112112
}
113113

114114
rb_iv_set(self, "__import__", a_import);

ext/dl/ptr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,9 @@ rb_dlptr_inspect(VALUE self)
466466
char str[1024];
467467

468468
Data_Get_Struct(self, struct ptr_data, data);
469-
snprintf(str, 1023, "#<%s:0x%x ptr=0x%x size=%ld free=0x%x>",
470-
rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
469+
snprintf(str, 1023, "#<%s:0x%lx ptr=0x%lx size=%ld free=0x%lx>",
470+
rb_class2name(CLASS_OF(self)), data, data->ptr, data->size,
471+
(long)data->free);
471472
return rb_str_new2(str);
472473
}
473474

ext/dl/sym.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ rb_dlsym_inspect(VALUE self)
268268
str_size = RSTRING(proto)->len + 100;
269269
str = dlmalloc(str_size);
270270
snprintf(str, str_size - 1,
271-
"#<DL::Symbol:0x%x func=0x%x '%s'>",
271+
"#<DL::Symbol:0x%lx func=0x%lx '%s'>",
272272
sym, sym->func, RSTRING(proto)->ptr);
273273
val = rb_tainted_str_new2(str);
274274
dlfree(str);

ext/socket/getnameinfo.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
*/
3636

3737
#include "config.h"
38+
#include <stdio.h>
3839
#include <sys/types.h>
3940
#ifndef _WIN32
4041
#if defined(__BEOS__)
@@ -51,15 +52,11 @@
5152
#endif
5253
#include <netdb.h>
5354
#if defined(HAVE_RESOLV_H)
54-
#ifdef _SX
55-
#include <stdio.h>
56-
#endif
5755
#include <resolv.h>
5856
#endif
5957
#endif
6058
#ifdef _WIN32
6159
#include <winsock2.h>
62-
#include <stdio.h>
6360
#define snprintf _snprintf
6461
#endif
6562

ext/tk/tcltklib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,13 +4414,13 @@ ip_finalize(ip)
44144414
}
44154415

44164416
if (Tcl_InterpDeleted(ip)) {
4417-
DUMP2("ip(%lx) is already deleted", ip);
4417+
DUMP2("ip(%p) is already deleted", ip);
44184418
return;
44194419
}
44204420

44214421
#if TCL_NAMESPACE_DEBUG
44224422
if (ip_null_namespace(ip)) {
4423-
DUMP2("ip(%lx) has null namespace", ip);
4423+
DUMP2("ip(%p) has null namespace", ip);
44244424
return;
44254425
}
44264426
#endif

ext/win32ole/win32ole.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ ole_hresult2msg(hr)
497497
DWORD dwCount;
498498

499499
char strhr[100];
500-
sprintf(strhr, " HRESULT error code:0x%08x\n ", hr);
500+
sprintf(strhr, " HRESULT error code:0x%08lx\n ", hr);
501501
msg = rb_str_new2(strhr);
502502

503503
dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -4033,7 +4033,8 @@ folevariable_name(self)
40334033
return rb_ivar_get(self, rb_intern("name"));
40344034
}
40354035

4036-
static ole_variable_ole_type(pTypeInfo, var_index)
4036+
static VALUE
4037+
ole_variable_ole_type(pTypeInfo, var_index)
40374038
ITypeInfo *pTypeInfo;
40384039
UINT var_index;
40394040
{
@@ -4077,7 +4078,8 @@ folevariable_ole_type(self)
40774078
return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
40784079
}
40794080

4080-
static ole_variable_ole_type_detail(pTypeInfo, var_index)
4081+
static VALUE
4082+
ole_variable_ole_type_detail(pTypeInfo, var_index)
40814083
ITypeInfo *pTypeInfo;
40824084
UINT var_index;
40834085
{
@@ -4113,7 +4115,8 @@ folevariable_ole_type_detail(self)
41134115
return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
41144116
}
41154117

4116-
static ole_variable_value(pTypeInfo, var_index)
4118+
static VALUE
4119+
ole_variable_value(pTypeInfo, var_index)
41174120
ITypeInfo *pTypeInfo;
41184121
UINT var_index;
41194122
{
@@ -4159,7 +4162,8 @@ folevariable_value(self)
41594162
return ole_variable_value(pvar->pTypeInfo, pvar->index);
41604163
}
41614164

4162-
static ole_variable_visible(pTypeInfo, var_index)
4165+
static VALUE
4166+
ole_variable_visible(pTypeInfo, var_index)
41634167
ITypeInfo *pTypeInfo;
41644168
UINT var_index;
41654169
{
@@ -4631,7 +4635,8 @@ folemethod_visible(self)
46314635
return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
46324636
}
46334637

4634-
static ole_method_event(pTypeInfo, method_index, method_name)
4638+
static VALUE
4639+
ole_method_event(pTypeInfo, method_index, method_name)
46354640
ITypeInfo *pTypeInfo;
46364641
WORD method_index;
46374642
VALUE method_name;

file.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,18 +2242,12 @@ rb_file_s_rename(klass, from, to)
22422242
errno = 0;
22432243
#endif
22442244
if (rename(src, dst) < 0) {
2245-
#if defined __CYGWIN__
2246-
extern unsigned long __attribute__((stdcall)) GetLastError(void);
2247-
if (errno == 0) { /* This is a bug of old Cygwin */
2248-
/* incorrect as cygwin errno, but the last resort */
2249-
errno = GetLastError();
2250-
}
2251-
#elif defined DOSISH && !defined _WIN32
2252-
if (errno == EEXIST
2245+
#if defined DOSISH && !defined _WIN32
2246+
switch (errno) {
2247+
case EEXIST:
22532248
#if defined (__EMX__)
2254-
|| errno == EACCES
2249+
case EACCES:
22552250
#endif
2256-
) {
22572251
if (chmod(dst, 0666) == 0 &&
22582252
unlink(dst) == 0 &&
22592253
rename(src, dst) == 0)
@@ -3132,8 +3126,10 @@ rb_file_truncate(obj, len)
31323126
# endif
31333127

31343128
#ifdef __CYGWIN__
3135-
static int
31363129
#include <winerror.h>
3130+
extern unsigned long __attribute__((stdcall)) GetLastError(void);
3131+
3132+
static int
31373133
cygwin_flock(int fd, int op)
31383134
{
31393135
int old_errno = errno;

intern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ VALUE rb_thread_local_aref _((VALUE, ID));
224224
VALUE rb_thread_local_aset _((VALUE, ID, VALUE));
225225
void rb_thread_atfork _((void));
226226
VALUE rb_funcall_rescue __((VALUE, ID, int, ...));
227+
VALUE is_ruby_native_thread _((void));
227228
/* file.c */
228229
VALUE rb_file_s_expand_path _((int, VALUE *));
229230
VALUE rb_file_expand_path _((VALUE, VALUE));

missing/strftime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
445445
} else {
446446
tbuf[0] = '+';
447447
}
448-
sprintf(tbuf+1, "%02d%02d", off/60, off%60);
448+
sprintf(tbuf+1, "%02u%02u", (unsigned)off/60, (unsigned)off%60);
449449
break;
450450
#endif /* MAILHEADER_EXT */
451451

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2007-08-22"
33
#define RUBY_VERSION_CODE 186
44
#define RUBY_RELEASE_CODE 20070822
5-
#define RUBY_PATCHLEVEL 76
5+
#define RUBY_PATCHLEVEL 77
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)