pidl: use ndr_push_charset_to_null() when [to_null] keyword is used in IDL
authorGünther Deschner <gd@samba.org>
Mon, 23 Jan 2017 13:50:45 +0000 (14:50 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 24 Jan 2017 09:53:17 +0000 (10:53 +0100)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index 94f4855..87ef6ce 100644 (file)
@@ -636,7 +636,11 @@ sub ParseElementPushLevel
 
                        # Allow speedups for arrays of scalar types
                        if (is_charset_array($e,$l)) {
-                               $self->pidl("NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . mapTypeName($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));");
+                               if ($l->{IS_TO_NULL}) {
+                                       $self->pidl("NDR_CHECK(ndr_push_charset_to_null($ndr, $ndr_flags, $var_name, $length, sizeof(" . mapTypeName($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));");
+                               } else {
+                                       $self->pidl("NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . mapTypeName($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));");
+                               }
                                return;
                        } elsif (has_fast_array($e,$l)) {
                                $self->pidl("NDR_CHECK(ndr_push_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));");