Home
last modified time | relevance | path

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

12345678910>>...22

/frameworks/base/core/tests/coretests/src/android/os/
DRedactingFileDescriptorTest.java53 final byte[] buf = new byte[1_000_000]; in setUp()
54 Arrays.fill(buf, (byte) 64); in setUp()
55 out.write(buf); in setUp()
69 final byte[] buf = new byte[1_000]; in testSingleByte()
70 assertEquals(buf.length, Os.read(fd, buf, 0, buf.length)); in testSingleByte()
71 for (int i = 0; i < buf.length; i++) { in testSingleByte()
73 assertEquals(0, buf[i]); in testSingleByte()
75 assertEquals(64, buf[i]); in testSingleByte()
85 final byte[] buf = new byte[10]; in testRanges()
86 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 90)); in testRanges()
[all …]
/frameworks/native/opengl/libs/EGL/
DBlobCache_test.cpp56 unsigned char buf[4] = { 0xee, 0xee, 0xee, 0xee }; in TEST_F() local
58 ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); in TEST_F()
59 ASSERT_EQ('e', buf[0]); in TEST_F()
60 ASSERT_EQ('f', buf[1]); in TEST_F()
61 ASSERT_EQ('g', buf[2]); in TEST_F()
62 ASSERT_EQ('h', buf[3]); in TEST_F()
66 unsigned char buf[2] = { 0xee, 0xee }; in TEST_F() local
69 ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); in TEST_F()
70 ASSERT_EQ('c', buf[0]); in TEST_F()
71 ASSERT_EQ('d', buf[1]); in TEST_F()
[all …]
DFileBlobCache.cpp34 static uint32_t crc32c(const uint8_t* buf, size_t len) { in crc32c() argument
38 r ^= buf[i]; in crc32c()
82 uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(nullptr, fileSize, in FileBlobCache() local
84 if (buf == MAP_FAILED) { in FileBlobCache()
93 if (memcmp(buf, cacheFileMagic, 4) != 0) { in FileBlobCache()
98 uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4); in FileBlobCache()
99 if (crc32c(buf + headerSize, cacheSize) != *crc) { in FileBlobCache()
105 int err = unflatten(buf + headerSize, cacheSize); in FileBlobCache()
109 munmap(buf, fileSize); in FileBlobCache()
114 munmap(buf, fileSize); in FileBlobCache()
[all …]
/frameworks/native/libs/gui/tests/
DSurfaceTextureClient_test.cpp220 ANativeWindowBuffer* buf; in TEST_F() local
221 ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); in TEST_F()
222 EXPECT_EQ(1, buf->width); in TEST_F()
223 EXPECT_EQ(1, buf->height); in TEST_F()
224 EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); in TEST_F()
225 ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); in TEST_F()
230 ANativeWindowBuffer* buf; in TEST_F() local
233 ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); in TEST_F()
234 EXPECT_EQ(16, buf->width); in TEST_F()
235 EXPECT_EQ(8, buf->height); in TEST_F()
[all …]
DCpuConsumer_test.cpp167 void checkPixel(const CpuConsumer::LockedBuffer &buf, in checkPixel() argument
170 switch(buf.format) { in checkPixel()
173 uint16_t *bPtr = (uint16_t*)buf.data; in checkPixel()
174 bPtr += y * buf.stride + x; in checkPixel()
192 uint8_t *bPtr = (uint8_t*)buf.data; in checkPixel()
193 bPtr += y * buf.stride + x; in checkPixel()
200 uint16_t *bPtr = ((uint16_t*)buf.data) + y * buf.stride + x; in checkPixel()
207 uint8_t *bPtr = (uint8_t*)buf.data; in checkPixel()
208 bPtr += (y * buf.stride + x) * bytesPerPixel; in checkPixel()
216 ADD_FAILURE() << "Unknown format for check:" << buf.format; in checkPixel()
[all …]
DFillBuffer.cpp25 void fillYV12Buffer(uint8_t* buf, int w, int h, int stride) { in fillYV12Buffer() argument
39 buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity; in fillYV12Buffer()
41 buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity; in fillYV12Buffer()
43 buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] = in fillYV12Buffer()
44 buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] = in fillYV12Buffer()
45 buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] = in fillYV12Buffer()
46 buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] = in fillYV12Buffer()
54 void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride, in fillYV12BufferRect() argument
66 buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = inside ? 240 : 64; in fillYV12BufferRect()
70 buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = 16; in fillYV12BufferRect()
[all …]
/frameworks/ml/nn/driver/cache/nnCache/
DnnCache_test.cpp62 uint8_t buf[4] = {0xee, 0xee, 0xee, 0xee}; in TEST_P() local
64 ASSERT_EQ(0, mCache->getBlob("abcd", 4, buf, 4)); in TEST_P()
65 ASSERT_EQ(0xee, buf[0]); in TEST_P()
66 ASSERT_EQ(0xee, buf[1]); in TEST_P()
67 ASSERT_EQ(0xee, buf[2]); in TEST_P()
68 ASSERT_EQ(0xee, buf[3]); in TEST_P()
72 uint8_t buf[4] = {0xee, 0xee, 0xee, 0xee}; in TEST_P() local
75 ASSERT_EQ(4, mCache->getBlob("abcd", 4, buf, 4)); in TEST_P()
76 ASSERT_EQ('e', buf[0]); in TEST_P()
77 ASSERT_EQ('f', buf[1]); in TEST_P()
[all …]
/frameworks/ml/nn/driver/cache/BlobCache/
DBlobCache_test.cpp67 unsigned char buf[4] = {0xee, 0xee, 0xee, 0xee}; in TEST_P() local
69 ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); in TEST_P()
70 ASSERT_EQ('e', buf[0]); in TEST_P()
71 ASSERT_EQ('f', buf[1]); in TEST_P()
72 ASSERT_EQ('g', buf[2]); in TEST_P()
73 ASSERT_EQ('h', buf[3]); in TEST_P()
77 unsigned char buf[2] = {0xee, 0xee}; in TEST_P() local
80 ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); in TEST_P()
81 ASSERT_EQ('c', buf[0]); in TEST_P()
82 ASSERT_EQ('d', buf[1]); in TEST_P()
[all …]
/frameworks/native/opengl/tests/EGLTest/
Degl_cache_test.cpp48 uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; in TEST_F() local
50 ASSERT_EQ(0, mCache->getBlob("abcd", 4, buf, 4)); in TEST_F()
51 ASSERT_EQ(0xee, buf[0]); in TEST_F()
52 ASSERT_EQ(0xee, buf[1]); in TEST_F()
53 ASSERT_EQ(0xee, buf[2]); in TEST_F()
54 ASSERT_EQ(0xee, buf[3]); in TEST_F()
58 uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; in TEST_F() local
61 ASSERT_EQ(4, mCache->getBlob("abcd", 4, buf, 4)); in TEST_F()
62 ASSERT_EQ('e', buf[0]); in TEST_F()
63 ASSERT_EQ('f', buf[1]); in TEST_F()
[all …]
/frameworks/base/core/java/android/net/util/
DIpUtils.java46 private static int checksum(ByteBuffer buf, int seed, int start, int end) { in checksum() argument
48 final int bufPosition = buf.position(); in checksum()
52 buf.position(start); in checksum()
53 ShortBuffer shortBuf = buf.asShortBuffer(); in checksum()
56 buf.position(bufPosition); in checksum()
66 short b = buf.get(start); in checksum()
83 ByteBuffer buf, int headerOffset, int protocol, int transportLen) { in pseudoChecksumIPv4() argument
85 partial += intAbs(buf.getShort(headerOffset + 12)); in pseudoChecksumIPv4()
86 partial += intAbs(buf.getShort(headerOffset + 14)); in pseudoChecksumIPv4()
87 partial += intAbs(buf.getShort(headerOffset + 16)); in pseudoChecksumIPv4()
[all …]
/frameworks/minikin/libs/minikin/
DLocale.cpp39 static bool isSubtag(const char* buf, size_t bufLen, const char* subtag, size_t subtagLen) { in isSubtag() argument
43 if (strncmp(buf, subtag, subtagLen) != 0) { in isSubtag()
46 return (bufLen == subtagLen || buf[subtagLen] == '\0' || buf[subtagLen] == '-' || in isSubtag()
47 buf[subtagLen] == '_'); in isSubtag()
218 void Locale::resolveUnicodeExtension(const char* buf, size_t length) { in resolveUnicodeExtension() argument
220 const char* pos = std::search(buf, buf + length, kPrefix, kPrefix + strlen(kPrefix)); in resolveUnicodeExtension()
221 if (pos != buf + length) { in resolveUnicodeExtension()
223 const size_t remainingLength = length - (pos - buf); in resolveUnicodeExtension()
231 LineBreakStyle Locale::resolveLineBreakStyle(const char* buf, size_t length) { in resolveLineBreakStyle() argument
237 const char* pos = std::search(buf, buf + length, kPrefix, kPrefix + strlen(kPrefix)); in resolveLineBreakStyle()
[all …]
/frameworks/base/libs/protoutil/tests/
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 …]
/frameworks/base/tools/aapt/
DZipEntry.cpp388 unsigned char buf[kLFHLen]; in read() local
393 if (fread(buf, 1, kLFHLen, fp) != kLFHLen) { in read()
398 if (ZipEntry::getLongLE(&buf[0x00]) != kSignature) { in read()
404 mVersionToExtract = ZipEntry::getShortLE(&buf[0x04]); in read()
405 mGPBitFlag = ZipEntry::getShortLE(&buf[0x06]); in read()
406 mCompressionMethod = ZipEntry::getShortLE(&buf[0x08]); in read()
407 mLastModFileTime = ZipEntry::getShortLE(&buf[0x0a]); in read()
408 mLastModFileDate = ZipEntry::getShortLE(&buf[0x0c]); in read()
409 mCRC32 = ZipEntry::getLongLE(&buf[0x0e]); in read()
410 mCompressedSize = ZipEntry::getLongLE(&buf[0x12]); in read()
[all …]
DZipEntry.h117 static inline unsigned short getShortLE(const unsigned char* buf) { in getShortLE() argument
118 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()
[all …]
/frameworks/base/packages/DynamicSystemInstallationService/src/com/android/dynsystem/
DSparseInputStream.java56 byte[] buf = new byte[size]; in readFull()
58 if ((n = in.read(buf, done, size - done)) < 0) { in readFull()
62 return buf; in readFull()
71 ByteBuffer buf = readBuffer(in, CHUNK_HDR_SIZE); in readChunk() local
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()
91 ByteBuffer buf = readBuffer(mIn, FILE_HDR_SIZE); in SparseInputStream() local
92 mIsSparse = (buf.getInt() == 0xed26ff3a); in SparseInputStream()
[all …]
/frameworks/minikin/tests/unittest/
DWordBreakerTests.cpp36 uint16_t buf[] = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; in TEST() local
38 breaker.setText(buf, NELEM(buf)); in TEST()
45 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end in TEST()
53 uint16_t buf[] = {'h', 'e', 'l', 0x00AD, 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; in TEST() local
55 breaker.setText(buf, NELEM(buf)); in TEST()
62 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end in TEST()
70 uint16_t buf[] = {'s', 'u', 'g', 'a', 'r', '-', 'f', 'r', 'e', 'e'}; in TEST() local
72 breaker.setText(buf, NELEM(buf)); in TEST()
74 EXPECT_EQ((ssize_t)NELEM(buf), breaker.followingWithLocale(Locale("en-US"), 0)); in TEST()
76 EXPECT_EQ((ssize_t)NELEM(buf), breaker.wordEnd()); in TEST()
[all …]
/frameworks/av/media/mtp/tests/
DMtpFfsHandle_test.cpp120 char buf[TEST_PACKET_SIZE + 1]; in TYPED_TEST() local
121 buf[TEST_PACKET_SIZE] = '\0'; in TYPED_TEST()
122 EXPECT_EQ(this->handle->read(buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE); in TYPED_TEST()
123 EXPECT_STREQ(buf, dummyDataStr.c_str()); in TYPED_TEST()
129 char buf[size + 1]; in TYPED_TEST() local
130 buf[size] = '\0'; in TYPED_TEST()
136 EXPECT_EQ(this->handle->read(buf, size), size); in TYPED_TEST()
138 EXPECT_STREQ(buf, ss.str().c_str()); in TYPED_TEST()
142 char buf[TEST_PACKET_SIZE + 1]; in TYPED_TEST() local
143 buf[TEST_PACKET_SIZE] = '\0'; in TYPED_TEST()
[all …]
/frameworks/compile/libbcc/bcinfo/include/bcinfo/Wrap/
DBCHeaderField.h48 bool Write(uint8_t* buf, size_t buf_len) { in Write() argument
57 WriteFixedSubfield(static_cast<FixedSubfield>(ID_), buf); in Write()
59 buf + sizeof(FixedSubfield)); in Write()
60 memcpy(buf + kTagLenSize, data_, len_); in Write()
63 memset(buf + fields_len, 0, pad_len); in Write()
68 bool Read(const uint8_t* buf, size_t buf_len) { in Read() argument
71 ReadFixedSubfield(&field, buf); in Read()
73 ReadFixedSubfield(&field, buf + sizeof(FixedSubfield)); in Read()
76 memcpy(data_, buf + kTagLenSize, len_); in Read()
89 static size_t GetDataSizeFromSerialized(const uint8_t* buf) { in GetDataSizeFromSerialized() argument
[all …]
/frameworks/base/libs/androidfw/
DZipUtils.cpp43 bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const { in ReadAtOffset() argument
55 size_t read = fread(buf, 1, len, mFp); in ReadAtOffset()
74 bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const { in ReadAtOffset() argument
75 return android::base::ReadFullyAtOffset(mFd, buf, len, offset); in ReadAtOffset()
89 bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const { in ReadAtOffset() argument
94 memcpy(buf, mInput + offset, len); in ReadAtOffset()
109 bool Append(uint8_t* buf, size_t bufSize) override { in Append() argument
114 memcpy(mOutput + mBytesWritten, buf, bufSize); in Append()
125 /*static*/ bool ZipUtils::inflateToBuffer(FILE* fp, void* buf, in inflateToBuffer() argument
129 BufferWriter writer(buf, uncompressedLen); in inflateToBuffer()
[all …]
/frameworks/base/core/java/android/net/
DNattKeepalivePacketData.java67 ByteBuffer buf = ByteBuffer.allocate(length); in nattKeepalivePacket() local
68 buf.order(ByteOrder.BIG_ENDIAN); in nattKeepalivePacket()
69 buf.putShort((short) 0x4500); // IP version and TOS in nattKeepalivePacket()
70 buf.putShort((short) length); in nattKeepalivePacket()
71 buf.putInt(0); // ID, flags, offset in nattKeepalivePacket()
72 buf.put((byte) 64); // TTL in nattKeepalivePacket()
73 buf.put((byte) OsConstants.IPPROTO_UDP); in nattKeepalivePacket()
74 int ipChecksumOffset = buf.position(); in nattKeepalivePacket()
75 buf.putShort((short) 0); // IP checksum in nattKeepalivePacket()
76 buf.put(srcAddress.getAddress()); in nattKeepalivePacket()
[all …]
/frameworks/opt/telephony/src/java/com/android/internal/telephony/cat/
DResponseData.java43 public abstract void format(ByteArrayOutputStream buf); in format() argument
45 public static void writeLength(ByteArrayOutputStream buf, int length) { in writeLength() argument
50 buf.write(0x81); in writeLength()
52 buf.write(length); in writeLength()
66 public void format(ByteArrayOutputStream buf) { in format() argument
69 buf.write(tag); // tag in format()
70 buf.write(1); // length in format()
71 buf.write(mId); // identifier of item chosen in format()
105 public void format(ByteArrayOutputStream buf) { in format() argument
106 if (buf == null) { in format()
[all …]
/frameworks/base/tools/powermodel/src/com/android/powermodel/
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()
91 fields.add(new String(buf, fieldStart, escapeIndex-fieldStart)); in parse()
96 fields.add(new String(buf, fieldStart, index-fieldStart)); in parse()
114 buf[escapeIndex] = buf[index]; in parse()
122 fields.add(new String(buf, fieldStart, escapeIndex-fieldStart)); 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()
[all …]
/frameworks/base/services/net/java/android/net/
DTcpKeepalivePacketData.java119 ByteBuffer buf = ByteBuffer.allocate(length); in buildV4Packet() local
120 buf.order(ByteOrder.BIG_ENDIAN); in buildV4Packet()
121 buf.put((byte) 0x45); // IP version and IHL in buildV4Packet()
122 buf.put((byte) tcpDetails.tos); // TOS in buildV4Packet()
123 buf.putShort((short) length); in buildV4Packet()
124 buf.putInt(0x00004000); // ID, flags=DF, offset in buildV4Packet()
125 buf.put((byte) tcpDetails.ttl); // TTL in buildV4Packet()
126 buf.put((byte) OsConstants.IPPROTO_TCP); in buildV4Packet()
127 final int ipChecksumOffset = buf.position(); in buildV4Packet()
128 buf.putShort((short) 0); // IP checksum in buildV4Packet()
[all …]
/frameworks/native/libs/ui/
DHdrCapabilities.cpp44 int32_t* const buf = static_cast<int32_t*>(buffer); in flatten() local
45 reinterpret_cast<float&>(buf[0]) = mMaxLuminance; in flatten()
46 reinterpret_cast<float&>(buf[1]) = mMaxAverageLuminance; in flatten()
47 reinterpret_cast<float&>(buf[2]) = mMinLuminance; in flatten()
48 buf[3] = static_cast<int32_t>(mSupportedHdrTypes.size()); in flatten()
50 buf[4 + i] = static_cast<int32_t>(mSupportedHdrTypes[i]); in flatten()
66 int32_t const * const buf = static_cast<int32_t const *>(buffer); in unflatten() local
67 const size_t itemCount = size_t(buf[3]); in unflatten()
74 mMaxLuminance = reinterpret_cast<float const&>(buf[0]); in unflatten()
75 mMaxAverageLuminance = reinterpret_cast<float const&>(buf[1]); in unflatten()
[all …]
/frameworks/libs/net/common/framework/com/android/net/module/util/
DDnsPacket.java72 DnsHeader(@NonNull ByteBuffer buf) throws BufferUnderflowException { in DnsHeader() argument
73 id = Short.toUnsignedInt(buf.getShort()); in DnsHeader()
74 flags = Short.toUnsignedInt(buf.getShort()); in DnsHeader()
78 mRecordCount[i] = Short.toUnsignedInt(buf.getShort()); in DnsHeader()
124 DnsRecord(int recordType, @NonNull ByteBuffer buf) in DnsRecord() argument
126 dName = parseName(buf, 0 /* Parse depth */); in DnsRecord()
131 nsType = Short.toUnsignedInt(buf.getShort()); in DnsRecord()
132 nsClass = Short.toUnsignedInt(buf.getShort()); in DnsRecord()
135 ttl = Integer.toUnsignedLong(buf.getInt()); in DnsRecord()
136 final int length = Short.toUnsignedInt(buf.getShort()); in DnsRecord()
[all …]

12345678910>>...22