| Index: tools/json_schema_compiler/cc_generator.py
|
| diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py
|
| index 1d243f03b5ad30fc582e4fb5083a2367eefe1cb7..a17217c24054d1b18b0c995a8ea87b9783dc3a33 100644
|
| --- a/tools/json_schema_compiler/cc_generator.py
|
| +++ b/tools/json_schema_compiler/cc_generator.py
|
| @@ -160,7 +160,7 @@ class _Generator(object):
|
| items.append('%s(false)' % prop.unix_name)
|
| elif (t.property_type == PropertyType.ANY or
|
| t.property_type == PropertyType.ARRAY or
|
| - t.property_type == PropertyType.BINARY or # mapped to std::string
|
| + t.property_type == PropertyType.BINARY or
|
| t.property_type == PropertyType.CHOICES or
|
| t.property_type == PropertyType.OBJECT or
|
| t.property_type == PropertyType.FUNCTION or
|
| @@ -817,13 +817,14 @@ class _Generator(object):
|
| .Append(' static_cast<const base::BinaryValue*>(%(src_var)s);')
|
| )
|
| if is_ptr:
|
| - (c.Append('%(dst_var)s.reset(')
|
| - .Append(' new std::string(binary_value->GetBuffer(),')
|
| - .Append(' binary_value->GetSize()));')
|
| + (c.Append('%(dst_var)s.reset(new std::vector<char>(')
|
| + .Append(' binary_value->GetBuffer(),')
|
| + .Append(' binary_value->GetBuffer() + binary_value->GetSize()));')
|
| )
|
| else:
|
| - (c.Append('%(dst_var)s.assign(binary_value->GetBuffer(),')
|
| - .Append(' binary_value->GetSize());')
|
| + (c.Append('%(dst_var)s.assign(')
|
| + .Append(' binary_value->GetBuffer(),')
|
| + .Append(' binary_value->GetBuffer() + binary_value->GetSize());')
|
| )
|
| c.Eblock('}')
|
| else:
|
|
|