Home
last modified time | relevance | path

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

123456

/bionic/tests/
Dlibc_logging_test.cpp26 char buf[BUFSIZ]; in TEST() local
28 __libc_format_buffer(buf, sizeof(buf), "a"); in TEST()
29 EXPECT_STREQ("a", buf); in TEST()
31 __libc_format_buffer(buf, sizeof(buf), "%%"); in TEST()
32 EXPECT_STREQ("%", buf); in TEST()
34 __libc_format_buffer(buf, sizeof(buf), "01234"); in TEST()
35 EXPECT_STREQ("01234", buf); in TEST()
37 __libc_format_buffer(buf, sizeof(buf), "a%sb", "01234"); in TEST()
38 EXPECT_STREQ("a01234b", buf); in TEST()
41 __libc_format_buffer(buf, sizeof(buf), "a%sb", s); in TEST()
[all …]
Dfortify_compilation_test.cpp32 char buf[4]; in test_sprintf() local
37 sprintf(buf, "foobar"); // NOLINT(runtime/printf) in test_sprintf()
42 sprintf(buf, "%s", "foobar"); // NOLINT(runtime/printf) in test_sprintf()
46 char buf[4]; in test_snprintf() local
51 snprintf(buf, 5, "foobar"); // NOLINT(runtime/printf) in test_snprintf()
56 snprintf(buf, 5, "%s", "foobar"); // NOLINT(runtime/printf) in test_snprintf()
61 snprintf(buf, 5, " %s ", "foobar"); // NOLINT(runtime/printf) in test_snprintf()
66 snprintf(buf, 5, "%d", 100000); // NOLINT(runtime/printf) in test_snprintf()
70 char buf[4]; in test_memcpy() local
75 memcpy(buf, "foobar", sizeof("foobar")); in test_memcpy()
[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 != NULL) { 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 != NULL) { 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.cpp41 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 …]
Dfortify_test.cpp363 char buf[10]; in TEST_F() local
365 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
375 char buf[0]; in TEST_F() local
377 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
387 char buf[0]; in TEST_F() local
389 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
399 char buf[1]; in TEST_F() local
401 ASSERT_FORTIFY(strcpy(buf, orig)); in TEST_F()
410 char buf[10]; in TEST_F() local
411 memcpy(buf, "0123456789", sizeof(buf)); in TEST_F()
[all …]
Dsys_xattr_test.cpp26 char buf[10]; in TEST() local
28 ASSERT_EQ(4, getxattr(tf.filename, "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.filename, "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 …]
Dstdio_test.cpp74 char buf[16]; in TEST() local
75 char* s = fgets(buf, sizeof(buf), fp); in TEST()
98 char buf[7]; in TEST() local
99 ASSERT_EQ(buf, fgets(buf, sizeof(buf), tfile)); in TEST()
100 ASSERT_STREQ("hello\n", buf); in TEST()
102 ASSERT_EQ(NULL, fgets(buf, sizeof(buf), tfile)); in TEST()
250 char buf[32]; in TEST() local
251 snprintf(buf, sizeof(buf), "%zd", v); in TEST()
256 char buf[BUFSIZ]; in TEST() local
257 EXPECT_EQ(23, snprintf(buf, sizeof(buf), "<%a>", 9990.235)); in TEST()
[all …]
Dinttypes_test.cpp24 char buf[512]; in TEST() local
29 snprintf(buf, sizeof(buf), "%08" PRIdPTR, i); in TEST()
30 snprintf(buf, sizeof(buf), "%08" PRIiPTR, i); in TEST()
31 snprintf(buf, sizeof(buf), "%08" PRIoPTR, i); in TEST()
32 snprintf(buf, sizeof(buf), "%08" PRIuPTR, u); in TEST()
33 snprintf(buf, sizeof(buf), "%08" PRIxPTR, u); in TEST()
34 snprintf(buf, sizeof(buf), "%08" PRIXPTR, u); in TEST()
36 sscanf(buf, "%08" SCNdPTR, &i); in TEST()
37 sscanf(buf, "%08" SCNiPTR, &i); in TEST()
38 sscanf(buf, "%08" SCNoPTR, &u); in TEST()
[all …]
Dstack_protector_test_helper.cpp19 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) + 1); in modify_stack_protector_test()
30 while ((p - buf) < size) *p++ = '\0'; in modify_stack_protector_test()
Dsys_sendfile_test.cpp39 char buf[3]; in TEST() local
40 buf[2] = '\0'; in TEST()
41 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST()
42 ASSERT_STREQ("ll", buf); in TEST()
58 char buf[3]; in TEST() local
59 buf[2] = '\0'; in TEST()
60 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST()
61 ASSERT_STREQ("ll", buf); in TEST()
Dstdio_ext_test.cpp42 char buf[128]; in TEST() local
43 fgets(buf, sizeof(buf), fp); in TEST()
46 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1)); in TEST()
49 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 8)); in TEST()
60 char buf[128]; in TEST() local
61 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf))); in TEST()
94 char buf[16]; in TEST() local
95 char* s = fgets(buf, sizeof(buf), fp); in TEST()
105 char buf[128]; in TEST() local
106 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf))); in TEST()
Dstring_test.cpp93 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 …]
/bionic/libc/bionic/
Dgetcwd.cpp35 extern "C" int __getcwd(char* buf, size_t size);
37 char* getcwd(char* buf, size_t size) { in getcwd() argument
39 if (buf != NULL && size == 0) { in getcwd()
47 if (buf == NULL) { in getcwd()
53 buf = allocated_buf = static_cast<char*>(malloc(allocated_size)); in getcwd()
54 if (buf == NULL) { in getcwd()
62 int rc = __getcwd(buf, allocated_size); in getcwd()
72 buf = strdup(allocated_buf); in getcwd()
75 buf = allocated_buf; in getcwd()
79 return buf; in getcwd()
Dmntent.cpp43 mntent* getmntent_r(FILE* fp, struct mntent* e, char* buf, int buf_len) { in getmntent_r() argument
45 while (fgets(buf, buf_len, fp) != NULL) { in getmntent_r()
49 if (sscanf(buf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", in getmntent_r()
52 e->mnt_fsname = &buf[fsname0]; in getmntent_r()
53 buf[fsname1] = '\0'; in getmntent_r()
55 e->mnt_dir = &buf[dir0]; in getmntent_r()
56 buf[dir1] = '\0'; in getmntent_r()
58 e->mnt_type = &buf[type0]; in getmntent_r()
59 buf[type1] = '\0'; in getmntent_r()
61 e->mnt_opts = &buf[opts0]; in getmntent_r()
[all …]
Dether_ntoa.c38 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()
Dpty.cpp57 char* buf = g_ptsname_tls_buffer.get(); in ptsname() local
58 int error = ptsname_r(fd, buf, g_ptsname_tls_buffer.size()); in ptsname()
59 return (error == 0) ? buf : NULL; in ptsname()
62 int ptsname_r(int fd, char* buf, size_t len) { in ptsname_r() argument
63 if (buf == NULL) { in ptsname_r()
74 if (snprintf(buf, len, "/dev/pts/%u", pty_num) >= static_cast<int>(len)) { in ptsname_r()
83 char* buf = g_ttyname_tls_buffer.get(); in ttyname() local
84 int error = ttyname_r(fd, buf, g_ttyname_tls_buffer.size()); in ttyname()
85 return (error == 0) ? buf : NULL; in ttyname()
88 int ttyname_r(int fd, char* buf, size_t len) { in ttyname_r() argument
[all …]
Dstrerror_r.cpp52 int strerror_r(int error_number, char* buf, size_t buf_len) { in strerror_r() argument
58 length = strlcpy(buf, error_name, buf_len); in strerror_r()
60 length = __libc_format_buffer(buf, buf_len, "Unknown error %d", error_number); in strerror_r()
70 extern "C" char* __gnu_strerror_r(int error_number, char* buf, size_t buf_len) { in __gnu_strerror_r() argument
72 strerror_r(error_number, buf, buf_len); in __gnu_strerror_r()
73 return buf; // ...and just returns whatever fit. in __gnu_strerror_r()
76 extern "C" __LIBC_HIDDEN__ const char* __strsignal(int signal_number, char* buf, size_t buf_len) { in __strsignal() argument
87 size_t length = snprintf(buf, buf_len, "%s signal %d", prefix, signal_number); in __strsignal()
91 return buf; in __strsignal()
/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/linker/tests/
Dlinked_list_test.cpp156 const char* buf[max_size]; in TEST() local
157 memset(buf, 0, sizeof(buf)); in TEST()
159 ASSERT_EQ(0U, list.copy_to_array(buf, max_size)); in TEST()
160 ASSERT_EQ(nullptr, buf[0]); in TEST()
167 memset(buf, 0, sizeof(buf)); in TEST()
168 ASSERT_EQ(2U, list.copy_to_array(buf, 2)); in TEST()
169 ASSERT_STREQ("a", buf[0]); in TEST()
170 ASSERT_STREQ("b", buf[1]); in TEST()
171 ASSERT_EQ(nullptr, buf[2]); in TEST()
173 ASSERT_EQ(4U, list.copy_to_array(buf, max_size)); in TEST()
[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()
Dgets.c41 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()
Dsetbuf.c38 setbuf(FILE *fp, char *buf) in setbuf() argument
40 (void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); in setbuf()
/bionic/linker/
Dlinker_utils.cpp28 char buf[len]; in normalize_path() local
31 char* out_ptr = buf; in normalize_path()
43 while (out_ptr > buf && *--out_ptr != '/') { in normalize_path()
60 *normalized_path = buf; in normalize_path()
103 char buf[512]; in parse_zip_path() local
104 if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) { in parse_zip_path()
109 buf[separator - path] = '\0'; in parse_zip_path()
111 *zip_path = buf; in parse_zip_path()
112 *entry_path = &buf[separator - path + 2]; in parse_zip_path()
/bionic/libc/upstream-openbsd/lib/libc/locale/
D_wcstod.h103 char *buf; in FUNCNAME() local
114 buf = malloc(bufsize + 1); in FUNCNAME()
115 if (!buf) { in FUNCNAME()
122 size_converted = wcsnrtombs(buf, &s, size, bufsize, &st); in FUNCNAME()
125 free(buf); in FUNCNAME()
130 buf[bufsize] = 0; in FUNCNAME()
131 result = STRTOD_FUNC(buf, &end); in FUNCNAME()
134 const char *s = buf; in FUNCNAME()
136 size = mbsnrtowcs(NULL, &s, end - buf, 0, &st); in FUNCNAME()
142 free(buf); in FUNCNAME()
/bionic/libc/include/
Dunistd.h298 char* getcwd(char* buf, size_t size) { in getcwd() argument
299 size_t bos = __bos(buf); in getcwd()
308 if (buf == NULL) { in getcwd()
313 return __getcwd_real(buf, size); in getcwd()
321 return __getcwd_real(buf, size); in getcwd()
325 return __getcwd_chk(buf, size, bos); in getcwd()
335 ssize_t pread(int fd, void* buf, size_t count, off_t offset) { in pread() argument
336 size_t bos = __bos0(buf); in pread()
344 return __PREAD_PREFIX(real)(fd, buf, count, offset); in pread()
352 return __PREAD_PREFIX(real)(fd, buf, count, offset); in pread()
[all …]

123456