[Bf-blender-cvs] [28c34ae7e2d] master: Cleanup: Use BLI_strncpy

Sergey Sharybin noreply at git.blender.org
Mon Jun 11 11:06:18 CEST 2018


Commit: 28c34ae7e2d61d0b1c570b7d9a303267404e54be
Author: Sergey Sharybin
Date:   Mon Jun 11 11:05:24 2018 +0200
Branches: master
https://developer.blender.org/rB28c34ae7e2d61d0b1c570b7d9a303267404e54be

Cleanup: Use BLI_strncpy

It has behavior which we expect, and silences strict compiler warning.

===================================================================

M	source/blender/blenkernel/intern/suggestions.c
M	source/blender/blenkernel/intern/text.c

===================================================================

diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index eb17e103671..b74143b5c07 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -246,12 +246,12 @@ void texttool_docs_show(const char *docs)
 	/* Ensure documentation ends with a '\n' */
 	if (docs[len - 1] != '\n') {
 		documentation = MEM_mallocN(len + 2, "Documentation");
-		strncpy(documentation, docs, len);
+		BLI_strncpy(documentation, docs, len);
 		documentation[len++] = '\n';
 	}
 	else {
 		documentation = MEM_mallocN(len + 1, "Documentation");
-		strncpy(documentation, docs, len);
+		BLI_strncpy(documentation, docs, len);
 	}
 	documentation[len] = '\0';
 }
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index bd2afd0c512..eed3138ec1b 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1705,7 +1705,7 @@ static void txt_undo_add_blockop(Text *text, TextUndoBuf *utxt, int op, const ch
 	/* 4 bytes */
 	txt_undo_store_uint32(utxt->buf, &utxt->pos, length);
 	/* 'length' bytes */
-	strncpy(utxt->buf + utxt->pos, buf, length);
+	BLI_strncpy(utxt->buf + utxt->pos, buf, length);
 	utxt->pos += length;
 	/* 4 bytes */
 	txt_undo_store_uint32(utxt->buf, &utxt->pos, length);



More information about the Bf-blender-cvs mailing list