Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 163) sorted by relevance

1234567

/bionic/tests/
Dasync_safe_test.cpp27 char buf[BUFSIZ]; in TEST() local
29 async_safe_format_buffer(buf, sizeof(buf), "a"); in TEST()
30 EXPECT_STREQ("a", buf); in TEST()
32 async_safe_format_buffer(buf, sizeof(buf), "%%"); in TEST()
33 EXPECT_STREQ("%", buf); in TEST()
35 async_safe_format_buffer(buf, sizeof(buf), "01234"); in TEST()
36 EXPECT_STREQ("01234", buf); in TEST()
38 async_safe_format_buffer(buf, sizeof(buf), "a%sb", "01234"); in TEST()
39 EXPECT_STREQ("a01234b", buf); in TEST()
42 async_safe_format_buffer(buf, sizeof(buf), "a%sb", s); in TEST()
[all …]
Dfortify_test.cpp308 char buf[10]; in TEST_F() local
310 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
320 char buf[0]; in TEST_F() local
322 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
332 char buf[0]; in TEST_F() local
334 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
344 char buf[1]; in TEST_F() local
346 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
355 char buf[10]; in TEST_F() local
356 memcpy(buf, "0123456789", sizeof(buf)); in TEST_F()
[all …]
Dlibgen_test.cpp44 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 …]
Dstring_posix_strerror_r_test.cpp23 int posix_strerror_r(int errnum, char* buf, size_t buflen);
26 char buf[256]; in TEST() local
29 ASSERT_EQ(0, posix_strerror_r(0, buf, sizeof(buf))); in TEST()
31 ASSERT_STREQ("No error information", buf); in TEST()
33 ASSERT_STREQ("Success", buf); in TEST()
35 ASSERT_EQ(0, posix_strerror_r(1, buf, sizeof(buf))); in TEST()
36 ASSERT_STREQ("Operation not permitted", buf); in TEST()
40 ASSERT_EQ(0, posix_strerror_r(-1, buf, sizeof(buf))); in TEST()
42 ASSERT_STREQ("Unknown error -1", buf); in TEST()
44 ASSERT_STREQ("No error information", buf); in TEST()
[all …]
Darpa_inet_test.cpp170 u_char buf[32]; in TEST() local
173 ASSERT_EQ(0U, inet_nsap_addr("123", buf, sizeof(buf))); in TEST()
174 ASSERT_EQ(0U, inet_nsap_addr("012", buf, sizeof(buf))); in TEST()
177 ASSERT_EQ(1U, inet_nsap_addr("0x12", buf, sizeof(buf))); in TEST()
178 ASSERT_EQ(0x12, buf[0]); in TEST()
181 ASSERT_EQ(10U, inet_nsap_addr("0x1234567890abcdef0011", buf, sizeof(buf))); in TEST()
182 ASSERT_EQ(0x12, buf[0]); in TEST()
183 ASSERT_EQ(0x34, buf[1]); in TEST()
184 ASSERT_EQ(0x56, buf[2]); in TEST()
185 ASSERT_EQ(0x78, buf[3]); in TEST()
[all …]
Dsys_xattr_test.cpp28 char buf[10]; in TEST() local
30 ASSERT_EQ(4, getxattr(tf.path, "user.foo", buf, sizeof(buf))); in TEST()
31 ASSERT_STREQ("bar", buf); in TEST()
32 buf[0] = '\0'; in TEST()
33 ASSERT_EQ(4, lgetxattr(tf.path, "user.foo", buf, sizeof(buf))); in TEST()
34 ASSERT_STREQ("bar", buf); in TEST()
39 char buf[10]; in TEST() local
41 ASSERT_EQ(4, fgetxattr(tf.fd, "user.foo", buf, sizeof(buf))); in TEST()
42 ASSERT_STREQ("bar", buf); in TEST()
47 char buf[10]; in TEST() local
[all …]
Dresolv_test.cpp44 uint8_t buf[128]; in TEST() local
45 ASSERT_EQ(128, b64_pton(data, buf, sizeof(buf))); in TEST()
49 char buf[128]; in TEST() local
50 memset(buf, 'x', sizeof(buf)); in TEST()
53 buf, sizeof(buf))); in TEST()
54 ASSERT_STREQ(buf, "aGVsbG8="); in TEST()
58 u_char buf[128]; in TEST() local
59 memset(buf, 'x', sizeof(buf)); in TEST()
60 ASSERT_EQ(static_cast<int>(strlen("hello")), b64_pton("aGVsbG8=", buf, sizeof(buf))); in TEST()
61 ASSERT_STREQ(reinterpret_cast<char*>(buf), "hello"); in TEST()
Diconv_test.cpp57 char buf[BUFSIZ] = {}; in TEST() local
65 char* out = buf; in TEST()
66 size_t out_bytes = sizeof(buf); in TEST()
70 wchar_t* utf16 = reinterpret_cast<wchar_t*>(buf); in TEST()
76 EXPECT_EQ(sizeof(buf) - (3 /* chars */ * 4 /* bytes each */), out_bytes); in TEST()
83 char buf[BUFSIZ] = {}; in TEST() local
91 char* out = buf; in TEST()
92 size_t out_bytes = sizeof(buf); in TEST()
99 EXPECT_EQ('a', buf[0]); in TEST()
100 EXPECT_EQ('?', buf[1]); in TEST()
[all …]
Dstdio_test.cpp104 char buf[BUFSIZ]; \
105 int w = snprintf(buf, sizeof(buf), fmt __VA_OPT__(, ) __VA_ARGS__); \
107 EXPECT_STREQ(expected, buf); \
115 wchar_t buf[BUFSIZ]; \
116 int w = swprintf(buf, sizeof(buf), fmt __VA_OPT__(, ) __VA_ARGS__); \
118 EXPECT_EQ(std::wstring(expected), std::wstring(buf, w)); \
459 char buf[32]; in TEST_F() local
461 EXPECT_DEATH(snprintf(buf, sizeof(buf), "a %n b", &i), "%n not allowed on Android"); in TEST_F()
473 wchar_t buf[32]; in TEST_F() local
475 EXPECT_DEATH(swprintf(buf, sizeof(buf), L"a %n b", &i), "%n not allowed on Android"); in TEST_F()
[all …]
Dinttypes_test.cpp27 char buf[512]; \
28 memset(buf, 0, sizeof(buf)); \
29 snprintf(buf, sizeof(buf), "%" PRId##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \
30 EXPECT_STREQ("123", buf); \
31 memset(buf, 0, sizeof(buf)); \
32 snprintf(buf, sizeof(buf), "%" PRIi##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \
33 EXPECT_STREQ("123", buf); \
34 memset(buf, 0, sizeof(buf)); \
35 snprintf(buf, sizeof(buf), "%" PRIo##FMT_SUFFIX, int##TYPE_SUFFIX(123)); \
36 EXPECT_STREQ("173", buf); \
[all …]
Dstring_test.cpp101 char buf[256]; in TEST() local
106 ASSERT_STREQ("Success", strerror_r(0, buf, sizeof(buf))); in TEST()
108 ASSERT_STREQ("Success", buf); in TEST()
110 ASSERT_STREQ("Operation not permitted", strerror_r(1, buf, sizeof(buf))); in TEST()
112 ASSERT_STREQ("Operation not permitted", buf); in TEST()
116 ASSERT_STREQ("Unknown error -1", strerror_r(-1, buf, sizeof(buf))); in TEST()
117 ASSERT_STREQ("Unknown error -1", buf); in TEST()
118 ASSERT_STREQ("Unknown error 1234", strerror_r(1234, buf, sizeof(buf))); in TEST()
119 ASSERT_STREQ("Unknown error 1234", buf); in TEST()
123 memset(buf, 0, sizeof(buf)); in TEST()
[all …]
Dgrp_pwd_test.cpp108 char buf[512]; in check_getpwuid_r() local
113 result = getpwuid_r(uid, &pwd_storage, buf, sizeof(buf), &pwd); in check_getpwuid_r()
123 char buf[512]; in check_getpwnam_r() local
128 result = getpwnam_r(username, &pwd_storage, buf, sizeof(buf), &pwd); in check_getpwnam_r()
153 char buf[512]; in expect_no_passwd_id() local
154 EXPECT_EQ(ENOENT, getpwuid_r(uid, &passwd_storage, buf, sizeof(buf), &passwd)); in expect_no_passwd_id()
167 char buf[512]; in expect_no_passwd_name() local
168 EXPECT_EQ(ENOENT, getpwnam_r(username, &passwd_storage, buf, sizeof(buf), &passwd)); in expect_no_passwd_name()
306 alignas(16) char buf[512]; in TEST() local
308 int result = getpwnam_r("root", &pwd_storage, buf + 1, sizeof(buf) - 1, &pwd); in TEST()
[all …]
Dsys_sendfile_test.cpp40 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/
Dns_print.c59 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/
Dunistd.h73 char* _Nullable getcwd(char* const _Nullable __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 _Nonnull __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 …]
Dsocket.h40 ssize_t recvfrom(int fd, void* _Nullable const buf __pass_object_size0, size_t len, int flags, stru… in recvfrom()
42 __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), in recvfrom()
45 size_t bos = __bos0(buf); in recvfrom()
48 return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len); in recvfrom()
51 return __call_bypassing_fortify(recvfrom)(fd, buf, len, flags, src_addr, addr_len); in recvfrom()
55 ssize_t sendto(int fd, const void* _Nonnull const buf __pass_object_size0, size_t len, int flags, c… in sendto()
57 __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), in sendto()
60 size_t bos = __bos0(buf); in sendto()
63 return __sendto_chk(fd, buf, len, bos, flags, dest_addr, addr_len); in sendto()
66 return __call_bypassing_fortify(sendto)(fd, buf, len, flags, dest_addr, addr_len); in sendto()
[all …]
/bionic/linker/
Dlinked_list_test.cpp168 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/bionic/
Dgetcwd.cpp34 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()
Dpty.cpp56 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 …]
Dmntent.cpp39 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/stdio/
Dfmemopen.cpp40 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/
Dvdprintf.c44 __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()
/bionic/benchmarks/
Dutil.cpp48 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()
/bionic/tests/libs/
Dstack_tagging_helper.cpp101 alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized)); in vfork_child() local
102 sink = &buf; in vfork_child()
104 for (char* p = buf; p < buf + sizeof(buf) / 2; p += 16) { in vfork_child()
114 alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized)); in vfork_parent() local
115 fprintf(stderr, "vfork_parent %p\n", &buf); in vfork_parent()
117 for (char* p = buf; p < buf + sizeof(buf); p += 16) { in vfork_parent()
120 fprintf(stderr, "tag mismatch at offset %zx: %p != %p\n", p - buf, p, q); in vfork_parent()
149 alignas(16) char buf[kStackAllocationSize] __attribute__((uninitialized)); in settag_and_longjmp() local
150 sink = &buf; in settag_and_longjmp()
152 for (char* p = buf; p < buf + sizeof(buf) / 2; p += 16) { in settag_and_longjmp()
[all …]
/bionic/libc/dns/resolv/
Dres_mkquery.c123 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 …]

1234567