Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 546) 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.cpp51 unsigned char buf[4] = {0xee, 0xee, 0xee, 0xee}; in TEST_F() local
53 ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); in TEST_F()
54 ASSERT_EQ('e', buf[0]); in TEST_F()
55 ASSERT_EQ('f', buf[1]); in TEST_F()
56 ASSERT_EQ('g', buf[2]); in TEST_F()
57 ASSERT_EQ('h', buf[3]); in TEST_F()
61 unsigned char buf[2] = {0xee, 0xee}; in TEST_F() local
64 ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); in TEST_F()
65 ASSERT_EQ('c', buf[0]); in TEST_F()
66 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.cpp218 ANativeWindowBuffer* buf; in TEST_F() local
219 ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); in TEST_F()
220 EXPECT_EQ(1, buf->width); in TEST_F()
221 EXPECT_EQ(1, buf->height); in TEST_F()
222 EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); in TEST_F()
223 ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); in TEST_F()
228 ANativeWindowBuffer* buf; in TEST_F() local
231 ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); in TEST_F()
232 EXPECT_EQ(16, buf->width); in TEST_F()
233 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/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/libs/net/common/framework/com/android/net/module/util/
DIpUtils.java45 private static int checksum(ByteBuffer buf, int seed, int start, int end) { in checksum() argument
47 final int bufPosition = buf.position(); in checksum()
51 buf.position(start); in checksum()
52 ShortBuffer shortBuf = buf.asShortBuffer(); in checksum()
55 buf.position(bufPosition); in checksum()
65 short b = buf.get(start); in checksum()
82 ByteBuffer buf, int headerOffset, int protocol, int transportLen) { in pseudoChecksumIPv4() argument
84 partial += intAbs(buf.getShort(headerOffset + 12)); in pseudoChecksumIPv4()
85 partial += intAbs(buf.getShort(headerOffset + 14)); in pseudoChecksumIPv4()
86 partial += intAbs(buf.getShort(headerOffset + 16)); in pseudoChecksumIPv4()
[all …]
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 …]
/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/minikin/libs/minikin/
DLocale.cpp51 static bool isSubtag(const char* buf, size_t bufLen, const char* subtag, size_t subtagLen) { in isSubtag() argument
55 if (strncmp(buf, subtag, subtagLen) != 0) { in isSubtag()
58 return (bufLen == subtagLen || buf[subtagLen] == '\0' || buf[subtagLen] == '-' || in isSubtag()
59 buf[subtagLen] == '_'); in isSubtag()
230 void Locale::resolveUnicodeExtension(const char* buf, size_t length) { in resolveUnicodeExtension() argument
232 const char* pos = std::search(buf, buf + length, kPrefix, kPrefix + strlen(kPrefix)); in resolveUnicodeExtension()
233 if (pos != buf + length) { in resolveUnicodeExtension()
235 const size_t remainingLength = length - (pos - buf); in resolveUnicodeExtension()
243 LineBreakStyle Locale::resolveLineBreakStyle(const char* buf, size_t length) { in resolveLineBreakStyle() argument
249 const char* pos = std::search(buf, buf + length, kPrefix, kPrefix + strlen(kPrefix)); in resolveLineBreakStyle()
[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/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/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/MtpFfsHandleTest/
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/opt/telephony/src/java/com/android/internal/telephony/cat/
DResponseData.java44 public abstract void format(ByteArrayOutputStream buf); in format() argument
46 public static void writeLength(ByteArrayOutputStream buf, int length) { in writeLength() argument
51 buf.write(0x81); in writeLength()
53 buf.write(length); in writeLength()
67 public void format(ByteArrayOutputStream buf) { in format() argument
70 buf.write(tag); // tag in format()
71 buf.write(1); // length in format()
72 buf.write(mId); // identifier of item chosen in format()
106 public void format(ByteArrayOutputStream buf) { in format() argument
107 if (buf == null) { in format()
[all …]
/frameworks/base/libs/androidfw/
DZipUtils.cpp43 bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const override { 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 override { 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 override { in ReadAtOffset() argument
99 memcpy(buf, pos.unsafe_ptr(), len); in ReadAtOffset()
114 bool Append(uint8_t* buf, size_t bufSize) override { in Append() argument
119 memcpy(mOutput + mBytesWritten, buf, bufSize); in Append()
130 /*static*/ bool ZipUtils::inflateToBuffer(FILE* fp, void* buf, in inflateToBuffer() argument
134 BufferWriter writer(buf, uncompressedLen); in inflateToBuffer()
[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/native/libs/ui/
DHdrCapabilities.cpp40 int32_t* const buf = static_cast<int32_t*>(buffer); in flatten() local
41 reinterpret_cast<float&>(buf[0]) = mMaxLuminance; in flatten()
42 reinterpret_cast<float&>(buf[1]) = mMaxAverageLuminance; in flatten()
43 reinterpret_cast<float&>(buf[2]) = mMinLuminance; in flatten()
44 buf[3] = static_cast<int32_t>(mSupportedHdrTypes.size()); in flatten()
46 buf[4 + i] = static_cast<int32_t>(mSupportedHdrTypes[i]); in flatten()
62 int32_t const * const buf = static_cast<int32_t const *>(buffer); in unflatten() local
63 const size_t itemCount = size_t(buf[3]); in unflatten()
70 mMaxLuminance = reinterpret_cast<float const&>(buf[0]); in unflatten()
71 mMaxAverageLuminance = reinterpret_cast<float const&>(buf[1]); in unflatten()
[all …]
/frameworks/base/core/tests/coretests/src/android/content/
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()
63 assertTrue(Arrays.equals(MemoryFileProvider.TEST_BLOB, buf)); in testClose()
73 byte[] buf = new byte[MemoryFileProvider.TEST_BLOB.length]; in testFile()
76 int count = in.read(buf); in testFile()
[all …]
/frameworks/av/services/camera/libcameraservice/tests/
DNV12Compressor.h104 static bool checkStartOfFrame(uint8_t* buf) { in checkStartOfFrame() argument
105 return buf[0] == kMarker && buf[1] == kStartOfFrame; in checkStartOfFrame()
109 static bool checkJpegStart(uint8_t* buf) { in checkJpegStart() argument
110 return buf[0] == kMarker && buf[1] == kStartOfImage; in checkJpegStart()
114 static bool checkJpegEnd(uint8_t *buf) { in checkJpegEnd() argument
115 return buf[0] == kMarker && buf[1] == kEndOfImage; in checkJpegEnd()
120 static uint8_t checkJpegMarker(uint8_t *buf) { in checkJpegMarker() argument
121 return (buf[0] == kMarker) ? buf[1] : 0; in checkJpegMarker()
/frameworks/base/libs/androidfw/include/androidfw/
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()
/frameworks/base/libs/protoutil/src/
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()

12345678910>>...22