Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-03-11 07:09:55 +0300
committerCampbell Barton <campbell@blender.org>2022-03-11 07:14:14 +0300
commit8cc5483331d1a3d5c6eba055ae303788ba843526 (patch)
tree0b132608148bd35d7aad85b760d35300b9c94102 /source/blender/blenkernel/BKE_text.h
parent231eac160ee394d41c84e0cc36845facb7594ba5 (diff)
Text: use simplified logic for txt_to_buf
This function was copied from txt_sel_to_buf, including unnecessary complexity to support selection as well as checks for the cursor which don't make sense when copying the whole buffer. Use a simple loop to copy all text into the destination buffer.
Diffstat (limited to 'source/blender/blenkernel/BKE_text.h')
-rw-r--r--source/blender/blenkernel/BKE_text.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index e833b4a14bb..bc6df18ce25 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -14,6 +14,8 @@ struct Main;
struct Text;
struct TextLine;
+#include "BLI_compiler_attrs.h"
+
/**
* \note caller must handle `compiled` member.
*/
@@ -55,7 +57,8 @@ 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, int *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);
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
@@ -135,11 +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, int *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);
+void txt_from_buf_for_undo(struct Text *text, const char *buf, int buf_len) ATTR_NONNULL(1, 2);
#ifdef __cplusplus
}