diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-13 15:12:21 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-13 15:12:21 +0000 |
| commit | aefb7b5797bf7c5b76f171d1ba4bb3861b21b5e7 (patch) | |
| tree | f7540f2b9770ee299d6829854c9610a958de1101 /codegen.py | |
| parent | 987931b0596907aaa795db118574d665df12469b (diff) | |
| parent | 22a7230bd868534aa4add9f3317334af70cd4495 (diff) | |
| download | rabbitmq-server-git-aefb7b5797bf7c5b76f171d1ba4bb3861b21b5e7.tar.gz | |
stable to default
Diffstat (limited to 'codegen.py')
| -rw-r--r-- | codegen.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/codegen.py b/codegen.py index 842549cf03..91fa115423 100644 --- a/codegen.py +++ b/codegen.py @@ -187,7 +187,7 @@ def genErl(spec): elif type == 'table': return p+'Len:32/unsigned, '+p+'Tab:'+p+'Len/binary' - def genFieldPostprocessing(packed): + def genFieldPostprocessing(packed, hasContent): for f in packed: type = erlType(f.domain) if type == 'bit': @@ -199,6 +199,10 @@ def genErl(spec): elif type == 'table': print " F%d = rabbit_binary_parser:parse_table(F%dTab)," % \ (f.index, f.index) + # We skip the check on content-bearing methods for + # speed. This is a sanity check, not a security thing. + elif type == 'shortstr' and not hasContent: + print " rabbit_binary_parser:assert_utf8(F%d)," % (f.index) else: pass @@ -214,7 +218,7 @@ def genErl(spec): restSeparator = '' recordConstructorExpr = '#%s{%s}' % (m.erlangName(), fieldMapList(m.arguments)) print "decode_method_fields(%s, <<%s>>) ->" % (m.erlangName(), binaryPattern) - genFieldPostprocessing(packedFields) + genFieldPostprocessing(packedFields, m.hasContent) print " %s;" % (recordConstructorExpr,) def genDecodeProperties(c): |
