diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-11 14:02:46 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-11 14:02:46 +0000 |
commit | c4b12333f770039fa4f189b3ac9ca015707836c3 (patch) | |
tree | a29bb09fea432ad826c76b31d50f6989e6f91f38 | |
parent | 06b1671107875eaba7099cf6cb4411ccc33fe052 (diff) | |
download | ruby-c4b12333f770039fa4f189b3ac9ca015707836c3.tar.gz |
* bignum.c (validate_integer_pack_format): Refine error messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 10 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Tue Jun 11 23:01:57 2013 Tanaka Akira <akr@fsij.org> + + * bignum.c (validate_integer_pack_format): Refine error messages. + Tue Jun 11 22:25:04 2013 Tanaka Akira <akr@fsij.org> * bignum.c (validate_integer_pack_format): numwords argument added. @@ -739,10 +739,16 @@ validate_integer_pack_format(size_t numwords, size_t wordsize, size_t nails, int { int wordorder_bits = flags & INTEGER_PACK_WORDORDER_MASK; int byteorder_bits = flags & INTEGER_PACK_BYTEORDER_MASK; - if (wordorder_bits != INTEGER_PACK_MSWORD_FIRST && + if (wordorder_bits == 0) { + rb_raise(rb_eArgError, "word order not specified"); + } + else if (wordorder_bits != INTEGER_PACK_MSWORD_FIRST && wordorder_bits != INTEGER_PACK_LSWORD_FIRST) rb_raise(rb_eArgError, "unexpected word order"); - if (byteorder_bits != INTEGER_PACK_MSBYTE_FIRST && + if (byteorder_bits == 0) { + rb_raise(rb_eArgError, "byte order not specified"); + } + else if (byteorder_bits != INTEGER_PACK_MSBYTE_FIRST && byteorder_bits != INTEGER_PACK_LSBYTE_FIRST && byteorder_bits != INTEGER_PACK_NATIVE_BYTE_ORDER) rb_raise(rb_eArgError, "unexpected byte order"); |