зеркало из https://github.com/github/ruby.git
* io.c (io_encname_bom_p): removed magic number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f64949e276
Коммит
5a12fb5fb8
|
@ -1,3 +1,7 @@
|
|||
Mon Sep 7 17:13:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (io_encname_bom_p): removed magic number.
|
||||
|
||||
Mon Sep 7 12:26:04 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/irb/inspector.rb (IRB::INSPECTORS.def_inspector): support
|
||||
|
|
6
io.c
6
io.c
|
@ -3938,11 +3938,13 @@ rb_io_fmode_modestr(int fmode)
|
|||
static int
|
||||
io_encname_bom_p(const char *name, long len)
|
||||
{
|
||||
static const char bom_prefix[] = "bom|utf-";
|
||||
enum {bom_prefix_len = (int)sizeof(bom_prefix) - 1};
|
||||
if (!len) {
|
||||
const char *p = strchr(name, ':');
|
||||
len = p ? p - name : strlen(name);
|
||||
len = p ? (long)(p - name) : (long)strlen(name);
|
||||
}
|
||||
return len > 8 && STRNCASECMP(name, "bom|utf-", 8) == 0;
|
||||
return len > bom_prefix_len && STRNCASECMP(name, bom_prefix, bom_prefix_len) == 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Загрузка…
Ссылка в новой задаче