/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_test.cpp | 305 char buf[10]; in TEST_F() local 307 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 317 char buf[0]; in TEST_F() local 319 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 329 char buf[0]; in TEST_F() local 331 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 341 char buf[1]; in TEST_F() local 343 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F() 352 char buf[10]; in TEST_F() local 353 memcpy(buf, "0123456789", sizeof(buf)); in TEST_F() [all …]
|
D | stdio_test.cpp | 286 char buf[32]; in TEST() local 287 snprintf(buf, sizeof(buf), "%zd", v); in TEST() 292 char buf[BUFSIZ]; in TEST() local 293 EXPECT_EQ(23, snprintf(buf, sizeof(buf), "<%a>", 9990.235)); in TEST() 294 EXPECT_STREQ("<0x1.3831e147ae148p+13>", buf); in TEST() 300 char buf[BUFSIZ]; in TEST() local 308 EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v)); in TEST() 309 EXPECT_STREQ("<-0x1.dfdfdfdfdfdf9b9b9b9b9b9b9b9bp+8160>", buf); in TEST() 313 EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v)); in TEST() 314 EXPECT_STREQ("<0x1.ffffffffffffffffffffffffffffp+16383>", buf); in TEST() [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 | 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 | 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 | 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 | 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 | string_test.cpp | 93 char buf[256]; in TEST() local 98 ASSERT_STREQ("Success", strerror_r(0, buf, sizeof(buf))); in TEST() 100 ASSERT_STREQ("Success", buf); in TEST() 102 ASSERT_STREQ("Operation not permitted", strerror_r(1, buf, sizeof(buf))); in TEST() 104 ASSERT_STREQ("Operation not permitted", buf); in TEST() 108 ASSERT_STREQ("Unknown error -1", strerror_r(-1, buf, sizeof(buf))); in TEST() 109 ASSERT_STREQ("Unknown error -1", buf); in TEST() 110 ASSERT_STREQ("Unknown error 1234", strerror_r(1234, buf, sizeof(buf))); in TEST() 111 ASSERT_STREQ("Unknown error 1234", buf); in TEST() 115 memset(buf, 0, sizeof(buf)); in TEST() [all …]
|
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 …]
|
D | grp_pwd_test.cpp | 106 char buf[512]; in check_getpwuid_r() local 111 result = getpwuid_r(uid, &pwd_storage, buf, sizeof(buf), &pwd); in check_getpwuid_r() 121 char buf[512]; in check_getpwnam_r() local 126 result = getpwnam_r(username, &pwd_storage, buf, sizeof(buf), &pwd); in check_getpwnam_r() 151 char buf[512]; in expect_no_passwd_id() local 152 EXPECT_EQ(ENOENT, getpwuid_r(uid, &passwd_storage, buf, sizeof(buf), &passwd)); in expect_no_passwd_id() 165 char buf[512]; in expect_no_passwd_name() local 166 EXPECT_EQ(ENOENT, getpwnam_r(username, &passwd_storage, buf, sizeof(buf), &passwd)); in expect_no_passwd_name() 304 alignas(16) char buf[512]; in TEST() local 306 int result = getpwnam_r("root", &pwd_storage, buf + 1, sizeof(buf) - 1, &pwd); in TEST() [all …]
|
D | time_test.cpp | 197 char buf[64]; in TEST() local 201 EXPECT_EQ(10U, strftime(buf, sizeof(buf), "%s", &t)); in TEST() 202 EXPECT_STREQ("4108320000", buf); in TEST() 206 EXPECT_EQ(24U, strftime(buf, sizeof(buf), "%c", &t)); in TEST() 207 EXPECT_STREQ("Sun Mar 10 00:00:00 2100", buf); in TEST() 215 char buf[64]; in TEST() local 221 EXPECT_EQ(5U, strftime(buf, sizeof(buf), "<%Z>", &t)); in TEST() 222 EXPECT_STREQ("<PST>", buf); in TEST() 226 EXPECT_EQ(5U, strftime(buf, sizeof(buf), "<%Z>", &t)); in TEST() 227 EXPECT_STREQ("<PDT>", buf); in TEST() [all …]
|
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()
|
/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/libc/include/bits/fortify/ |
D | unistd.h | 73 char* getcwd(char* const __pass_object_size buf, size_t size) in getcwd() argument 75 __error_if_overflows_objectsize(size, __bos(buf), getcwd) { in getcwd() 77 size_t bos = __bos(buf); in getcwd() 80 return __getcwd_chk(buf, size, bos); in getcwd() 83 return __call_bypassing_fortify(getcwd)(buf, size); in getcwd() 88 ssize_t pread(int fd, void* const __pass_object_size0 buf, size_t count, off_t offset) in pread() argument 91 __error_if_overflows_objectsize(count, __bos0(buf), pread) { in pread() 93 size_t bos = __bos0(buf); in pread() 96 return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos); in pread() 99 return __PREAD_PREFIX(real)(fd, buf, count, offset); in pread() [all …]
|
D | socket.h | 41 ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int flags, struct sockadd… in recvfrom() 43 __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), in recvfrom() 46 size_t bos = __bos0(buf); in recvfrom() 49 return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len); in recvfrom() 52 return __call_bypassing_fortify(recvfrom)(fd, buf, len, flags, src_addr, addr_len); in recvfrom() 56 ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, int flags, const stru… in sendto() 58 __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), in sendto() 61 size_t bos = __bos0(buf); in sendto() 64 return __sendto_chk(fd, buf, len, bos, flags, dest_addr, addr_len); in sendto() 67 return __call_bypassing_fortify(sendto)(fd, buf, len, flags, dest_addr, addr_len); in sendto() [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/bionic/ |
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 | 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 | 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 …]
|
D | fortify.cpp | 104 size_t __fread_chk(void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) { in __fread_chk() argument 108 return fread(buf, size, count, stream); in __fread_chk() 111 return fread(buf, size, count, stream); in __fread_chk() 114 size_t __fwrite_chk(const void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) { in __fwrite_chk() argument 118 return fwrite(buf, size, count, stream); in __fwrite_chk() 121 return fwrite(buf, size, count, stream); in __fwrite_chk() 124 extern char* __getcwd_chk(char* buf, size_t len, size_t actual_size) { in __getcwd_chk() argument 126 return getcwd(buf, len); in __getcwd_chk() 178 ssize_t __pread64_chk(int fd, void* buf, size_t count, off64_t offset, size_t buf_size) { in __pread64_chk() argument 181 return pread64(fd, buf, count, offset); in __pread64_chk() [all …]
|
/bionic/benchmarks/ |
D | stdlib_benchmark.cpp | 162 std::vector<char> buf; in BM_stdlib_mbstowcs() local 175 char* buf_aligned = GetAlignedPtr(&buf, buf_alignment, 500000); in BM_stdlib_mbstowcs() 181 buf[l++] = i, buf[l++] = j; in BM_stdlib_mbstowcs() 185 buf[l++] = i, buf[l++] = j, buf[l++] = k; in BM_stdlib_mbstowcs() 189 buf[l++] = i, buf[l++] = j, buf[l++] = 0x80, buf[l++] = k; in BM_stdlib_mbstowcs() 190 buf[l++] = 0; in BM_stdlib_mbstowcs() 204 std::vector<char> buf; in BM_stdlib_mbrtowc() local 216 char* buf_aligned = GetAlignedPtr(&buf, buf_alignment, 500000); in BM_stdlib_mbrtowc() 221 buf[l++] = i, buf[l++] = j; in BM_stdlib_mbrtowc() 225 buf[l++] = i, buf[l++] = j, buf[l++] = k; in BM_stdlib_mbrtowc() [all …]
|
/bionic/libc/dns/net/ |
D | gethnamaddr.c | 134 u_char buf[MAXPACKET]; member 218 res_state res, struct hostent *hent, char *buf, size_t buflen, int *he) in getanswer() argument 241 eom = answer->buf + anslen; in getanswer() 262 bp = buf; in getanswer() 263 ep = buf + buflen; in getanswer() 264 cp = answer->buf; in getanswer() 269 n = dn_expand(answer->buf, eom, cp, bp, (int)(ep - bp)); in getanswer() 294 n = dn_expand(answer->buf, eom, cp, bp, (int)(ep - bp)); in getanswer() 315 n = dn_expand(answer->buf, eom, cp, tbuf, in getanswer() 344 n = dn_expand(answer->buf, eom, cp, tbuf, in getanswer() [all …]
|
/bionic/libc/dns/resolv/ |
D | res_mkquery.c | 123 u_char *buf, /* buffer to put query */ in res_nmkquery() argument 141 if ((buf == NULL) || (buflen < HFIXEDSZ)) in res_nmkquery() 143 memset(buf, 0, HFIXEDSZ); in res_nmkquery() 144 hp = (HEADER *)(void *)buf; in res_nmkquery() 150 cp = buf + HFIXEDSZ; in res_nmkquery() 151 ep = buf + buflen; in res_nmkquery() 153 *dpp++ = buf; in res_nmkquery() 221 return (cp - buf); in res_nmkquery() 233 u_char *buf, /* buffer to put query */ in res_nopt() argument 246 hp = (HEADER *)(void *)buf; in res_nopt() [all …]
|