os/ossrv/ofdbus/dbus-glib/dbus/dbus-gmarshal.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 #include "dbus-gmarshal.h"
    18 
    19 #include	<glib-object.h>
    20 
    21 
    22 #ifdef G_ENABLE_DEBUG
    23 #define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
    24 #define g_marshal_value_peek_char(v)     g_value_get_char (v)
    25 #define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
    26 #define g_marshal_value_peek_int(v)      g_value_get_int (v)
    27 #define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
    28 #define g_marshal_value_peek_long(v)     g_value_get_long (v)
    29 #define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
    30 #define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
    31 #define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
    32 #define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
    33 #define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
    34 #define g_marshal_value_peek_float(v)    g_value_get_float (v)
    35 #define g_marshal_value_peek_double(v)   g_value_get_double (v)
    36 #define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
    37 #define g_marshal_value_peek_param(v)    g_value_get_param (v)
    38 #define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
    39 #define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
    40 #define g_marshal_value_peek_object(v)   g_value_get_object (v)
    41 #else /* !G_ENABLE_DEBUG */
    42 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
    43  *          Do not access GValues directly in your code. Instead, use the
    44  *          g_value_get_*() functions
    45  */
    46 #define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
    47 #define g_marshal_value_peek_char(v)     (v)->data[0].v_int
    48 #define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
    49 #define g_marshal_value_peek_int(v)      (v)->data[0].v_int
    50 #define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
    51 #define g_marshal_value_peek_long(v)     (v)->data[0].v_long
    52 #define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
    53 #define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
    54 #define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
    55 #define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
    56 #define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
    57 #define g_marshal_value_peek_float(v)    (v)->data[0].v_float
    58 #define g_marshal_value_peek_double(v)   (v)->data[0].v_double
    59 #define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
    60 #define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
    61 #define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
    62 #define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
    63 #define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
    64 #endif /* !G_ENABLE_DEBUG */
    65 
    66 
    67 /* NONE:STRING,STRING,STRING (dbus-gmarshal.list:1) */
    68 void
    69 _dbus_g_marshal_VOID__STRING_STRING_STRING (GClosure     *closure,
    70                                             GValue       *return_value,
    71                                             guint         n_param_values,
    72                                             const GValue *param_values,
    73                                             gpointer      invocation_hint,
    74                                             gpointer      marshal_data)
    75 {
    76   typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING) (gpointer     data1,
    77                                                            gpointer     arg_1,
    78                                                            gpointer     arg_2,
    79                                                            gpointer     arg_3,
    80                                                            gpointer     data2);
    81   register GMarshalFunc_VOID__STRING_STRING_STRING callback;
    82   register GCClosure *cc = (GCClosure*) closure;
    83   register gpointer data1, data2;
    84 
    85   g_return_if_fail (n_param_values == 4);
    86 
    87   if (G_CCLOSURE_SWAP_DATA (closure))
    88     {
    89       data1 = closure->data;
    90       data2 = g_value_peek_pointer (param_values + 0);
    91     }
    92   else
    93     {
    94       data1 = g_value_peek_pointer (param_values + 0);
    95       data2 = closure->data;
    96     }
    97   callback = (GMarshalFunc_VOID__STRING_STRING_STRING) (marshal_data ? marshal_data : cc->callback);
    98 
    99   callback (data1,
   100             g_marshal_value_peek_string (param_values + 1),
   101             g_marshal_value_peek_string (param_values + 2),
   102             g_marshal_value_peek_string (param_values + 3),
   103             data2);
   104 }
   105