LCOV - code coverage report
Current view: top level - build/tests - generated_test_marshallers.c (source / functions) Hit Total Coverage
Test: out.info Lines: 26 60 43.3 %
Date: 2022-01-27 10:43:00 Functions: 4 8 50.0 %

          Line data    Source code
       1             : /* this is a file autogenerated by spice_codegen.py */
       2             : /*
       3             :   Copyright (C) 2013 Red Hat, Inc.
       4             : 
       5             :   This library is free software; you can redistribute it and/or
       6             :   modify it under the terms of the GNU Lesser General Public
       7             :   License as published by the Free Software Foundation; either
       8             :   version 2.1 of the License, or (at your option) any later version.
       9             : 
      10             :   This library is distributed in the hope that it will be useful,
      11             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :   Lesser General Public License for more details.
      14             : 
      15             :   You should have received a copy of the GNU Lesser General Public
      16             :   License along with this library; if not, see <http://www.gnu.org/licenses/>.
      17             : */
      18             : 
      19             : #include <config.h>
      20             : #include "test-marshallers.h"
      21             : #include <string.h>
      22             : #include <assert.h>
      23             : #include <stdlib.h>
      24             : #include <stdio.h>
      25             : #include <spice/protocol.h>
      26             : #include <spice/macros.h>
      27             : #include "common/marshaller.h"
      28             : 
      29             : #ifdef _MSC_VER
      30             : #pragma warning(disable:4101)
      31             : #pragma warning(disable:4018)
      32             : #endif
      33             : 
      34           1 : SPICE_GNUC_UNUSED static void spice_marshall_array_uint64(SpiceMarshaller *m, const uint64_t *ptr, unsigned count)
      35             : {
      36             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      37             :     uint32_t i;
      38             : 
      39           3 :     for (i = 0; i < count; i++) {
      40           2 :         spice_marshaller_add_uint64(m, *ptr++);
      41             :     }
      42           1 : }
      43             : 
      44           1 : void spice_marshall_msg_main_ShortDataSubMarshall(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgMainShortDataSubMarshall *msg)
      45             : {
      46             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      47             :     const SpiceMsgMainShortDataSubMarshall *src;
      48           1 :     src = (const SpiceMsgMainShortDataSubMarshall *)msg;
      49             : 
      50           1 :     spice_marshaller_add_uint8(m, src->dummy_byte);
      51           1 :     spice_marshaller_add_uint32(m, src->data_size);
      52           1 :     m2 = spice_marshaller_get_ptr_submarshaller(m);
      53           1 :     if (src->data != NULL) {
      54           1 :         spice_marshall_array_uint64(m2, src->data, src->data_size);
      55             :     }
      56           1 : }
      57             : 
      58           0 : void spice_marshall_msg_main_ArrayMessage(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgMainArrayMessage *msg)
      59             : {
      60             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      61           0 : }
      62             : 
      63           1 : void spice_marshall_msg_main_Zeroes(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgMainZeroes *msg)
      64             : {
      65             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      66             :     const SpiceMsgMainZeroes *src;
      67           1 :     src = (const SpiceMsgMainZeroes *)msg;
      68             : 
      69           1 :     spice_marshaller_add_uint8(m, 0);
      70           1 :     spice_marshaller_add_uint16(m, src->n);
      71           1 :     spice_marshaller_add_uint32(m, 0);
      72           1 : }
      73             : 
      74           1 : void spice_marshall_msg_main_channels_list(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgChannels *msg)
      75             : {
      76             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      77             :     const SpiceMsgChannels *src;
      78             :     const uint16_t *  channels__element;
      79             :     uint32_t i;
      80           1 :     src = (const SpiceMsgChannels *)msg;
      81             : 
      82           1 :     spice_marshaller_add_uint32(m, src->num_of_channels);
      83           1 :     channels__element = src->channels;
      84           4 :     for (i = 0; i < src->num_of_channels; i++) {
      85           3 :         spice_marshaller_add_uint16(m, *channels__element);
      86           3 :         channels__element++;
      87             :     }
      88           1 : }
      89             : 
      90           0 : void spice_marshall_msg_main_LenMessage(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgMainLenMessage *msg)
      91             : {
      92             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
      93             :     const SpiceMsgMainLenMessage *src;
      94             :     const uint32_t *  dummy__element;
      95             :     uint32_t i;
      96           0 :     src = (const SpiceMsgMainLenMessage *)msg;
      97             : 
      98           0 :     dummy__element = src->dummy;
      99           0 :     for (i = 0; i < 2; i++) {
     100           0 :         spice_marshaller_add_uint32(m, *dummy__element);
     101           0 :         dummy__element++;
     102             :     }
     103             :     /* Remaining data must be appended manually */
     104           0 : }
     105             : 
     106           0 : SPICE_GNUC_UNUSED static void spice_marshall_array_uint8(SpiceMarshaller *m, const uint8_t *ptr, unsigned count)
     107             : {
     108             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
     109             :     uint32_t i;
     110             : 
     111           0 :     for (i = 0; i < count; i++) {
     112           0 :         spice_marshaller_add_uint8(m, *ptr++);
     113             :     }
     114           0 : }
     115             : 
     116           0 : void spice_marshall_msg_main_ZeroLen1(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED const SpiceMsgMainZeroLen1 *msg, SpiceMarshaller **txt2_out)
     117             : {
     118             :     SPICE_GNUC_UNUSED SpiceMarshaller *m2;
     119             :     const SpiceMsgMainZeroLen1 *src;
     120             :     const uint8_t *  txt1__element;
     121             :     uint32_t i;
     122             :     const uint8_t *  txt3__element;
     123             :     const uint8_t *  txt4__element;
     124           0 :     *txt2_out = NULL;
     125           0 :     src = (const SpiceMsgMainZeroLen1 *)msg;
     126             : 
     127           0 :     txt1__element = src->txt1;
     128           0 :     for (i = 0; i < 4; i++) {
     129           0 :         spice_marshaller_add_uint8(m, *txt1__element);
     130           0 :         txt1__element++;
     131             :     }
     132           0 :     spice_marshaller_add_uint8(m, src->sep1);
     133           0 :     spice_marshaller_add_uint32(m, src->txt2_len);
     134           0 :     *txt2_out = spice_marshaller_get_ptr_submarshaller(m);
     135           0 :     txt3__element = src->txt3;
     136           0 :     for (i = 0; i < src->txt2_len; i++) {
     137           0 :         spice_marshaller_add_uint8(m, *txt3__element);
     138           0 :         txt3__element++;
     139             :     }
     140           0 :     spice_marshaller_add_uint32(m, src->n);
     141           0 :     spice_marshaller_add_uint16(m, src->txt4_len);
     142           0 :     txt4__element = src->txt4;
     143           0 :     for (i = 0; i < src->txt4_len; i++) {
     144           0 :         spice_marshaller_add_uint8(m, *txt4__element);
     145           0 :         txt4__element++;
     146             :     }
     147           0 : }
     148             : 

Generated by: LCOV version 1.14