<commit_before>/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

/*=========================================================================
  =                             Includes                                  =
  =========================================================================*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <mama/mama.h>
#include <proton/message.h>
#include <proton/error.h>

#include "payloadbridge.h"
#include "msgfieldimpl.h"
#include "qpidcommon.h"


inline void
qpidmsgPayloadInternal_checkLengthAndIncDest (mama_size_t  written, 
                                              mama_size_t* length, 
                                              char**        dest);

/*=========================================================================
  =                  Public implementation functions                      =
  =========================================================================*/

mamaFieldType
qpidmsgPayloadInternal_toMamaType (pn_type_t type)
{
    switch (type)
    {
    case PN_NULL:       return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_BOOL:       return MAMA_FIELD_TYPE_BOOL;
    case PN_UBYTE:      return MAMA_FIELD_TYPE_U8;
    case PN_BYTE:       return MAMA_FIELD_TYPE_I8;
    case PN_USHORT:     return MAMA_FIELD_TYPE_U16;
    case PN_SHORT:      return MAMA_FIELD_TYPE_I16;
    case PN_UINT:       return MAMA_FIELD_TYPE_U32;
    case PN_INT:        return MAMA_FIELD_TYPE_I32;
    case PN_CHAR:       return MAMA_FIELD_TYPE_CHAR;
    case PN_ULONG:      return MAMA_FIELD_TYPE_U64;
    case PN_LONG:       return MAMA_FIELD_TYPE_I64;
    case PN_TIMESTAMP:  return MAMA_FIELD_TYPE_TIME;
    case PN_FLOAT:      return MAMA_FIELD_TYPE_F32;
    case PN_DOUBLE:     return MAMA_FIELD_TYPE_F64;
    case PN_DECIMAL32:  return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_DECIMAL64:  return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_DECIMAL128: return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_UUID:       return MAMA_FIELD_TYPE_UNKNOWN;<commit_msg>QPIDMSG: Function should be declared static inline<commit_after>/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

/*=========================================================================
  =                             Includes                                  =
  =========================================================================*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <mama/mama.h>
#include <proton/message.h>
#include <proton/error.h>

#include "payloadbridge.h"
#include "msgfieldimpl.h"
#include "qpidcommon.h"


static inline void
qpidmsgPayloadInternal_checkLengthAndIncDest (mama_size_t  written, 
                                              mama_size_t* length, 
                                              char**        dest);

/*=========================================================================
  =                  Public implementation functions                      =
  =========================================================================*/

mamaFieldType
qpidmsgPayloadInternal_toMamaType (pn_type_t type)
{
    switch (type)
    {
    case PN_NULL:       return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_BOOL:       return MAMA_FIELD_TYPE_BOOL;
    case PN_UBYTE:      return MAMA_FIELD_TYPE_U8;
    case PN_BYTE:       return MAMA_FIELD_TYPE_I8;
    case PN_USHORT:     return MAMA_FIELD_TYPE_U16;
    case PN_SHORT:      return MAMA_FIELD_TYPE_I16;
    case PN_UINT:       return MAMA_FIELD_TYPE_U32;
    case PN_INT:        return MAMA_FIELD_TYPE_I32;
    case PN_CHAR:       return MAMA_FIELD_TYPE_CHAR;
    case PN_ULONG:      return MAMA_FIELD_TYPE_U64;
    case PN_LONG:       return MAMA_FIELD_TYPE_I64;
    case PN_TIMESTAMP:  return MAMA_FIELD_TYPE_TIME;
    case PN_FLOAT:      return MAMA_FIELD_TYPE_F32;
    case PN_DOUBLE:     return MAMA_FIELD_TYPE_F64;
    case PN_DECIMAL32:  return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_DECIMAL64:  return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_DECIMAL128: return MAMA_FIELD_TYPE_UNKNOWN;
    case PN_UUID:       return MAMA_FIELD_TYPE_UNKNOWN;
{'fraction_non_alphanumeric': 0.15681098204857444, 'fraction_numerical': 0.014783526927138331, 'mean_word_length': 3.094380403458213, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1206322', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1557, 'n_words': 484}