summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-sprintf/src/sprintf.c
AgeCommit message (Collapse)Author
2017-08-09Replaced tabs with spacesChristopher Aue
2017-07-14Avoid duplicated width filling for sprintf `%d` specifier; fix #3736Yukihiro "Matz" Matsumoto
2017-07-05`print("%d", 0)` should not print `-0`; fix #3731Yukihiro "Matz" Matsumoto
2017-07-05Negation was not a good way to handle negative integers; fix #3729Yukihiro "Matz" Matsumoto
There's a number that negation does not work (-2147483648 in 32bit environment).
2017-07-05In Ruby, `sprintf` specifier `%u` should behave as `%d`; fix #3730Yukihiro "Matz" Matsumoto
Since there's no unsigned integer in Ruby. Binary, octal and hexadecimal negative numbers can be represented by using 2's compliment. But decimal (not being power of 2) cannot be use that kind of format.
2017-07-04Refactor `sprintf()` code.Yukihiro "Matz" Matsumoto
2017-07-04Initialize `flags` for each loop.Yukihiro "Matz" Matsumoto
2017-06-28Avoid `mrb_funcall()` unless absolutely necessary; ref #3722Yukihiro "Matz" Matsumoto
As a result, `#chr` is not called for ch < 0x80, so we need to update the "invalid chr" test.
2017-05-25Under MRB_INT64, width may be bigger than INT_MAX; fix #3665Yukihiro "Matz" Matsumoto
2017-05-08Fix segmentation fault ref: #3648ksss
2017-04-29Better error messageNobuyoshi Nakada
Raise argument error with the better message, at the only place where the size to fill can be negative.
2017-04-29Use `FILL` and `PUSH`Nobuyoshi Nakada
Instead of loop or `memcpy` after `CHECK`, use dedicated macros, `FILL` and `PUSH`, respectively.
2017-04-23Refactor "%f" % Inf/NaNNobuyoshi Nakada
As for non-finite float, calculate the exact needed size with the space flag.
2017-04-23Fix space flag when Inf/NaN and width==3Nobuyoshi Nakada
While `"% 2f"` and `"% 4f"` result in `" Inf"` and `" Inf"` respectively, `"% 3f"` results in `"Inf"` (no space).
2017-04-03Unify `else` clause styleYukihiro "Matz" Matsumoto
2017-03-18Should use mrb_int for any objectksss
o=Object.new def o.to_int 1 end p "%*d" % [o, 1]
2017-03-13Fix out-of-bound accessNobuyoshi Nakada
Get rid of out-of-bound access when single % at the end.
2017-03-11The width printf specifier may be negative; fix #3498Yukihiro "Matz" Matsumoto
2017-03-11fixup! Check return value from snprintf(); ref #3498Yukihiro "Matz" Matsumoto
2017-03-11Check return value from snprintf(); ref #3498Yukihiro "Matz" Matsumoto
2017-02-11Avoid integer overflow in sprintf(); fix #3439Yukihiro "Matz" Matsumoto
This issue was reported by https://hackerone.com/aerodudrizzt
2017-01-16Dots is not needed for base 10 negative numbers; fix #3400Yukihiro "Matz" Matsumoto
2016-12-21One less argument for raisef(); fix #3355Yukihiro "Matz" Matsumoto
This issue was reported by https://hackerone.com/mg36
2016-12-18Check if width is zero or negative before fill; fix #3347Yukihiro "Matz" Matsumoto
Reported by https://hackerone.com/haquaman.
2016-12-18Prohibit mixture of posarg and nextarg; ref #3347Yukihiro "Matz" Matsumoto
2016-11-24Fixes for compiling mruby as C++Tomasz Dąbrowski
2016-11-23Fix segfault when Fixnum#chr doesn't return a stringBouke van der Bijl
2016-07-01Fix warning shift-negative-valueksss
2016-04-23mruby-sprintf:fix double negative signs in printf; fix #3148Yukihiro "Matz" Matsumoto
MRB_INT_MAX does not have corresponding positive integer
2016-04-23mruby-sprintf: format specifiers o,u,x,b ignore sign(+); ref #3148Yukihiro "Matz" Matsumoto
2016-01-07mruby-sprintf to use mrb_int formatting macros; ref #3076Yukihiro "Matz" Matsumoto
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-11-19formatting buffer should be bigger for negative dots; ref #3025Yukihiro "Matz" Matsumoto
2015-11-19binary format no longer need to preserve org_vYukihiro "Matz" Matsumoto
2015-11-19integer range check was moved to mrb_flo_to_fixnum(); ref #3025Yukihiro "Matz" Matsumoto
2015-11-19negative binary format should not be masked by 10bits; ref #3025Yukihiro "Matz" Matsumoto
2015-11-19binary sprintf should not be restricted by mrb_int size; fix #3025Yukihiro "Matz" Matsumoto
2015-09-03unsigned long may be smaller than mrb_int; use uint64_t instead; fix #2935Yukihiro "Matz" Matsumoto
2015-06-24Remove unnecessary backticks.Franck Verrot
Dr Markus Kuhn published in 1999 an article [1] explaining in details why we shouldn't use the ASCII grave accent (0x60) as a left quotation. Backticks have been used most notably to produce nice-looking LaTeX documents but it doesn't seem to be an issue on modern platforms and for the oldest ones, there are workarounds as mentioned by Dr Kuhn. [1]: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2014-09-04refactor MACRO to avoid local variable name conflict; ref #2585Yukihiro "Matz" Matsumoto
2014-09-04get rid of shadowing variables (mrbgems)cremno
Mostly renaming, except that the definition of struct accessor methods is now done in a new function.
2014-07-12remove spaces after open parensYukihiro "Matz" Matsumoto
2014-05-04simply use `isfinite`cremno
2014-04-25Use mrb_int in mrbgem rest argument getting.take_cheeze
2014-03-25Use mrb_int instead of intcubicdaiya
2014-03-22Use bool-macro instead of magic-numbercubicdaiya
2014-03-11add MRB_INT_BITcremno
2014-03-06make embed string when create literalsksss
2014-03-06embed small stringksss
use flags 4 for *this object is embed* use flags 8~64 for *embed string length*
2014-02-28cancel 313f6b; add fallthrough commentYukihiro "Matz" Matsumoto