diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-14 06:25:33 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-14 06:25:33 +0300 |
commit | 541ba689913e8359216a61a67a60425837af88a9 (patch) | |
tree | d74b3170e86db69571593a2265c8d4503fd392a3 /source/blender/blenkernel/BKE_text.h | |
parent | a5571fd0e8cddeb19fd7191896bc57ded44bdd7d (diff) |
Cleanup: use size_t for BLF text API functions
Also minor cleanup to txt_sel_to_buf:
- Use memcpy instead of strncpy as the strings don't contain nil bytes.
- Replace while loops with for loops.
Diffstat (limited to 'source/blender/blenkernel/BKE_text.h')
-rw-r--r-- | source/blender/blenkernel/BKE_text.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index bc6df18ce25..a5b71d42cdc 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -57,7 +57,7 @@ void BKE_text_write(struct Text *text, const char *str); int BKE_text_file_modified_check(struct Text *text); void BKE_text_file_modified_ignore(struct Text *text); -char *txt_to_buf(struct Text *text, int *r_buf_strlen) +char *txt_to_buf(struct Text *text, size_t *r_buf_strlen) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL; void txt_clean_text(struct Text *text); void txt_order_cursors(struct Text *text, bool reverse); @@ -92,7 +92,7 @@ void txt_sel_all(struct Text *text); void txt_sel_clear(struct Text *text); void txt_sel_line(struct Text *text); void txt_sel_set(struct Text *text, int startl, int startc, int endl, int endc); -char *txt_sel_to_buf(struct Text *text, int *r_buf_strlen); +char *txt_sel_to_buf(struct Text *text, size_t *r_buf_strlen); void txt_insert_buf(struct Text *text, const char *in_buffer); void txt_split_curline(struct Text *text); void txt_backspace_char(struct Text *text); @@ -138,12 +138,12 @@ enum { /** * Create a buffer, the only requirement is #txt_from_buf_for_undo can decode it. */ -char *txt_to_buf_for_undo(struct Text *text, int *r_buf_len) +char *txt_to_buf_for_undo(struct Text *text, size_t *r_buf_len) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL; /** * Decode a buffer from #txt_to_buf_for_undo. */ -void txt_from_buf_for_undo(struct Text *text, const char *buf, int buf_len) ATTR_NONNULL(1, 2); +void txt_from_buf_for_undo(struct Text *text, const char *buf, size_t buf_len) ATTR_NONNULL(1, 2); #ifdef __cplusplus } |