Blender V5.0
BLI_string.h File Reference
#include <inttypes.h>
#include <stdarg.h>
#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Macros

#define BLI_STR_FORMAT_UINT64_GROUPED_SIZE   27
#define BLI_STR_FORMAT_INT64_GROUPED_SIZE   28
#define BLI_STR_FORMAT_INT32_GROUPED_SIZE   15
#define BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE   15
#define BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE   5
#define BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE   7
#define BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE   5
String Copy/Format Macros

Avoid repeating destination with sizeof(..).

Note
ARRAY_SIZE allows pointers on some platforms.
#define STRNCPY_RLEN(dst, src)
#define SNPRINTF(dst, format, ...)
#define SNPRINTF_RLEN(dst, format, ...)
#define VSNPRINTF(dst, format, args)
#define VSNPRINTF_RLEN(dst, format, args)
#define STR_CONCAT(dst, len, suffix)
#define STR_CONCATF(dst, len, format, ...)
#define STRNLEN(str)
Equal to Any Element (STR_ELEM) Macro

Follows ELEM macro convention.

#define _VA_STR_ELEM2(v, a)
#define _VA_STR_ELEM3(v, a, b)
#define _VA_STR_ELEM4(v, a, b, c)
#define _VA_STR_ELEM5(v, a, b, c, d)
#define _VA_STR_ELEM6(v, a, b, c, d, e)
#define _VA_STR_ELEM7(v, a, b, c, d, e, f)
#define _VA_STR_ELEM8(v, a, b, c, d, e, f, g)
#define _VA_STR_ELEM9(v, a, b, c, d, e, f, g, h)
#define _VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i)
#define _VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j)
#define _VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k)
#define _VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l)
#define _VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m)
#define _VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n)
#define _VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
#define _VA_STR_ELEM17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
#define STR_ELEM(...)
String Debugging
#define BLI_string_debug_size(str, str_maxncpy)
#define BLI_string_debug_size_after_nil(str, str_maxncpy)

Functions

char * BLI_strdupn (const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup (const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * BLI_strdup_null (const char *str) ATTR_WARN_UNUSED_RESULT ATTR_MALLOC
char * BLI_strdupcat (const char *__restrict str1, const char *__restrict str2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * BLI_strncpy (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char char * BLI_strncpy_ensure_pad (char *__restrict dst, const char *__restrict src, char pad, size_t dst_maxncpy) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char char size_t char * BLI_strncat (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char char size_t char const char * BLI_strchr_or_end (const char *str, char ch) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
bool BLI_str_quoted_substr_range (const char *__restrict str, const char *__restrict prefix, int *__restrict r_start, int *__restrict r_end) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool bool BLI_str_quoted_substr (const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxncpy)
size_t BLI_snprintf (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t ATTR_PRINTF_FORMAT (3, 4)
size_t BLI_snprintf_rlen (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t BLI_vsnprintf (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3
size_t size_t BLI_vsnprintf_rlen (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3
size_t size_t char * BLI_sprintfN_with_buffer (char *fixed_buf, size_t fixed_buf_size, size_t *result_len, const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t size_t char ATTR_PRINTF_FORMAT (4, 5)
char * BLI_vsprintfN_with_buffer (char *fixed_buf, size_t fixed_buf_size, size_t *result_len, const char *__restrict format, va_list args) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char ATTR_PRINTF_FORMAT (4, 0)
char * BLI_sprintfN (const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char char * BLI_vsprintfN (const char *__restrict format, va_list args) ATTR_NONNULL(1
char char ATTR_MALLOC ATTR_PRINTF_FORMAT (1, 0)
size_t BLI_str_escape (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t size_t BLI_str_unescape_ex (char *__restrict dst, const char *__restrict src, size_t src_maxncpy, size_t dst_maxncpy, bool *r_is_complete) ATTR_NONNULL(1
size_t size_t size_t BLI_str_unescape (char *__restrict dst, const char *__restrict src, size_t src_maxncpy) ATTR_NONNULL(1
size_t size_t size_t const char * BLI_str_escape_find_quote (const char *str) ATTR_NONNULL(1)
size_t BLI_str_format_int_grouped (char dst[BLI_STR_FORMAT_INT32_GROUPED_SIZE], int num) ATTR_NONNULL(1)
size_t BLI_str_format_uint64_grouped (char dst[BLI_STR_FORMAT_UINT64_GROUPED_SIZE], uint64_t num) ATTR_NONNULL(1)
size_t BLI_str_format_int64_grouped (char dst[BLI_STR_FORMAT_INT64_GROUPED_SIZE], int64_t num) ATTR_NONNULL(1)
void BLI_str_format_byte_unit (char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE], long long int bytes, bool base_10) ATTR_NONNULL(1)
void BLI_str_format_byte_unit_compact (char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE], long long int bytes, bool base_10) ATTR_NONNULL(1)
void BLI_str_format_decimal_unit (char dst[BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE], int number_to_format) ATTR_NONNULL(1)
void BLI_str_format_integer_unit (char dst[BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE], int number_to_format) ATTR_NONNULL(1)
int BLI_strcaseeq (const char *a, const char *b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char * BLI_strcasestr (const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char * BLI_strncasestr (const char *s, const char *find, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char int BLI_strcasecmp (const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char int int BLI_strncasecmp (const char *s1, const char *s2, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char int int int BLI_strcasecmp_natural (const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char int int int int BLI_strcmp_ignore_pad (const char *str1, const char *str2, char pad) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int char char int int int int size_t BLI_strnlen (const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_str_tolower_ascii (char *str, size_t len) ATTR_NONNULL(1)
void BLI_str_toupper_ascii (char *str, size_t len) ATTR_NONNULL(1)
char BLI_tolower_ascii (const char c) ATTR_WARN_UNUSED_RESULT
char BLI_toupper_ascii (const char c) ATTR_WARN_UNUSED_RESULT
void BLI_str_rstrip (char *str) ATTR_NONNULL(1)
int BLI_str_rstrip_float_zero (char *str, char pad) ATTR_NONNULL(1)
int BLI_str_rstrip_digits (char *str) ATTR_NONNULL()
int BLI_str_index_in_array_n (const char *__restrict str, const char **__restrict str_array, int str_array_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_index_in_array (const char *__restrict str, const char **__restrict str_array) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int bool BLI_str_startswith (const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int bool bool BLI_str_endswith (const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
int bool bool bool BLI_strn_endswith (const char *__restrict str, const char *__restrict end, size_t str_len) ATTR_NONNULL(1
int bool bool bool size_t BLI_str_partition (const char *str, const char delim[], const char **sep, const char **suf) ATTR_NONNULL(1
int bool bool bool size_t size_t BLI_str_rpartition (const char *str, const char delim[], const char **sep, const char **suf) ATTR_NONNULL(1
int bool bool bool size_t size_t size_t BLI_str_partition_ex (const char *str, const char *end, const char delim[], const char **sep, const char **suf, bool from_right) ATTR_NONNULL(1
int bool bool bool size_t size_t size_t int BLI_string_max_possible_word_count (int str_len) ATTR_WARN_UNUSED_RESULT
bool BLI_string_has_word_prefix (const char *haystack, const char *needle, size_t needle_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool bool BLI_string_all_words_matched (const char *name, const char *str, int(*words)[2], int words_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool bool int BLI_string_find_split_words (const char *str, size_t str_maxlen, char delim, int r_words[][2], int words_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool bool int bool BLI_string_elem_split_by_delim (const char *haystack, const char delim, const char *needle) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
template<size_t N>
char * STRNCPY (char(&dst)[N], const char *src)

Variables

char ATTR_MALLOC

Macro Definition Documentation

◆ _VA_STR_ELEM10

#define _VA_STR_ELEM10 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i )
Value:
(_VA_STR_ELEM9(v, a, b, c, d, e, f, g, h) || (_VA_STR_ELEM2(v, i)))
#define _VA_STR_ELEM9(v, a, b, c, d, e, f, g, h)
Definition BLI_string.h:640
#define _VA_STR_ELEM2(v, a)
Definition BLI_string.h:627
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
i
Definition text_draw.cc:230

Definition at line 642 of file BLI_string.h.

◆ _VA_STR_ELEM11

#define _VA_STR_ELEM11 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j )
Value:
(_VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i) || (_VA_STR_ELEM2(v, j)))
#define _VA_STR_ELEM10(v, a, b, c, d, e, f, g, h, i)
Definition BLI_string.h:642

Definition at line 644 of file BLI_string.h.

◆ _VA_STR_ELEM12

#define _VA_STR_ELEM12 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k )
Value:
(_VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || (_VA_STR_ELEM2(v, k)))
#define _VA_STR_ELEM11(v, a, b, c, d, e, f, g, h, i, j)
Definition BLI_string.h:644

Definition at line 646 of file BLI_string.h.

◆ _VA_STR_ELEM13

#define _VA_STR_ELEM13 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l )
Value:
(_VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || (_VA_STR_ELEM2(v, l)))
#define _VA_STR_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k)
Definition BLI_string.h:646
ATTR_WARN_UNUSED_RESULT const BMLoop * l

Definition at line 648 of file BLI_string.h.

◆ _VA_STR_ELEM14

#define _VA_STR_ELEM14 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m )
Value:
(_VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || (_VA_STR_ELEM2(v, m)))
#define _VA_STR_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l)
Definition BLI_string.h:648

Definition at line 650 of file BLI_string.h.

◆ _VA_STR_ELEM15

#define _VA_STR_ELEM15 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n )
Value:
(_VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || (_VA_STR_ELEM2(v, n)))
#define _VA_STR_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m)
Definition BLI_string.h:650

Definition at line 652 of file BLI_string.h.

◆ _VA_STR_ELEM16

#define _VA_STR_ELEM16 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o )
Value:
(_VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || (_VA_STR_ELEM2(v, o)))
#define _VA_STR_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n)
Definition BLI_string.h:652

Definition at line 654 of file BLI_string.h.

◆ _VA_STR_ELEM17

#define _VA_STR_ELEM17 ( v,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p )
Value:
(_VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || (_VA_STR_ELEM2(v, p)))
#define _VA_STR_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
Definition BLI_string.h:654

Definition at line 656 of file BLI_string.h.

◆ _VA_STR_ELEM2

#define _VA_STR_ELEM2 ( v,
a )
Value:
(strcmp(v, a) == 0)

Definition at line 627 of file BLI_string.h.

◆ _VA_STR_ELEM3

#define _VA_STR_ELEM3 ( v,
a,
b )
Value:

Definition at line 628 of file BLI_string.h.

◆ _VA_STR_ELEM4

#define _VA_STR_ELEM4 ( v,
a,
b,
c )
Value:
(_VA_STR_ELEM3(v, a, b) || (_VA_STR_ELEM2(v, c)))
#define _VA_STR_ELEM3(v, a, b)
Definition BLI_string.h:628

Definition at line 630 of file BLI_string.h.

◆ _VA_STR_ELEM5

#define _VA_STR_ELEM5 ( v,
a,
b,
c,
d )
Value:
(_VA_STR_ELEM4(v, a, b, c) || (_VA_STR_ELEM2(v, d)))
#define _VA_STR_ELEM4(v, a, b, c)
Definition BLI_string.h:630

Definition at line 632 of file BLI_string.h.

◆ _VA_STR_ELEM6

#define _VA_STR_ELEM6 ( v,
a,
b,
c,
d,
e )
Value:
(_VA_STR_ELEM5(v, a, b, c, d) || (_VA_STR_ELEM2(v, e)))
#define _VA_STR_ELEM5(v, a, b, c, d)
Definition BLI_string.h:632

Definition at line 634 of file BLI_string.h.

◆ _VA_STR_ELEM7

#define _VA_STR_ELEM7 ( v,
a,
b,
c,
d,
e,
f )
Value:
(_VA_STR_ELEM6(v, a, b, c, d, e) || (_VA_STR_ELEM2(v, f)))
#define _VA_STR_ELEM6(v, a, b, c, d, e)
Definition BLI_string.h:634

Definition at line 636 of file BLI_string.h.

◆ _VA_STR_ELEM8

#define _VA_STR_ELEM8 ( v,
a,
b,
c,
d,
e,
f,
g )
Value:
(_VA_STR_ELEM7(v, a, b, c, d, e, f) || (_VA_STR_ELEM2(v, g)))
#define _VA_STR_ELEM7(v, a, b, c, d, e, f)
Definition BLI_string.h:636

Definition at line 638 of file BLI_string.h.

◆ _VA_STR_ELEM9

#define _VA_STR_ELEM9 ( v,
a,
b,
c,
d,
e,
f,
g,
h )
Value:
(_VA_STR_ELEM8(v, a, b, c, d, e, f, g) || (_VA_STR_ELEM2(v, h)))
#define _VA_STR_ELEM8(v, a, b, c, d, e, f, g)
Definition BLI_string.h:638

Definition at line 640 of file BLI_string.h.

◆ BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE

#define BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE   7

◆ BLI_STR_FORMAT_INT32_GROUPED_SIZE

#define BLI_STR_FORMAT_INT32_GROUPED_SIZE   15

◆ BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE

#define BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE   5

Definition at line 40 of file BLI_string.h.

Referenced by BLI_str_format_integer_unit(), BLI_str_unescape(), and TEST().

◆ BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE

#define BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE   5

Definition at line 34 of file BLI_string.h.

Referenced by BLI_str_format_byte_unit_compact(), and BLI_str_unescape().

◆ BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE

◆ BLI_STR_FORMAT_INT64_GROUPED_SIZE

#define BLI_STR_FORMAT_INT64_GROUPED_SIZE   28

◆ BLI_STR_FORMAT_UINT64_GROUPED_SIZE

#define BLI_STR_FORMAT_UINT64_GROUPED_SIZE   27

◆ BLI_string_debug_size

◆ BLI_string_debug_size_after_nil

◆ SNPRINTF

#define SNPRINTF ( dst,
format,
... )
Value:
BLI_snprintf(dst, ARRAY_SIZE(dst), format, __VA_ARGS__)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define ARRAY_SIZE(arr)
format

Definition at line 604 of file BLI_string.h.

Referenced by blender::gpu::TexturePool::acquire_texture(), BKE_appdir_program_python_search(), BKE_image_save_options_init(), BKE_memfile_undo_encode(), BKE_packedfile_write_to_file(), BKE_ptcache_load_external(), BKE_ptcache_update_info(), BKE_unit_replace_string(), blend_file_thumb_from_camera(), blend_file_thumb_from_screenshot(), blender_version_decimal(), Freestyle::BlenderStrokeRenderer::BlenderStrokeRenderer(), BLI_path_frame(), BLI_path_frame_range(), BLI_str_format_int64_grouped(), BLI_str_format_int_grouped(), BLI_str_format_uint64_grouped(), BLO_write_file_impl(), block_create__close_file_dialog(), blender::io::hydra::cache_image_file(), blender::io::hydra::cache_or_get_image_file(), camera_multiview_advanced(), blender::gpu::GLTexture::check_feedback_loop(), blender::gpu::debug::check_gl_error(), blender::gpu::debug::check_gl_resources(), blender::deg::color_for_pointer(), console_drop_path_copy(), crashlog_file_generate(), do_history(), blender::draw::DRW_cdlayer_attr_aliases_add(), dynamicPaintSurface_updateType(), blender::io::usd::export_packed_texture(), blender::draw::extract_tan_init_common(), file_overwrite_detailed_info_show(), blender::bke::bake::frame_to_file_name(), fsmenu_read_system(), blender::gpu::shader::GPUCodegen::generate_attribs(), blender::io::usd::get_in_memory_texture_filename(), get_proxy_filepath(), get_proxy_filepath(), get_tc_filepath(), GPU_material_split_sub_function(), gpu_node_graph_add_texture(), gpu_node_input_link(), GPU_vertformat_multiload_enable(), blender::deg::IDNode::identifier(), image_update_views_format(), imb_exr_multilayer_parse_channels_from_file(), blender::draw::init_vbo_for_attribute(), interactive_value_update(), make_structDNA(), Freestyle::BlenderStrokeRenderer::NewMesh(), blender::nodes::node_fn_bit_math_cc::node_label(), blender::gpu::debug::object_label(), blender::gpu::debug::object_label(), blender::seq::open_anim_file_multiview(), operator<<(), panel_draw(), playanim_toscreen_ex(), radial_control_paint_cursor(), radial_control_update_header(), RE_engine_update_stats(), render_result_exr_file_cache_path(), replace_if_different(), rna_def_fileselect_asset_idfilter(), rna_def_node_item_array_common_functions(), rna_def_node_item_array_new_with_socket_and_name(), rna_def_node_item_array_socket_item_common(), RNA_path_append(), rna_preprocess(), blender::seq::seq_proxy_get_custom_file_filepath(), blender::seq::seq_proxy_get_filepath(), blender::seq::seqbase_unique_name(), blender::ed::vse::sequencer_image_strip_reserve_frames(), strip_sound_proxy_update_cb(), blender::bke::greasepencil::tests::TEST(), thumb_create_ex(), uiTemplateMovieclipInformation(), unpack_generate_paths(), uri_from_filepath(), blender::io::hydra::USDSceneDelegate::USDSceneDelegate(), version_geometry_nodes_add_attribute_input_settings(), wm_autosave_location(), WM_platform_associate_set(), and write_global().

◆ SNPRINTF_RLEN

#define SNPRINTF_RLEN ( dst,
format,
... )
Value:
BLI_snprintf_rlen(dst, ARRAY_SIZE(dst), format, __VA_ARGS__)
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1

Definition at line 605 of file BLI_string.h.

Referenced by DRW_text_edit_mesh_measure_stats(), and idp_str_append_escape().

◆ STR_CONCAT

#define STR_CONCAT ( dst,
len,
suffix )
Value:
len += BLI_strncpy_rlen(dst + len, suffix, ARRAY_SIZE(dst) - len)
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
uint len

Definition at line 609 of file BLI_string.h.

Referenced by BKE_image_save_options_init(), and WM_platform_support_perform_checks().

◆ STR_CONCATF

#define STR_CONCATF ( dst,
len,
format,
... )
Value:
len += BLI_snprintf_rlen(dst + len, ARRAY_SIZE(dst) - len, format, __VA_ARGS__)

Definition at line 611 of file BLI_string.h.

◆ STR_ELEM

#define STR_ELEM ( ...)
Value:
VA_NARGS_CALL_OVERLOAD(_VA_STR_ELEM, __VA_ARGS__)
#define VA_NARGS_CALL_OVERLOAD(name,...)

Definition at line 661 of file BLI_string.h.

Referenced by blender::io::fbx::add_image_texture(), BKE_image_render_write_exr(), BKE_scene_multiview_is_render_view_active(), blo_do_versions_280(), blo_do_versions_420(), blo_is_builtin_template(), blo_update_defaults_screen(), BLO_update_defaults_startup_blend(), common_poll_default(), blender::deg::RNANodeQuery::construct_node_identifier(), convert_include(), blender::ed::object::data_transfer_poll_property(), blender::draw::drw_volume_object_mesh_init(), edbm_spin_poll_property(), blender::nodes::node_composite_render_layer_cc::RenderLayerOperation::execute(), file_browse_invoke(), geo_cmp_node_poll_default(), blender::compositor::get_result_type(), gpu_node_input_link(), image_open_draw_check_prop(), main(), menu_types_add_from_keymap_items(), blender::ed::space_node::node_add_image_poll(), blender::ed::space_node::node_group_operator_active_poll(), blender::nodes::node_shader_volume_coefficients_cc::node_shader_update_coefficients(), blender::nodes::node_shader_bsdf_hair_principled_cc::node_shader_update_hair_principled(), blender::nodes::node_shader_volume_scatter_cc::node_shader_update_scatter(), blender::nodes::node_shader_subsurface_scattering_cc::node_shader_update_subsurface_scattering(), blender::ed::object::object_add_to_selected_poll_property(), openexr_header_metadata_global(), pyrna_struct_getattro(), RE_RenderPassIsColor(), rna_def_property_get_func(), rna_range_from_int_type(), blender::ed::asset::screenshot_preview_exec(), blender::ed::vse::sequencer_add_draw_check_fn(), blender::ed::vse::sequencer_add_effect_strip_poll_property(), sh_geo_poll_default(), socket_type_from_pass(), version_geometry_nodes_use_rotation_socket(), version_mesh_crease_generic(), blender::ed::space_node::WIDGETGROUP_node_box_mask_poll(), blender::ed::space_node::WIDGETGROUP_node_ellipse_mask_poll(), blender::ed::space_node::WIDGETGROUP_node_glare_poll(), blender::ed::space_node::WIDGETGROUP_node_split_poll(), and WM_window_cursor_keymap_status_refresh().

◆ STRNCPY_RLEN

#define STRNCPY_RLEN ( dst,
src )

◆ STRNLEN

#define STRNLEN ( str)

◆ VSNPRINTF

#define VSNPRINTF ( dst,
format,
args )
Value:
BLI_vsnprintf(dst, ARRAY_SIZE(dst), format, args)
size_t BLI_vsnprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3

Definition at line 607 of file BLI_string.h.

◆ VSNPRINTF_RLEN

#define VSNPRINTF_RLEN ( dst,
format,
args )
Value:
size_t size_t BLI_vsnprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3

Definition at line 608 of file BLI_string.h.

Function Documentation

◆ ATTR_PRINTF_FORMAT() [1/4]

char char ATTR_MALLOC ATTR_PRINTF_FORMAT ( 1 ,
0  )

References ATTR_PRINTF_FORMAT.

◆ ATTR_PRINTF_FORMAT() [2/4]

size_t ATTR_PRINTF_FORMAT ( 3 ,
4  )

References ATTR_NONNULL, and ATTR_PRINTF_FORMAT.

◆ ATTR_PRINTF_FORMAT() [3/4]

char ATTR_PRINTF_FORMAT ( 4 ,
0  )

References ATTR_PRINTF_FORMAT.

◆ ATTR_PRINTF_FORMAT() [4/4]

size_t size_t char ATTR_PRINTF_FORMAT ( 4 ,
5  )

References ATTR_PRINTF_FORMAT.

◆ BLI_snprintf()

◆ BLI_snprintf_rlen()

◆ BLI_sprintfN()

char * BLI_sprintfN ( const char *__restrict format,
... )

Print formatted string into a newly MEM_mallocN'd string and return it.

References ATTR_MALLOC, ATTR_NONNULL, ATTR_PRINTF_FORMAT, ATTR_WARN_UNUSED_RESULT, and BLI_sprintfN().

Referenced by action_flip_pchan_rna_paths(), add_driver_with_target(), anim_change_prop_name(), animpath_update_basepath(), blender::bke::asset_edit_weak_reference_from_id(), blender::bke::asset_weak_reference_for_essentials(), blender::bke::asset_weak_reference_for_user_library(), BKE_action_fix_paths_rename(), BKE_animdata_fix_paths_rename(), BKE_animsys_fix_rna_path_rename(), BKE_id_to_unique_string_key(), blf_display_name(), BLF_display_name_from_file(), BLI_sprintfN(), buffer_from_filepath(), build_pict_list_from_anim(), create_lineset_handler(), do_version_hue_sat_node(), blender::ed::vse::draw_channel_widget_lock(), blender::ed::vse::draw_channel_widget_mute(), fcurve_path_rename(), getname_anim_fcurve(), blender::bke::node_interface::item_types::item_copy(), blender::bke::node_interface::make_socket(), blender::ed::space_node::node_panel_drop_tooltip(), blender::ed::space_node::node_socket_drop_tooltip(), paint_brush_asset_reference_from_essentials(), paint_brush_asset_reference_ptr_from_essentials(), pose_slide_apply_quat(), pose_slide_apply_vec3(), replace_bbone_len_scale_rnapath(), strip_convert_transform_crop(), strip_convert_transform_crop_2(), strip_speed_factor_fix_rna_path(), update_mapping_node_fcurve_rna_path_callback(), update_mapping_node_inputs_and_properties(), version_bonecollection_anim(), version_liboverride_nla_frame_start_end(), version_node_group_split_socket(), and version_node_socket_index_animdata().

◆ BLI_sprintfN_with_buffer()

size_t size_t char * BLI_sprintfN_with_buffer ( char * fixed_buf,
size_t fixed_buf_size,
size_t * result_len,
const char *__restrict format,
... )

◆ BLI_str_endswith()

int bool bool BLI_str_endswith ( const char *__restrict str,
const char *__restrict end )

Find if a string ends with another string.

Parameters
strThe string to search within.
endThe string we look for at the end.
Returns
If str ends with end.

References str.

Referenced by animdata_filter_shapekey(), blo_do_versions_pre250(), check_valid_camera_multiview(), blender::ed::asset::index::AssetLibraryIndex::collect_preexisting_file_indices(), do_version_alpha_over_node_options_to_inputs_animation(), do_version_anti_alias_node_options_to_inputs_animation(), do_version_bilateral_blur_node_options_to_inputs_animation(), do_version_blur_node_options_to_inputs_animation(), do_version_bokeh_blur_node_options_to_inputs_animation(), do_version_bokeh_image_node_options_to_inputs_animation(), do_version_box_mask_node_options_to_inputs_animation(), do_version_channel_matte_node_options_to_inputs_animation(), do_version_chroma_matte_node_options_to_inputs_animation(), do_version_color_balance_node_options_to_inputs_animation(), do_version_color_correction_node_options_to_inputs_animation(), do_version_color_matte_node_options_to_inputs_animation(), do_version_color_spill_node_options_to_inputs_animation(), do_version_crop_node_options_to_inputs_animation(), do_version_denoise_node_options_to_inputs_animation(), do_version_despeckle_node_options_to_inputs_animation(), do_version_difference_matte_node_options_to_inputs_animation(), do_version_dilate_node_options_to_inputs_animation(), do_version_directional_blur_node_options_to_inputs_animation(), do_version_distance_matte_node_options_to_inputs_animation(), do_version_ellipse_mask_node_options_to_inputs_animation(), do_version_glare_node_options_to_inputs(), do_version_glare_node_star_45_option_to_input_animation(), do_version_id_mask_node_options_to_inputs_animation(), do_version_inpaint_node_options_to_inputs_animation(), do_version_invert_node_options_to_inputs_animation(), do_version_keying_node_options_to_inputs_animation(), do_version_keying_screen_node_options_to_inputs_animation(), do_version_kuwahara_node_options_to_inputs_animation(), do_version_lens_distortion_node_options_to_inputs_animation(), do_version_luminance_matte_node_options_to_inputs_animation(), do_version_mask_node_options_to_inputs_animation(), do_version_pixelate_node_options_to_inputs_animation(), do_version_plane_track_deform_node_options_to_inputs_animation(), do_version_split_node_options_to_inputs_animation(), do_version_stabilize_node_options_to_inputs_animation(), do_version_sun_beams_node_options_to_inputs_animation(), do_version_switch_node_options_to_inputs_animation(), do_version_time_curve_node_options_to_inputs_animation(), do_version_tone_map_node_options_to_inputs_animation(), do_version_vector_blur_node_options_to_inputs_animation(), do_version_z_combine_node_options_to_inputs_animation(), blender::eevee::Instance::info_append(), blender::eevee::Instance::info_append_i18n(), menu_items_from_ui_create(), replace_bbone_len_scale_rnapath(), replace_bbone_scale_rnapath(), rna_preprocess(), blender::ed::vse::sequencer_fcurves_targets_color_strip(), TEST(), TEST(), update_mapping_node_fcurve_rna_path_callback(), and WM_keymap_poll().

◆ BLI_str_escape()

size_t BLI_str_escape ( char *__restrict dst,
const char *__restrict src,
size_t dst_maxncpy )

This roughly matches C and Python's string escaping with double quotes - ".

Since every character may need escaping, it's common to create a buffer twice as large as the input.

Parameters
dstThe destination string, at least dst_maxncpy, typically (strlen(src) * 2) + 1.
srcThe un-escaped source string.
dst_maxncpyThe maximum number of bytes allowable to copy.
Note
This is used for creating animation paths in blend files.

References ATTR_NONNULL, BLI_str_escape(), and str.

Referenced by action_flip_pchan(), action_flip_pchan_rna_paths(), blender::nodes::add_attribute_search_or_value_buttons(), blender::nodes::add_layer_name_search_button(), BKE_action_fix_paths_rename(), BKE_animdata_fix_paths_rename(), BKE_animsys_fix_rna_path_rename(), BKE_linestyle_path_to_color_ramp(), BKE_tracking_get_rna_path_for_plane_track(), BKE_tracking_get_rna_path_for_track(), BKE_tracking_get_rna_path_prefix_for_plane_track(), BKE_tracking_get_rna_path_prefix_for_track(), BLI_str_escape(), bpy_escape_identifier(), do_version_alpha_over_node_options_to_inputs_animation(), do_version_anti_alias_node_options_to_inputs_animation(), do_version_bilateral_blur_node_options_to_inputs_animation(), do_version_blur_node_options_to_inputs_animation(), do_version_bokeh_blur_node_options_to_inputs_animation(), do_version_bokeh_image_node_options_to_inputs_animation(), do_version_box_mask_node_options_to_inputs_animation(), do_version_channel_matte_node_options_to_inputs_animation(), do_version_chroma_matte_node_options_to_inputs_animation(), do_version_color_balance_node_options_to_inputs_animation(), do_version_color_correction_node_options_to_inputs_animation(), do_version_color_matte_node_options_to_inputs_animation(), do_version_color_spill_node_options_to_inputs_animation(), do_version_convert_to_generic_nodes_after_linking(), do_version_crop_node_options_to_inputs_animation(), do_version_denoise_node_options_to_inputs_animation(), do_version_despeckle_node_options_to_inputs_animation(), do_version_difference_matte_node_options_to_inputs_animation(), do_version_dilate_node_options_to_inputs_animation(), do_version_directional_blur_node_options_to_inputs_animation(), do_version_distance_matte_node_options_to_inputs_animation(), do_version_ellipse_mask_node_options_to_inputs_animation(), do_version_glare_node_bloom_strength(), do_version_glare_node_options_to_inputs(), do_version_glare_node_star_45_option_to_input_animation(), do_version_hue_sat_node(), do_version_id_mask_node_options_to_inputs_animation(), do_version_inpaint_node_options_to_inputs_animation(), do_version_invert_node_options_to_inputs_animation(), do_version_keying_node_options_to_inputs_animation(), do_version_keying_screen_node_options_to_inputs_animation(), do_version_kuwahara_node_options_to_inputs_animation(), do_version_lens_distortion_node_options_to_inputs_animation(), do_version_luminance_matte_node_options_to_inputs_animation(), do_version_mask_node_options_to_inputs_animation(), do_version_pixelate_node_options_to_inputs_animation(), do_version_plane_track_deform_node_options_to_inputs_animation(), do_version_split_node_options_to_inputs_animation(), do_version_stabilize_node_options_to_inputs_animation(), do_version_sun_beams_node_options_to_inputs_animation(), do_version_switch_node_options_to_inputs_animation(), do_version_time_curve_node_options_to_inputs_animation(), do_version_tone_map_node_options_to_inputs_animation(), do_version_vector_blur_node_options_to_inputs_animation(), do_version_z_combine_node_options_to_inputs_animation(), blender::nodes::draw_geometry_nodes_operator_redo_ui(), blender::nodes::draw_interface_panel_as_panel(), blender::nodes::draw_property_for_output_socket(), blender::nodes::draw_property_for_socket(), blender::animrig::get_keyable_id_property_paths(), blender::bke::greasepencil::convert::legacy_gpencil_to_grease_pencil(), blender::bke::greasepencil::convert::legacy_object_modifier_common(), blender::bke::greasepencil::convert::legacy_object_modifier_opacity(), blender::bke::greasepencil::convert::legacy_object_thickness_modifier_thickness_anim(), blender::bke::node_remove_node(), RNA_path_append(), rna_path_from_ptr_to_property_index_ex(), RNA_path_full_ID_py(), RNA_property_as_string(), blender::nodes::inverse_eval::set_modifier_value(), blender::nodes::inverse_eval::set_socket_value(), blender::nodes::inverse_eval::set_value_node_value(), strip_convert_transform_crop(), strip_convert_transform_crop_2(), strip_speed_factor_fix_rna_path(), StringEscape::testEscapeWords(), update_mapping_node_fcurve_rna_path_callback(), update_mapping_node_inputs_and_properties(), version_liboverride_nla_strip_frame_start_end(), version_liboverride_rnacollections_insertion_object(), version_node_socket_index_animdata(), and version_principled_bsdf_update_animdata().

◆ BLI_str_escape_find_quote()

size_t size_t size_t const char * BLI_str_escape_find_quote ( const char * str)

Find the first un-escaped quote in the string (to find the end of the string).

Parameters
strTypically this is the first character in a quoted string. Where the character before *str would be ".
Returns
The pointer to the first un-escaped quote.

Definition at line 438 of file string.cc.

References str.

Referenced by action_flip_pchan_rna_paths(), BLI_str_quoted_substr_range(), and rna_path_token_in_brackets().

◆ BLI_str_format_byte_unit()

void BLI_str_format_byte_unit ( char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE],
long long int bytes,
bool base_10 )

Format a size in bytes using binary units. 1000 -> 1 KB Number of decimal places grows with the used unit (e.g. 1.5 MB, 1.55 GB, 1.545 TB).

Parameters
dstThe resulting string. Dimension of 14 to support largest possible value for bytes (#LLONG_MAX).
bytesNumber to format.
base_10Calculate using base 10 (GB, MB, ...) or 2 (GiB, MiB, ...).

Definition at line 1207 of file string.cc.

References ARRAY_SIZE, BLI_snprintf_rlen(), BLI_STATIC_ASSERT, BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE, BLI_str_rstrip_float_zero(), BLI_string_debug_size, BLI_strncpy(), fabs(), and len.

Referenced by BKE_ptcache_update_info(), BLI_filelist_entry_size_to_string(), blender::ed::spreadsheet::SpreadsheetLayoutDrawer::draw_int(), ED_info_statusbar_string_ex(), blender::nodes::get_bake_state_string(), blender::HashTableStats::print(), TEST(), and blender::internal::vector_print_stats().

◆ BLI_str_format_byte_unit_compact()

void BLI_str_format_byte_unit_compact ( char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE],
long long int bytes,
bool base_10 )

Format a size in bytes using binary units in compact (max 4 chars) format.

It shows a lower bound instead of rounding the number.

1 -> 1B 15 -> 15B 155 -> 155B 1555 -> 1K 15555 -> 15K 155555 -> .1M 1555555 -> 1M 15555555 -> 15M 155555555 -> .1G 1000000000 -> 1G ...

Parameters
dstThe resulting string. Dimension of 5 to support largest possible value for bytes (#LLONG_MAX).
bytesNumber to format.
base_10Calculate using base 10 (GB, MB, ...) or 2 (GiB, MiB, ...).

Definition at line 1237 of file string.cc.

References ARRAY_SIZE, BLI_snprintf(), BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE, BLI_string_debug_size, fabsf, float, and floorf.

Referenced by BLI_filelist_entry_size_to_string().

◆ BLI_str_format_decimal_unit()

void BLI_str_format_decimal_unit ( char dst[BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE],
int number_to_format )

Format a count to up to 6 places (plus \0 terminator) string using long number names abbreviations. Used to produce a compact representation of large numbers.

1 -> 1 15 -> 15 155 -> 155 1555 -> 1.6K 15555 -> 15.6K 155555 -> 156K 1555555 -> 1.6M 15555555 -> 15.6M 155555555 -> 156M 1000000000 -> 1B ...

Length of 7 is the maximum of the resulting string, for example, -15.5K\0.

Definition at line 1270 of file string.cc.

References ARRAY_SIZE, BLI_snprintf(), BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE, BLI_string_debug_size, fabsf, and float.

Referenced by blender::ed::spreadsheet::draw_count(), and TEST().

◆ BLI_str_format_int64_grouped()

size_t BLI_str_format_int64_grouped ( char dst[BLI_STR_FORMAT_INT64_GROUPED_SIZE],
int64_t num )

◆ BLI_str_format_int_grouped()

size_t BLI_str_format_int_grouped ( char dst[BLI_STR_FORMAT_INT32_GROUPED_SIZE],
int num )

Format integers with decimal grouping. 1000 -> 1,000

Parameters
dstThe resulting string.
numNumber to format.
Returns
The length of dst

Definition at line 1171 of file string.cc.

References BLI_STR_FORMAT_INT32_GROUPED_SIZE, BLI_str_format_int_grouped_ex(), BLI_string_debug_size, num, SNPRINTF, and UNUSED_VARS_NDEBUG.

Referenced by BKE_ptcache_update_info(), blender::ed::spreadsheet::spreadsheet_footer_region_draw(), and TEST().

◆ BLI_str_format_integer_unit()

void BLI_str_format_integer_unit ( char dst[BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE],
int number_to_format )

Format a count to up to 3 places (plus minus sign, plus '\0' terminator) string using long number names abbreviations. Used to produce a compact representation of large numbers as integers.

It shows a lower bound instead of rounding the number.

1 -> 1 15 -> 15 155 -> 155 1555 -> 1K 15555 -> 15K 155555 -> .1M 1555555 -> 1M 15555555 -> 15M 155555555 -> .1B 1000000000 -> 1B ...

Length of 5 is the maximum of the resulting string, for example, -15K\0.

Definition at line 1294 of file string.cc.

References abs, ARRAY_SIZE, BLI_snprintf(), BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE, BLI_string_debug_size, fabsf, float, and floorf.

Referenced by blender::ed::outliner::outliner_draw_userbuts(), TEST(), UI_icon_text_overlay_init_from_count(), and uiTemplateStatusInfo().

◆ BLI_str_format_uint64_grouped()

size_t BLI_str_format_uint64_grouped ( char dst[BLI_STR_FORMAT_UINT64_GROUPED_SIZE],
uint64_t num )

Format uint64_t with decimal grouping. 1000 -> 1,000

Parameters
dstThe resulting string.
numNumber to format.
Returns
The length of dst.

Definition at line 1183 of file string.cc.

References BLI_str_format_int_grouped_ex(), BLI_STR_FORMAT_UINT64_GROUPED_SIZE, BLI_string_debug_size, num, PRIu64, SNPRINTF, and UNUSED_VARS_NDEBUG.

Referenced by file_draw_tooltip_custom_func(), and TEST().

◆ BLI_str_index_in_array()

int BLI_str_index_in_array ( const char *__restrict str,
const char **__restrict str_array )

Return index of a string in a string array.

Parameters
strThe string to find.
str_arrayArray of strings, (must be NULL-terminated).
Returns
The index of str in str_array or -1.

References ATTR_WARN_UNUSED_RESULT, and str.

Referenced by bpyunits_validate().

◆ BLI_str_index_in_array_n()

int BLI_str_index_in_array_n ( const char *__restrict str,
const char **__restrict str_array,
int str_array_len )

Return index of a string in a string array.

Parameters
strThe string to find.
str_arrayArray of strings.
str_array_lenThe length of the array, or -1 for a NULL-terminated array.
Returns
The index of str in str_array or -1.

Definition at line 846 of file string.cc.

References str, and STREQ.

◆ BLI_str_partition()

int bool bool bool size_t BLI_str_partition ( const char * str,
const char delim[],
const char ** sep,
const char ** suf )

Find the first char matching one of the chars in delim, from left.

Parameters
strThe string to search within.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
Returns
The length of the prefix (i.e. *sep - str).

References str.

Referenced by passtype_from_name(), and TEST().

◆ BLI_str_partition_ex()

int bool bool bool size_t size_t size_t BLI_str_partition_ex ( const char * str,
const char * end,
const char delim[],
const char ** sep,
const char ** suf,
bool from_right )

Find the first char matching one of the chars in delim, either from left or right.

Parameters
strThe string to search within.
endIf non-NULL, the right delimiter of the string.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
from_rightIf true, search from the right of str, else, search from its left.
Returns
The length of the prefix (i.e. *sep - str).

References ATTR_WARN_UNUSED_RESULT, and str.

Referenced by imb_exr_split_token(), and TEST().

◆ BLI_str_quoted_substr()

bool bool BLI_str_quoted_substr ( const char *__restrict str,
const char *__restrict prefix,
char * result,
size_t result_maxncpy )

Fills result with text within "" that appear after some the contents of prefix. i.e. for string pose["apples"] with prefix pose[, it will return apples.

Parameters
stris the entire string to chop.
prefixis the part of the string to step over.
resultThe buffer to fill.
result_maxncpyThe maximum size of the buffer (including nil terminator).
Returns
True if the prefix was found and the entire quoted string was copied into result.

Assume that the strings returned must be freed afterwards, and that the inputs will contain data we want.

Definition at line 521 of file string.cc.

References BLI_str_quoted_substr_range(), BLI_str_unescape_ex(), BLI_string_debug_size, result, and str.

Referenced by animchan_sync_fcurve_scene(), blender::bke::BKE_action_find_fcurves_with_bones(), can_delete_fcurve(), can_delete_key(), blender::animrig::fcurve_matches_collection_path(), getname_anim_fcurve(), is_animating_bone(), pose_select_same_keyingset(), and skip_fcurve_selected_data().

◆ BLI_str_quoted_substr_range()

bool BLI_str_quoted_substr_range ( const char *__restrict str,
const char *__restrict prefix,
int *__restrict r_start,
int *__restrict r_end )

Return the range of the quoted string (excluding quotes) str after prefix.

A version of #BLI_str_quoted_substrN that calculates the range instead of un-escaping and allocating the result.

Parameters
strString potentially including prefix.
prefixQuoted string prefix.
r_startThe start of the quoted string (after the first quote).
r_endThe end of the quoted string (before the last quote).
Returns
True when a quoted string range could be found after prefix.

References ATTR_MALLOC, ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, BLI_str_quoted_substr_range(), result, and str.

Referenced by BLI_str_quoted_substr_range(), blender::ed::animation::flip_names(), and version_bone_hide_property_driver().

◆ BLI_str_rpartition()

int bool bool bool size_t size_t BLI_str_rpartition ( const char * str,
const char delim[],
const char ** sep,
const char ** suf )

Find the first char matching one of the chars in delim, from right.

Parameters
strThe string to search within.
delimThe set of delimiters to search for, as unicode values.
sepReturn value, set to the first delimiter found (or NULL if none found).
sufReturn value, set to next char after the first delimiter found (or NULL if none found).
Returns
The length of the prefix (i.e. *sep - str).

References str.

Referenced by BKE_scene_multiview_view_prefix_get(), and TEST().

◆ BLI_str_rstrip()

void BLI_str_rstrip ( char * str)

Strip white-space from end of the string.

Definition at line 980 of file string.cc.

References i, and str.

Referenced by ED_area_status_text(), and fsmenu_xdg_user_dirs_parse().

◆ BLI_str_rstrip_digits()

int BLI_str_rstrip_digits ( char * str)

Strip trailing digits.

  • ABC123 -> ABC
Parameters
str
Returns
The number of digits stripped.

Definition at line 1012 of file string.cc.

References str.

Referenced by ui_do_but_text_value_cycle(), and wm_save_as_mainfile_exec().

◆ BLI_str_rstrip_float_zero()

int BLI_str_rstrip_float_zero ( char * str,
char pad )

Strip trailing zeros from a float, eg:

  • 0.0000 -> 0.0
  • 2.0010 -> 2.001
Parameters
str
pad
Returns
The number of zeros stripped.

Definition at line 992 of file string.cc.

References pad, and str.

Referenced by ANIM_add_driver(), BLI_str_format_byte_unit(), ui_but_copy_numeric_value(), and ui_textedit_begin().

◆ BLI_str_startswith()

int bool BLI_str_startswith ( const char *__restrict str,
const char *__restrict start )

◆ BLI_str_tolower_ascii()

void BLI_str_tolower_ascii ( char * str,
size_t len )

◆ BLI_str_toupper_ascii()

void BLI_str_toupper_ascii ( char * str,
size_t len )

Definition at line 965 of file string.cc.

References BLI_toupper_ascii(), i, len, and str.

Referenced by WM_operator_bl_idname().

◆ BLI_str_unescape()

size_t size_t size_t BLI_str_unescape ( char *__restrict dst,
const char *__restrict src,
size_t src_maxncpy )

See BLI_str_unescape_ex doc-string.

This function makes the assumption that dst always has at least src_maxncpy bytes available.

Use BLI_str_unescape_ex if dst has a smaller fixed size.

Note
This is used for parsing animation paths in blend files (runs often).

References BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE, BLI_STR_FORMAT_INT32_GROUPED_SIZE, BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE, BLI_STR_FORMAT_INT64_BYTE_UNIT_COMPACT_SIZE, BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE, BLI_STR_FORMAT_INT64_GROUPED_SIZE, BLI_STR_FORMAT_UINT64_GROUPED_SIZE, num, and str.

Referenced by action_flip_pchan_rna_paths(), bpy_unescape_identifier(), rna_path_token_in_brackets(), and StringEscape::testEscapeWords().

◆ BLI_str_unescape_ex()

size_t size_t BLI_str_unescape_ex ( char *__restrict dst,
const char *__restrict src,
size_t src_maxncpy,
size_t dst_maxncpy,
bool * r_is_complete )

This roughly matches C and Python's string escaping with double quotes - ".

The destination will never be larger than the source, it will either be the same or up to half when all characters are escaped.

Parameters
dstThe destination string, at least the size of strlen(src) + 1.
srcThe escaped source string.
src_maxncpyThe maximum number of bytes allowable to copy from src.
dst_maxncpyThe maximum number of bytes allowable to copy into dst.
r_is_completeSet to true when.

◆ BLI_strcasecmp()

◆ BLI_strcasecmp_natural()

◆ BLI_strcaseeq()

int BLI_strcaseeq ( const char * a,
const char * b )

Compare two strings without regard to case.

Return values
Trueif the strings are equal, false otherwise.

References ATTR_WARN_UNUSED_RESULT, and b.

Referenced by blender::bke::file_handlers_poll_file_drop(), blender::bke::FileHandlerType::filter_supported_paths(), imb_exr_pass_name_from_channel(), and imb_exr_split_channel_name().

◆ BLI_strcasestr()

◆ BLI_strchr_or_end()

char char size_t char const char * BLI_strchr_or_end ( const char * str,
char ch )

A version of strchr that returns the end of the string (point to \0) if the character is not found.

Useful for stepping over newlines up until the last line.

Definition at line 931 of file string.cc.

References ELEM, and str.

Referenced by BLI_string_elem_split_by_delim(), BLI_strncat(), console_paste_exec(), DRW_draw_region_engine_info(), blender::bke::file_handler_add(), get_path_environment_multiple(), and blender::io::fbx::read_ufbx_property().

◆ BLI_strcmp_ignore_pad()

int char char int int int int BLI_strcmp_ignore_pad ( const char * str1,
const char * str2,
char pad )

Like strcmp, but will ignore any heading/trailing pad char for comparison. So e.g. if pad is *, *world and world* will compare equal.

References ATTR_WARN_UNUSED_RESULT, len, pad, and str.

Referenced by filelist_setfilter_options().

◆ BLI_strdup()

char * BLI_strdup ( const char * str)

Duplicates the C-string str into a newly mallocN'd string and returns it.

Parameters
strThe string to be duplicated
Return values
Returnsthe duplicated string

Definition at line 41 of file string.cc.

References BLI_strdupn(), and str.

Referenced by action_create(), action_set_create(), actkeys_paste_get_description(), add_driver_with_target(), blender::add_missing_data_block_mappings(), alloc_driver_fcurve(), ANIM_copy_as_driver(), animsys_blend_in_fcurves(), blender::bke::asset_weak_reference_for_user_library(), BKE_appdir_app_templates(), BKE_asset_catalog_path_list_add_path(), BKE_asset_catalog_path_list_duplicate(), BKE_bpath_foreach_path_allocated_process(), BKE_id_to_unique_string_key(), BKE_keyingset_add_path(), BKE_lib_override_library_property_get(), BKE_lib_override_library_property_operation_get(), BKE_lib_override_library_property_rna_path_change(), BKE_mesh_legacy_attribute_flags_to_strings(), BKE_modifier_set_error(), BKE_modifier_set_warning(), BKE_object_sync_to_original(), BKE_packedfile_unpack_to_file(), BKE_paint_canvas_key_get(), BKE_paint_copy(), BKE_previewimg_cached_ensure(), BKE_previewimg_cached_thumbnail_read(), BKE_render_result_stamp_data(), bke_view_layer_verify_aov_cb(), BKE_viewer_path_elem_copy(), blf_dir_metrics_search(), blf_font_new_impl(), bli_builddir(), BLI_cpu_brand_string(), BLI_string_replaceN(), BLO_blendhandle_get_datablock_names(), BLO_blendhandle_get_linkable_groups(), blo_do_versions_420(), BLT_lang_init(), BLT_lang_locale_explode(), BMO_op_vinitf(), build_pict_list_from_image_sequence(), copy_animedit_keys(), copy_attribute_names(), blender::copy_data(), current_relpath_append(), curves_copy_data(), blender::bke::curves_copy_parameters(), data_transfer_mesh_attributes_transfer_active_color_string(), data_transfer_mesh_attributes_transfer_default_color_string(), do_version_file_output_node(), ED_armature_join_objects_exec(), ED_fsmenu_entry_set_path(), blender::ed::space_node::viewer_linking::ensure_geometry_nodes_viewer_has_non_geometry_socket(), fcurves_to_pchan_links_get(), file_browse_exec(), file_browse_invoke(), file_execute(), fileentry_uiname(), filelist_file_create_entry(), filelist_readjob_recursive_dir_add_items(), folderlist_pushdir(), fsmenu_insert_entry(), fsmenu_xdg_user_dirs_parse(), geometry_attribute_new_data(), ghost_event_proc(), blender::nodes::id_property_create_from_socket(), blender::nodes::id_property_int_update_enum_items(), IDP_ui_data_copy(), idprop_ui_data_update_base(), idprop_ui_data_update_string(), IMB_thumb_path_lock(), blender::io::fbx::import_colors(), blender::gpu::GPUPlatformGlobal::init(), blender::seq::init_text_effect(), blender::ed::object::bake_simulation::initialize_modifier_bake_directory_if_necessary(), blender::bke::node_interface::item_types::item_copy(), blender::ed::greasepencil::join_object_with_active(), legacy_socket_move_to_interface(), lib_override_library_property_copy(), lib_override_library_property_operation_copy(), blender::nodes::node_composite_file_output_cc::node_init(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_init(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_init(), blender::nodes::node_geo_simulation_cc::sim_output_node::node_init(), blender::ed::object::object_curves_empty_hair_add_exec(), uiLayout::op_menu_hold(), override_library_properties_validate(), panel_list_copy(), path_destination_ensure_filename(), pyrna_struct_anim_args_parse_ex(), RE_engine_set_error_message(), read_text_corpus(), remove_in_and_out_node_panel_recursive(), run_string_handle_error(), blender::nodes::socket_items::set_item_name_and_make_unique(), blender::ed::object::shade_auto_smooth_exec(), blender::ed::spreadsheet::spreadsheet_column_assign_runtime_data(), blender::ed::spreadsheet::spreadsheet_column_copy(), blender::ed::spreadsheet::spreadsheet_column_id_copy(), str_ghash_tests(), str_map_tests(), blender::ed::curves::surface_set::surface_set_exec(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), text_convert_whitespace_exec(), text_copy_data(), text_save_as_exec(), toolsystem_brush_type_binding_update(), try_parse_enum_item(), ui_apply_but_TEX(), ui_but_convert_to_unit_alt_name(), ui_but_rna_menu_convert_to_menu_type(), ui_but_rna_menu_convert_to_panel_type(), ui_but_string_get_dynamic(), ui_def_but_rna__menu(), UI_list_filter_and_sort_items(), ui_searchbox_apply(), ui_tooltip_data_from_tool(), uiTemplateRecentFiles(), blender::bke::bake::unpack_geometry_nodes_bake(), UNUSED_FUNCTION_WITH_RETURN_TYPE(), blender::nodes::update_input_properties_from_node_tree(), blender::nodes::update_output_properties_from_node_tree(), version_copy_socket(), version_dynamic_viewer_node_items(), version_idproperty_move_data_string(), version_idproperty_ui_data(), version_liboverride_rnacollections_insertion_object(), version_liboverride_rnacollections_insertion_object_constraints(), versioning_fix_socket_subtype_idnames(), blender::ed::viewer_path::viewer_path_elem_for_compute_context(), blender::ed::viewer_path::viewer_path_for_geometry_node(), blender::draw::volume_grid_cache_get(), wm_clipboard_text_set_impl(), wm_history_file_new(), wm_history_file_read(), wm_msg_remote_io_gset_key_duplicate(), and wm_save_as_mainfile_get_description().

◆ BLI_strdup_null()

char * BLI_strdup_null ( const char * str)

Duplicates the C-string str into a newly mallocN'd string and returns it.

Parameters
strThe string to be duplicated, can be null
Return values
Returnsthe duplicated string or null if str is null

Definition at line 46 of file string.cc.

References BLI_strdupn(), and str.

Referenced by blender::ed::object::bake_simulation::bake_geometry_nodes_startjob(), blender::copy_data(), blender::nodes::BakeItemsAccessor::copy_item(), blender::nodes::CaptureAttributeItemsAccessor::copy_item(), blender::nodes::ClosureInputItemsAccessor::copy_item(), blender::nodes::ClosureOutputItemsAccessor::copy_item(), blender::nodes::CombineBundleItemsAccessor::copy_item(), blender::nodes::EvaluateClosureInputItemsAccessor::copy_item(), blender::nodes::EvaluateClosureOutputItemsAccessor::copy_item(), blender::nodes::FieldToGridItemsAccessor::copy_item(), blender::nodes::FileOutputItemsAccessor::copy_item(), blender::nodes::ForeachGeometryElementGenerationItemsAccessor::copy_item(), blender::nodes::ForeachGeometryElementInputItemsAccessor::copy_item(), blender::nodes::ForeachGeometryElementMainItemsAccessor::copy_item(), blender::nodes::FormatStringItemsAccessor::copy_item(), blender::nodes::GeoViewerItemsAccessor::copy_item(), blender::nodes::MenuSwitchItemsAccessor::copy_item(), blender::nodes::RepeatItemsAccessor::copy_item(), blender::nodes::SeparateBundleItemsAccessor::copy_item(), blender::nodes::SimulationItemsAccessor::copy_item(), blender::seq::copy_text_effect(), do_version_file_output_node(), geometry_attribute_copy_data(), blender::ed::greasepencil::grease_pencil_layer_parent_set(), blender::nodes::id_property_int_update_enum_items(), IDP_ui_data_copy(), blender::bke::node_interface::item_types::item_copy(), blender::bke::greasepencil::LayerMask::LayerMask(), blender::nodes::node_composite_file_output_cc::node_copy_storage(), blender::bke::node_socket_move_default_value(), blender::bke::node_tree_asset_on_clear_asset(), blender::bke::node_tree_asset_on_mark_asset(), blender::bke::ntree_copy_data(), blender::bke::bake::pack_files_from_directory(), remove_in_and_out_node_panel_recursive(), blender::ed::spreadsheet::spreadsheet_table_id_copy_content_geometry(), blender::bke::greasepencil::TreeNode::TreeNode(), try_parse_enum_item(), and version_copy_socket().

◆ BLI_strdupcat()

char * BLI_strdupcat ( const char *__restrict str1,
const char *__restrict str2 )

Appends the two strings, and returns new mallocN'ed string

Parameters
str1first string for copy
str2second string for append
Return values
Returnsdst

References ATTR_WARN_UNUSED_RESULT, and BLI_strdupcat().

Referenced by BLI_strdupcat(), BLT_lang_locale_explode(), do_versions_after_linking_440(), and replace_bbone_scale_rnapath().

◆ BLI_strdupn()

char * BLI_strdupn ( const char * str,
size_t len )

Duplicates the first len bytes of the C-string str into a newly mallocN'd string and returns it. str is assumed to be at least len bytes long.

Parameters
strThe string to be duplicated
lenThe number of bytes to duplicate
Return values
Returnsthe duplicated string

Definition at line 30 of file string.cc.

References BLI_assert_msg, BLI_strnlen(), len, MEM_malloc_arrayN(), and str.

Referenced by blender::ed::space_node::animation_basepath_change_new(), BKE_fcurve_rnapath_set(), BKE_id_attributes_active_color_set(), BKE_id_attributes_default_color_set(), BKE_nlastrip_validate_fcurves(), BKE_panel_layout_panel_state_ensure(), BLI_file_read_as_lines(), BLI_path_make_safe_filename_ex(), BLI_strdup(), BLI_strdup_null(), block_create__close_file_dialog(), BLT_lang_locale_explode(), console_lb_add__internal(), console_lb_add_str__internal(), blender::animrig::create_fcurve_for_channel(), data_transfer_mesh_attributes_transfer_active_color_string(), data_transfer_mesh_attributes_transfer_default_color_string(), do_versions_after_linking_280(), blender::animrig::tests::ActionFCurveMoveTest::fcurve_create(), blender::bke::greasepencil::convert::AnimDataConvertor::fcurves_convert(), fileentry_uiname(), ibJpegImageFromCinfo(), blender::ed::asset::index::init_indexer_entry_from_value(), blender::bke::greasepencil::LayerMask::LayerMask(), blender::bke::node_interface::make_panel(), blender::bke::node_interface::make_socket(), memiter_words10k_test(), blender::bke::mesh_ensure_default_color_attribute_on_add(), blender::asset_system::utils::normalize_path(), pyop_poll_message_get_fn(), blender::bke::greasepencil::Layer::set_parent_bone_name(), blender::bke::greasepencil::Layer::set_view_layer_name(), blender::ed::asset::shelf::settings_set_active_catalog(), blender::ed::spreadsheet::ViewerDataPath::store(), TEST(), text_autocomplete_build(), text_convert_whitespace_exec(), text_copy_data(), blender::bke::greasepencil::TreeNode::TreeNode(), txt_insert_buf(), UI_but_placeholder_set(), ui_but_string_get_dynamic(), ui_number_from_string_factor(), ui_number_from_string_percentage(), UI_panel_drawname_set(), ui_textedit_begin(), WM_msg_publish_remote_io(), WM_msg_subscribe_remote_io(), and WM_msg_subscribe_rna_params().

◆ BLI_string_all_words_matched()

bool bool BLI_string_all_words_matched ( const char * name,
const char * str,
int(*) words[2],
int words_len )

References ATTR_WARN_UNUSED_RESULT, name, and str.

Referenced by operator_search_update_fn().

◆ BLI_string_elem_split_by_delim()

bool bool int bool BLI_string_elem_split_by_delim ( const char * haystack,
const char delim,
const char * needle )

A version of STR_ELEM(..) that treats haystack as multiple elements split by delim. Return true when needle is found in haystack.

Parameters
haystackThe string to search in.
delimThe delimiter which divides haystack.
needleThe string to search for (must not contain delim or the result will never be true).

The following guarantees are made:

  • Only an exact match returns true, requiring the strings length and case be match.
  • Successive delimiters are supported.
  • An empty needle will match against:
    • A blank string.
    • Delimiters at the beginning or end of the string
    • Two successive delimiters.

References ATTR_WARN_UNUSED_RESULT.

Referenced by BLI_delete_soft(), TEST(), TEST(), and TEST().

◆ BLI_string_find_split_words()

bool bool int BLI_string_find_split_words ( const char * str,
size_t str_maxlen,
char delim,
int r_words[][2],
int words_max )

Find the ranges needed to split str into its individual words.

Parameters
strThe string to search for words.
str_maxlenSize of the string to search (ignored when larger than strlen(str)).
delimCharacter to use as a delimiter.
r_wordsInfo about the words found. Set to [index, len] pairs.
words_maxMax number of words to find
Returns
The number of words found in str

References ATTR_WARN_UNUSED_RESULT, and str.

Referenced by name_matches_dopesheet_filter(), operator_search_update_fn(), and StringFindSplitWords::testStringFindSplitWords().

◆ BLI_string_has_word_prefix()

bool BLI_string_has_word_prefix ( const char * haystack,
const char * needle,
size_t needle_len )

◆ BLI_string_max_possible_word_count()

int bool bool bool size_t size_t size_t int BLI_string_max_possible_word_count ( int str_len)

Definition at line 573 of file string.cc.

Referenced by name_matches_dopesheet_filter(), operator_search_update_fn(), and TEST().

◆ BLI_strn_endswith()

int bool bool bool BLI_strn_endswith ( const char *__restrict str,
const char *__restrict end,
size_t str_len )

◆ BLI_strncasecmp()

int char char int int BLI_strncasecmp ( const char * s1,
const char * s2,
size_t len )

◆ BLI_strncasestr()

int char char * BLI_strncasestr ( const char * s,
const char * find,
size_t len )

Variation of BLI_strcasestr with string length limited to len

References ATTR_WARN_UNUSED_RESULT, and len.

Referenced by name_matches_dopesheet_filter(), and TEST().

◆ BLI_strncat()

char char size_t char * BLI_strncat ( char *__restrict dst,
const char *__restrict src,
size_t dst_maxncpy )

◆ BLI_strncpy()

char * BLI_strncpy ( char *__restrict dst,
const char *__restrict src,
size_t dst_maxncpy )

Like strncpy but ensures dst is always \0 terminated.

Parameters
dstDestination for copy.
srcSource string to copy.
dst_maxncpyMaximum number of characters to copy (generally the size of dst).
Return values
Returnsdst

References ATTR_NONNULL, and BLI_strncpy().

Referenced by absolute_convert_foreach_path_cb(), blender::io::usd::add_input_named_attrib_node(), blender::io::obj::append_frame_to_filename(), AS_asset_full_path_explode_from_weak_ref(), blender::bke::asset_blendfile_path_for_save(), BKE_appdir_folder_documents(), BKE_appdir_font_folder_default(), BKE_blendfile_library_path_explode(), BKE_bpath_foreach_path_fixed_process(), BKE_cachefile_filepath_get(), BKE_id_full_name_get(), BKE_id_new_name_validate(), BKE_image_ensure_tile_token_filename_only(), BKE_image_user_file_path_ex(), BKE_libblock_alloc_in_lib(), BKE_main_global_namemap_get_unique_name(), BKE_main_namemap_get_unique_name(), BKE_movieclip_filepath_for_frame(), BKE_nurb_valid_message(), BKE_path_apply_template(), BKE_ptcache_id_clear(), BKE_scene_multiview_filepath_get(), BKE_scene_multiview_view_filepath_get(), BKE_scene_multiview_view_prefix_get(), BKE_unit_name_to_alt(), BKE_unit_replace_string(), blendfile_library_relocate_id_remap_finalize(), BLI_current_working_dir(), BLI_filelist_entry_mode_to_string(), BLI_filelist_entry_owner_to_string(), BLI_hostname_get(), BLI_path_abs(), BLI_path_contains(), BLI_path_extension_check_glob(), BLI_path_frame_strip(), BLI_path_program_search(), BLI_path_rel(), BLI_path_sequence_decode(), BLI_path_split_dir_file(), BLI_path_split_dir_part(), BLI_path_split_file_part(), BLI_string_replace_table_exact(), BLI_string_split_name_number(), BLI_string_split_prefix(), BLI_string_split_suffix(), BLI_strncpy(), BLI_temp_directory_path_copy_if_valid(), BLI_temp_directory_path_get(), BLI_uniquename_cb(), bpath_list_restore(), bpyunits_to_value(), blender::bke::tests::change_name_global(), blender::io::alembic::create_archive(), create_placeholder(), customdata_external_filename(), do_makepicstring(), blender::seq::edit_strip_swap(), blender::io::usd::export_packed_texture(), file_path_to_ui_path(), file_select_match(), file_sfile_to_operator_ex(), filelist_cache_previews_push(), filelist_file_get_full_path(), find_bhead_from_code_name(), fluid_validatepaths(), folderlist_popdir(), foreach_id_file_path_foreach_callback(), foreach_path_clean_cb(), blender::ed::vse::frame_filename_set(), fsmenu_entry_generate_name(), blender::io::usd::get_absolute_path(), blender::ed::vse::get_drag_path(), get_index_dir(), get_sequence_filepath(), GPU_offscreen_create(), GPU_shader_create_info_check_error(), GPU_shader_get_attribute_info(), GPU_shader_get_ssbo_input_info(), id_name_final_build(), image_abs_path(), imb_exr_pass_name_from_channel(), imb_exr_pass_name_from_channel_name(), imb_exr_split_channel_name(), IMB_metadata_get_field(), lib_id_library_local_paths_callback(), lib_override_library_create_from(), library_copy_data(), Freestyle::Controller::LoadMesh(), missing_files_find__recursive(), missing_files_find_foreach_path_cb(), ml_addlayer_cb(), new_folder_path(), node_group_label(), node_image_label(), blender::nodes::node_fn_bit_math_cc::node_label(), blender::nodes::node_fn_integer_math_cc::node_label(), blender::asset_system::utils::normalize_directory_path(), blender::ui::AbstractTreeView::persistent_state(), blender::ui::AbstractTreeView::persistent_state_apply(), blender::seq::proxy_dir_get(), ptcache_path(), pyrna_py_to_prop(), relative_convert_foreach_path_cb(), relative_rebase_foreach_path_cb(), RNA_parameter_list_create(), RNA_property_string_get_default(), blender::seq::seq_proxy_get_custom_file_filepath(), sequence_guess_offset(), STRNCPY(), test_env_path(), UI_autocomplete_end(), ui_but_string_get_ex(), ui_but_string_set(), ui_but_text_password_hide(), ui_searchbox_apply(), UI_text_clip_multiline_middle(), ui_textedit_string_set(), unpack_generate_paths(), blender::io::usd::USD_path_abs(), where_am_i(), and WM_operator_bl_idname().

◆ BLI_strncpy_ensure_pad()

char char * BLI_strncpy_ensure_pad ( char *__restrict dst,
const char *__restrict src,
char pad,
size_t dst_maxncpy )

Like BLI_strncpy but ensures dst is always padded by given char, on both sides (unless src is empty).

Parameters
dstDestination for copy
srcSource string to copy
padthe char to use for padding
dst_maxncpyMaximum number of characters to copy (generally the size of dst).
Return values
Returnsdst

References ATTR_NONNULL, BLI_strncpy_ensure_pad(), and pad.

Referenced by BLI_strncpy_ensure_pad(), blender::ui::TreeViewBuilder::build_tree_view(), filelist_setfilter_options(), blender::ed::asset::shelf::filter_string_get(), blender::ed::outliner::outliner_filter_tree(), and uiListNameFilter::uiListNameFilter().

◆ BLI_strncpy_rlen()

char char size_t BLI_strncpy_rlen ( char *__restrict dst,
const char *__restrict src,
size_t dst_maxncpy )

Like strncpy but ensures dst is always \0 terminated.

Note
This is a duplicate of BLI_strncpy that returns bytes copied. And is a drop in replacement for snprintf(str, sizeof(str), "s", arg);
Parameters
dstDestination for copy
srcSource string to copy
dst_maxncpyMaximum number of characters to copy (generally the size of dst).
Return values
Thenumber of bytes copied (The only difference from BLI_strncpy).

References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, and BLI_strncpy_rlen().

Referenced by BKE_image_get_tile_label(), BKE_preferences_extension_repo_dirpath_get(), BKE_unit_name_to_alt(), bli_builddir(), BLI_path_append(), BLI_path_join_array(), BLI_path_rel(), BLI_path_to_display_name(), BLI_str_utf8_invalid_substitute_if_needed(), BLI_strncpy_rlen(), event_ids_from_flag(), get_thumb_dir(), ptcache_filepath(), ptcache_filepath_ext_append(), scene_undo_depsgraph_gen_key(), unpack_generate_paths(), WM_operator_bl_idname(), and WM_operator_py_idname().

◆ BLI_strnlen()

◆ BLI_tolower_ascii()

char BLI_tolower_ascii ( const char c)

Definition at line 946 of file string.cc.

Referenced by BLI_str_tolower_ascii().

◆ BLI_toupper_ascii()

char BLI_toupper_ascii ( const char c)

◆ BLI_vsnprintf()

size_t BLI_vsnprintf ( char *__restrict dst,
size_t dst_maxncpy,
const char *__restrict format,
va_list arg )

Portable replacement for vsnprintf.

References ATTR_PRINTF_FORMAT, and BLI_vsnprintf().

Referenced by BLI_vsnprintf().

◆ BLI_vsnprintf_rlen()

size_t size_t BLI_vsnprintf_rlen ( char *__restrict dst,
size_t dst_maxncpy,
const char *__restrict format,
va_list arg )

A version of BLI_vsnprintf that returns strlen(dst)

References ATTR_PRINTF_FORMAT, and BLI_vsnprintf_rlen().

Referenced by BLI_vsnprintf_rlen().

◆ BLI_vsprintfN()

char char * BLI_vsprintfN ( const char *__restrict format,
va_list args )

A version of BLI_sprintfN that takes a #va_list.

References ATTR_MALLOC, ATTR_NONNULL, and BLI_vsprintfN().

Referenced by BKE_reportf(), BKE_reports_prependf(), BLI_vsprintfN(), and WM_global_reportf().

◆ BLI_vsprintfN_with_buffer()

char * BLI_vsprintfN_with_buffer ( char * fixed_buf,
size_t fixed_buf_size,
size_t * result_len,
const char *__restrict format,
va_list args )

◆ STRNCPY()

template<size_t N>
char * STRNCPY ( char(&) dst[N],
const char * src )
inline

Copy source string str into the destination dst of a size known at a compile time. Ensures that the destination is not overflown, and that the destination is always null-terminated.

Returns the dst.

Definition at line 693 of file BLI_string.h.

References BLI_strncpy(), and N.

Referenced by ABC_export(), absolute_convert_foreach_path_cb(), add_bevel_modifier_attribute_name_defaults(), blender::io::usd::USDGeomReader::add_cache_modifier(), blender::ed::vse::add_catalog_assets_menu_type(), add_ibuf_for_tile(), blender::seq::add_image_load_file(), blender::seq::add_image_set_directory(), blender::seq::add_image_strip(), blender::seq::add_load_data_init(), blender::seq::add_movie_strip(), add_object_path(), blender::compositor::FileOutput::add_pass(), blender::ed::vse::add_scene_menu_type(), blender::ed::vse::add_unassigned_assets_menu_type(), blender::io::alembic::AbcObjectReader::addCacheModifier(), ANIM_armature_bonecoll_active_index_set(), ANIM_armature_bonecoll_active_set(), ANIM_armature_bonecoll_name_set(), arg_handle_debug_gpu_scope_capture_set(), arg_handle_output_set(), arg_handle_python_file_run(), blender::bke::asset_root_path_for_save(), asset_shelf_settings_new(), blender::bke::asset_weak_reference_for_user_library(), attr_input_name(), blender::ed::object::bake_simulation::bake_simulation_get_path_users(), BKE_addon_ensure(), BKE_appdir_font_folder_default(), BKE_appdir_program_path_init(), BKE_blender_globals_init(), BKE_blender_user_menu_ensure(), BKE_blendfile_append(), BKE_bpath_foreach_path_allocated_process(), BKE_bpath_foreach_path_dirfile_fixed_process(), BKE_bpath_foreach_path_fixed_process(), BKE_cachefile_add_layer(), BKE_cachefile_eval(), BKE_collection_exporter_add(), BKE_collection_exporter_name_set(), BKE_cryptomatte_matte_id_to_entries(), BKE_fluid_modifier_copy(), BKE_fmodifier_name_set(), BKE_id_new_name_validate(), BKE_image_load_exists_in_lib(), BKE_image_load_in_lib(), BKE_image_packfiles(), BKE_image_packfiles_from_mem(), BKE_image_render_write(), BKE_image_save_options_init(), BKE_image_signal(), BKE_keyblock_copy_settings(), BKE_keyconfig_pref_ensure(), BKE_keyingset_add_path(), BKE_lib_override_library_update(), BKE_libblock_copy_in_lib(), BKE_library_filepath_set(), BKE_main_library_weak_reference_add(), BKE_main_library_weak_reference_find(), BKE_memfile_undo_decode(), BKE_memfile_undo_encode(), BKE_movieclip_file_add(), BKE_movieclip_file_add_exists_ex(), BKE_packedfile_compare_to_file(), BKE_packedfile_new(), BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_to_file(), BKE_packedfile_unpack_vfont(), BKE_packedfile_unpack_volume(), BKE_packedfile_write_to_file(), BKE_preferences_asset_library_add(), BKE_preferences_asset_library_path_set(), BKE_preferences_extension_repo_add(), BKE_preferences_extension_repo_add_default_remote(), BKE_preferences_extension_repo_custom_dirpath_set(), BKE_preferences_extension_repo_module_set(), BKE_ptcache_disk_cache_rename(), BKE_ptcache_load_external(), BKE_ptcache_update_info(), BKE_scene_multiview_view_filepath_get(), BKE_sim_debug_data_add_element(), BKE_sound_new_file(), BKE_sound_new_file_exists_ex(), BKE_studiolight_create(), BKE_studiolight_init(), BKE_tempdir_init(), BKE_text_file_modified_check(), BKE_text_file_modified_ignore(), BKE_text_load_ex(), BKE_text_reload(), BKE_undosys_step_push_init_with_type(), BKE_undosys_step_push_with_type(), BKE_vfont_load(), BKE_vfont_load_exists_ex(), BKE_vfontdata_from_freetypefont(), BKE_view_layer_rename(), BKE_volume_load(), BKE_volume_new_for_eval(), BKE_volume_set_velocity_grid_by_name(), Freestyle::BlenderStrokeRenderer::BlenderStrokeRenderer(), bli_builddir(), BLI_path_abs(), BLI_path_abs_from_cwd(), BLI_path_contains(), BLI_path_program_search(), BLI_path_rel(), blo_add_main_for_library(), BLO_blendhandle_get_datablock_info(), blo_do_versions_270(), blo_do_versions_280(), blo_do_versions_290(), blo_do_versions_pre250(), blo_do_versions_userdef(), blo_filedata_from_file(), blo_find_main_for_library_and_idname(), BLO_library_temp_load_id(), blo_read_file_internal(), BLO_read_from_memfile(), blo_update_defaults_screen(), BLO_update_defaults_workspace(), BLO_write_file_impl(), BLO_Write_IDBuffer::BLO_Write_IDBuffer(), BMO_op_vinitf(), bookmark_select_exec(), bpy_lib_enter(), bpy_lib_load(), bpy_lib_write(), bpy_rna_data_context_enter(), bpy_rna_data_temp_data(), blender::nodes::decl::String::build(), build_pict_list_from_image_sequence(), cache_file_init_data(), blender::io::hydra::cache_image_file(), cachefile_open_exec(), can_create_dir_from_user_input(), cdf_layer_add(), blender::seq::check_sound_media_missing(), cmp_node_image_add_pass_output(), collection_exporter_copy(), colormanage_load_config(), blender::io::obj::OBJExportRegressionTest::compare_obj_export_to_golden(), blender::io::stl::STLExportTest::compare_to_golden(), blender::nodes::node_composite_file_output_cc::compute_image_path(), blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2(), blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_generic(), copy_image_packedfiles(), blender::io::fbx::create_placeholder_image(), blender::io::obj::create_placeholder_image(), blender::io::usd::create_temp_path_for_usdz_export(), blender::bke::tests::ArmatureDeformTestBase::create_test_armature_object(), blender::bke::tests::ArmatureDeformTestBase::create_test_mesh(), curve_calc_modifiers_post(), CustomData_external_add(), blender::io::obj::default_export_params(), blender::io::obj::default_import_params(), detect_clip_source(), direct_link_library(), blender::bke::direct_link_node_socket_default_value(), do_version_file_output_node(), do_version_keyframe_jump(), do_version_map_value_node(), do_version_material_remove_use_nodes(), do_version_node_curve_to_mesh_scale_input(), do_version_world_remove_use_nodes(), do_versions(), do_versions_nodetree_customnodes(), do_versions_nodetree_multi_file_output_format_2_62_1(), do_write_image_or_movie(), blender::eevee::Instance::draw(), blender::nodes::draw_common_bake_settings(), blender::workbench::Instance::draw_viewport(), drivers_path_rename_fix(), dynamicPaint_Modifier_copy(), dynamicPaint_outputSurfaceImage(), ED_armature_bone_rename(), ED_file_change_dir_ex(), ED_fileselect_ensure_default_filepath(), ED_fsmenu_entry_set_name(), ED_image_filesel_detect_sequences(), blender::seq::edit_strip_swap(), blender::seq::effect_text_font_load(), blender::nodes::GeoNodeExecParams::ensure_absolute_path(), eval_template(), blender::io::stl::export_frame(), blender::io::usd::export_in_memory_texture(), blender::io::usd::export_packed_texture(), file_browse_exec(), file_browse_invoke(), file_directory_enter_handle(), file_directory_new_exec(), file_draw_string(), file_expand_directory(), file_filename_enter_handle(), blender::bke::tests::file_handler_add_test(), file_handler_import_operator_write_ptr(), file_path_to_ui_path(), file_rename_state_activate(), file_select_do(), file_sfile_filepath_set(), filelist_readjob_all_asset_library(), filelist_readjob_recursive_dir_add_items(), filelist_readjob_start_ex(), filelist_setdir(), fileselect_ensure_updated_file_params(), fileselect_file_set(), fileselect_initialize_params_common(), fileselect_refresh_asset_params(), fillCineonMainHeader(), fillDpxMainHeader(), fix_relpaths_library(), blender::gpu::FrameBuffer::FrameBuffer(), FRS_copy_active_lineset(), FRS_paste_active_lineset(), fsmenu_insert_entry(), fsmenu_read_bookmarks(), blender::io::usd::gather_objects_paths(), blender::gpu::shader::GPUCodegen::generate_attribs(), blender::bke::FileHandlerType::get_default_filename(), blender::io::obj::get_image_filepath(), blender::io::usd::get_in_memory_texture_filename(), blender::bke::bake::get_modifier_bake_path(), blender::bke::bake::get_node_bake_path(), get_path_system_ex(), get_path_user_ex(), get_proxy_filepath(), blender::io::usd::get_relative_path(), get_udim_tiles(), Freestyle::StringUtils::getPathName(), Freestyle::BlenderStrokeRenderer::GetStrokeShader(), gpu_node_graph_add_attribute(), gpu_node_graph_add_layer_attribute(), gpu_node_graph_add_uniform_attribute(), groupname_to_code(), handle_load_file(), idp_generic_copy(), image_add_view(), image_file_browse_invoke(), image_foreach_path(), image_memorypack_imbuf(), image_open_single(), image_replace_exec(), image_save_post(), image_save_update_filepath(), image_sequence_get_frame_ranges(), image_update_views_format(), IMB_colormanagement_space_to_icc_profile(), IMB_colormanagement_working_space_check(), IMB_colormanagement_working_space_convert(), IMB_colormanagement_working_space_init_default(), imb_colormanagement_working_space_set_from_matrix(), IMB_colormanagement_working_space_set_from_name(), imb_exr_multilayer_parse_channels_from_file(), IMB_load_image_from_filepath(), IMB_moviecache_create(), imbuf_load_impl(), blender::io::usd::import_asset(), import_file(), blender::io::ply::import_mesh(), blender::io::usd::import_startjob(), blender::io::ply::importer_main(), blender::io::stl::importer_main(), init(), init_data(), blender::deg::VolumeBackup::init_from_volume(), initLaplacianSystem(), blender::animrig::keyingset_info_register(), keymap_update_brushes_handle_add_item(), keymap_update_brushes_handle_remove_item(), blender::bke::greasepencil::convert::legacy_object_modifier_build(), blender::bke::greasepencil::convert::legacy_object_modifier_dash(), blender::bke::greasepencil::convert::legacy_object_modifier_hook(), blender::bke::greasepencil::convert::legacy_object_modifier_time(), blender::bke::greasepencil::convert::legacy_object_modifier_weight_angle(), blender::bke::greasepencil::convert::legacy_object_modifier_weight_proximity(), library_link_end(), LibWeakRefKey::LibWeakRefKey(), blender::bke::greasepencil::convert::lineart_unwrap_v3(), blender::bke::greasepencil::convert::lineart_wrap_v3(), blender::ed::vse::load_data_init_from_operator(), load_image_single(), main(), blender::ed::outliner::merged_element_search_fn_recursive(), blender::bke::mesh_calc_finalize(), mesh_new_from_mesh(), meshcache_do(), ml_addpass_cb(), blender::ed::object::mode_set_ex(), modify_geometry_set(), modify_mesh(), MOV_decode_frame(), MOV_open_file(), MOV_set_custom_proxy_dir(), MOV_set_multiview_suffix(), movie_index_open(), movieclip_open_anim_file(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), blender::io::obj::MTLWriter::MTLWriter(), blender::ed::outliner::namebutton_fn(), blender::ed::space_node::node_add_import_node_exec(), blender::nodes::node_geo_import_csv::node_geo_exec(), blender::nodes::node_geo_import_obj::node_geo_exec(), blender::nodes::node_geo_import_stl::node_geo_exec(), blender::nodes::nodes_geo_import_ply::node_geo_exec(), blender::ed::space_node::node_group_make_from_node_declaration(), blender::nodes::node_composite_file_output_cc::node_init(), node_reroute_init(), blender::bke::node_type_socket_templates(), object_copy_data(), open_invoke(), open_invoke(), blender::panel_register(), blender::io::obj::OBJParser::parse(), paste_material_exec(), blender::io::path_reference(), pose_paste_exec(), blender::io::usd::process_usdz_textures(), ptcache_frame_from_filename(), radial_control_update_header(), RE_bake_engine(), RE_create_gp_pass(), RE_engine_render(), RE_engine_update_stats(), RE_SetActiveRenderView(), blender::io::grease_pencil::SVGImporter::read(), read_file_version_and_colorspace(), read_global(), read_library_file_data(), blender::io::usd::USDVolumeReader::read_object_data(), blender::io::usd::USDXformReader::read_object_data(), blender::asset_system::AssetLibrary::refresh_catalog_simplename(), relative_convert_foreach_path_cb(), renamebutton_cb(), render_layer_add_pass(), render_result_exr_file_cache_path(), render_result_from_bake(), replace_if_different(), RNA_struct_state_owner_set(), save_image_op(), save_set_filepath(), scene_copy_data(), scene_init_data(), screenshot_invoke(), blender::seq::seq_proxy_get_filepath(), blender::ed::vse::sequencer_add_image_strip_exec(), blender::ed::vse::sequencer_add_movie_multiple_strips(), blender::ed::vse::sequencer_add_sound_multiple_strips(), blender::ed::vse::sequencer_change_path_exec(), blender::ed::vse::sequencer_generic_invoke_path__internal(), blender::ed::vse::sequencer_image_strip_reserve_frames(), blender::io::usd::set_job_filepath(), setError(), blender::animrig::tests::ArmatureBoneCollections::SetUp(), blender::animrig::tests::ArmatureBoneCollectionsLiboverrides::SetUp(), blender::animrig::tests::ArmatureBoneCollectionsTestList::SetUp(), blender::animrig::tests::KeyframingTest::SetUp(), blender::animrig::tests::PoseTest::SetUp(), blender::bke::tests::BKE_armature_find_selected_bones_test::SetUp(), blender::bke::tests::BPathTest::SetUp(), blender::io::alembic::AlembicExportTest::SetUp(), blender::ed::asset::list::AssetList::setup(), setup_app_data(), blender::io::alembic::AbcObjectReader::setupObjectTransform(), blender::gpu::Shader::Shader(), space_text_update_drawcache(), split_main_newid(), blender::gpu::StorageBuf::StorageBuf(), blender::seq::strip_unique_name_set(), studiolight_add_file(), surface_setUniqueOutputName(), blender::bke::id::tests::TEST(), blender::bke::id::tests::TEST(), blender::bke::id::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::io::obj::TEST(), TEST(), TEST(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::io::ply::TEST_F(), blender::bke::tests::test_render_pass_conflict(), text_jump_to_file_at_point_exec(), text_jump_to_file_at_point_internal(), text_open_invoke(), text_save_as_invoke(), blender::gpu::Texture::Texture(), texture_paint_image_from_view_exec(), tracks_map_new(), transformcache_copy(), transformcache_evaluate(), txt_write_file(), ubuf_from_image_no_tiles(), UI_list_filter_and_sort_items(), ui_text_clip_middle(), UI_text_clip_middle_ex(), ui_text_clip_middle_protect_right(), ui_text_clip_right_label(), ui_tooltip_from_vfont(), uiStyleInit(), uiTemplateComponentMenu(), undoarm_from_editarm(), undosys_id_ref_store(), blender::gpu::UniformBuf::UniformBuf(), unique_name(), unpack_generate_paths(), blender::bke::bake::unpack_geometry_nodes_bake(), uri_from_filepath(), blender::io::usd::USD_import(), blender::nodes::FileOutputItemsAccessor::validate_name(), version_node_add_empty(), version_node_id(), versioning_eevee_material_shadow_none(), vfont_init_data(), volume_copy_data(), blender::ed::object::volume_import_exec(), volume_init_data(), weightvg_do_mask(), widget_draw_text(), WM_dropbox_add(), wm_file_write(), wm_gizmogroup_tweak_modal_keymap(), wm_homefile_read_ex(), wm_id_linked_relocate_exec(), WM_init(), WM_init_state_app_template_set(), WM_jobs_get(), WM_keyconfig_remove(), WM_keyconfig_set_active(), WM_keymap_add_item(), WM_keymap_item_restore_to_default(), wm_keymap_new(), wm_lib_relocate_exec_do(), wm_link_append_exec(), wm_main_playanim_intern(), WM_modalkeymap_add_item_str(), wm_open_mainfile_get_description(), WM_operator_last_properties_store(), WM_operatortype_macro_define(), wm_revert_mainfile_exec(), wm_save_as_mainfile_exec(), wm_search_menu_invoke(), wm_set_working_color_space_exec(), WM_window_cursor_keymap_status_refresh(), WM_xr_active_action_set_set(), wm_xr_session_controller_data_populate(), wm_xr_session_event_create(), workspace_layout_name_set(), write_crash_blend(), write_global(), blender::io::obj::write_materials(), and write_renderinfo().

Variable Documentation

◆ ATTR_MALLOC

char ATTR_MALLOC

Definition at line 79 of file BLI_string.h.