projects
/
YACASL2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a4a4d92
)
dumpwordコマンドで数値以外の値が引数のときにエラーが発生するよう修正
author
j8takagi
<j8takagi@nifty.com>
Sun, 31 Jan 2010 15:58:20 +0000
(
00:58
+0900)
committer
j8takagi
<j8takagi@nifty.com>
Sun, 31 Jan 2010 15:58:20 +0000
(
00:58
+0900)
src/word.c
patch
|
blob
|
history
diff --git
a/src/word.c
b/src/word.c
index
d2deaee
..
e4b9af8
100644
(file)
--- a/
src/word.c
+++ b/
src/word.c
@@
-42,10
+42,14
@@
WORD h2word(const char *str)
/* 10進数または16進数の文字列をWORD値に変換 */
WORD a2word(const char *str)
{
- WORD word = 0x0;
+ WORD word;
+ if(!isdigit(*str) && *str != '-' && *str != '#') {
+ setcerr(114, str); /* not integer */
+ return 0x0;
+ }
if(*str == '#') {
word = h2word(str);
- } else
if(isdigit(*str) || *str == '-')
{
+ } else {
word = n2word(str);
}
return word;