summaryrefslogtreecommitdiff
path: root/vsnprintf.c
AgeCommit message (Collapse)Author
2020-03-04[win32] suppress false warning by mingw gccNobuyoshi Nakada
2019-08-27Use array indexing with considering clang's feelingNobuyoshi Nakada
``` In file included from sprintf.c:1256: ./vsnprintf.c:833:8: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] IS_PRI_EXTRA_MARK(fmt)) { ^~~~~~~~~~~~~~~~~~~~~~ ./vsnprintf.c:826:34: note: expanded from macro 'IS_PRI_EXTRA_MARK' strncmp((s)+1, PRI_EXTRA_MARK+1, \ ~~~~~~~~~~~~~~^~ ./vsnprintf.c:833:8: note: use array indexing to silence this warning ./vsnprintf.c:826:34: note: expanded from macro 'IS_PRI_EXTRA_MARK' strncmp((s)+1, PRI_EXTRA_MARK+1, \ ^ 1 warning generated. ```
2019-04-26give up sanitizing BSD_vfprintfUrabe, Shyouhei
Sanitizers report something inside of this function but it is beyond my brain capacity. Also the code is proven to work. Let me ignore.
2018-11-16avoid division by zeroshyouhei
* cvt(): use signbit() instead of 1/d < 0 * w_float(): ditto * ruby_float_step_size(): unit==0 check shall be prior to divisions * arith_seq_float_step_size(): ditto * rb_big_divide(): same as r65642 * fix_divide(): ditto * rb_big_fdiv_double(): ditto * fix_fdiv_double(): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23unused membernobu
* vsnprintf.c (__sFILE): _lbfsize is not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-29vsnprintf.c: prefix with precisionnobu
* vsnprintf.c (BSD_vfprintf): sign and hex-prefix should not be counted in precision. [ruby-dev:47714] [Bug #8916] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 * internal.h (WARN_UNUSED_RESULT): moved to configure.in, toshyouhei
actually check its availability rather to check GCC's version. * configure.in (WARN_UNUSED_RESULT): moved to here. * configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration to return int rather than void, because it makes no sense for a warn_unused_result attributed function to return void. Funny thing however is that it also makes no sense for noreturn attributed function to return int. So there is a fundamental conflict between them. While I tested this, I confirmed both GCC 6 and Clang 3.8 prefers int over void to correctly detect necessary attributes under this setup. Maybe subject to change in future. * internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then moved to configure.in for the same reason we move WARN_UNUSED_RESULT. * configure.in (MAYBE_UNUSED): moved to here. * internal.h (__has_attribute): deleted, because it has no use now. * string.c (rb_str_enumerate_lines): refactor macro rename. * string.c (rb_str_enumerate_bytes): ditto. * string.c (rb_str_enumerate_chars): ditto. * string.c (rb_str_enumerate_codepoints): ditto. * thread.c (do_select): ditto. * vm_backtrace.c (rb_debug_inspector_open): ditto. * vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18Suppress false warningsnobu
* vsnprintf.c (BSD_vfprintf): make PRI_EXTRA_MARK_LEN an explicit int to suppress type-limits warnings by old gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* compile.c: fix typos.hsbt
[ci skip][fix GH-1140] Patch by @jutaz * dir.c: ditto. * gc.c: ditto. * io.c: ditto. * node.h: ditto. * thread_pthread.c: ditto. * vm_insnhelper.c: ditto. * vsnprintf.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28vsnprintf.c: constifynobu
* vsnprintf.c (FILE::vextra): constify the return value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-22sprintf.c: ruby specific functionsnobu
* sprintf.c (ruby_vsnprintf, ruby_snprintf): move ruby specific functions from vsnprintf.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-13util.c: hexdigitnobu
* util.c (hexdigit): extract identical constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-04ruby.h: add mark to PRIsVALUEnobu
* include/ruby/ruby.h (PRIsVALUE), vsnprintf.c (BSD_vfprintf): add RUBY_PRI_VALUE_MARK to reduce danger of accidental conflict with plain "%i". binary incompatible with extension libraries using PRIsVALUE and built for 2.1 and earlier. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25vsnprintf.c: fix string precisionnobu
* vsnprintf.c (BSD_vfprintf): fix string width when precision is given. as the result of `memchr` is NULL or its offset from the start cannot exceed the size, the comparison was always false. [ruby-core:62737] [Bug #9861] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05* vsnprintf.c: remove duplicated def of `UNINITIALIZED_VAR()'.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-13* vsnprintf.c: Fix spelling from compliment to complement.charliesome
Patch by @agrimm. Closes GH-422. * include/ruby/ruby.h: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-19vsnprintf.c: initialize cpnobu
* vsnprintf.c (BSD_vfprintf): initialize cp so that size is 0 in the commented case. fix an accidental bug at r16716. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-12vsnprintf.c: fix buffer overflownobu
* vsnprintf.c (MAXEXP, MAXFRACT): calculate depending on constants in float.h. * vsnprintf.c (BSD_vfprintf): limit length for cvt() to get rid of buffer overflow. [ruby-core:57023] [Bug #8864] * vsnprintf.c (exponent): make expbuf size more precise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16unecessary macros and K&R style codingnobu
* strftime.c: remove unnecessary macros to check traditional C. https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim). * vsnprintf.c: remove K&R. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24sprintf.c: inspect by plusnobu
* sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of to_s if plus flag is given. * vsnprintf.c (BSD_vfprintf): pass sign flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24Feature #5896nobu
* vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in rb_enc_vsprintf(). [Feature #5896] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* vsnprintf.c (BSD_vfprintf): support 'll' prefix.naruse
* vsnprintf.c (__sfeof): rename to avoid the collision with NetBSD's one. * vsnprintf.c (__sferror): ditto. * vsnprintf.c (__sclearerr): ditto. * vsnprintf.c (__sfileno): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-18* vsnprintf.c (cvt): set first byte of buf to NUL for the case whennaruse
no bytes are written to the buf. [ruby-dev:43062] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-16* vsnprintf.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30* vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.naruse
patched by Peter Weldon <peter.weldon AT null.net> [ruby-core:33985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-18* vsnprintf.c (BSD_vfprintf): suppress warning: "_WIN32" is not defined.kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-24* vsnprintf (BSD_vfprintf): use QUADINT macro only when _HAVE_SANE_QUAD_usa
macro is defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-24* vsnprintf (BSD_vfprintf): added VC++ compatible size specificationsusa
(I, I32, I64). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22* vsnprintf.c (BSD_vfprintf): don't output floating pointnaruse
when the precision is 0. [ruby-dev:42615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-08* vsnprintf.c (BSD_vfprintf): fix precision specifier doesn'tnaruse
work well on %f. [ruby-dev:42552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26* vsnprintf.c (BSD_vfprintf): suppress warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24* vsnprintf.c (BSD_vfprintf): prec digits fractal part should benobu
appended to 0 if prec is given. [ruby-dev:42453] #3979 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-20* vsnprintf.c (BSD_vfprintf): print floating point on "%#a".naruse
[ruby-dev:42431] Bug#3965 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* vsnprintf.c (BSD_vfprintf): clear ALT flag for %a.naruse
[ruby-core:32841] [ruby-core:32848] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* vsnprintf.c (BSD_vfprintf): fix over-count of field size.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-18* vsnprintf.c (BSD_vfprintf): use HEXPREFIX flag for prefix of %a.nobu
[ruby-core:32841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-18* sprintf.c (BSD_vfprintf): wrong padding arround prefix andnaruse
floating point with %a. [ruby-dev:42403] Bug #3956 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12* vsnprintf.c (BSD_vfprintf): fix cast.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29* removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-28* vsnprintf.c (ruby_vsnprintf, ruby_snprintf): suppress warnings.nobu
why return int in spite of the arguments of size_t? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-04* include/ruby/ruby.h: replace snprintf and vsnprintf bynaruse
ruby_snprintf and ruby_vsnprintf. [ruby-dev:40909] * configure.in: don't check snprintf(3) and vsnprintf(3). * include/ruby/missing.h: don't delare snprintf and vsnprintf. * include/ruby/ruby.h: include stdarg.h. * sprintf.c: include vsnprintf.c * vsnprintf.c: renamed from missing/vsnprintf.c. * vsnprintf.c: remove useless ifdefs. * win32/mkexports.rb: use ruby_snprintf and ruby_vsnprintf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e