Comment #4 on issue 302 by liuj...@google.com: Skip(count) fails when count offset >2^32 count type should be off_t, not int
http://code.google.com/p/protobuf/issues/detail?id=302

Well, for the java version, I think you mean the LimitedInputStream. That class has to use long to override its super class java.io.FilterInputStream;

If you take a look at the c.g.protobuf.CodedInputStream, it uses int32 for size type.
public void skipRawBytes(final int size) throws IOException

We cannot simply change the Skip() to accept int64 because:
1> In protobuf, we use "int" to describe buffer size, e.g. the constructor of CodedInputStream, PushLimit(), GetDirectBufferPointer(), etc. We cannot change Skip() to accept int64, while leaving others still expecting int32. Users may be confused by the inconsistent size type. Even if we change Skip() to int64, the rest of code will still assumes the underlying buffer size is within int32, which can cause potential problems. 2> ZeroCopyStream interface uses int32. Changing the interface function signature means we need to update all the implementation classes. We could do a large code refactoring inside google, but we cannot change code outside the company. Changing the interface may break existing opensource protobuf users. I believe there are many clients who implement ZeroCopyStream for their IO layer.

For your case, I think there are many workarounds. e.g. ensuring the chunk doesn't exceed int32max, and use ZeroCopyStream to operate on each chunk. Or maybe implement your own ZeroCopyStream, which ports large int operation to protobuf API.


--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to