/bionic/tests/ |
D | async_safe_test.cpp | 25 char buf[BUFSIZ]; in TEST() local 27 async_safe_format_buffer(buf, sizeof(buf), "a"); in TEST() 28 EXPECT_STREQ("a", buf); in TEST() 30 async_safe_format_buffer(buf, sizeof(buf), "%%"); in TEST() 31 EXPECT_STREQ("%", buf); in TEST() 33 async_safe_format_buffer(buf, sizeof(buf), "01234"); in TEST() 34 EXPECT_STREQ("01234", buf); in TEST() 36 async_safe_format_buffer(buf, sizeof(buf), "a%sb", "01234"); in TEST() 37 EXPECT_STREQ("a01234b", buf); in TEST() 40 async_safe_format_buffer(buf, sizeof(buf), "a%sb", s); in TEST() [all …]
|
D | fortify_filecheck_diagnostics_test.cpp | 47 char buf[4]; in test_sprintf() local 51 sprintf(buf, "foobar"); // NOLINT(runtime/printf) in test_sprintf() 54 sprintf(buf, "%s", "foobar"); // NOLINT(runtime/printf) in test_sprintf() 58 char buf[4]; in test_snprintf() local 62 snprintf(buf, 5, "foobar"); // NOLINT(runtime/printf) in test_snprintf() 65 snprintf(buf, 5, "%s", "foobar"); // NOLINT(runtime/printf) in test_snprintf() 68 snprintf(buf, 5, " %s ", "foobar"); // NOLINT(runtime/printf) in test_snprintf() 71 snprintf(buf, 5, "%d", 100000); // NOLINT(runtime/printf) in test_snprintf() 75 char buf[4]; in test_memcpy() local 78 memcpy(buf, "foobar", sizeof("foobar") + 100); in test_memcpy() [all …]
|
D | libgen_test.cpp | 44 char* buf, size_t buf_size, int expected_errno) { in TestBasename() argument 46 int rc = basename_r(in, buf, buf_size); in TestBasename() 48 if (rc != -1 && buf != nullptr) { in TestBasename() 49 ASSERT_STREQ(expected_out, buf) << in; in TestBasename() 55 char* buf, size_t buf_size, int expected_errno) { in TestDirname() argument 57 int rc = dirname_r(in, buf, buf_size); in TestDirname() 59 if (rc != -1 && buf != nullptr) { in TestDirname() 60 ASSERT_STREQ(expected_out, buf) << in; in TestDirname() 68 char buf[256]; in TEST() local 70 TestBasename("", ".", -1, buf, 0, ERANGE); in TEST() [all …]
|
D | string_posix_strerror_r_test.cpp | 41 char buf[256]; in TEST() local 44 ASSERT_EQ(0, strerror_r(0, buf, sizeof(buf))); in TEST() 45 ASSERT_STREQ("Success", buf); in TEST() 46 ASSERT_EQ(0, strerror_r(1, buf, sizeof(buf))); in TEST() 47 ASSERT_STREQ("Operation not permitted", buf); in TEST() 50 ASSERT_EQ(0, strerror_r(-1, buf, sizeof(buf))); in TEST() 51 ASSERT_STREQ("Unknown error -1", buf); in TEST() 52 ASSERT_EQ(0, strerror_r(1234, buf, sizeof(buf))); in TEST() 53 ASSERT_STREQ("Unknown error 1234", buf); in TEST() 57 memset(buf, 0, sizeof(buf)); in TEST() [all …]
|
D | fortify_test.cpp | 313 char buf[10]; in TEST_F() local 315 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 325 char buf[0]; in TEST_F() local 327 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 337 char buf[0]; in TEST_F() local 339 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 349 char buf[1]; in TEST_F() local 351 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 360 char buf[10]; in TEST_F() local 361 memcpy(buf, "0123456789", sizeof(buf)); in TEST_F() [all …]
|
D | sys_xattr_test.cpp | 26 char buf[10]; in TEST() local 28 ASSERT_EQ(4, getxattr(tf.path, "user.foo", buf, sizeof(buf))); in TEST() 29 ASSERT_STREQ("bar", buf); in TEST() 30 buf[0] = '\0'; in TEST() 31 ASSERT_EQ(4, lgetxattr(tf.path, "user.foo", buf, sizeof(buf))); in TEST() 32 ASSERT_STREQ("bar", buf); in TEST() 37 char buf[10]; in TEST() local 39 ASSERT_EQ(4, fgetxattr(tf.fd, "user.foo", buf, sizeof(buf))); in TEST() 40 ASSERT_STREQ("bar", buf); in TEST() 45 char buf[10]; in TEST() local [all …]
|
D | resolv_test.cpp | 42 uint8_t buf[128]; in TEST() local 43 ASSERT_EQ(128, b64_pton(data, buf, sizeof(buf))); in TEST() 47 char buf[128]; in TEST() local 48 memset(buf, 'x', sizeof(buf)); in TEST() 51 buf, sizeof(buf))); in TEST() 52 ASSERT_STREQ(buf, "aGVsbG8="); in TEST() 56 u_char buf[128]; in TEST() local 57 memset(buf, 'x', sizeof(buf)); in TEST() 58 ASSERT_EQ(static_cast<int>(strlen("hello")), b64_pton("aGVsbG8=", buf, sizeof(buf))); in TEST() 59 ASSERT_STREQ(reinterpret_cast<char*>(buf), "hello"); in TEST()
|
D | stdio_test.cpp | 278 char buf[32]; in TEST() local 279 snprintf(buf, sizeof(buf), "%zd", v); in TEST() 284 char buf[BUFSIZ]; in TEST() local 285 EXPECT_EQ(23, snprintf(buf, sizeof(buf), "<%a>", 9990.235)); in TEST() 286 EXPECT_STREQ("<0x1.3831e147ae148p+13>", buf); in TEST() 290 char buf[BUFSIZ]; in TEST() local 292 EXPECT_EQ(3, snprintf(buf, sizeof(buf), "<%lc>", wc)); in TEST() 293 EXPECT_STREQ("<a>", buf); in TEST() 297 char buf[BUFSIZ]; in TEST() local 299 EXPECT_EQ(3, snprintf(buf, sizeof(buf), "<%C>", wc)); in TEST() [all …]
|
D | iconv_test.cpp | 55 char buf[BUFSIZ] = {}; in TEST() local 63 char* out = buf; in TEST() 64 size_t out_bytes = sizeof(buf); in TEST() 68 wchar_t* utf16 = reinterpret_cast<wchar_t*>(buf); in TEST() 74 EXPECT_EQ(sizeof(buf) - (3 /* chars */ * 4 /* bytes each */), out_bytes); in TEST() 81 char buf[BUFSIZ] = {}; in TEST() local 89 char* out = buf; in TEST() 90 size_t out_bytes = sizeof(buf); in TEST() 97 EXPECT_EQ('a', buf[0]); in TEST() 98 EXPECT_EQ('?', buf[1]); in TEST() [all …]
|
D | stack_protector_test_helper.cpp | 19 char buf[128]; in modify_stack_protector_test() local 23 volatile char* p = buf; in modify_stack_protector_test() 24 int size = static_cast<int>(sizeof(buf) + sizeof(void*)); in modify_stack_protector_test() 25 while ((p - buf) < size) *p++ = '\0'; in modify_stack_protector_test()
|
D | sys_sendfile_test.cpp | 40 char buf[3]; in TEST() local 41 buf[2] = '\0'; in TEST() 42 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST() 43 ASSERT_STREQ("ll", buf); in TEST() 59 char buf[3]; in TEST() local 60 buf[2] = '\0'; in TEST() 61 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST() 62 ASSERT_STREQ("ll", buf); in TEST()
|
D | inttypes_test.cpp | 25 char buf[512]; \ 26 memset(buf, 0, sizeof(buf)); \ 27 snprintf(buf, sizeof(buf), "%" PRId##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \ 28 EXPECT_STREQ("123", buf); \ 29 memset(buf, 0, sizeof(buf)); \ 30 snprintf(buf, sizeof(buf), "%" PRIi##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \ 31 EXPECT_STREQ("123", buf); \ 32 memset(buf, 0, sizeof(buf)); \ 33 snprintf(buf, sizeof(buf), "%" PRIo##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \ 34 EXPECT_STREQ("173", buf); \ [all …]
|
/bionic/libc/include/bits/fortify/ |
D | socket.h | 45 ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int flags, struct sockadd… in recvfrom() 47 __clang_error_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos(buf) < len, in recvfrom() 49 size_t bos = __bos0(buf); in recvfrom() 52 return __call_bypassing_fortify(recvfrom)(fd, buf, len, flags, src_addr, addr_len); in recvfrom() 54 return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len); in recvfrom() 60 ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, int flags, const stru… in sendto() 62 __clang_error_if(__bos0(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos0(buf) < len, in sendto() 64 size_t bos = __bos0(buf); in sendto() 67 return __call_bypassing_fortify(sendto)(fd, buf, len, flags, dest_addr, addr_len); in sendto() 69 return __sendto_chk(fd, buf, len, bos, flags, dest_addr, addr_len); in sendto() [all …]
|
D | unistd.h | 71 char* getcwd(char* const __pass_object_size buf, size_t size) in getcwd() argument 73 __error_if_overflows_objectsize(size, __bos(buf), getcwd) { in getcwd() 74 size_t bos = __bos(buf); in getcwd() 77 return __call_bypassing_fortify(getcwd)(buf, size); in getcwd() 80 return __getcwd_chk(buf, size, bos); in getcwd() 86 ssize_t pread(int fd, void* const __pass_object_size0 buf, size_t count, off_t offset) in pread() argument 89 __error_if_overflows_objectsize(count, __bos0(buf), pread) { in pread() 90 size_t bos = __bos0(buf); in pread() 93 return __PREAD_PREFIX(real)(fd, buf, count, offset); in pread() 96 return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos); in pread() [all …]
|
/bionic/libc/bionic/ |
D | getcwd.cpp | 34 extern "C" int __getcwd(char* buf, size_t size); 36 char* getcwd(char* buf, size_t size) { in getcwd() argument 38 if (buf != nullptr && size == 0) { in getcwd() 46 if (buf == nullptr) { in getcwd() 52 buf = allocated_buf = static_cast<char*>(malloc(allocated_size)); in getcwd() 53 if (buf == nullptr) { in getcwd() 59 int rc = __getcwd(buf, allocated_size); in getcwd() 69 buf = strdup(allocated_buf); in getcwd() 72 buf = allocated_buf; in getcwd() 76 return buf; in getcwd()
|
D | pty.cpp | 56 char* buf = tls.ptsname_buf; in ptsname() local 57 int error = ptsname_r(fd, buf, sizeof(tls.ptsname_buf)); in ptsname() 58 return (error == 0) ? buf : nullptr; in ptsname() 61 int ptsname_r(int fd, char* buf, size_t len) { in ptsname_r() argument 62 if (buf == nullptr) { in ptsname_r() 73 if (snprintf(buf, len, "/dev/pts/%u", pty_num) >= static_cast<int>(len)) { in ptsname_r() 83 char* buf = tls.ttyname_buf; in ttyname() local 84 int error = ttyname_r(fd, buf, sizeof(tls.ttyname_buf)); in ttyname() 85 return (error == 0) ? buf : nullptr; in ttyname() 88 int ttyname_r(int fd, char* buf, size_t len) { in ttyname_r() argument [all …]
|
D | ether_ntoa.c | 38 ether_ntoa_r (const struct ether_addr *addr, char * buf) in ether_ntoa_r() argument 40 snprintf(buf, 18, "%02x:%02x:%02x:%02x:%02x:%02x", in ether_ntoa_r() 44 return buf; in ether_ntoa_r() 53 static char buf[18]; in ether_ntoa() local 54 return ether_ntoa_r(addr, buf); in ether_ntoa()
|
D | mntent.cpp | 39 mntent* getmntent_r(FILE* fp, struct mntent* e, char* buf, int buf_len) { in getmntent_r() argument 41 while (fgets(buf, buf_len, fp) != nullptr) { in getmntent_r() 45 if (sscanf(buf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", in getmntent_r() 48 e->mnt_fsname = &buf[fsname0]; in getmntent_r() 49 buf[fsname1] = '\0'; in getmntent_r() 51 e->mnt_dir = &buf[dir0]; in getmntent_r() 52 buf[dir1] = '\0'; in getmntent_r() 54 e->mnt_type = &buf[type0]; in getmntent_r() 55 buf[type1] = '\0'; in getmntent_r() 57 e->mnt_opts = &buf[opts0]; in getmntent_r() [all …]
|
/bionic/libc/dns/nameser/ |
D | ns_print.c | 59 char **buf, size_t *buflen); 62 char **buf, size_t *buflen); 63 static void addlen(size_t len, char **buf, size_t *buflen); 65 char **buf, size_t *buflen); 67 char **buf, size_t *buflen); 90 char *buf, size_t buflen) in ns_sprintrr() argument 97 name_ctx, origin, buf, buflen); in ns_sprintrr() 112 char *buf, size_t buflen) in ns_sprintrrf() argument 114 const char *obuf = buf; in ns_sprintrrf() 126 T(addstr("\t\t\t", (size_t)3, &buf, &buflen)); in ns_sprintrrf() [all …]
|
/bionic/linker/ |
D | linked_list_test.cpp | 168 const char* buf[max_size]; in TEST() local 169 memset(buf, 0, sizeof(buf)); in TEST() 171 ASSERT_EQ(0U, list.copy_to_array(buf, max_size)); in TEST() 172 ASSERT_EQ(nullptr, buf[0]); in TEST() 179 memset(buf, 0, sizeof(buf)); in TEST() 180 ASSERT_EQ(2U, list.copy_to_array(buf, 2)); in TEST() 181 ASSERT_STREQ("a", buf[0]); in TEST() 182 ASSERT_STREQ("b", buf[1]); in TEST() 183 ASSERT_EQ(nullptr, buf[2]); in TEST() 185 ASSERT_EQ(4U, list.copy_to_array(buf, max_size)); in TEST() [all …]
|
/bionic/libc/stdio/ |
D | fmemopen.cpp | 40 char* buf; member 48 static int fmemopen_read(void* cookie, char* buf, int n) { in fmemopen_read() argument 54 memmove(buf, ck->buf + ck->offset, n); in fmemopen_read() 60 static int fmemopen_write(void* cookie, const char* buf, int n) { in fmemopen_write() argument 65 size_t space_for_null = (n > 0 && buf[n - 1] != '\0') ? 1 : 0; in fmemopen_write() 81 memmove(ck->buf + ck->offset, buf, n); in fmemopen_write() 85 if (buf[n - 1] != '\0') ck->buf[ck->offset] = '\0'; in fmemopen_write() 113 FILE* fmemopen(void* buf, size_t capacity, const char* mode) { in fmemopen() argument 123 ck->buf = static_cast<char*>(buf); in fmemopen() 126 if (ck->buf == nullptr) ck->buf = ck->allocation = static_cast<char*>(calloc(capacity, 1)); in fmemopen() [all …]
|
/bionic/libc/upstream-openbsd/lib/libc/stdio/ |
D | vdprintf.c | 44 __dwrite(void *cookie, const char *buf, int n) in __dwrite() argument 47 return (write(*fdp, buf, n)); in __dwrite() 55 unsigned char buf[BUFSIZ]; in vdprintf() local 60 f._p = buf; in vdprintf() 61 f._w = sizeof(buf); in vdprintf() 64 f._bf._base = buf; in vdprintf() 65 f._bf._size = sizeof(buf); in vdprintf()
|
D | gets.c | 41 gets(char *buf) in gets() argument 47 for (s = buf; (c = getchar_unlocked()) != '\n';) in gets() 49 if (s == buf) { in gets() 58 return (buf); in gets()
|
/bionic/libc/private/ |
D | FdPath.h | 22 snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd); in FdPath() 26 return buf; in c_str() 30 char buf[40];
|
/bionic/benchmarks/ |
D | util.cpp | 48 char* GetAlignedPtr(std::vector<char>* buf, size_t alignment, size_t nbytes) { in GetAlignedPtr() argument 49 buf->resize(nbytes + 3 * alignment); in GetAlignedPtr() 50 return GetAlignedMemory(buf->data(), alignment, 0); in GetAlignedPtr() 53 wchar_t* GetAlignedPtr(std::vector<wchar_t>* buf, size_t alignment, size_t nchars) { in GetAlignedPtr() argument 54 buf->resize(nchars + ceil((3 * alignment) / sizeof(wchar_t))); in GetAlignedPtr() 55 return reinterpret_cast<wchar_t*>(GetAlignedMemory(reinterpret_cast<char*>(buf->data()), in GetAlignedPtr() 59 char* GetAlignedPtrFilled(std::vector<char>* buf, size_t alignment, size_t nbytes, char fill_byte) { in GetAlignedPtrFilled() argument 60 char* buf_aligned = GetAlignedPtr(buf, alignment, nbytes); in GetAlignedPtrFilled()
|