summaryrefslogtreecommitdiffstats
path: root/util/generic/strfcpy.cpp
diff options
context:
space:
mode:
authormelkov <[email protected]>2022-02-10 16:48:13 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:13 +0300
commit438546c8737d5c1fdeb31157dcf999717d930eec (patch)
treed29d229abd2f9f889b9b7eb148d635059dc26acf /util/generic/strfcpy.cpp
parent96647fad5355ff5ef45a00a6d85c097028584ab0 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/generic/strfcpy.cpp')
-rw-r--r--util/generic/strfcpy.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/util/generic/strfcpy.cpp b/util/generic/strfcpy.cpp
index 19b4da493e1..d9dd21eb8ea 100644
--- a/util/generic/strfcpy.cpp
+++ b/util/generic/strfcpy.cpp
@@ -1,13 +1,13 @@
/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
-/*
+/*
* Copyright (c) 1998, 2015 Todd C. Miller <[email protected]>
- *
- *
+ *
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -15,23 +15,23 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
+ */
+
/*
* Modified version is
* Copyright (c) Alexey Galakhov
*/
-#include "strfcpy.h"
-
-/*
+#include "strfcpy.h"
+
+/*
* Copy string src to buffer dst of size dsize. At most dsize-1
* chars will be copied. Always NUL terminates (unless dsize == 0).
- */
+ */
void strfcpy(char* dst, const char* src, size_t dsize)
{
size_t nleft = dsize;
-
+
/* Copy as many bytes as will fit. */
if (nleft != 0) {
while (--nleft != 0) {
@@ -40,11 +40,11 @@ void strfcpy(char* dst, const char* src, size_t dsize)
}
}
}
-
+
/* Not enough room in dst, add NUL */
if (nleft == 0) {
if (dsize != 0) {
*dst = '\0'; /* NUL-terminate dst */
}
}
-}
+}