Page MenuHome

Add thousands separators to scene stats
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on Jul 14 2014, 1:49 AM.

Details

Reviewers
Diego Gangl (januz)
Group Reviewers
User Interface
Summary

This patch adds a thousands separator to the stats in the info header so they are more readable.
(from T38898)

Diff Detail

Event Timeline

source/blender/blenlib/BLI_string.h
67

prefer BLI_str*** prefix, eg. BLI_str_number_separator ? (names aren't so obvious)

Could also take length of out to avoid buffer overflow.

source/blender/blenlib/intern/string.c
764

why is this static? and why an int? did you mean const ?

769

can replace strcpy with memcpy using length from sprintf

774

can avoid a call to strlen() here, by getting the value from sprintf

Campbell Barton (campbellbarton) requested changes to this revision.Jul 14 2014, 5:11 AM
Diego Gangl (januz) updated this revision to Unknown Object (????).Jul 16 2014, 8:09 PM

Applied all changes. Also changed a few things to follow the style of the rest of the code better.

Committed rB4cc93123c8120f1f52af44c18236114b5cf5d999

  • Python calls this decimal grouping, so named BLI_str_format_int_grouped (number is too vague and confused with float's)
  • turns out size wont exceed 16 chars for int32_t, so just define arg size as 16 (size checking was incorrect, and making it work was a bit of a hassle).
  • added support for negative numbers.
  • use macro in scene stats.
  • added GTest's