Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
0597f66b
Commit
0597f66b
authored
8 years ago
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3196 from mimaki/fix-negative-ord
Fix String#ord failure which return a negative value
parents
ee40f9bb
861b0eed
master
mruby2-draft
removing-y-tab-c
revert-5391-throw
stable
3.1.0-rc
3.0.0
3.0.0-rc
3.0.0-preview
2.1.2
2.1.2-rc2
2.1.2-rc
2.1.1
2.1.1-rc2
2.1.1-rc
2.1.0
2.1.0-rc
2.0.1
2.0.0
1.4.1
1.4.0
1.3.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
mrbgems/mruby-string-ext/src/string.c
mrbgems/mruby-string-ext/src/string.c
+1
-1
mrbgems/mruby-string-ext/test/string.rb
mrbgems/mruby-string-ext/test/string.rb
+4
-0
No files found.
mrbgems/mruby-string-ext/src/string.c
View file @
0597f66b
...
...
@@ -529,7 +529,7 @@ mrb_str_ord(mrb_state* mrb, mrb_value str)
{
if
(
RSTRING_LEN
(
str
)
==
0
)
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"empty string"
);
return
mrb_fixnum_value
(
RSTRING_PTR
(
str
)[
0
]);
return
mrb_fixnum_value
(
(
unsigned
char
)
RSTRING_PTR
(
str
)[
0
]);
}
#endif
...
...
This diff is collapsed.
Click to expand it.
mrbgems/mruby-string-ext/test/string.rb
View file @
0597f66b
...
...
@@ -497,6 +497,10 @@ end
assert
(
'String#ord'
)
do
got
=
"hello!"
.
split
(
''
).
map
{
|
x
|
x
.
ord
}
expect
=
[
104
,
101
,
108
,
108
,
111
,
33
]
unless
UTF8STRING
got
<<
"
\xff
"
.
ord
expect
<<
0xff
end
assert_equal
expect
,
got
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment