Home
last modified time | relevance | path

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

12345678910>>...13

/aosp14/frameworks/base/core/tests/coretests/src/android/os/
H A DRedactingFileDescriptorTest.java70 assertEquals(buf.length, Os.read(fd, buf, 0, buf.length)); in testSingleByte()
86 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 90)); in testRanges()
89 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testRanges()
92 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 100)); in testRanges()
95 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 195)); in testRanges()
98 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 395)); in testRanges()
122 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testReadWrite()
127 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testReadWrite()
178 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 0)); in testFreeAtStart()
190 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 0)); in testFreeAtOffset()
[all …]
/aosp14/system/core/libutils/
H A DSharedBuffer_test.cpp38 android::SharedBuffer* buf = in TEST() local
40 if (buf != nullptr) { in TEST()
42 buf->release(); in TEST()
50 if (buf != nullptr) { in TEST()
52 buf->release(); in TEST()
58 ASSERT_NE(nullptr, buf); in TEST()
59 ASSERT_EQ(0U, buf->size()); in TEST()
60 buf->release(); in TEST()
76 buf->release(); in TEST()
85 buf = buf->editResize(0); in TEST()
[all …]
H A DString8.cpp51 return buf; in getEmptyString()
68 if (buf) { in allocFromUTF8()
92 if (!buf) { in allocFromUTF16()
114 if (!buf) { in allocFromUTF32()
354 if (buf) { in lockBuffer()
426 *buf = static_cast<char>(tolower(*buf)); in toLower()
427 buf++; in toLower()
481 buf = buf+1; in walkPath()
486 String8 res = buf != str ? String8(buf) : *this; in walkPath()
491 String8 res(buf, cp-buf); in walkPath()
[all …]
H A DString16.cpp38 return buf; in alloc()
53 if (buf) { in allocFromUTF8()
77 if (buf) { in allocFromUTF16()
192 if (buf) { in setTo()
305 SharedBuffer* buf; in edit() local
308 if (buf) { in edit()
315 return buf; in edit()
319 SharedBuffer* buf; in editResize() local
326 if (buf) { in editResize()
333 return buf; in editResize()
[all …]
/aosp14/frameworks/base/libs/protoutil/tests/
H A Dprotobuf_test.cpp28 uint8_t buf[11]; in TEST() local
29 memset(buf, UNSET_BYTE, sizeof(buf)); in TEST()
30 EXPECT_EQ(write_raw_varint(buf, UINT64_C(150)) - buf, 2); in TEST()
31 EXPECT_EQ(buf[0], 0x96); in TEST()
32 EXPECT_EQ(buf[1], 0x01); in TEST()
33 EXPECT_EQ(buf[2], UNSET_BYTE); in TEST()
35 memset(buf, UNSET_BYTE, sizeof(buf)); in TEST()
36 EXPECT_EQ(write_raw_varint(buf, UINT64_C(-2)) - buf, 10); in TEST()
37 EXPECT_EQ(buf[0], 0xfe); in TEST()
39 EXPECT_EQ(buf[i], 0xff); in TEST()
[all …]
/aosp14/frameworks/base/tools/aapt/
H A DZipEntry.cpp388 unsigned char buf[kLFHLen]; in read() local
393 if (fread(buf, 1, kLFHLen, fp) != kLFHLen) { in read()
409 mCRC32 = ZipEntry::getLongLE(&buf[0x0e]); in read()
454 unsigned char buf[kLFHLen]; in write() local
462 ZipEntry::putLongLE(&buf[0x0e], mCRC32); in write()
468 if (fwrite(buf, 1, kLFHLen, fp) != kLFHLen) in write()
522 unsigned char buf[kCDELen]; in read() local
546 mCRC32 = ZipEntry::getLongLE(&buf[0x10]); in read()
612 unsigned char buf[kCDELen]; in write() local
621 ZipEntry::putLongLE(&buf[0x10], mCRC32); in write()
[all …]
H A DZipEntry.h118 return buf[0] | (buf[1] << 8); in getShortLE()
120 static inline unsigned long getLongLE(const unsigned char* buf) { in getLongLE() argument
121 return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); in getLongLE()
123 static inline void putShortLE(unsigned char* buf, short val) { in putShortLE() argument
124 buf[0] = (unsigned char) val; in putShortLE()
125 buf[1] = (unsigned char) (val >> 8); in putShortLE()
127 static inline void putLongLE(unsigned char* buf, long val) { in putLongLE() argument
128 buf[0] = (unsigned char) val; in putLongLE()
129 buf[1] = (unsigned char) (val >> 8); in putLongLE()
130 buf[2] = (unsigned char) (val >> 16); in putLongLE()
[all …]
/aosp14/system/core/trusty/libtrusty-rs/src/
H A Dlib.rs117 let write_len = self.0.write(buf)?; in send()
124 buf.len(), in send()
128 buf.len(), in send()
158 if buf.capacity() == 0 { in recv()
159 buf.reserve(MAX_MESSAGE_SIZE); in recv()
164 buf.resize(buf.capacity(), 0); in recv()
166 match self.0.read(buf.as_mut_slice()) { in recv()
168 buf.truncate(len); in recv()
185 buf.reserve(MAX_MESSAGE_SIZE - buf.capacity()); in recv()
191 buf.truncate(0); in recv()
[all …]
/aosp14/system/core/fastboot/fuzzy_fastboot/
H A Dtransport_sniffer.cpp26 Event e(READ_ERROR, std::move(buf)); in Read()
33 Event e(READ, std::move(buf)); in Read()
54 Event e(WRITE, std::move(buf)); in Write()
68 std::vector<char> buf; in Reset() local
69 Event e(RESET, std::move(buf)); in Reset()
95 if (buf.size() > max_chars) { in CreateTrace()
110 if (buf.size() > max_chars) { in CreateTrace()
174 std::vector<char> buf; in ProcessSerial() local
175 buf.resize(1000); in ProcessSerial()
177 n = read(serial_fd_, buf.data() + count, buf.size() - count); in ProcessSerial()
[all …]
/aosp14/frameworks/base/packages/DynamicSystemInstallationService/src/com/android/dynsystem/
H A DSparseInputStream.java56 byte[] buf = new byte[size]; in readFull()
62 return buf; in readFull()
72 chunk.mChunkType = buf.getShort(); in readChunk()
73 buf.getShort(); in readChunk()
74 chunk.mChunkSize = buf.getInt(); in readChunk()
75 chunk.mTotalSize = buf.getInt(); in readChunk()
97 int major = buf.getShort(); in SparseInputStream()
98 int minor = buf.getShort(); in SparseInputStream()
110 mBlockSize = buf.getInt(); in SparseInputStream()
114 mTotalBlocks = buf.getInt(); in SparseInputStream()
[all …]
/aosp14/frameworks/base/libs/androidfw/
H A DZipUtils.cpp55 size_t read = fread(buf, 1, len, mFp); in ReadAtOffset()
99 memcpy(buf, pos.unsafe_ptr(), len); in ReadAtOffset()
119 memcpy(mOutput + mBytesWritten, buf, bufSize); in Append()
134 BufferWriter writer(buf, uncompressedLen); in inflateToBuffer()
142 BufferWriter writer(buf, uncompressedLen); in inflateToBuffer()
150 BufferWriter writer(buf, uncompressedLen); in inflateToBuffer()
155 return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); in get4LE()
232 unsigned char buf[8]; in examineGzip() local
236 if (fread(buf, 1, 8, fp) != 8) in examineGzip()
242 *pCRC32 = get4LE(&buf[0]); in examineGzip()
[all …]
H A DBackupHelpers.cpp235 free(buf); in write_update_file()
245 free(buf); in write_update_file()
258 free(buf); in write_update_file()
281 free(buf); in write_update_file()
326 free(buf); in compute_crc32()
449 for (uint8_t* p = (uint8_t*) buf; p < ((uint8_t*)buf) + 512; p++) { in calc_tar_checksum()
598 buf[156] = type; in write_tarfile()
719 free(buf); in write_tarfile()
1253 "%02x %02x %02x %02x '%c%c%c%c'\n", str, buf[0], buf[1], buf[2], buf[3], in test_read_header_and_entity()
1254 buf[0], buf[1], buf[2], buf[3]); in test_read_header_and_entity()
[all …]
/aosp14/frameworks/base/tools/powermodel/src/com/android/powermodel/
H A DCsvParser.java60 final byte[] buf = new byte[MAX_FIELD_SIZE+1]; in parse()
70 int amt = input.read(buf, readPos, buf.length-readPos); in parse()
86 byte c = buf[index]; in parse()
96 fields.add(new String(buf, fieldStart, index-fieldStart)); in parse()
114 buf[escapeIndex] = buf[index]; in parse()
128 buf[escapeIndex] = buf[index]; in parse()
135 fields.add(new String(buf, fieldStart, index-fieldStart)); in parse()
149 if (fieldStart == 0 && index == buf.length) { in parse()
151 + new String(buf, 0, 20, utf8) + "..."); in parse()
158 System.arraycopy(buf, fieldStart, buf, 0, readPos); in parse()
[all …]
/aosp14/system/core/libcutils/
H A Dpartition_utils.cpp28 static int only_one_char(uint8_t *buf, int len, uint8_t c) in only_one_char() argument
34 if (buf[i] != c) { in only_one_char()
43 uint8_t buf[4096]; in partition_wiped() local
50 ret = read(fd, buf, sizeof(buf)); in partition_wiped()
53 if (ret != sizeof(buf)) { in partition_wiped()
58 if (only_one_char(buf, sizeof(buf), 0)) { in partition_wiped()
63 if (only_one_char(buf, sizeof(buf), 0xff)) { in partition_wiped()
H A Dashmem-host.cpp37 static bool ashmem_validate_stat(int fd, struct stat* buf) { in ashmem_validate_stat() argument
38 int result = fstat(fd, buf); in ashmem_validate_stat()
48 if (!(buf->st_nlink == 0 && S_ISREG(buf->st_mode))) { in ashmem_validate_stat()
56 struct stat buf; in ashmem_valid() local
57 return ashmem_validate_stat(fd, &buf); in ashmem_valid()
90 struct stat buf; in ashmem_get_size_region() local
91 if (!ashmem_validate_stat(fd, &buf)) { in ashmem_get_size_region()
95 return buf.st_size; in ashmem_get_size_region()
H A Dfs.cpp134 char buf[BUF_SIZE]; in fs_read_atomic_int() local
135 if (TEMP_FAILURE_RETRY(read(fd, buf, BUF_SIZE)) == -1) { in fs_read_atomic_int()
139 if (sscanf(buf, "%d", out_value) != 1) { in fs_read_atomic_int()
165 char buf[BUF_SIZE]; in fs_write_atomic_int() local
166 int len = snprintf(buf, BUF_SIZE, "%d", value) + 1; in fs_write_atomic_int()
171 if (TEMP_FAILURE_RETRY(write(fd, buf, len)) < len) { in fs_write_atomic_int()
210 char* buf = strdup(path); in fs_mkdirs() local
211 char* segment = buf + 1; in fs_mkdirs()
218 ALOGE("Invalid path: %s", buf); in fs_mkdirs()
242 ALOGE("Symbolic links are not allowed: %s", buf); in fs_mkdirs()
[all …]
/aosp14/frameworks/base/core/tests/coretests/src/android/content/
H A DMemoryFileProviderTest.java40 byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length]; in testRead()
43 int count = in.read(buf); in testRead()
44 assertEquals(buf.length, count); in testRead()
47 assertTrue(Arrays.equals(MemoryFileProvider.TEST_BLOB, buf)); in testRead()
60 byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length]; in testClose()
61 int count = in.read(buf); in testClose()
62 assertEquals(buf.length, count); in testClose()
73 byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length]; in testFile()
76 int count = in.read(buf); in testFile()
77 assertEquals(buf.length, count); in testFile()
[all …]
/aosp14/system/core/libsysutils/src/
H A DSocketClient.cpp78 char *buf; in sendMsg() local
96 ret = sendMsg(buf); in sendMsg()
97 free(buf); in sendMsg()
106 char buf[8]; in sendBinaryMsg() local
108 snprintf(buf, 4, "%.3d", code); in sendBinaryMsg()
111 memcpy(buf + 4, &tmp, sizeof(uint32_t)); in sendBinaryMsg()
114 vec[0].iov_base = (void *) buf; in sendBinaryMsg()
115 vec[0].iov_len = sizeof(buf); in sendBinaryMsg()
128 char buf[4]; in sendCode() local
129 snprintf(buf, sizeof(buf), "%.3d", code); in sendCode()
[all …]
/aosp14/frameworks/base/tests/CoreTests/android/core/
H A DTestWebServer.java329 byte[] buf; field in TestWebServer.Worker
356 buf = new byte[BUF_SIZE]; in Worker()
426 buf[i] = 0; in clearBuffer()
510 if (buf[0] == (byte)'G' && in parseStatusLine()
511 buf[1] == (byte)'E' && in parseStatusLine()
512 buf[2] == (byte)'T' && in parseStatusLine()
513 buf[3] == (byte)' ') { in parseStatusLine()
545 if ((buf[i] == (byte)'\n') || (buf[i] == (byte)'\r')) { in parseStatusLine()
580 while (buf[i] != (byte)':') { in parseHeader()
583 if ((buf[i] == (byte)'\n') || (buf[i] == (byte)'\r')) { in parseHeader()
[all …]
/aosp14/frameworks/base/libs/androidfw/include/androidfw/
H A DObbFile.h106 static inline uint32_t get4LE(const unsigned char* buf) { in get4LE() argument
107 return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); in get4LE()
110 static inline void put4LE(unsigned char* buf, uint32_t val) { in put4LE() argument
111 buf[0] = val & 0xFF; in put4LE()
112 buf[1] = (val >> 8) & 0xFF; in put4LE()
113 buf[2] = (val >> 16) & 0xFF; in put4LE()
114 buf[3] = (val >> 24) & 0xFF; in put4LE()
/aosp14/frameworks/base/core/jni/
H A Dandroid_hardware_SerialPort.cpp172 jbyte* buf = (jbyte *)malloc(length); in android_hardware_SerialPort_read_array() local
173 if (!buf) { in android_hardware_SerialPort_read_array()
178 int ret = read(fd, buf, length); in android_hardware_SerialPort_read_array()
184 free(buf); in android_hardware_SerialPort_read_array()
196 if (!buf) { in android_hardware_SerialPort_read_direct()
201 int ret = read(fd, buf, length); in android_hardware_SerialPort_read_direct()
212 if (!buf) { in android_hardware_SerialPort_write_array()
218 jint ret = write(fd, buf, length); in android_hardware_SerialPort_write_array()
219 free(buf); in android_hardware_SerialPort_write_array()
230 if (!buf) { in android_hardware_SerialPort_write_direct()
[all …]
/aosp14/frameworks/base/libs/protoutil/src/
H A Dprotobuf.cpp46 write_raw_varint(uint8_t* buf, uint64_t val) in write_raw_varint() argument
48 uint8_t* p = buf; in write_raw_varint()
61 write_length_delimited_tag_header(uint8_t* buf, uint32_t fieldId, size_t size) in write_length_delimited_tag_header() argument
63 buf = write_raw_varint(buf, (fieldId << FIELD_ID_SHIFT) | WIRE_TYPE_LENGTH_DELIMITED); in write_length_delimited_tag_header()
64 buf = write_raw_varint(buf, size); in write_length_delimited_tag_header()
65 return buf; in write_length_delimited_tag_header()
/aosp14/system/core/libsparse/
H A Dsparse_read.cpp128 char* buf; member in SparseFileBufSource
142 this->buf = buf; in SparseFileBufSource()
154 buf += off; in Seek()
181 buf += len; in ReadValue()
192 buf += len; in GetCrc32()
468 if (!buf) { in do_sparse_file_read_normal()
483 if (buf[0] != buf[i]) { in do_sparse_file_read_normal()
511 if (!buf) in sparse_file_read_normal()
515 free(buf); in sparse_file_read_normal()
526 if (!buf) { in sparse_file_read_hole()
[all …]
/aosp14/frameworks/base/core/java/android/util/jar/
H A DStrictJarManifestReader.java38 private final byte[] buf; field in StrictJarManifestReader
50 public StrictJarManifestReader(byte[] buf, Attributes main) throws IOException { in StrictJarManifestReader() argument
51 this.buf = buf; in StrictJarManifestReader()
117 while (pos < buf.length) { in readName()
118 if (buf[pos++] != ':') { in readName()
122 String nameString = new String(buf, mark, pos - mark - 1, StandardCharsets.US_ASCII); in readName()
124 if (buf[pos++] != ' ') { in readName()
147 while (pos < buf.length) { in readValue()
148 byte next = buf[pos++]; in readValue()
165 valueBuffer.write(buf, mark, last - mark); in readValue()
[all …]
/aosp14/frameworks/base/services/core/java/com/android/server/am/
H A DNativeCrashListener.java173 static int unpackInt(byte[] buf, int offset) { in unpackInt() argument
177 b1 = ((int) buf[offset+1]) & 0xFF; in unpackInt()
178 b2 = ((int) buf[offset+2]) & 0xFF; in unpackInt()
179 b3 = ((int) buf[offset+3]) & 0xFF; in unpackInt()
203 final byte[] buf = new byte[4096]; in consumeNativeCrashData()
221 int headerBytes = readExactly(fd, buf, 0, 9); in consumeNativeCrashData()
228 int pid = unpackInt(buf, 0); in consumeNativeCrashData()
229 int signal = unpackInt(buf, 4); in consumeNativeCrashData()
261 bytes = Os.read(fd, buf, 0, buf.length); in consumeNativeCrashData()
268 if (buf[bytes - 1] == 0) { in consumeNativeCrashData()
[all …]

12345678910>>...13