getting rid of utf8string2

2010-03-24 Thread Stefan (metze) Metzmacher
Hi Simo,


 diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h
 index e8b3da5..d763a8b 100644
 --- a/librpc/idl/idl_types.h
 +++ b/librpc/idl/idl_types.h
 @@ -48,9 +48,10 @@
  #define utf8string   [flag(STR_UTF8|STR_NULLTERM)] string
  
  /*
 -  an utf8 string prefixed with [size], 32 bits
 +  an utf8 string prefixed with [length], 32 bits

This should be [size] when you use STR_SIZE4...

 +  not null terminated
  */
 -#define utf8string2  [flag(STR_UTF8|STR_SIZE4)] string
 +#define utf8string2  [flag(STR_SIZE4|STR_UTF8|STR_NOTERM)] string

I'd like to get rid of this as you can express the same with valid NDR.

Something like:

[value(strlen(dns_name))] uint32 dns_name_size;
[charset(UTF8)] uint8 dns_name[dns_name_size];

should do the same.

Can you send me a file I can pass to ndrdump to test it?

metze

PS: It would be nice if you wouldn't introduce leading whitespaces in
the idl file...:-)



signature.asc
Description: OpenPGP digital signature


Re: getting rid of utf8string2

2010-03-24 Thread simo
On Wed, 2010-03-24 at 08:24 +0100, Stefan (metze) Metzmacher wrote:
 Hi Simo,
 
 
  diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h
  index e8b3da5..d763a8b 100644
  --- a/librpc/idl/idl_types.h
  +++ b/librpc/idl/idl_types.h
  @@ -48,9 +48,10 @@
   #define utf8string [flag(STR_UTF8|STR_NULLTERM)] string
   
   /*
  -  an utf8 string prefixed with [size], 32 bits
  +  an utf8 string prefixed with [length], 32 bits
 
 This should be [size] when you use STR_SIZE4...

Yeah, I was experimenting with STR_LEN4 and forgot to change it back.

  +  not null terminated
   */
  -#define utf8string2[flag(STR_UTF8|STR_SIZE4)] string
  +#define utf8string2[flag(STR_SIZE4|STR_UTF8|STR_NOTERM)] string
 
 I'd like to get rid of this as you can express the same with valid NDR.
 
 Something like:
 
 [value(strlen(dns_name))] uint32 dns_name_size;
 [charset(UTF8)] uint8 dns_name[dns_name_size];
 
 should do the same.

Yes, but it is extremely ugly, and adds artifacts (the size) in the
structure, what is the problem with this string type ?

 Can you send me a file I can pass to ndrdump to test it?

Attached

 PS: It would be nice if you wouldn't introduce leading whitespaces in
 the idl file...:-)

Ops sorry, I usually remove spaces, but forgot, I'll fix them and the
comment and commit.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer s...@samba.org
Principal Software Engineer at Red Hat, Inc. s...@redhat.com