Skip to content

Commit

Permalink
Merge branch 'master' into java-base64-bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat authored Aug 10, 2023
2 parents 0bda056 + 6ad6ce3 commit b34856c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/xdrgen/generators/java.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

module Xdrgen
module Generators

class Java < Xdrgen::Generators::Base

def generate
Expand Down Expand Up @@ -872,7 +871,7 @@ def decode_type(decl)
when AST::Typespecs::Bool ;
"stream.readInt() == 1 ? true : false"
when AST::Typespecs::String ;
"XdrString.decode(stream, #{decl.size})"
"XdrString.decode(stream, #{decl.size || 'Integer.MAX_VALUE'})"
when AST::Typespecs::Simple ;
"#{name decl.type.resolved_type}.decode(stream)"
when AST::Concerns::NestedDefinition ;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_java/struct.x/MyStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static MyStruct decode(XdrDataInputStream stream) throws IOException {
int someOpaquesize = 10;
decodedMyStruct.someOpaque = new byte[someOpaquesize];
stream.read(decodedMyStruct.someOpaque, 0, someOpaquesize);
decodedMyStruct.someString = XdrString.decode(stream, );
decodedMyStruct.someString = XdrString.decode(stream, Integer.MAX_VALUE);
decodedMyStruct.maxString = XdrString.decode(stream, 100);
return decodedMyStruct;
}
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_java/test.x/Str2.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
public static Str2 decode(XdrDataInputStream stream) throws IOException {
Str2 decodedStr2 = new Str2();
decodedStr2.str2 = XdrString.decode(stream, );
decodedStr2.str2 = XdrString.decode(stream, Integer.MAX_VALUE);
return decodedStr2;
}

Expand Down

0 comments on commit b34856c

Please sign in to comment.