GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix component search fast path (#16548) · chrisvest/netty@2dce5e1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src
    • main/java/io/netty/buffer
      • CompositeByteBuf.java
    • test/java/io/netty/buffer
      • AbstractCompositeByteBufTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ private Component findComponentForRead(int offset) {
17011701
int cc = componentCount;
17021702
for (int next = lastAccessedIndex + 1; next < cc; next++) {
17031703
Component c = components[next];
1704-
if (c.endOffset > c.offset) {
1704+
if (offset < c.endOffset) {
17051705
lastAccessed = c;
17061706
lastAccessedIndex = next;
17071707
return c;
Collapse file

‎buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/AbstractCompositeByteBufTest.java
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,4 +1855,27 @@ public void componentSliceFromFlattenedCompositeShouldHaveCorrectView() {
18551855
}
18561856
}
18571857

1858+
@Test
1859+
public void testFindComponent() {
1860+
CompositeByteBuf composite = newCompositeBuffer();
1861+
1862+
ByteBuf b1 = newBuffer(10);
1863+
b1.writeByte('a');
1864+
composite.addComponent(true, b1);
1865+
1866+
ByteBuf b2 = newBuffer(10);
1867+
b2.writeByte('b');
1868+
composite.addComponent(true, b2);
1869+
1870+
ByteBuf b3 = newBuffer(10);
1871+
b3.writeByte('c');
1872+
composite.addComponent(true, b3);
1873+
1874+
assertEquals('a', composite.readByte());
1875+
composite.skipBytes(1);
1876+
assertEquals('c', composite.readByte());
1877+
1878+
composite.release();
1879+
}
1880+
18581881
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.