Skip to content

Commit

Permalink
Apply checkstyle to the build
Browse files Browse the repository at this point in the history
Please note that the build will fail at the moment due to various checkstyle
violations which should be fixed soon
  • Loading branch information
trustin committed Jan 11, 2012
1 parent c38e6c7 commit ebfc451
Show file tree
Hide file tree
Showing 188 changed files with 3,246 additions and 3,088 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,7 +5,7 @@
*.ipr
*.iws
.geany
*/target
/target
*/target
/reports
*/reports
Expand Down
Expand Up @@ -135,7 +135,7 @@ public void ensureWritableBytes(int writableBytes) {

@Override
public boolean getBoolean(int index) {
return (getByte(index) == 1);
return getByte(index) != 0;
}

@Override
Expand Down Expand Up @@ -278,7 +278,7 @@ public byte readByte() {

@Override
public boolean readBoolean() {
return (readByte() == 1);
return readByte() != 0;
}

@Override
Expand Down
Expand Up @@ -59,67 +59,67 @@ public ByteOrder order() {

@Override
public short getShort(int index) {
return (short) (array[index] << 8 | array[index+1] & 0xFF);
return (short) (array[index] << 8 | array[index + 1] & 0xFF);
}

@Override
public int getUnsignedMedium(int index) {
return (array[index] & 0xff) << 16 |
(array[index+1] & 0xff) << 8 |
(array[index+2] & 0xff) << 0;
return (array[index] & 0xff) << 16 |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 0;
}

@Override
public int getInt(int index) {
return (array[index] & 0xff) << 24 |
(array[index+1] & 0xff) << 16 |
(array[index+2] & 0xff) << 8 |
(array[index+3] & 0xff) << 0;
return (array[index] & 0xff) << 24 |
(array[index + 1] & 0xff) << 16 |
(array[index + 2] & 0xff) << 8 |
(array[index + 3] & 0xff) << 0;
}

@Override
public long getLong(int index) {
return ((long) array[index] & 0xff) << 56 |
((long) array[index+1] & 0xff) << 48 |
((long) array[index+2] & 0xff) << 40 |
((long) array[index+3] & 0xff) << 32 |
((long) array[index+4] & 0xff) << 24 |
((long) array[index+5] & 0xff) << 16 |
((long) array[index+6] & 0xff) << 8 |
((long) array[index+7] & 0xff) << 0;
return ((long) array[index] & 0xff) << 56 |
((long) array[index + 1] & 0xff) << 48 |
((long) array[index + 2] & 0xff) << 40 |
((long) array[index + 3] & 0xff) << 32 |
((long) array[index + 4] & 0xff) << 24 |
((long) array[index + 5] & 0xff) << 16 |
((long) array[index + 6] & 0xff) << 8 |
((long) array[index + 7] & 0xff) << 0;
}

@Override
public void setShort(int index, int value) {
array[index ] = (byte) (value >>> 8);
array[index+1] = (byte) (value >>> 0);
array[index] = (byte) (value >>> 8);
array[index + 1] = (byte) (value >>> 0);
}

@Override
public void setMedium(int index, int value) {
array[index ] = (byte) (value >>> 16);
array[index+1] = (byte) (value >>> 8);
array[index+2] = (byte) (value >>> 0);
array[index] = (byte) (value >>> 16);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 0);
}

@Override
public void setInt(int index, int value) {
array[index ] = (byte) (value >>> 24);
array[index+1] = (byte) (value >>> 16);
array[index+2] = (byte) (value >>> 8);
array[index+3] = (byte) (value >>> 0);
array[index] = (byte) (value >>> 24);
array[index + 1] = (byte) (value >>> 16);
array[index + 2] = (byte) (value >>> 8);
array[index + 3] = (byte) (value >>> 0);
}

@Override
public void setLong(int index, long value) {
array[index ] = (byte) (value >>> 56);
array[index+1] = (byte) (value >>> 48);
array[index+2] = (byte) (value >>> 40);
array[index+3] = (byte) (value >>> 32);
array[index+4] = (byte) (value >>> 24);
array[index+5] = (byte) (value >>> 16);
array[index+6] = (byte) (value >>> 8);
array[index+7] = (byte) (value >>> 0);
array[index] = (byte) (value >>> 56);
array[index + 1] = (byte) (value >>> 48);
array[index + 2] = (byte) (value >>> 40);
array[index + 3] = (byte) (value >>> 32);
array[index + 4] = (byte) (value >>> 24);
array[index + 5] = (byte) (value >>> 16);
array[index + 6] = (byte) (value >>> 8);
array[index + 7] = (byte) (value >>> 0);
}

@Override
Expand Down
Expand Up @@ -107,9 +107,9 @@ public short getShort(int index) {

@Override
public int getUnsignedMedium(int index) {
return (getByte(index) & 0xff) << 16 |
(getByte(index+1) & 0xff) << 8 |
(getByte(index+2) & 0xff) << 0;
return (getByte(index) & 0xff) << 16 |
(getByte(index + 1) & 0xff) << 8 |
(getByte(index + 2) & 0xff) << 0;
}

@Override
Expand Down Expand Up @@ -172,9 +172,9 @@ public void setShort(int index, int value) {

@Override
public void setMedium(int index, int value) {
setByte(index, (byte) (value >>> 16));
setByte(index+1, (byte) (value >>> 8));
setByte(index+2, (byte) (value >>> 0));
setByte(index, (byte) (value >>> 16));
setByte(index + 1, (byte) (value >>> 8));
setByte(index + 2, (byte) (value >>> 0));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion buffer/src/main/java/io/netty/buffer/ChannelBuffer.java
Expand Up @@ -47,7 +47,7 @@
*
* <pre>
* {@link ChannelBuffer} buffer = ...;
* for (int i = 0; i &lt; buffer.capacity(); i ++</strong>) {
* for (int i = 0; i &lt; buffer.capacity(); i ++) {
* byte b = buffer.getByte(i);
* System.out.println((char) b);
* }
Expand Down
8 changes: 6 additions & 2 deletions buffer/src/main/java/io/netty/buffer/ChannelBuffers.java
Expand Up @@ -84,7 +84,7 @@
* @apiviz.landmark
* @apiviz.has io.netty.buffer.ChannelBuffer oneway - - creates
*/
public class ChannelBuffers {
public final class ChannelBuffers {

/**
* Big endian byte order.
Expand Down Expand Up @@ -307,7 +307,11 @@ public static ChannelBuffer wrappedBuffer(ByteBuffer buffer) {
return EMPTY_BUFFER;
}
if (buffer.hasArray()) {
return wrappedBuffer(buffer.order(), buffer.array(), buffer.arrayOffset() + buffer.position(),buffer.remaining());
return wrappedBuffer(
buffer.order(),
buffer.array(),
buffer.arrayOffset() + buffer.position(),
buffer.remaining());
} else {
return new ByteBufferBackedChannelBuffer(buffer);
}
Expand Down
Expand Up @@ -347,7 +347,7 @@ public void setMedium(int index, int value) {
setByte(index + 2, (byte) value);
} else {
setShort(index , (short) value);
setByte (index + 2, (byte) (value >>> 16));
setByte(index + 2, (byte) (value >>> 16));
}
}

Expand Down
Expand Up @@ -57,9 +57,9 @@ public static ChannelBufferFactory getInstance(ByteOrder defaultEndianness) {
private final Object bigEndianLock = new Object();
private final Object littleEndianLock = new Object();
private final int preallocatedBufferCapacity;
private ChannelBuffer preallocatedBigEndianBuffer = null;
private ChannelBuffer preallocatedBigEndianBuffer;
private int preallocatedBigEndianBufferPosition;
private ChannelBuffer preallocatedLittleEndianBuffer = null;
private ChannelBuffer preallocatedLittleEndianBuffer;
private int preallocatedLittleEndianBufferPosition;

/**
Expand Down
Expand Up @@ -59,67 +59,67 @@ public ByteOrder order() {

@Override
public short getShort(int index) {
return (short) (array[index] & 0xFF | array[index+1] << 8);
return (short) (array[index] & 0xFF | array[index + 1] << 8);
}

@Override
public int getUnsignedMedium(int index) {
return (array[index ] & 0xff) << 0 |
(array[index+1] & 0xff) << 8 |
(array[index+2] & 0xff) << 16;
return (array[index] & 0xff) << 0 |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 16;
}

@Override
public int getInt(int index) {
return (array[index ] & 0xff) << 0 |
(array[index+1] & 0xff) << 8 |
(array[index+2] & 0xff) << 16 |
(array[index+3] & 0xff) << 24;
return (array[index] & 0xff) << 0 |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 16 |
(array[index + 3] & 0xff) << 24;
}

@Override
public long getLong(int index) {
return ((long) array[index] & 0xff) << 0 |
((long) array[index+1] & 0xff) << 8 |
((long) array[index+2] & 0xff) << 16 |
((long) array[index+3] & 0xff) << 24 |
((long) array[index+4] & 0xff) << 32 |
((long) array[index+5] & 0xff) << 40 |
((long) array[index+6] & 0xff) << 48 |
((long) array[index+7] & 0xff) << 56;
return ((long) array[index] & 0xff) << 0 |
((long) array[index + 1] & 0xff) << 8 |
((long) array[index + 2] & 0xff) << 16 |
((long) array[index + 3] & 0xff) << 24 |
((long) array[index + 4] & 0xff) << 32 |
((long) array[index + 5] & 0xff) << 40 |
((long) array[index + 6] & 0xff) << 48 |
((long) array[index + 7] & 0xff) << 56;
}

@Override
public void setShort(int index, int value) {
array[index ] = (byte) (value >>> 0);
array[index+1] = (byte) (value >>> 8);
array[index] = (byte) (value >>> 0);
array[index + 1] = (byte) (value >>> 8);
}

@Override
public void setMedium(int index, int value) {
array[index ] = (byte) (value >>> 0);
array[index+1] = (byte) (value >>> 8);
array[index+2] = (byte) (value >>> 16);
array[index] = (byte) (value >>> 0);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
}

@Override
public void setInt(int index, int value) {
array[index ] = (byte) (value >>> 0);
array[index+1] = (byte) (value >>> 8);
array[index+2] = (byte) (value >>> 16);
array[index+3] = (byte) (value >>> 24);
array[index] = (byte) (value >>> 0);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
array[index + 3] = (byte) (value >>> 24);
}

@Override
public void setLong(int index, long value) {
array[index ] = (byte) (value >>> 0);
array[index+1] = (byte) (value >>> 8);
array[index+2] = (byte) (value >>> 16);
array[index+3] = (byte) (value >>> 24);
array[index+4] = (byte) (value >>> 32);
array[index+5] = (byte) (value >>> 40);
array[index+6] = (byte) (value >>> 48);
array[index+7] = (byte) (value >>> 56);
array[index] = (byte) (value >>> 0);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
array[index + 3] = (byte) (value >>> 24);
array[index + 4] = (byte) (value >>> 32);
array[index + 5] = (byte) (value >>> 40);
array[index + 6] = (byte) (value >>> 48);
array[index + 7] = (byte) (value >>> 56);
}

@Override
Expand Down

0 comments on commit ebfc451

Please sign in to comment.