Home
last modified time | relevance | path

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

12345678910

/packages/modules/NeuralNetworks/driver/cache/BlobCache/
DBlobCache_test.cpp66 unsigned char buf[4] = {0xee, 0xee, 0xee, 0xee}; in TEST_P() local
68 ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); in TEST_P()
69 ASSERT_EQ('e', buf[0]); in TEST_P()
70 ASSERT_EQ('f', buf[1]); in TEST_P()
71 ASSERT_EQ('g', buf[2]); in TEST_P()
72 ASSERT_EQ('h', buf[3]); in TEST_P()
76 unsigned char buf[2] = {0xee, 0xee}; in TEST_P() local
79 ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); in TEST_P()
80 ASSERT_EQ('c', buf[0]); in TEST_P()
81 ASSERT_EQ('d', buf[1]); in TEST_P()
[all …]
/packages/providers/MediaProvider/tests/src/com/android/providers/media/util/
DRedactingFileDescriptorTest.java59 final byte[] buf = new byte[1_000_000]; in setUp()
60 Arrays.fill(buf, (byte) 64); in setUp()
61 out.write(buf); in setUp()
82 final byte[] buf = new byte[1_000]; in testSingleByte()
83 assertEquals(buf.length, Os.read(fd, buf, 0, buf.length)); in testSingleByte()
84 for (int i = 0; i < buf.length; i++) { in testSingleByte()
86 assertEquals(0, buf[i]); in testSingleByte()
88 assertEquals(64, buf[i]); in testSingleByte()
98 final byte[] buf = new byte[10]; in testRanges()
99 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 90)); in testRanges()
[all …]
/packages/modules/NeuralNetworks/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 …]
DnnCache.cpp146 static uint32_t crc32c(const uint8_t* buf, size_t len) { in crc32c() argument
150 r ^= buf[i]; in crc32c()
190 uint8_t* buf = new uint8_t[fileSize]; in saveBlobCacheLocked() local
191 if (!buf) { in saveBlobCacheLocked()
198 int err = mBlobCache->flatten(buf + headerSize, cacheSize); in saveBlobCacheLocked()
201 delete[] buf; in saveBlobCacheLocked()
208 memcpy(buf, cacheFileMagic, 4); in saveBlobCacheLocked()
209 uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4); in saveBlobCacheLocked()
210 *crc = crc32c(buf + headerSize, cacheSize); in saveBlobCacheLocked()
212 if (write(fd, buf, fileSize) == -1) { in saveBlobCacheLocked()
[all …]
/packages/modules/Connectivity/tests/cts/hostside/app/src/com/android/cts/net/hostside/
DPacketReflector.java67 private static void swapBytes(byte[] buf, int pos1, int pos2, int len) { in swapBytes() argument
69 byte b = buf[pos1 + i]; in swapBytes()
70 buf[pos1 + i] = buf[pos2 + i]; in swapBytes()
71 buf[pos2 + i] = b; in swapBytes()
75 private static void swapAddresses(byte[] buf, int version) { in swapAddresses() argument
89 swapBytes(buf, addrPos, addrPos + addrLen, addrLen); in swapAddresses()
94 private void processTcpPacket(byte[] buf, int version, int len, int hdrLen) { in processTcpPacket() argument
100 swapAddresses(buf, version); in processTcpPacket()
103 writePacket(buf, len); in processTcpPacket()
108 private void processUdpPacket(byte[] buf, int version, int len, int hdrLen) { in processUdpPacket() argument
[all …]
/packages/modules/NetworkStack/src/android/net/dhcp/
DDhcpPacket.java494 Inet4Address srcIp, short destUdp, short srcUdp, ByteBuffer buf, in fillInPacket() argument
506 buf.clear(); in fillInPacket()
507 buf.order(ByteOrder.BIG_ENDIAN); in fillInPacket()
510 buf.put(ETHER_BROADCAST); in fillInPacket()
511 buf.put(mClientMac); in fillInPacket()
512 buf.putShort((short) OsConstants.ETH_P_IP); in fillInPacket()
519 ipHeaderOffset = buf.position(); in fillInPacket()
520 buf.put(IP_VERSION_HEADER_LEN); in fillInPacket()
521 buf.put(IP_TOS_LOWDELAY); // tos: IPTOS_LOWDELAY in fillInPacket()
522 ipLengthOffset = buf.position(); in fillInPacket()
[all …]
/packages/modules/Connectivity/tests/cts/net/jni/
DNativeDnsJni.c50 char buf[256]; in Java_android_net_cts_DnsTest_testNativeDns() local
53 buf, sizeof(buf)); in Java_android_net_cts_DnsTest_testNativeDns()
55 LOGD(" %s", buf); in Java_android_net_cts_DnsTest_testNativeDns()
58 buf, sizeof(buf)); in Java_android_net_cts_DnsTest_testNativeDns()
60 LOGD(" %s", buf); in Java_android_net_cts_DnsTest_testNativeDns()
83 char buf[256]; in Java_android_net_cts_DnsTest_testNativeDns() local
86 buf, sizeof(buf)); in Java_android_net_cts_DnsTest_testNativeDns()
87 LOGD(" %s", buf); in Java_android_net_cts_DnsTest_testNativeDns()
91 buf, sizeof(buf)); in Java_android_net_cts_DnsTest_testNativeDns()
92 LOGD(" %s", buf); in Java_android_net_cts_DnsTest_testNativeDns()
[all …]
DNativeMultinetworkJni.cpp76 int makeQuery(const char* name, int qtype, uint8_t* buf, size_t buflen) { in makeQuery() argument
77 return res_mkquery(ns_o_query, name, ns_c_in, qtype, NULL, 0, NULL, buf, buflen); in makeQuery()
80 int getAsyncResponse(JNIEnv* env, int fd, int timeoutMs, int* rcode, uint8_t* buf, size_t bufLen) { in getAsyncResponse() argument
85 int n = android_res_nresult(fd, rcode, buf, bufLen); in getAsyncResponse()
96 int extractIpAddressAnswers(uint8_t* buf, size_t bufLen, int family) { in extractIpAddressAnswers() argument
98 if (ns_initparse((const uint8_t*) buf, bufLen, &handle) < 0) { in extractIpAddressAnswers()
125 uint8_t buf[MAXPACKET] = {}; in expectAnswersValid() local
126 int res = getAsyncResponse(env, fd, TIMEOUT_MS, &rcode, buf, MAXPACKET); in expectAnswersValid()
134 return extractIpAddressAnswers(buf, res, family); in expectAnswersValid()
141 uint8_t buf[MAXPACKET] = {}; in expectAnswersNotValid() local
[all …]
/packages/modules/NetworkStack/common/netlinkclient/src/android/net/netlink/
DNduseroptMessage.java64 NduseroptMessage(@NonNull StructNlMsgHdr header, @NonNull ByteBuffer buf) in NduseroptMessage() argument
69 buf.order(ByteOrder.nativeOrder()); // Restored in the finally clause inside parse(). in NduseroptMessage()
70 final int start = buf.position(); in NduseroptMessage()
71 family = buf.get(); in NduseroptMessage()
72 buf.get(); // Skip 1 byte of padding. in NduseroptMessage()
73 opts_len = Short.toUnsignedInt(buf.getShort()); in NduseroptMessage()
74 ifindex = buf.getInt(); in NduseroptMessage()
75 icmp_type = buf.get(); in NduseroptMessage()
76 icmp_code = buf.get(); in NduseroptMessage()
77 buf.position(buf.position() + 6); // Skip 6 bytes of padding. in NduseroptMessage()
[all …]
DStructNdOptPref64.java110 private StructNdOptPref64(@NonNull ByteBuffer buf) { in StructNdOptPref64() argument
111 super(buf.get(), Byte.toUnsignedInt(buf.get())); in StructNdOptPref64()
115 int scaledLifetimePlc = Short.toUnsignedInt(buf.getShort()); in StructNdOptPref64()
119 buf.get(addressBytes, 0, 12); in StructNdOptPref64()
137 public static StructNdOptPref64 parse(@NonNull ByteBuffer buf) { in parse() argument
138 if (buf == null || buf.remaining() < STRUCT_SIZE) return null; in parse()
140 return new StructNdOptPref64(buf); in parse()
150 protected void writeToByteBuffer(ByteBuffer buf) { in writeToByteBuffer() argument
151 super.writeToByteBuffer(buf); in writeToByteBuffer()
152 buf.putShort(getScaledLifetimePlc(lifetime, prefixLengthToPlc(prefix.getPrefixLength()))); in writeToByteBuffer()
[all …]
DNdOption.java53 public static NdOption parse(ByteBuffer buf) { in parse() argument
54 if (buf == null || buf.remaining() < STRUCT_SIZE) return null; in parse()
57 byte type = buf.get(buf.position()); in parse()
58 int length = Byte.toUnsignedInt(buf.get(buf.position() + 1)); in parse()
63 return StructNdOptPref64.parse(buf); in parse()
66 int newPosition = Math.min(buf.limit(), buf.position() + length * 8); in parse()
67 buf.position(newPosition); in parse()
72 void writeToByteBuffer(ByteBuffer buf) { in writeToByteBuffer() argument
73 buf.put(type); in writeToByteBuffer()
74 buf.put((byte) length); in writeToByteBuffer()
/packages/modules/NetworkStack/tests/unit/src/android/net/netlink/
DNduseroptMessageTest.java94 ByteBuffer buf = toBuffer(hexBytes); in testParseWithinNetlinkMessage() local
95 assertEquals(68, buf.limit()); in testParseWithinNetlinkMessage()
96 buf.order(ByteOrder.nativeOrder()); in testParseWithinNetlinkMessage()
98 NetlinkMessage nlMsg = NetlinkMessage.parse(buf, NETLINK_ROUTE); in testParseWithinNetlinkMessage()
123 ByteBuffer buf = toBuffer(hexBytes); in testParseUnknownOptionWithinNetlinkMessage() local
124 assertEquals(76, buf.limit()); in testParseUnknownOptionWithinNetlinkMessage()
125 buf.order(ByteOrder.nativeOrder()); in testParseUnknownOptionWithinNetlinkMessage()
127 NetlinkMessage nlMsg = NetlinkMessage.parse(buf, NETLINK_ROUTE); in testParseUnknownOptionWithinNetlinkMessage()
139 ByteBuffer buf = toBuffer(MSG_PREF64); in testUnknownOption() local
142 assertEquals(38, buf.get(optionStart)); in testUnknownOption()
[all …]
DStructNdOptPref64Test.java74 ByteBuffer buf = ByteBuffer.allocate(16) in makeNdOptPref64() local
80 buf.flip(); in makeNdOptPref64()
81 return buf; in makeNdOptPref64()
106 ByteBuffer buf = makeNdOptPref64(600, prefixBytes(PREFIX1), 0); in testParsing() local
107 StructNdOptPref64 opt = StructNdOptPref64.parse(buf); in testParsing()
111 buf = makeNdOptPref64(0, prefixBytes(PREFIX1), 1); in testParsing()
112 opt = StructNdOptPref64.parse(buf); in testParsing()
116 buf = makeNdOptPref64(8, prefixBytes(PREFIX2), 2); in testParsing()
117 opt = StructNdOptPref64.parse(buf); in testParsing()
122 buf = makeNdOptPref64(65528, prefixBytes(PREFIX2), 5); in testParsing()
[all …]
/packages/modules/NetworkStack/common/networkstackclient/src/android/net/util/
DKeepalivePacketDataUtil.java129 ByteBuffer buf = ByteBuffer.allocate(length); in buildV4Packet() local
130 buf.order(ByteOrder.BIG_ENDIAN); in buildV4Packet()
131 buf.put((byte) 0x45); // IP version and IHL in buildV4Packet()
132 buf.put((byte) tcpDetails.tos); // TOS in buildV4Packet()
133 buf.putShort((short) length); in buildV4Packet()
134 buf.putInt(0x00004000); // ID, flags=DF, offset in buildV4Packet()
135 buf.put((byte) tcpDetails.ttl); // TTL in buildV4Packet()
136 buf.put((byte) OsConstants.IPPROTO_TCP); in buildV4Packet()
137 final int ipChecksumOffset = buf.position(); in buildV4Packet()
138 buf.putShort((short) 0); // IP checksum in buildV4Packet()
[all …]
/packages/modules/adb/client/
Dadb_install.cpp143 static void read_status_line(int fd, char* buf, size_t count) { in read_status_line() argument
146 int len = adb_read(fd, buf, count); in read_status_line()
151 buf += len; in read_status_line()
154 *buf = '\0'; in read_status_line()
248 char buf[BUFSIZ]; in install_app_streamed() local
249 read_status_line(remote_fd.get(), buf, sizeof(buf)); in install_app_streamed()
250 if (strncmp("Success", buf, 7) != 0) { in install_app_streamed()
251 fprintf(stderr, "adb: failed to install %s: %s", file, buf); in install_app_streamed()
255 fputs(buf, stdout); in install_app_streamed()
406 char buf[BUFSIZ] = {}; in calculate_install_mode() local
[all …]
/packages/modules/Connectivity/framework/src/android/net/
DNattKeepalivePacketData.java68 ByteBuffer buf = ByteBuffer.allocate(length); in nattKeepalivePacket() local
69 buf.order(ByteOrder.BIG_ENDIAN); in nattKeepalivePacket()
70 buf.putShort((short) 0x4500); // IP version and TOS in nattKeepalivePacket()
71 buf.putShort((short) length); in nattKeepalivePacket()
72 buf.putInt(0); // ID, flags, offset in nattKeepalivePacket()
73 buf.put((byte) 64); // TTL in nattKeepalivePacket()
74 buf.put((byte) OsConstants.IPPROTO_UDP); in nattKeepalivePacket()
75 int ipChecksumOffset = buf.position(); in nattKeepalivePacket()
76 buf.putShort((short) 0); // IP checksum in nattKeepalivePacket()
77 buf.put(srcAddress.getAddress()); in nattKeepalivePacket()
[all …]
/packages/modules/Connectivity/Tethering/tests/privileged/src/android/net/ip/
DDadProxyTest.java150 final ByteBuffer buf = ByteBuffer.allocate(icmpLen + IPV6_HEADER_LEN + ETH_HEADER_LEN); in createDadPacket() local
154 buf.put(srcMac.toByteArray()); in createDadPacket()
156 buf.put(dstMac.toByteArray()); in createDadPacket()
157 buf.putShort((short) ETHER_TYPE_IPV6); in createDadPacket()
161 buf.put(version); // Version in createDadPacket()
162 buf.putShort((byte) icmpLen); // Length in createDadPacket()
163 buf.put((byte) IPPROTO_ICMPV6); // Next header in createDadPacket()
164 buf.put((byte) 0xff); // Hop limit in createDadPacket()
177 buf.put(src); in createDadPacket()
178 buf.put(dst); in createDadPacket()
[all …]
/packages/apps/Gallery2/gallerycommon/src/com/android/gallery3d/common/
DBlobCache.java196 byte[] buf = mIndexHeader; in loadIndex()
197 if (mIndexFile.read(buf) != INDEX_HEADER_SIZE) { in loadIndex()
202 if (readInt(buf, IH_MAGIC) != MAGIC_INDEX_FILE) { in loadIndex()
207 if (readInt(buf, IH_VERSION) != mVersion) { in loadIndex()
212 mMaxEntries = readInt(buf, IH_MAX_ENTRIES); in loadIndex()
213 mMaxBytes = readInt(buf, IH_MAX_BYTES); in loadIndex()
214 mActiveRegion = readInt(buf, IH_ACTIVE_REGION); in loadIndex()
215 mActiveEntries = readInt(buf, IH_ACTIVE_ENTRIES); in loadIndex()
216 mActiveBytes = readInt(buf, IH_ACTIVE_BYTES); in loadIndex()
218 int sum = readInt(buf, IH_CHECKSUM); in loadIndex()
[all …]
/packages/modules/StatsD/tests/src/android/cts/statsd/atom/
DBufferDebug.java43 public static String debugString(byte[] buf, int max) { in debugString() argument
44 if (buf == null) { in debugString()
47 if (buf.length == 0) { in debugString()
52 if (len <= 0 || len > buf.length) { in debugString()
53 max = len = buf.length; in debugString()
56 if (isPrintable(buf, len)) { in debugString()
57 return "\"" + new String(buf, 0, len, StandardCharsets.UTF_8) + "\"\n"; in debugString()
59 return toHex(buf, len, max); in debugString()
63 private static String toHex(byte[] buf, int len, int max) { in toHex() argument
69 writeRow(str, buf, row * WIDTH, WIDTH, max); in toHex()
[all …]
/packages/modules/DnsResolver/
Dgethnamaddr.cpp99 uint8_t buf[MAXPACKET]; member
129 struct hostent* hent, char* buf, size_t buflen, int* he) { in getanswer() argument
149 eom = answer->buf + anslen; in getanswer()
171 bp = buf; in getanswer()
172 ep = buf + buflen; in getanswer()
173 cp = answer->buf; in getanswer()
177 n = dn_expand(answer->buf, eom, cp, bp, (int) (ep - bp)); in getanswer()
198 n = dn_expand(answer->buf, eom, cp, bp, (int) (ep - bp)); in getanswer()
219 n = dn_expand(answer->buf, eom, cp, tbuf, (int) sizeof tbuf); in getanswer()
246 n = dn_expand(answer->buf, eom, cp, tbuf, (int) sizeof tbuf); in getanswer()
[all …]
/packages/modules/StatsD/lib/libstatssocket/
Dstats_event.c70 uint8_t* buf; member
99 event->buf = (uint8_t*)calloc(event->bufSize, 1); in AStatsEvent_obtain()
101 event->buf[0] = OBJECT_TYPE; in AStatsEvent_obtain()
108 free(event->buf); in AStatsEvent_release()
126 memcpy(&event->buf[POS_TIMESTAMP + sizeof(uint8_t)], &timestampNs, sizeof(timestampNs)); in AStatsEvent_overwriteTimestamp()
149 event->buf = (uint8_t*)realloc(event->buf, event->bufSize); in overflows()
158 event->buf[event->numBytesWritten] = value; in append_byte()
169 memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value)); in append_int32()
176 memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value)); in append_int64()
183 memcpy(&event->buf[event->numBytesWritten], &value, sizeof(value)); in append_float()
[all …]
/packages/modules/Virtualization/authfs/src/file/
Dlocal_file.rs44 fn read_chunk(&self, chunk_index: u64, buf: &mut ChunkBuffer) -> io::Result<usize> { in read_chunk()
51 debug_assert!(read_size <= buf.len()); in read_chunk()
52 self.file.read_exact_at(&mut buf[..read_size], start)?; in read_chunk()
65 let mut buf = [0u8; 4096]; in test_read_4k_file() localVariable
66 let size = file_reader.read_chunk(0, &mut buf)?; in test_read_4k_file()
67 assert_eq!(size, buf.len()); in test_read_4k_file()
74 let mut buf = [0u8; 4096]; in test_read_4k1_file() localVariable
75 let size = file_reader.read_chunk(0, &mut buf)?; in test_read_4k1_file()
76 assert_eq!(size, buf.len()); in test_read_4k1_file()
77 let size = file_reader.read_chunk(1, &mut buf)?; in test_read_4k1_file()
[all …]
/packages/modules/adb/
Dadb_io_test.cpp54 char buf[sizeof(expected)] = {}; in POSIX_TEST() local
55 ASSERT_TRUE(ReadFdExactly(tf.fd, buf, sizeof(buf) - 1)) << strerror(errno); in POSIX_TEST()
56 EXPECT_STREQ(expected, buf); in POSIX_TEST()
68 char buf[sizeof(expected) + 1] = {}; in POSIX_TEST() local
69 ASSERT_FALSE(ReadFdExactly(tf.fd, buf, sizeof(buf))); in POSIX_TEST()
82 char buf[sizeof(input) - 1] = {}; in POSIX_TEST() local
83 ASSERT_TRUE(ReadFdExactly(tf.fd, buf, sizeof(buf) - 1)); in POSIX_TEST()
87 EXPECT_STREQ(expected.c_str(), buf); in POSIX_TEST()
106 const char buf[] = "Foobar"; in POSIX_TEST() local
111 ASSERT_TRUE(WriteFdExactly(tf.fd, buf, sizeof(buf) - 2)) << strerror(errno); in POSIX_TEST()
[all …]
Dsysdeps.h104 extern int adb_read(borrowed_fd fd, void* buf, int len);
105 extern int adb_pread(borrowed_fd fd, void* buf, int len, off64_t offset);
106 extern int adb_write(borrowed_fd fd, const void* buf, int len);
107 extern int adb_pwrite(borrowed_fd fd, const void* buf, int len, off64_t offset);
115 extern int adb_getlogin_r(char* buf, size_t bufsize);
125 extern int unix_read_interruptible(borrowed_fd fd, void* buf, size_t len);
128 static inline int unix_read(borrowed_fd fd, void* buf, size_t len) { in unix_read() argument
129 return TEMP_FAILURE_RETRY(unix_read_interruptible(fd, buf, len)); in unix_read()
139 static inline int unix_write(borrowed_fd fd, const void* buf, size_t len) { in unix_write() argument
140 return write(fd.get(), buf, len); in unix_write()
[all …]
/packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/
DCellBroadcastResources.java60 SpannableStringBuilder buf = new SpannableStringBuilder(); in getMessageDetails() local
62 appendMessageDetail(context, buf, R.string.delivery_time_heading, in getMessageDetails()
67 appendMessageDetail(context, buf, R.string.message_identifier, in getMessageDetails()
69 appendMessageDetail(context, buf, R.string.message_serial_number, in getMessageDetails()
75 appendCmasAlertDetails(context, buf, message.getCmasWarningInfo()); in getMessageDetails()
79 appendMessageDetail(context, buf, R.string.data_coding_scheme, in getMessageDetails()
82 appendMessageDetail(context, buf, R.string.message_content, message.getMessageBody()); in getMessageDetails()
84 appendMessageDetail(context, buf, R.string.location_check_time, locationCheckTime == -1 in getMessageDetails()
88 appendMessageDetail(context, buf, R.string.maximum_waiting_time, in getMessageDetails()
92 appendMessageDetail(context, buf, R.string.message_displayed, in getMessageDetails()
[all …]

12345678910