Skip to content

Commit

Permalink
Fix encoding of ByteBuffer.append(long) > 16777216
Browse files Browse the repository at this point in the history
And use an easier code path for `ByteBuffer.appent(int)` too.
Closes #383.
  • Loading branch information
lapo-luchini authored Jun 23, 2020
1 parent ae70d26 commit 1e460d5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions openpdf/src/main/java/com/lowagie/text/pdf/ByteBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,18 @@ public ByteBuffer append(ByteBuffer buf) {
* @return a reference to this <CODE>ByteBuffer</CODE> object
*/
public ByteBuffer append(int i) {
return append((double)i);
return append(String.valueOf(i));
}


/**
* Appends the string representation of a <CODE>long</CODE>.
* @param l the <CODE>long</CODE> to be appended
* @return a reference to this <CODE>ByteBuffer</CODE> object
*/
public ByteBuffer append(long l) {
return append(String.valueOf(l));
}

public ByteBuffer append(byte b) {
return append_i(b);
}
Expand Down

0 comments on commit 1e460d5

Please sign in to comment.