Blender V5.0
BLI_string_utf8.h File Reference
#include <stdarg.h>
#include "BLI_compiler_attrs.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Macros

#define BLI_UTF8_MAX   6
#define BLI_UTF8_WIDTH_MAX   2 /* columns */
#define BLI_UTF8_ERR   ((unsigned int)-1)
String Copy/Format Macros

Avoid repeating destination with sizeof(..).

Note
ARRAY_SIZE allows pointers on some platforms.
#define STRNCPY_UTF8(dst, src)
#define STRNCPY_UTF8_RLEN(dst, src)
#define STRNLEN_UTF8(str)
#define SNPRINTF_UTF8(dst, format, ...)
#define SNPRINTF_UTF8_RLEN(dst, format, ...)
#define VSNPRINTF_UTF8(dst, format, args)
#define VSNPRINTF_UTF8_RLEN(dst, format, args)

Functions

char * BLI_strncpy_utf8 (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char size_t BLI_strncpy_utf8_rlen (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char size_t size_t BLI_strncpy_utf8_rlen_unterminated (char *__restrict dst, const char *__restrict src, size_t dst_maxncpy)
ptrdiff_t BLI_str_utf8_invalid_byte (const char *str, size_t str_len) ATTR_NONNULL(1)
int BLI_str_utf8_invalid_strip (char *str, size_t str_len) ATTR_NONNULL(1)
int BLI_str_utf8_invalid_substitute (char *str, size_t str_len, const char substitute) ATTR_NONNULL(1)
const char * BLI_str_utf8_invalid_substitute_if_needed (const char *str, size_t str_len, const char substitute, char *buf, const size_t buf_maxncpy) ATTR_NONNULL(1
const char int BLI_str_utf8_size_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_size_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int BLI_str_utf8_as_unicode_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int BLI_str_utf8_as_unicode_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int BLI_str_utf8_as_unicode_step_safe (const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
unsigned int unsigned int BLI_str_utf8_as_unicode_step_or_error (const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
unsigned int unsigned int size_t BLI_str_utf8_from_unicode_len (unsigned int c) ATTR_WARN_UNUSED_RESULT
size_t BLI_str_utf8_from_unicode (unsigned int c, char *dst, size_t dst_maxncpy) ATTR_NONNULL(2)
size_t BLI_str_utf8_as_utf32 (char32_t *__restrict dst_w, const char *__restrict src_c, size_t dst_w_maxncpy) ATTR_NONNULL(1
size_t size_t BLI_str_utf32_as_utf8 (char *__restrict dst, const char32_t *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t size_t size_t BLI_str_utf32_as_utf8_len_ex (const char32_t *src, size_t src_maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_str_utf32_as_utf8_len (const char32_t *src) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
const char * BLI_str_find_prev_char_utf8 (const char *p, const char *str_start) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
const char const char * BLI_str_find_next_char_utf8 (const char *p, const char *str_end) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
const char const char size_t BLI_wstrlen_utf8 (const wchar_t *src) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
size_t BLI_strlen_utf8_ex (const char *strc, size_t *r_len_bytes) ATTR_NONNULL(1
size_t BLI_strlen_utf8 (const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
size_t BLI_strnlen_utf8_ex (const char *strc, size_t strc_maxlen, size_t *r_len_bytes) ATTR_NONNULL(1
size_t size_t BLI_strnlen_utf8 (const char *strc, size_t strc_maxlen) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
size_t BLI_strncpy_wchar_as_utf8 (char *__restrict dst, const wchar_t *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t size_t BLI_strncpy_wchar_from_utf8 (wchar_t *__restrict dst_w, const char *__restrict src_c, size_t dst_w_maxncpy) ATTR_NONNULL(1
size_t size_t size_t BLI_snprintf_utf8 (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t size_t size_t ATTR_PRINTF_FORMAT (3, 4)
size_t BLI_snprintf_utf8_rlen (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t BLI_vsnprintf_utf8 (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3
size_t size_t BLI_vsnprintf_utf8_rlen (char *__restrict dst, size_t dst_maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3
size_t size_t int BLI_wcwidth_or_error (char32_t ucs) ATTR_WARN_UNUSED_RESULT
int BLI_wcwidth_safe (char32_t ucs) ATTR_WARN_UNUSED_RESULT
int BLI_wcswidth_or_error (const char32_t *pwcs, size_t n) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char32_t BLI_str_utf32_char_to_upper (char32_t wc)
char32_t BLI_str_utf32_char_to_lower (char32_t wc)
bool BLI_str_utf32_char_is_breaking_space (char32_t codepoint)
bool BLI_str_utf32_char_is_optional_break_after (char32_t codepoint, char32_t codepoint_prev)
bool BLI_str_utf32_char_is_optional_break_before (char32_t codepoint, char32_t codepoint_prev)
int BLI_str_utf8_char_width_or_error (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_char_width_safe (const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_str_partition_utf8 (const char *str, const unsigned int delim[], const char **r_sep, const char **r_suf) ATTR_NONNULL(1
size_t size_t BLI_str_rpartition_utf8 (const char *str, const unsigned int delim[], const char **r_sep, const char **r_suf) ATTR_NONNULL(1
size_t size_t size_t BLI_str_partition_ex_utf8 (const char *str, const char *end, const unsigned int delim[], const char **r_sep, const char **r_suf, bool from_right) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t size_t size_t bool BLI_str_utf8_truncate_at_size (char *str, const size_t str_size)
int BLI_str_utf8_offset_to_index (const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_from_index (const char *str, size_t str_len, int index_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_to_column (const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_from_column (const char *str, size_t str_len, int column_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_to_column_with_tabs (const char *str, size_t str_len, int offset_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_offset_from_column_with_tabs (const char *str, size_t str_len, int column_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_str_utf8_column_count (const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)

Variables

size_t ATTR_WARN_UNUSED_RESULT

Macro Definition Documentation

◆ BLI_UTF8_ERR

◆ BLI_UTF8_MAX

#define BLI_UTF8_MAX   6

◆ BLI_UTF8_WIDTH_MAX

#define BLI_UTF8_WIDTH_MAX   2 /* columns */

Definition at line 323 of file BLI_string_utf8.h.

Referenced by textview_wrap_offsets().

◆ SNPRINTF_UTF8

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

Definition at line 337 of file BLI_string_utf8.h.

Referenced by action_flip_pchan(), blender::ed::object::add_hook_object(), blender::ed::transform::apply_shear(), blender::ed::transform::apply_value_impl(), blender::ed::transform::applyBakeTime(), blender::ed::transform::applyBoneEnvelope(), blender::ed::transform::applyBoneRoll(), blender::ed::transform::applyCurveShrinkFatten(), blender::ed::transform::applyGPOpacity(), blender::ed::transform::applyMaskShrinkFatten(), blender::ed::transform::applyMirror(), blender::ed::transform::applyPushPull(), blender::ed::transform::applyTilt(), blender::ed::transform::applyToSphere(), blender::ed::object::bake_targets_output_external(), blender::ed::transform::Bend(), BKE_freestyle_lineset_add(), BKE_image_add_renderslot(), BKE_keyblock_add(), blender_version_init(), BLI_uniquename_cb(), blo_do_versions_280(), blo_do_versions_pre250(), block_create__close_file_dialog(), block_create_save_file_overwrite_dialog(), boid_new_state(), BPY_driver_exec(), BPY_modules_load_user(), blender::seq::channels_ensure(), copy_particle_systems_to_object(), create_title_button(), curve_rename_fcurves(), customdata_version_242(), datadropper_id_sample_pt(), do_version_layers_to_collections(), do_versions_after_linking_280(), do_versions_nodetree_multi_file_output_format_2_62_1(), draw_grid_unit_name(), draw_marker_texts(), draw_selected_name(), blender::ed::vse::draw_seq_text_get_overlay_string(), blender::ed::vse::draw_strip_in_view(), draw_text_main(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_update_header(), ED_image_draw_info(), ed_marker_add_exec(), ed_marker_camera_bind_exec(), ed_marker_move_update_header(), ED_region_cache_draw_curfra_label(), ED_scene_draw_fps(), edbm_bevel_update_status_text(), edbm_inset_update_header(), blender::io::grease_pencil::SVGExporter::export_grease_pencil_objects(), file_draw_tooltip_custom_func(), filelist_get_details_column_string(), fmodifier_panel_register(), fmodifier_subpanel_register(), generator_panel_draw(), get_default_collection_name(), getname_anim_fcurve(), graph_draw_driver_settings_panel(), icon_draw_rect_input(), blender::animrig::id_action_ensure(), IMB_thumb_load_image(), knifetool_draw_angle(), knifetool_draw_visible_distances(), loopcut_init(), loopcut_modal(), make_renderinfo_string(), menu_items_from_all_operators(), blender::draw::mesh_extract_uv_format_init(), meshdeform_matrix_solve(), metadata_custom_draw_fields(), minimize_stretch_iteration(), modifier_subpanel_register(), MOV_decode_preview_frame(), blender::ed::object::multires_external_save_invoke(), blender::ed::space_node::node_buts_image_user(), blender::bke::node_remove_node(), blender::bke::node_replace_undefined_types(), ntreeCompositCryptomatteAddSocket(), blender::draw::particle_batch_cache_ensure_pos_and_seg(), pyrna_prop_str(), pyrna_py_to_prop(), sample_color_update_header(), scene_ensure_depsgraph_p(), screen_state_to_nonnormal(), screen_user_menu_draw(), separate_slots_exec(), blender::ed::transform::setNearestAxis3d(), blender::ed::transform::setUserConstraint(), shaderfx_subpanel_register(), blender::ed::object::skin_armature_bone_create(), slider_draw(), blender::ed::vse::slip_update_header(), slot_channels_move_to_new_action_exec(), stampdata(), stampdata_from_template(), stats_row(), template_texture_user_menu(), text_info_row(), thumb_create_ex(), tracking_dopesheet_channels_calc(), ui_block_colorpicker(), ui_but_user_menu_add(), ui_def_but_rna__menu_type(), ui_draw_but_WAVEFORM(), ui_imageuser_slot_menu(), UI_pie_menu_begin(), ui_popup_context_menu_for_panel(), UI_popup_menu_reports(), ui_template_list_layout_draw(), ui_tooltip_data_from_tool(), uiblock_layer_pass_buttons(), uiDefAutoButR(), uiTemplateImageInfo(), uiTemplateMovieclipInformation(), uiTemplatePreview(), uiTemplateRecentFiles_tooltip_func(), uiTemplateRunningJobs(), unpack_menu(), version_bonelayers_to_bonecollections(), version_liboverride_rnacollections_insertion_object(), blender::ed::object::vgroup_duplicate(), wm_cursor_number_impl(), wm_filepath_default(), and WM_toolsystem_ref_sync_from_context().

◆ SNPRINTF_UTF8_RLEN

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

Definition at line 339 of file BLI_string_utf8.h.

Referenced by blender::ed::vse::add_vertical_line(), blender::ed::vse::draw_handle_transform_text(), blender::ed::vse::draw_waveform_graticule(), Matrix_str(), metadata_draw_imbuf(), nla_draw_strip_frames_text(), template_ID(), and ui_update_color_picker_buts_rgba().

◆ STRNCPY_UTF8

#define STRNCPY_UTF8 ( dst,
src )
Value:
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1

Definition at line 332 of file BLI_string_utf8.h.

Referenced by action_buttons_register(), action_flip_pchan_rna_paths(), action_groups_add_new(), add_driver_with_target(), blender::ed::object::add_hook_object(), add_ibuf_for_tile(), blender::io::fbx::add_image_texture(), blender::seq::add_movie_strip(), add_new_constraint_internal(), blender::ed::space_node::add_node_group_asset(), blender::ed::space_node::add_root_catalogs_menu_type(), blender::compositor::FileOutput::add_view(), blender::compositor::FileOutput::add_view(), blender::ed::transform::addMatrixSpace(), ANIM_armature_bonecoll_name_set(), ANIM_bonecoll_new(), ANIM_channel_debug_print_info(), ANIM_copy_as_driver(), arg_handle_engine_set(), armature_autoside_names_exec(), armature_extrude_exec(), asset_metadata_tag_add(), BKE_animdata_merge_copy(), BKE_blendfile_userdef_from_defaults(), BKE_color_managed_colorspace_settings_copy(), BKE_color_managed_colorspace_settings_init(), BKE_color_managed_display_settings_copy(), BKE_color_managed_display_settings_init(), BKE_color_managed_view_settings_copy_keep_curve_mapping(), BKE_color_managed_view_settings_init(), BKE_constraint_targets_flush(), BKE_freestyle_lineset_add(), BKE_gpencil_layer_addnew(), BKE_gpencil_palette_addnew(), BKE_gpencil_palettecolor_addnew(), BKE_grease_pencil_vgroup_name_update(), BKE_id_new_name_validate(), BKE_image_add_generated(), BKE_image_add_renderslot(), BKE_image_add_tile(), BKE_image_format_color_management_copy_from_scene(), BKE_image_format_init_for_write(), BKE_image_format_update_color_space_for_type(), BKE_image_save_options_init(), BKE_keyblock_add(), BKE_keyingset_add(), BKE_mask_layer_copy(), BKE_mask_layer_new(), BKE_mask_layer_rename(), BKE_mask_new(), BKE_modifier_copy_ex(), BKE_nla_action_stash(), BKE_nlastack_add_strip(), BKE_nlastrip_validate_name(), BKE_nlatrack_insert_before(), BKE_object_calc_parent(), BKE_object_copy_modifier(), BKE_object_defgroup_set_name(), BKE_panel_new(), BKE_pose_add_group(), BKE_pose_channel_ensure(), BKE_preferences_asset_library_name_set(), BKE_preferences_extension_repo_name_set(), BKE_render_result_stamp_data(), BKE_scene_add_render_view(), BKE_scene_disable_color_management(), BKE_shaderfx_new(), BKE_tracking_object_add(), BKE_tracking_plane_track_add(), BKE_tracking_reconstruction_context_new(), BKE_tracking_reconstruction_report_error_message(), BKE_tracking_track_add_empty(), BKE_view_layer_add(), BKE_view_layer_add_aov(), BKE_view_layer_add_lightgroup(), BKE_view_layer_rename(), BKE_view_layer_rename_lightgroup(), blo_do_versions_250(), blo_do_versions_260(), blo_do_versions_270(), blo_do_versions_280(), blo_do_versions_290(), blo_do_versions_300(), blo_do_versions_430(), blo_do_versions_440(), blo_do_versions_pre250(), blo_do_versions_userdef(), blo_update_defaults_scene(), BLO_update_defaults_startup_blend(), boid_new_rule(), boid_new_state(), blender::ui::bonedropper_sample_pt(), blender::ed::sculpt_paint::brush_asset_save_as_exec(), buttons_context_register(), blender::ed::transform::calculatePropRatio(), blender::ed::space_node::catalog_assets_menu_type(), blender::ed::asset::shelf::catalog_selector_panel_register(), change_input_socket_to_rotation_type(), change_node_socket_name(), blender::animrig::Channelbag::channel_group_create(), cmp_node_image_add_pass_output(), collection_add(), blender::ed::object::collection_exporter_register(), colormanage_check_display_settings(), colormanage_check_view_settings(), blender::ed::space_node::connect_nodes_to_aovs(), blender::ed::object::constraint_apply_exec(), constraint_bone_name_fix(), blender::ed::object::constraint_copy_exec(), blender::ed::object::constraint_delete_exec(), convert_grease_pencil_stroke_hardness_to_softness(), blender::animrig::convert_to_layered_action(), copy_lineset(), blender::bke::create_auto_smooth_modifier(), blender::ed::asset::shelf::create_shelf_from_type(), CustomData_set_layer_unique_name(), customdata_version_242(), depthdropper_depth_sample_pt(), blender::nodes::do_forward_compat_versioning(), do_version_convert_to_generic_nodes(), do_version_workspaces_after_lib_link(), do_versions_after_linking_300(), do_versions_after_linking_500(), do_versions_compositor_render_passes_storage(), do_versions_node_group_add_socket_2_56_2(), do_versions_nodetree_customnodes(), do_versions_nodetree_file_output_layers_2_64_5(), do_versions_nodetree_multi_file_output_format_2_62_1(), do_versions_nodetree_multi_file_output_path_2_63_1(), do_versions_point_attribute_names(), do_versions_point_attributes(), blender::nodes::draw_data_blocks(), blender::nodes::draw_geometry_nodes_modifier_ui(), blender::nodes::draw_geometry_nodes_operator_redo_ui(), blender::nodes::socket_items::ui::draw_items_list_with_operators(), draw_marker_texts(), draw_movieclip_notes(), driver_add_new_variable(), duplicateEditBoneObjects(), dynamicPaint_bakeImageSequence(), dynamicPaintSurface_setUniqueName(), ED_armature_bone_rename(), ED_armature_bones_flip_names(), ED_armature_ebone_add(), ED_armature_from_edit(), ED_armature_join_objects_exec(), ED_buttons_search_string_set(), ED_clip_buttons_register(), ED_gpencil_anim_copybuf_copy(), ED_image_draw_info(), ED_info_draw_stats(), ed_marker_duplicate_apply(), ED_node_set_tree_type(), ED_node_shader_default(), ED_node_tree_push(), ED_node_tree_start(), ed_panel_draw(), ED_scene_view_layer_delete(), ED_screen_user_menu_item_add_menu(), ED_screen_user_menu_item_add_operator(), ED_screen_user_menu_item_add_prop(), ED_screen_user_menu_register(), ED_slider_status_string_get(), ED_slider_unit_set(), ED_spacetype_action(), ED_spacetype_buttons(), ED_spacetype_clip(), ED_spacetype_console(), ED_spacetype_file(), ED_spacetype_image(), ED_spacetype_info(), ED_spacetype_ipo(), ED_spacetype_nla(), ED_spacetype_node(), ED_spacetype_outliner(), ED_spacetype_script(), blender::ed::vse::ED_spacetype_sequencer(), ED_spacetype_statusbar(), ED_spacetype_text(), ED_spacetype_topbar(), ED_spacetype_userpref(), ED_spacetype_view3d(), ED_uvedit_buttons_register(), blender::animrig::tests::KeyframingTest::ensure_action_is_legacy(), blender::seq::ensure_unique_name(), fcurves_path_rename_fix(), file_execute_region_panels_register(), file_external_operations_menu_register(), file_tool_props_region_panels_register(), file_tools_region_panels_register(), filelist_get_details_column_string(), filelist_setfilter_options(), fileselect_ensure_updated_file_params(), fluid_bake_sequence(), fmodifier_panel_register(), fmodifier_subpanel_register(), generator_panel_draw(), graph_buttons_register(), graph_panel_properties(), blender::ed::asset::shelf::header_regiontype_register(), hud_panels_register(), idprops_ensure_named_group(), image_add_view(), image_buttons_register(), image_colorspace_from_imbuf(), image_init_multilayer_multiview(), image_node_colorspace(), IMB_colormanagement_check_file_config(), IMB_colormanagement_colorspace_from_ibuf_ftype(), IMB_colormanagement_init_untonemapped_view_settings(), IMB_colormanagement_validate_settings(), imb_exr_set_known_colorspace(), imb_handle_colorspace_and_alpha(), blender::io::fbx::import_blend_shape_full_weights(), blender::nodes::node_composite_planetrackdeform_cc::init(), blender::nodes::node_composite_trackpos_cc::init(), blender::init_data(), blender::ed::asset::index::init_indexer_entry_from_value(), joined_armature_fix_animdata_cb(), joined_armature_fix_links(), joined_armature_fix_links_constraints(), blender::animrig::Action::layer_add(), blender::bke::greasepencil::convert::legacy_object_modifier_common(), blender::ed::object::link_to_collection_menu_register(), blender::io::usd::USDMaterialReader::load_tex_image(), make_boneList_recursive(), blender::ed::object::make_object_duplilist_real(), blender::bke::make_socket(), mask_parent_set_exec(), blender::bke::mesh_uv_select_to_single_attribute(), minimal_operator_create(), ml_addview_cb(), blender::ed::object::modifier_add(), blender::ed::object::modifier_add_asset_exec(), blender::ed::object::modifier_add_catalog_assets_menu_type(), blender::ed::object::modifier_add_root_catalogs_menu_type(), blender::ed::object::modifier_add_unassigned_assets_menu_type(), modifier_allocate_and_init(), blender::ed::object::modifier_copy(), blender::seq::modifier_new(), blender::seq::modifier_panel_register(), modifier_panel_register(), modifier_subpanel_register(), blender::nodes::decl::modify_subtype_except_for_storage(), blender::nodes::decl::modify_subtype_except_for_storage(), MOV_open_file(), blender::ed::object::move_to_collection_menu_register(), blender::ed::outliner::namebutton_fn(), new_modifier(), nla_buttons_register(), nla_tweakmode_exit_nofollowptr(), blender::nodes::node_composite_convert_color_space_cc::node_composit_init_convert_colorspace(), blender::nodes::node_composite_keyingscreen_cc::node_composit_init_keyingscreen(), blender::nodes::node_composite_render_layer_cc::node_composit_init_rlayers(), blender::bke::node_copy_with_mapping(), blender::ed::space_node::node_create(), blender::ed::space_node::node_draw_space(), blender::ed::space_node::node_geometry_add_attribute_search_button(), blender::ed::space_node::node_geometry_add_layer_search_button(), blender::ed::space_node::node_geometry_add_volume_grid_search_button(), blender::ed::space_node::node_group_make_from_node_declaration(), blender::ed::geometry::node_group_operator_assets_menu(), blender::ed::geometry::node_group_operator_assets_menu_unassigned(), blender::io::fbx::node_matrix_to_obj(), node_reroute_add_storage(), node_sock_label(), node_socket_copy_default_value(), blender::ed::space_node::node_swap_group_asset_invoke(), blender::ed::space_node::node_tree_interface_panel_register(), blender::bke::node_update_idname_from_experimental(), ntreeCompositOutputFileAddSocket(), object_add_or_copy_particle_system(), blender::ed::object::object_grease_pencil_add_exec(), blender::ed::object::object_speaker_add_exec(), uiLayout::op_menu_enum(), outputNumInput(), override_idtemplate_menu(), blender::panel_register(), blender::ed::object::parent_set(), blender::ed::object::parent_set_with_depsgraph(), blender::ed::io::paths_to_operator_properties(), blender::ed::asset::shelf::popover_panel_register(), pose_autoside_names_exec(), pose_bone_do_paste(), pose_clear_user_transforms_exec(), preferences_extension_repo_add_exec(), blender::ed::space_node::preview_prepare_scene(), preview_prepare_scene(), blender::ed::space_node::preview_render(), proj_paint_add_slot(), uiLayout::prop_menu_enum(), pygpu_offscreen__tp_new(), pygpu_texture__tp_new(), pygpu_uniformbuffer__tp_new(), pyrna_prop_str(), RE_InitState(), recent_files_menu_register(), blender::nodes::refresh_node_socket(), blender::ed::spreadsheet::register_row_filter_panels(), blender::ed::spreadsheet::register_spacetype(), blender::ed::greasepencil::remap_vertex_groups(), rename_mesh_uv_seam_attribute(), render_result_new(), render_result_view_new(), render_result_views_shallowcopy(), blender::ed::sculpt_paint::undo::save_active_attribute(), scene_init_data(), screen_opengl_views_setup(), screenshot_invoke(), blender::ed::vse::sequencer_add_image_strip_exec(), blender::ed::vse::sequencer_add_movie_strip_exec(), blender::ed::vse::sequencer_buttons_register(), blender::ed::vse::sequencer_meta_make_exec(), blender::ed::vse::sequencer_separate_images_exec(), blender::ed::object::set_constraint_nth_target(), blender::imbuf::set_file_colorspace(), blender::ed::transform::setNearestAxis2d(), blender::editor::animation::tests::KeylistSummaryTest::SetUp(), blender::interface::tests::CopyDriversToSelected::SetUp(), blender::ed::object::shade_auto_smooth_exec(), blender::ed::object::shaderfx_add(), blender::ed::object::shaderfx_copy(), blender::ed::object::shaderfx_copy_exec(), shaderfx_panel_register(), blender::ed::object::shaderfx_remove_exec(), shaderfx_subpanel_register(), blender::animrig::Action::slot_add(), blender::animrig::Action::slot_identifier_define(), blender::animrig::Action::slot_identifier_propagate(), solve_camera_invoke(), solve_camera_updatejob(), split_groups_action_temp(), blender::ed::spreadsheet::spreadsheet_data_set_region_panels_register(), stampdata(), stampdata_from_template(), blender::seq::strip_add_set_view_transform(), blender::seq::strip_write_data_cb(), blender::ed::space_node::swap_root_catalogs_menu_type(), blender::bke::tests::TEST(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::ed::animation::tests::TEST_F(), text_find_set_selected_exec(), text_replace_set_selected_exec(), toolsystem_ref_set_by_id_pending(), toolsystem_reinit_ensure_toolref(), tracking_dopesheet_channels_calc(), blender::ed::transform::transform_orientations_current_set(), blender::bke::bake::try_load_mesh(), UI_block_begin(), ui_block_open_begin(), ui_but_anim_expression_create(), ui_but_anim_expression_set(), UI_but_icon_indicator_set(), ui_draw_menu_item(), ui_imageuser_slot_menu(), ui_list_ensure(), blender::ed::space_node::ui_node_menu_column(), ui_panel_category_active_set(), UI_panel_category_add(), ui_pie_menu_level_create(), ui_popup_menu_create_from_menutype(), ui_style_new(), UI_theme_init_default(), UI_UL_cache_file_layers(), uiblock_layer_pass_buttons(), uiTemplateCollectionExporters(), uiTemplatePreview(), uiTemplateTextureUser(), blender::ed::space_node::unassigned_assets_menu_type(), undo_history_menu_register(), unwrap_options_get(), update_duplicate_subtarget(), update_paint_modes_for_brush_assets(), update_voronoi_node_fac_output(), user_string_to_number(), userpref_main_region_layout(), version_add_group_in_out_node(), version_geometry_nodes_primitive_uv_maps(), version_geometry_nodes_set_position_node_offset(), version_make_socket_stub(), version_mesh_crease_generic(), version_node_add_socket(), version_replace_velvet_sheen_node(), version_switch_node_input_prefix(), versioning_replace_legacy_combined_and_separate_color_nodes(), versioning_replace_legacy_glossy_node(), versioning_replace_legacy_mix_rgb_node(), versioning_replace_musgrave_texture_node(), versioning_replace_splitviewer(), blender::ed::object::vgroup_duplicate(), view3d_buttons_register(), view_layer_add(), view_lock_to_active_exec(), blender::draw::color_management::viewport_settings_apply(), what_does_obaction(), wm_add_default(), wm_cursor_text_generator(), wm_data_consistency_ensure(), WM_dropboxmap_find(), WM_keyconfig_new(), wm_keymap_new(), wm_main_playanim_intern(), wm_operator_create(), WM_toolsystem_ref_set_from_runtime(), WM_toolsystem_ref_sync_from_context(), wm_window_copy(), WM_window_ensure_active_view_layer(), WM_window_open(), WM_window_set_active_view_layer(), WM_xr_actionmap_binding_ensure_unique(), WM_xr_actionmap_binding_new(), WM_xr_actionmap_ensure_unique(), WM_xr_actionmap_item_ensure_unique(), WM_xr_actionmap_item_new(), WM_xr_actionmap_new(), and write_jpeg().

◆ STRNCPY_UTF8_RLEN

#define STRNCPY_UTF8_RLEN ( dst,
src )
Value:
char size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1

Definition at line 333 of file BLI_string_utf8.h.

Referenced by bone_autoside_name(), nla_draw_strip_text(), WM_xr_actionmap_binding_ensure_unique(), WM_xr_actionmap_ensure_unique(), and WM_xr_actionmap_item_ensure_unique().

◆ STRNLEN_UTF8

#define STRNLEN_UTF8 ( str)
Value:
size_t size_t BLI_strnlen_utf8(const char *strc, size_t strc_maxlen) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define str(s)

Definition at line 335 of file BLI_string_utf8.h.

◆ VSNPRINTF_UTF8

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

Definition at line 341 of file BLI_string_utf8.h.

◆ VSNPRINTF_UTF8_RLEN

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

Definition at line 342 of file BLI_string_utf8.h.

Function Documentation

◆ ATTR_PRINTF_FORMAT()

size_t size_t size_t ATTR_PRINTF_FORMAT ( 3 ,
4  )

References ATTR_NONNULL, and ATTR_PRINTF_FORMAT.

◆ BLI_snprintf_utf8()

size_t size_t size_t BLI_snprintf_utf8 ( char *__restrict dst,
size_t dst_maxncpy,
const char *__restrict format,
... )

Portable replacement for snprintf that truncates partial UTF8 code-points.

References BLI_snprintf_utf8().

Referenced by acf_action_slot_name(), acf_nla_curve_name(), acf_shapekey_name(), ANIM_add_driver(), BKE_blender_version_blendfile_string_from_values(), BKE_collection_new_name_get(), 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_snprintf_utf8(), bone_autoside_name(), blender::ed::vse::draw_seq_text_get_source(), blender::draw::drw_curves_get_attribute_sampler_name(), ED_slider_status_string_get(), get_current_time_str(), get_default_texture_layer_name_for_object(), getname_anim_fcurve(), graph_fmodifier_panel_id(), blender::ed::transform::headerBoneSize(), blender::ed::transform::headerResize(), blender::ed::transform::headerSeqSlide(), blender::ed::transform::headerTimeScale(), blender::ed::transform::headerTimeSlide(), blender::ed::transform::headerTimeTranslate(), loopcut_init(), loopcut_modal(), new_folder_path(), nla_fmodifier_panel_id(), outputNumInput(), PyC_ObSpitStr(), pyrna_enum_to_py(), pyrna_func_error_prefix(), reconstruct_update_solve_cb(), ruler_item_as_string(), blender::ed::transform::translate_dist_to_str(), blender::ed::outliner::TreeElementRNAArrayElement::TreeElementRNAArrayElement(), ui_but_copy_menu(), ui_but_copy_popover(), ui_but_string_get_ex(), UI_list_panel_unique_str(), blender::ed::space_node::ui_node_sock_name(), view_to_string__frame_number(), view_to_string__value(), WM_uilisttype_to_full_list_id(), WM_xr_actionmap_binding_ensure_unique(), WM_xr_actionmap_ensure_unique(), and WM_xr_actionmap_item_ensure_unique().

◆ BLI_snprintf_utf8_rlen()

◆ BLI_str_find_next_char_utf8()

const char const char * BLI_str_find_next_char_utf8 ( const char * p,
const char * str_end )
Parameters
pa pointer to a position within a UTF8 encoded string
str_enda pointer to the byte following the end of the string.

Finds the start of the next UTF8 character in the string after p

p does not have to be at the beginning of a UTF8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.

Returns
a pointer to the found character or a pointer to the null terminating character '\0'.

References ATTR_RETURNS_NONNULL, and ATTR_WARN_UNUSED_RESULT.

Referenced by BLI_str_cursor_step_next_utf8(), ui_text_clip_give_next_off(), and ui_text_position_from_hidden().

◆ BLI_str_find_prev_char_utf8()

const char * BLI_str_find_prev_char_utf8 ( const char * p,
const char * str_start )

BLI_str_find_prev_char_utf8:

Parameters
ppointer to some position within str
str_startpointer to the beginning of a UTF8 encoded string

Given a position p with a UTF8 encoded string str, find the start of the previous UTF8 character starting before. p Returns str_start if no UTF8 characters are present in str_start before p.

p does not have to be at the beginning of a UTF8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.

Returns
A pointer to the found character.

References ATTR_RETURNS_NONNULL, and ATTR_WARN_UNUSED_RESULT.

Referenced by blf_font_width_to_rstrlen(), BLI_str_cursor_step_prev_utf8(), draw_brackets(), blender::nodes::geo_eval_log::StringLog::StringLog(), text_delete_exec(), txt_wrap_move_eol(), ui_text_clip_cursor(), ui_text_clip_give_prev_off(), ui_text_clip_right_label(), and unit_find_str().

◆ BLI_str_partition_ex_utf8()

◆ BLI_str_partition_utf8()

size_t BLI_str_partition_utf8 ( const char * str,
const unsigned int delim[],
const char ** r_sep,
const char ** r_suf )

◆ BLI_str_rpartition_utf8()

size_t size_t BLI_str_rpartition_utf8 ( const char * str,
const unsigned int delim[],
const char ** r_sep,
const char ** r_suf )

◆ BLI_str_utf32_as_utf8()

size_t size_t BLI_str_utf32_as_utf8 ( char *__restrict dst,
const char32_t *__restrict src,
size_t dst_maxncpy )

◆ BLI_str_utf32_as_utf8_len()

size_t BLI_str_utf32_as_utf8_len ( const char32_t * src)
Returns
The UTF32 len in UTF8.

Definition at line 1232 of file string_utf8.cc.

References BLI_str_utf8_from_unicode_len(), and len.

Referenced by BKE_vfont_clipboard_set(), and ED_curve_editfont_load().

◆ BLI_str_utf32_as_utf8_len_ex()

size_t size_t size_t BLI_str_utf32_as_utf8_len_ex ( const char32_t * src,
size_t src_maxlen )
Returns
The UTF32 len in UTF8 with a clamped length.

Definition at line 1220 of file string_utf8.cc.

References BLI_str_utf8_from_unicode_len(), and len.

Referenced by font_select_to_buffer().

◆ BLI_str_utf32_char_is_breaking_space()

bool BLI_str_utf32_char_is_breaking_space ( char32_t codepoint)

◆ BLI_str_utf32_char_is_optional_break_after()

bool BLI_str_utf32_char_is_optional_break_after ( char32_t codepoint,
char32_t codepoint_prev )

Definition at line 924 of file string_utf8.cc.

References BLI_str_utf32_char_is_breaking_space(), and ELEM.

Referenced by blf_font_wrap_apply(), and BLI_vsnprintf_utf8_rlen().

◆ BLI_str_utf32_char_is_optional_break_before()

bool BLI_str_utf32_char_is_optional_break_before ( char32_t codepoint,
char32_t codepoint_prev )

Definition at line 965 of file string_utf8.cc.

References BLI_str_utf32_char_is_breaking_space(), and ELEM.

Referenced by blf_font_wrap_apply(), and BLI_vsnprintf_utf8_rlen().

◆ BLI_str_utf32_char_to_lower()

char32_t BLI_str_utf32_char_to_lower ( char32_t wc)

Return the lowercase of a 32-bit character or the character when no case change is needed.

Note
A 1:1 mapping doesn't account for multiple characters as part of conversion in some cases.

Definition at line 789 of file string_utf8.cc.

References ARRAY_SIZE, max, min, and U.

Referenced by BLI_vsnprintf_utf8_rlen(), and set_case().

◆ BLI_str_utf32_char_to_upper()

char32_t BLI_str_utf32_char_to_upper ( char32_t wc)

Return the uppercase of a 32-bit character or the character when no case change is needed.

Note
A 1:1 mapping doesn't account for multiple characters as part of conversion in some cases.

Definition at line 678 of file string_utf8.cc.

References ARRAY_SIZE, max, min, and U.

Referenced by BLI_vsnprintf_utf8_rlen(), and set_case().

◆ BLI_str_utf8_as_unicode_or_error()

unsigned int BLI_str_utf8_as_unicode_or_error ( const char * p)
Parameters
pa pointer to Unicode character encoded as UTF8

Converts a sequence of bytes encoded as UTF8 to a Unicode character. If p does not point to a valid UTF8 encoded character, results are undefined. If you are not sure that the bytes are complete valid Unicode characters, you should use g_utf8_get_char_validated() instead.

Return value: the resulting character

Definition at line 1042 of file string_utf8.cc.

References BLI_UTF8_ERR, len, mask(), UNLIKELY, utf8_char_compute_skip_or_error_with_mask(), and utf8_char_decode().

Referenced by BLI_str_partition_ex_utf8(), BLI_str_utf8_as_unicode_safe(), BLI_str_utf8_char_width_or_error(), BLI_str_utf8_char_width_safe(), insert_text_invoke(), key_event_glyph_or_text(), text_autocomplete_build(), and text_insert_invoke().

◆ BLI_str_utf8_as_unicode_safe()

◆ BLI_str_utf8_as_unicode_step_or_error()

unsigned int unsigned int BLI_str_utf8_as_unicode_step_or_error ( const char *__restrict p,
size_t p_len,
size_t *__restrict index )

UTF8 decoding that steps over the index (unless an error is encountered).

Parameters
pThe text to step over.
p_lenThe length of p.
indexIndex of p to step over.
Returns
the code-point or BLI_UTF8_ERR if there is a decoding error.
Note
The behavior for clipped text (where p_len limits decoding trailing bytes) must have the same behavior is encountering a nil byte, so functions that only use the first part of a string has matching behavior to functions that null terminate the text.

References ATTR_WARN_UNUSED_RESULT.

Referenced by cursor_delim_type_utf8().

◆ BLI_str_utf8_as_unicode_step_safe()

unsigned int BLI_str_utf8_as_unicode_step_safe ( const char *__restrict p,
size_t p_len,
size_t *__restrict index )

UTF8 decoding that steps over the index. When an error is encountered fall back to LATIN1, stepping over a single byte.

Parameters
pThe text to step over.
p_lenThe length of p.
indexIndex of p to step over.
Returns
the code-point (p + *index) if there is a decoding error.

References ATTR_WARN_UNUSED_RESULT.

Referenced by blf_glyph_from_utf8_and_step(), blender::string_search::damerau_levenshtein_distance(), blender::string_search::extract_normalized_words(), blender::string_search::match_word_initials(), text_autocomplete_build(), text_insert_exec(), txt_insert_buf(), txt_replace_char(), and utf8_as_char32().

◆ BLI_str_utf8_as_utf32()

size_t BLI_str_utf8_as_utf32 ( char32_t *__restrict dst_w,
const char *__restrict src_c,
size_t dst_w_maxncpy )

◆ BLI_str_utf8_char_width_or_error()

int BLI_str_utf8_char_width_or_error ( const char * p)

◆ BLI_str_utf8_char_width_safe()

◆ BLI_str_utf8_column_count()

int BLI_str_utf8_column_count ( const char * str,
size_t str_len )

Definition at line 1463 of file string_utf8.cc.

References BLI_str_utf8_offset_to_column(), and str.

Referenced by BLI_str_partition_ex_utf8(), and cursor_bitmap_from_text().

◆ BLI_str_utf8_from_unicode()

size_t BLI_str_utf8_from_unicode ( unsigned int c,
char * dst,
size_t dst_maxncpy )

BLI_str_utf8_from_unicode:

Parameters
ca Unicode character code
dstoutput buffer, must have at least dst_maxncpy bytes of space. If the length required by c exceeds dst_maxncpy, the bytes available bytes will be zeroed and dst_maxncpy returned.

Converts a single character to UTF8.

Returns
number of bytes written.

Definition at line 1143 of file string_utf8.cc.

References BLI_string_debug_size, i, len, UNLIKELY, and UTF8_VARS_FROM_CHAR32.

Referenced by BLI_str_utf32_as_utf8(), BLI_strncpy_wchar_as_utf8(), find_family_object(), blender::io::usd::make_safe_name(), txt_add_char_intern(), txt_extended_ascii_as_utf8(), txt_replace_char(), and wm_event_add_ghostevent().

◆ BLI_str_utf8_from_unicode_len()

unsigned int unsigned int size_t BLI_str_utf8_from_unicode_len ( unsigned int c)

◆ BLI_str_utf8_invalid_byte()

ptrdiff_t BLI_str_utf8_invalid_byte ( const char * str,
size_t str_len )

◆ BLI_str_utf8_invalid_strip()

int BLI_str_utf8_invalid_strip ( char * str,
size_t str_len )

Remove any invalid UTF8 byte (taking into account multi-bytes sequences).

Parameters
stra null terminated string.
str_lenthe result of strlen(str).
Returns
number of stripped bytes.

Definition at line 287 of file string_utf8.cc.

References BLI_assert, BLI_str_utf8_invalid_byte(), and str.

Referenced by BKE_id_new_name_validate(), BKE_vfontdata_from_freetypefont(), blo_do_versions_450(), blender::seq::edit_strip_name_set(), id_name_final_build(), outputNumInput(), TEST(), ui_textedit_end(), and wm_clipboard_text_get_ex().

◆ BLI_str_utf8_invalid_substitute()

int BLI_str_utf8_invalid_substitute ( char * str,
size_t str_len,
const char substitute )

Substitute any invalid UTF8 byte with substitute (taking into account multi-bytes sequences). The length of the string remains unchanged.

Parameters
stra null terminated string.
str_lenthe result of strlen(str).
Returns
number of bytes replaced.

Definition at line 312 of file string_utf8.cc.

References BLI_assert, BLI_str_utf8_invalid_byte(), and str.

Referenced by BLI_path_to_display_name(), BLI_str_utf8_invalid_substitute_if_needed(), and TEST().

◆ BLI_str_utf8_invalid_substitute_if_needed()

const char * BLI_str_utf8_invalid_substitute_if_needed ( const char * str,
size_t str_len,
const char substitute,
char * buf,
const size_t buf_maxncpy )
nodiscard

A utility for BLI_str_utf8_invalid_substitute that returns str when it contains a valid UTF8 string. Otherwise it is copied into buf with invalid byte sequences substituted for substitute.

Note
This is intended for situations when the string is expected to be valid, where copying and substituting values is typically not needed.

References ATTR_WARN_UNUSED_RESULT, and str.

Referenced by WM_window_title().

◆ BLI_str_utf8_offset_from_column()

int BLI_str_utf8_offset_from_column ( const char * str,
size_t str_len,
int column_target )

Definition at line 1411 of file string_utf8.cc.

References BLI_str_utf8_as_unicode_step_safe(), BLI_wcwidth_safe(), and str.

Referenced by BLI_str_partition_ex_utf8().

◆ BLI_str_utf8_offset_from_column_with_tabs()

int BLI_str_utf8_offset_from_column_with_tabs ( const char * str,
size_t str_len,
int column_target,
int tab_width )

◆ BLI_str_utf8_offset_from_index()

int BLI_str_utf8_offset_from_index ( const char * str,
size_t str_len,
int index_target )

Return the byte offset in str from index_target.

Parameters
index_targetThe unicode index, where multi-byte characters are counted once. There is no need to clamp this value, the index is logically clamped to BLI_strlen_utf8(str) or below.

Definition at line 1383 of file string_utf8.cc.

References BLI_assert, BLI_str_utf8_as_unicode_step_safe(), str, and UNUSED_VARS.

Referenced by BLI_str_partition_ex_utf8(), ED_space_text_region_location_from_cursor(), blender::nodes::node_geo_string_to_curves_cc::get_text_layout(), blender::nodes::node_fn_slice_string_cc::node_build_multi_function(), TEST(), and txt_sel_set().

◆ BLI_str_utf8_offset_to_column()

int BLI_str_utf8_offset_to_column ( const char * str,
size_t str_len,
int offset_target )

◆ BLI_str_utf8_offset_to_column_with_tabs()

int BLI_str_utf8_offset_to_column_with_tabs ( const char * str,
size_t str_len,
int offset_target,
int tab_width )

◆ BLI_str_utf8_offset_to_index()

int BLI_str_utf8_offset_to_index ( const char * str,
size_t str_len,
int offset_target )

◆ BLI_str_utf8_size_or_error()

const char int BLI_str_utf8_size_or_error ( const char * p)
Returns
The size (in bytes) of a single UTF8 char.
Warning
Can return -1 on bad chars.

Definition at line 1032 of file string_utf8.cc.

References utf8_char_compute_skip_or_error().

Referenced by handleNumInput(), ui_do_but_textedit(), ui_handle_menu_letter_press_search(), wm_event_add_ghostevent(), WM_event_print(), and WM_event_utf8_to_ascii().

◆ BLI_str_utf8_size_safe()

◆ BLI_str_utf8_truncate_at_size()

size_t size_t size_t bool BLI_str_utf8_truncate_at_size ( char * str,
const size_t str_size )

Ensure that str has a null byte in the range of [0..str_size], while not generating any invalid UTF-8 code. The resulting strlen(str) is guaranteed to be less than str_size.

Returns
true when str was truncated.

Definition at line 1345 of file string_utf8.cc.

References BLI_assert, str, and str_utf8_truncate_at_size_unchecked().

Referenced by BLI_str_partition_ex_utf8(), bone_autoside_name(), long_id_names_process_action_slots_identifiers(), and read_id_struct().

◆ BLI_strlen_utf8()

◆ BLI_strlen_utf8_ex()

size_t BLI_strlen_utf8_ex ( const char * strc,
size_t * r_len_bytes )

◆ BLI_strncpy_utf8()

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

Referenced by acf_action_slot_name(), acf_filldrivers_name(), acf_generic_idblock_name(), acf_gpl_name_legacy(), acf_group_name(), acf_masklay_name(), acf_nla_controls_name(), acf_nlaaction_name(), acf_nlatrack_name(), acf_object_name(), acf_shapekey_name(), acf_summary_name(), ANIM_add_driver(), blender::ed::transform::applyTransformOrientation(), blender::ed::space_node::attribute_search_exec_fn(), BKE_collection_new_name_get(), BKE_cryptomatte_find_name(), BKE_lightgroup_membership_set(), BKE_preferences_extension_remote_to_name(), BKE_tracking_get_rna_path_prefix_for_plane_track(), BKE_tracking_get_rna_path_prefix_for_track(), BKE_tracking_reconstruction_check(), BLI_string_flip_side_name(), BLI_uniquename_cb(), blo_do_versions_300(), blo_do_versions_pre250(), bone_mouse_select_menu(), colormanage_role_color_space_name_get(), blender::animrig::versioning::convert_legacy_action_assignments(), CustomData_validate_layer_name(), blender::ed::vse::draw_seq_text_get_source(), draw_suggestion_list(), ED_area_status_text(), blender::seq::edit_strip_name_set(), fileselect_ensure_updated_file_params(), blender::ed::spreadsheet::filter_panel_id_fn(), fluid_initjob(), blender::animrig::generic_assign_action_slot(), getname_anim_fcurve(), blender::ed::space_node::grid_search_exec_fn(), imb_handle_colorspace_and_alpha(), blender::ed::animation::greasepencil::layer_group_name(), blender::ed::animation::greasepencil::layer_name(), blender::ed::space_node::layer_search_exec_fn(), MOV_open_file(), blender::ed::outliner::namebutton_fn(), node_blend_label(), blender::nodes::node_fn_boolean_math_cc::node_label(), blender::nodes::node_fn_compare_cc::node_label(), blender::nodes::node_fn_float_to_int_cc::node_label(), blender::nodes::node_fn_match_string_cc::node_label(), blender::nodes::node_geo_closure_cc::input_node::node_label(), blender::nodes::node_geo_foreach_geometry_element_cc::input_node::node_label(), blender::nodes::node_geo_repeat_cc::repeat_input_node::node_label(), blender::nodes::node_geo_simulation_cc::sim_input_node::node_label(), blender::nodes::node_geo_warning_cc::node_label(), blender::nodes::node_composite_mask_cc::node_mask_label(), node_math_label(), node_vector_math_label(), ntreeCompositCryptomatteLayerPrefix(), object_mouse_select_menu(), outputNumInput(), probe_video_colorspace(), PyC_ObSpitStr(), pyrna_py_to_prop(), blender::ed::object::return_editmesh_vgroup(), blender::ed::vse::sequencer_meta_make_exec(), blender::ed::vse::sequencer_text_insert_invoke(), blender::ed::transform::setAxisMatrixConstraint(), blender::ed::transform::setConstraint(), blender::nodes::node_sh_mix_cc::sh_node_mix_label(), blender::animrig::Action::slot_add(), blender::animrig::Action::slot_add_for_id_type(), blender::animrig::Action::slot_display_name_define(), text_text_search_exec(), ui_but_anim_expression_get(), ui_but_copy_operator(), ui_but_string_get_ex(), ui_but_string_set(), blender::ed::space_node::ui_node_sock_name(), UI_popup_menu_reports(), ui_textedit_string_set(), and blender::ed::object::vgroup_init_remap().

◆ BLI_strncpy_utf8_rlen()

◆ BLI_strncpy_utf8_rlen_unterminated()

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

A version of BLI_strncpy_utf8_rlen that doesn't null terminate the string.

Note
Useful for C++ APIs that don't null terminate strings.

Definition at line 424 of file string_utf8.cc.

References BLI_string_debug_size, and str_utf8_copy_max_bytes_impl().

Referenced by blender::StringRefBase::copy_utf8_truncated().

◆ BLI_strncpy_wchar_as_utf8()

size_t BLI_strncpy_wchar_as_utf8 ( char *__restrict dst,
const wchar_t *__restrict src,
size_t dst_maxncpy )

◆ BLI_strncpy_wchar_from_utf8()

size_t size_t BLI_strncpy_wchar_from_utf8 ( wchar_t *__restrict dst_w,
const char *__restrict src_c,
size_t dst_w_maxncpy )

◆ BLI_strnlen_utf8()

size_t size_t BLI_strnlen_utf8 ( const char * strc,
size_t strc_maxlen )
Parameters
strcthe string to measure the length.
strc_maxlenthe string length (in bytes)
Returns
the unicode length (not in bytes!)

Definition at line 528 of file string_utf8.cc.

References BLI_strnlen_utf8_ex().

Referenced by BLI_strnlen_utf8_ex(), blender::string_search::count_utf8_code_points(), blender::nodes::node_fn_string_to_value_cc::get_multi_function(), space_text_draw_wrapped(), TEST(), and ui_text_position_to_hidden().

◆ BLI_strnlen_utf8_ex()

size_t BLI_strnlen_utf8_ex ( const char * strc,
size_t strc_maxlen,
size_t * r_len_bytes )

◆ BLI_vsnprintf_utf8()

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

Portable replacement for vsnprintf that truncates partial UTF8 code-points.

References ATTR_PRINTF_FORMAT, and BLI_vsnprintf_utf8().

Referenced by BLI_vsnprintf_utf8().

◆ BLI_vsnprintf_utf8_rlen()

◆ BLI_wcswidth_or_error()

int BLI_wcswidth_or_error ( const char32_t * pwcs,
size_t n )

Definition at line 643 of file string_utf8.cc.

Referenced by BLI_vsnprintf_utf8_rlen().

◆ BLI_wcwidth_or_error()

size_t size_t int BLI_wcwidth_or_error ( char32_t ucs)

Count columns that character/string occupies (based on wcwidth.co).

Definition at line 625 of file string_utf8.cc.

Referenced by blf_glyph_render(), BLI_str_cursor_step_next_utf32(), BLI_str_cursor_step_prev_utf32(), BLI_str_utf8_char_width_or_error(), BLI_vsnprintf_utf8_rlen(), and BLI_wcwidth_safe().

◆ BLI_wcwidth_safe()

◆ BLI_wstrlen_utf8()

const char const char size_t BLI_wstrlen_utf8 ( const wchar_t * src)
Returns
the wchar_t length in UTF8.

Definition at line 458 of file string_utf8.cc.

References BLI_str_utf8_from_unicode_len(), and len.

Variable Documentation

◆ ATTR_WARN_UNUSED_RESULT

size_t ATTR_WARN_UNUSED_RESULT

Definition at line 186 of file BLI_string_utf8.h.