Commit Graph

81 Commits

Author SHA1 Message Date
bf69453ae7 BLI_string: add BLI_snprintf_rlen
use when the length of the destination string is needed.
2015-04-22 05:37:22 +10:00
5357474ad8 Fix building with very strict flags, use size_t rather than int for string length.
Reported on bf-committers.
2015-01-10 19:15:49 +01:00
9590e77a59 cleanup: style & warnings 2015-01-10 12:40:09 +11:00
ac619aaf38 BLI_string: BLI_str_ends_with -> BLI_str_endswith
Loosely following Python str convention.
2015-01-09 23:47:17 +11:00
2f16098d20 Gooseberry animation request: Paste flipped pose in action
and graph editor.

This was a tricky commit that was not so straightforward to make work.
The information for bones is not easy to come by in the animation curves,
however we do have some string manipulation tricks to make it happen.

Testing in gooseberry worked for the rigs there, commiting to master now
2015-01-09 12:16:58 +01:00
16ed20ff3c Add some BLI helpers needed by asset branch.
`BLI_strncpy_ensure_pad()` is also useful with current master code.

The two others (`BLI_strcmp_ignore_pad()` and `BLI_filelist_duplicate()`)
are only used in asset branch currently, but think they could be useful
in other places too, and simplifies handling of asset branch & future patch review.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D965
2015-01-03 10:13:44 +01:00
0d1484e4ad Make function definition consistent with function declaration (as discussed with campbell) 2014-08-01 14:32:04 +02:00
4cc93123c8 Add thousands separators to scene stats (D646)
by januz with own modifications
2014-07-17 14:54:12 +10:00
ea1f1fe0c2 BLI_string, dont pass unicode to ascii BLI_str_partition functions 2014-07-08 06:06:34 +10:00
e3c8cf0a9e Add (r)partition funcs to BLI_string, to get left-most/right-most first occurence of delimiters.
Inspired by Python (r)partition str functions. Also added some Gtest cases for those new funcs.

Reviewed by Campbell Barton, many thanks!
2014-07-04 14:14:06 +02:00
ab5f4c4dfa BLI: Add two helpers to search a given string in an array of strings. 2014-06-17 15:58:07 +02:00
341fd67fbf Add string escaping support for BLI_str_quoted_substrN 2014-06-14 00:47:12 +10:00
483d8da9bc Code cleanup: use 'const' for arrays (blenlib) 2014-04-27 00:25:15 +10:00
dcba34b411 Fix T38303: same names with different case sorted unpredictable in the file browser.
The string comparison was in lower case, so the same strings with different case
were considered the same which can make qsort give different results on each
sort since it's not a stable sort. Now take case into account in comparison.
2014-01-21 14:59:12 +01:00
af93ebcb50 Code Cleanup: style and redundant casts 2014-01-16 19:15:53 +11:00
7f4533fa49 String API: BLI_ascii_strtolower/upper now check NULL terminator
This wasn't needed before now, but since recent change to bUnit_ReplaceString,
it uses in a context where NULL terminator is expected - best add.
(spotted by Sergey)
2013-12-25 01:20:46 +11:00
c4a50e9aeb remove unneeded NULL checks, add one for give_matarar() return value. 2013-07-28 06:37:58 +00:00
6aa001f48d code cleanup: remove redundant NULL checks and avoid writing to the source string.
also rename BLI_replacestr() -> BLI_replacestrN() since it returns an allocated buffer.
2013-07-27 14:05:59 +00:00
3ff3d1bc0f replace use of strcat() where the string offset is known.
also correct bad logic with converting a textblock to 3d-text, bytes-vs-number of chars wasn't handled right.
2013-07-23 12:49:30 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
02f5b0fc08 debug option (off by default), for BLI_string to help find incorrect sizes being passed in (enable in source files only) 2013-07-15 03:54:57 +00:00
2df82a2a2b Code cleanup: fix some vs2012 compiler warnings 2013-06-21 12:33:19 +00:00
c9341334b1 add BLI_strcpy_rlen, replace strcat, which was used in misleading way. 2013-06-16 08:29:02 +00:00
0d36225dd1 quiet sign conversion warnings and reduce sign conversion for BLI_string, and BLF. 2013-05-12 06:33:21 +00:00
65ed588c8b Fix #35270: files with numbers higher than 2147483648 or with different numbers
of leading zeros but otherwise the same would show in random order in the file
browser. Selecting an item would change the order of all the items.

Problem was that it was comparing by parsing the number into an int, which has
only limited precision and does not care about the number of leading zeros. Now
do the comparison directly on the string.
2013-05-10 14:52:23 +00:00
c97983c9de correction for uv template, also some doxygen comment corrections. 2013-05-05 18:41:45 +00:00
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00
9e2db2dad4 revert own change: don't use memchr for strnlen, causes problems when the len is longer then the string data, instead use strnlen from freebsd.
also simplify empty string checks in logic_ops.c
2013-03-16 18:52:09 +00:00
0159647ada add BLI_strncpy_rlen(), a clone of BLI_strncpy() that returns the number of bytes copied.
also move doxy comments for BLI_string.h into the C file.
2013-03-14 10:07:05 +00:00
4dcd4e1a28 minor change to BLI_strncpy(). replace strlen() with BLI_strnlen(). 2013-03-14 09:49:20 +00:00
24da4a6032 fix [#34490] Copy and paste floating point number fields losses precision
- copy now gets up to 6 decimal places
- copy and UI float button editing now strip zeros: 1.000 -> 1.0
2013-03-04 04:21:51 +00:00
029686a2fd Bug fix #34281
The RNA path interpretor code was using a function to get the portion between quotes,
this function was not even checking if there *are* quotes at all! Causing bad
memory allocs or crashes.
2013-02-17 18:46:50 +00:00
682df047a0 style cleanup 2013-01-08 02:06:16 +00:00
0b9be70591 typo's and some style cleanup, also added asserts into BLI_vsnprintf and BLI_sprintfN when invalid args are given. 2012-11-28 06:43:04 +00:00
69b88cf719 Patch [#33196] Warning Fixes 11-16-2012
* MEM_CacheLimitier - Size type to int conversion, should be safe for now (doing my best Bill Gates 640k impression)
* OpenNL CMakeLists.txt - MSVC and GCC have slightly different ways to remove definitions (DEBUG) without the compiler complaining
* BLI_math inlines - The include guard name and inline option macro name should be different. Suppressed warning about not exporting any symbols from inline math library
* BLI string / utf8 - Fixed some inconsistencies between declarations and definitions
* nodes - node_composite_util is apparently not used unless you enable the legacy compositor, so it should not be compiled in that case.

Leaving out changes to BLI_fileops for now, need to do more testing.
2012-11-23 15:12:13 +00:00
fd2907a0b6 add assert if zero is passed to string copy functions, would copy into first byte anyway. 2012-10-31 04:28:49 +00:00
d6d8de015c change BLI_strlen_range_utf8 to the more conventional BLI_strnlen_utf8 2012-10-27 02:47:39 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
7dc19e0bc7 use __restrict for string functions args so the compiler can assume they dont overlap.
also avoid comparing int/size_t in for loops.
2012-10-10 04:47:53 +00:00
1b487e9948 Some FFmpeg changes
- Make FFmpeg initialization called from creator, not from functions
  which requires FFmpeg. Makes it easier to follow when initialization
  should happen.

- Enable DNxHD codec. It was commented a while ago due to some strange
  behavior on some platforms. Re-tested it on Linux and Windows and
  it seemd to be working quite nice. Would let it be tested further,
  if it wouldn't be stable enough, easy to comment it again.

- Make non-error messages from writeffmpeg.c printed only if ffmpeg
  debug argument was passed to blender. Reduces console pollution
  with messages which are not useful for general troubleshooting.
  Error messages would still be printed to the console.

- Show FFmpeg error message when video stream failed to allocate.
  makes it easier to understand what exactly is wrong from Blender
  interface, no need to restart blender with FFmpeg debug flag and
  check for console messages.

  Used custom log callback for this which stores last error message
  in static variable. This is not thread safe, but with current
  design FFmpeg routines could not be called form several threads
  anyway, so think it's fine solution/
2012-08-26 11:01:14 +00:00
df107939c9 rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing an allocation. 2012-07-09 22:16:50 +00:00
cfb7aee017 style cleanup 2012-07-07 22:51:57 +00:00
2d2d36fe3b code cleanup:
- style - multi-line ifs move braces onto new lines.
- iterators - convert some to macros, other split up and move brace.
2012-05-20 19:49:27 +00:00
bddc7dfc20 style cleanup: remaining BLI files. 2012-05-12 15:13:06 +00:00
e701f9b670 style cleanup: whitespace / commas 2012-04-29 15:47:02 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +00:00
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +00:00
1e4be0a4bf replace BLI_strtok_r from r41337 with lighter method that doesnt alloc for template_list 2011-10-29 08:18:42 +00:00