Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2014-06-30 Thread Marc Gravell
The simple answer would be "use the existing oversized types, and cast at
the caller". Varint data in particular will either be 1 byte or 2 (50%
each) for byte values. For longer sequences (rgba etc) there are existing
fixed-32 and bytes.

If the intent is to add a wire type to precisely represent a byte: that is
hugely problematic. Adding a wire type is a significant thing, as:

- the numbers of wire types is strictly limited, and there isn't much spare
(unless the next wire type somehow means "check the next byte for the
longer wire type", or something)
- all existing clients, libraries and deployments would need updating to
even touch data with that wire type - it isn't even possible to ignore the
data if you don't understand the wire type.

Marc
On 30 Jun 2014 18:20,  wrote:

>
> Comment #4 on issue 269 by thecodem...@gmail.com: Would like to have byte
> or int8 type for the message definition
> http://code.google.com/p/protobuf/issues/detail?id=269
>
> I don't need a fixed length string; I want to encode RGB or RGBA data as 3
> or 4 bytes. I could pack them into an int32, but it seems like a byte type
> is a perfectly reasonable request.
>
> --
> You received this message because this project is configured to send all
> issue notifications to this address.
> You may adjust your notification preferences at:
> https://code.google.com/hosting/settings
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-04-04 Thread Feng Xiao


On Wednesday, March 13, 2013 7:36:18 PM UTC-7, Sumit Kumar wrote:
>
> Int32 and such will see endianness issues when exchanging messages 
> in-between cross-endian platforms hence only byte type suffices.
>
Not a problem when you are using protobufs.
 

>
> On how we achieve fixed length string support once byte type is supported 
> - Just create a message with specific number of byte elements and can name 
> it like fixed8String instead. Accessors can be added via simple plugin that 
> uses protoc insert point.
>
> Regards,
> Sumit Kumar
>
> On 13 Mar, 2013, at 8:38 PM, Giri Guntipalli 
> > 
> wrote:
>
> we need similar thing to hold binary data in proto message, where i can 
> not use string because binary data may have the null character in middle
>
>
> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, prot...@googlecode.comwrote:
>>
>>
>> Comment #3 on issue 269 by xiaof...@google.com: Would like to have byte 
>> or   
>> int8 type for the message definition 
>> http://code.google.com/p/protobuf/issues/detail?id=269 
>>
>> Re kumar.sumit: 
>> How are you going to use the byte field to implement a fixed length 
>> string?   
>> If byte can, why can't int32? 
>>
>>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to protobuf+u...@googlegroups.com .
> To post to this group, send email to prot...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-04-04 Thread Mario Luzeiro
+1 for int8 and uint8 sizes
>
>
>

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-03-14 Thread Oliver Jowett
On Thu, Mar 14, 2013 at 2:37 AM, Sumit Kumar wrote:

> No you cant, on C++ bytes translates to string, wont allow for null.
>

std::string handles NULs just fine, and protobuf's use of it for bytes
fields also works fine. (I have code that's been in production for a few
years that relies on this)

Oliver

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-03-14 Thread Ilia Mirkin
Really? AFAIK C++ strings handle null's just fine... they're
pascal-style strings, not c-style strings.

$ cat test.cc
#include 
#include 

int main() {
  std::string a("a\0b", 3);
  std::cout << a.size() << std::endl;
  return 0;
}
$ g++ -o test test.cc
$ ./test
3

Or are you saying that the decoder is buggy and somehow doesn't
actually populate the string object correctly?

On Wed, Mar 13, 2013 at 10:37 PM, Sumit Kumar  wrote:
> No you cant, on C++ bytes translates to string, wont allow for null.
>
> Regards,
> Sumit Kumar
>
> On 14 Mar, 2013, at 2:39 AM, Feng Xiao  wrote:
>
> You can just use bytes field.
>
> On Wed, Mar 13, 2013 at 5:38 AM, Giri Guntipalli 
> wrote:
>>
>> we need similar thing to hold binary data in proto message, where i can
>> not use string because binary data may have the null character in middle
>>
>>
>>
>> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, prot...@googlecode.com
>> wrote:
>>>
>>>
>>> Comment #3 on issue 269 by xiaof...@google.com: Would like to have byte
>>> or
>>> int8 type for the message definition
>>> http://code.google.com/p/protobuf/issues/detail?id=269
>>>
>>> Re kumar.sumit:
>>> How are you going to use the byte field to implement a fixed length
>>> string?
>>> If byte can, why can't int32?
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-03-14 Thread Sumit Kumar
No you cant, on C++ bytes translates to string, wont allow for null.

Regards,
Sumit Kumar

On 14 Mar, 2013, at 2:39 AM, Feng Xiao  wrote:

> You can just use bytes field.
> 
> On Wed, Mar 13, 2013 at 5:38 AM, Giri Guntipalli  
> wrote:
>> we need similar thing to hold binary data in proto message, where i can not 
>> use string because binary data may have the null character in middle
>> 
>> 
>> 
>> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, prot...@googlecode.com wrote:
>>> 
>>> 
>>> Comment #3 on issue 269 by xiaof...@google.com: Would like to have byte or  
>>>  
>>> int8 type for the message definition 
>>> http://code.google.com/p/protobuf/issues/detail?id=269 
>>> 
>>> Re kumar.sumit: 
>>> How are you going to use the byte field to implement a fixed length string? 
>>>   
>>> If byte can, why can't int32?
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-03-14 Thread Sumit Kumar
Int32 and such will see endianness issues when exchanging messages in-between 
cross-endian platforms hence only byte type suffices.

On how we achieve fixed length string support once byte type is supported - 
Just create a message with specific number of byte elements and can name it 
like fixed8String instead. Accessors can be added via simple plugin that uses 
protoc insert point.

Regards,
Sumit Kumar

On 13 Mar, 2013, at 8:38 PM, Giri Guntipalli  wrote:

> we need similar thing to hold binary data in proto message, where i can not 
> use string because binary data may have the null character in middle
> 
> 
> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, prot...@googlecode.com wrote:
>> 
>> 
>> Comment #3 on issue 269 by xiaof...@google.com: Would like to have byte or   
>> int8 type for the message definition 
>> http://code.google.com/p/protobuf/issues/detail?id=269 
>> 
>> Re kumar.sumit: 
>> How are you going to use the byte field to implement a fixed length string?  
>>  
>> If byte can, why can't int32?
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Re: [protobuf] Re: Issue 269 in protobuf: Would like to have byte or int8 type for the message definition

2013-03-13 Thread Feng Xiao
You can just use bytes field.

On Wed, Mar 13, 2013 at 5:38 AM, Giri Guntipalli
wrote:

> we need similar thing to hold binary data in proto message, where i can
> not use string because binary data may have the null character in middle
>
>
>
> On Tuesday, 29 January 2013 14:30:31 UTC+5:30, prot...@googlecode.comwrote:
>>
>>
>> Comment #3 on issue 269 by xiaof...@google.com: Would like to have byte
>> or
>> int8 type for the message definition
>> http://code.google.com/p/**protobuf/issues/detail?id=269
>>
>> Re kumar.sumit:
>> How are you going to use the byte field to implement a fixed length
>> string?
>> If byte can, why can't int32?
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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