summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 13:40:22 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-22 13:40:22 +0900
commit4130048db7db34844d962d1a42ed83e6dc8100a2 (patch)
tree1d08558edb86ee380099d4c576ca74d0ac05aa0e
parent9f5142efe3d305103427ba0377ce0cb9fb556e1d (diff)
os-posixbasedos001legacylibrary branch 0.1sandbox/ToshikazuOhiwa/os-posixbasedos001legacylibrary
-rw-r--r--other_service.mk2
-rw-r--r--posix_based_os001_legacy_library/Makefile.client2
-rw-r--r--posix_based_os001_legacy_library/library/Makefile2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/itoa.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/strlcat.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/strlcpy.h2
-rw-r--r--posix_based_os001_legacy_library/library/include/other_service/ultoa.h2
-rw-r--r--posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c2
-rw-r--r--posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c2
-rw-r--r--posix_based_os001_legacy_library/library/src/itoa.c2
-rw-r--r--posix_based_os001_legacy_library/library/src/strlcat.c43
-rw-r--r--posix_based_os001_legacy_library/library/src/strlcpy.c2
-rw-r--r--posix_based_os001_legacy_library/library/src/ultoa.c2
16 files changed, 30 insertions, 43 deletions
diff --git a/other_service.mk b/other_service.mk
index 908176bf..85a2f2c7 100644
--- a/other_service.mk
+++ b/other_service.mk
@@ -1,7 +1,7 @@
#############################################################
#
# Common Makefile for other_service
-# Copyright (C) 2017-2019 TOYOTA MOTOR CORPORATION
+# Copyright (C) 2017-2020 TOYOTA MOTOR CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/Makefile.client b/posix_based_os001_legacy_library/Makefile.client
index bbb1095a..41927048 100644
--- a/posix_based_os001_legacy_library/Makefile.client
+++ b/posix_based_os001_legacy_library/Makefile.client
@@ -1,5 +1,5 @@
#
-# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/Makefile b/posix_based_os001_legacy_library/library/Makefile
index fdd94108..874a4313 100644
--- a/posix_based_os001_legacy_library/library/Makefile
+++ b/posix_based_os001_legacy_library/library/Makefile
@@ -1,5 +1,5 @@
#
-# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h b/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
index dd922cf0..2c3fb444 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001ClockCycleApi.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h b/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
index 1d2870e4..616bda40 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/PosixBasedOS001TimeApi.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/itoa.h b/posix_based_os001_legacy_library/library/include/other_service/itoa.h
index 9525d547..4f266342 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/itoa.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/itoa.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h b/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
index a3c547b2..188cb01a 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/posix_based_os001_legacy_library.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2017-2019 TOYOTA MOTOR CORPORATION
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/strlcat.h b/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
index ecae2bd1..d42c136c 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/strlcat.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h b/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
index 8f4dfed2..14c51fe9 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/strlcpy.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/include/other_service/ultoa.h b/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
index b86428be..2291f1a7 100644
--- a/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
+++ b/posix_based_os001_legacy_library/library/include/other_service/ultoa.h
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c b/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
index d0366212..b4e73c57 100644
--- a/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
+++ b/posix_based_os001_legacy_library/library/src/PosixBasedOS001ClockCycleApi.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c b/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
index 1def295c..2a1dd721 100644
--- a/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
+++ b/posix_based_os001_legacy_library/library/src/PosixBasedOS001TimeApi.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/src/itoa.c b/posix_based_os001_legacy_library/library/src/itoa.c
index 4c32ed36..49a24bfc 100644
--- a/posix_based_os001_legacy_library/library/src/itoa.c
+++ b/posix_based_os001_legacy_library/library/src/itoa.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/src/strlcat.c b/posix_based_os001_legacy_library/library/src/strlcat.c
index 54233ddf..8d11eaba 100644
--- a/posix_based_os001_legacy_library/library/src/strlcat.c
+++ b/posix_based_os001_legacy_library/library/src/strlcat.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,37 +17,24 @@
#include <sys/types.h>
#include <string.h>
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
size_t
-strlcat(char *dst, const char *src, size_t siz)
+strlcat(char *dst, const char *src, size_t size)
{
- char *d = dst;
- const char *s = src;
- size_t n = siz;
- size_t dlen;
+ size_t dstsize, srcsize, copysize;
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0 && *d != '\0')
- d++;
- dlen = (size_t)(d - dst);
- n = siz - dlen;
+ dstsize = strnlen(dst, size);
+ srcsize = strlen(src);
+ if (dstsize == size) {
+ return dstsize + srcsize;
+ }
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
+ copysize = size - dstsize - 1;
+ if (srcsize < copysize) {
+ copysize = srcsize;
}
- *d = '\0';
- return(dlen + (size_t)(s - src)); /* count does not include NUL */
+ memcpy(dst + dstsize, src, copysize);
+ dst[dstsize + copysize] = '\0';
+
+ return dstsize + srcsize;
}
diff --git a/posix_based_os001_legacy_library/library/src/strlcpy.c b/posix_based_os001_legacy_library/library/src/strlcpy.c
index 8d81e796..f440c0e3 100644
--- a/posix_based_os001_legacy_library/library/src/strlcpy.c
+++ b/posix_based_os001_legacy_library/library/src/strlcpy.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/posix_based_os001_legacy_library/library/src/ultoa.c b/posix_based_os001_legacy_library/library/src/ultoa.c
index 488e2df0..1984246e 100644
--- a/posix_based_os001_legacy_library/library/src/ultoa.c
+++ b/posix_based_os001_legacy_library/library/src/ultoa.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.