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

* defines.h: define RUBY_MBCHAR_MAX instead of MB_CUR_MAX.

* dir.c (Next, emx_mblen): use RUBY_MBCHAR_MAX for mblen().
* file.c (CharNext): ditto.
* ruby.c (translate_char): ditto.
* util.c (__crt0_glob_function): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
siena 2004-01-21 15:26:11 +00:00
parent cb3cf6cfea
commit fc69b2a7f6
6 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Thu Jan 22 00:12:51 2004 Siena. <siena@faculty.chiba-u.jp>
* defines.h: define RUBY_MBCHAR_MAX instead of MB_CUR_MAX.
* dir.c (Next, emx_mblen): use RUBY_MBCHAR_MAX for mblen().
* file.c (CharNext): ditto.
* ruby.c (translate_char): ditto.
* util.c (__crt0_glob_function): ditto.
Thu Jan 22 00:10:01 2004 Dave Thomas <dave@pragprog.com> Thu Jan 22 00:10:01 2004 Dave Thomas <dave@pragprog.com>
* lib/base64.rb: :nodoc: the Deprecated module * lib/base64.rb: :nodoc: the Deprecated module

View file

@ -203,6 +203,11 @@ typedef int pid_t;
#define EXTERN RUBY_EXTERN /* deprecated */ #define EXTERN RUBY_EXTERN /* deprecated */
#endif #endif
#ifndef RUBY_MBCHAR_MAXSIZE
#define RUBY_MBCHAR_MAXSIZE INT_MAX
/* MB_CUR_MAX will not work well in C locale */
#endif
#if defined(sparc) || defined(__sparc__) #if defined(sparc) || defined(__sparc__)
static inline void static inline void
flush_register_windows(void) flush_register_windows(void)

4
dir.c
View file

@ -85,14 +85,14 @@ char *strchr _((char*,char));
#if defined(CharNext) #if defined(CharNext)
# define Next(p) CharNext(p) # define Next(p) CharNext(p)
#elif defined(DJGPP) #elif defined(DJGPP)
# define Next(p) ((p) + mblen(p, MB_CUR_MAX)) # define Next(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
#elif defined(__EMX__) #elif defined(__EMX__)
# define Next(p) ((p) + emx_mblen(p)) # define Next(p) ((p) + emx_mblen(p))
static inline int static inline int
emx_mblen(p) emx_mblen(p)
const char *p; const char *p;
{ {
int n = mblen(p, INT_MAX); int n = mblen(p, RUBY_MBCHAR_MAXSIZE);
return (n < 0) ? 1 : n; return (n < 0) ? 1 : n;
} }
#endif #endif

2
file.c
View file

@ -2120,7 +2120,7 @@ rb_file_s_umask(argc, argv)
#endif #endif
#ifndef CharNext /* defined as CharNext[AW] on Windows. */ #ifndef CharNext /* defined as CharNext[AW] on Windows. */
# if defined(DJGPP) # if defined(DJGPP)
# define CharNext(p) ((p) + mblen(p, MB_CUR_MAX)) # define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
# else # else
# define CharNext(p) ((p) + 1) # define CharNext(p) ((p) + 1)
# endif # endif

2
ruby.c
View file

@ -226,7 +226,7 @@ translate_char(p, from, to)
#ifdef CharNext /* defined as CharNext[AW] on Windows. */ #ifdef CharNext /* defined as CharNext[AW] on Windows. */
p = CharNext(p); p = CharNext(p);
#else #else
p += mblen(p, MB_CUR_MAX); p += mblen(p, RUBY_MBCHAR_MAXSIZE);
#endif #endif
} }
} }

2
util.c
View file

@ -347,7 +347,7 @@ __crt0_glob_function(char *path)
strncpy(buf, path, len); strncpy(buf, path, len);
buf[len] = '\0'; buf[len] = '\0';
for (p = buf; *p; p += mblen(p, MB_CUR_MAX)) for (p = buf; *p; p += mblen(p, RUBY_MBCHAR_MAXSIZE))
if (*p == '\\') if (*p == '\\')
*p = '/'; *p = '/';