*/
/* TODO items:
-
* 64-BIT OPTIMIZATION: certain implementations use 32-bit math even on 64-bit platforms
(uint64_size, uint64_pack, parse_uint64)
* use size_t consistently
*/
-#if HAVE_PROTOBUF_C_CONFIG_H
-#include "protobuf-c-config.h"
-#endif
+//#if HAVE_PROTOBUF_C_CONFIG_H
+//#include "protobuf-c-config.h"
+//#endif
#include <stdio.h> /* for occasional printf()s */
#include <stdlib.h> /* for abort(), malloc() etc */
#include <string.h> /* for strlen(), memcpy(), memmove() */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#elif HAVE_MALLOC_H
-#include <malloc.h>
-#endif
+//#if HAVE_ALLOCA_H
+//#include <alloca.h>
+//#elif HAVE_MALLOC_H
+//#include <malloc.h>
+//#endif
#ifndef PRINT_UNPACK_ERRORS
#define PRINT_UNPACK_ERRORS 1
static inline size_t
fixed32_pack (uint32_t value, void *out)
{
-#if IS_LITTLE_ENDIAN
+#if 0 // IS_LITTLE_ENDIAN
memcpy (out, &value, 4);
#else
uint8_t *buf = out;
static inline size_t
fixed64_pack (uint64_t value, void *out)
{
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
memcpy (out, &value, 8);
#else
fixed32_pack (value, out);
static void
copy_to_little_endian_32 (void *out, const void *in, unsigned N)
{
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
memcpy (out, in, N * 4);
#else
unsigned i;
static void
copy_to_little_endian_64 (void *out, const void *in, unsigned N)
{
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
memcpy (out, in, N * 8);
#else
unsigned i;
case PROTOBUF_C_TYPE_SFIXED32:
case PROTOBUF_C_TYPE_FIXED32:
case PROTOBUF_C_TYPE_FLOAT:
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
rv = count * 4;
goto no_packing_needed;
#else
case PROTOBUF_C_TYPE_SFIXED64:
case PROTOBUF_C_TYPE_FIXED64:
case PROTOBUF_C_TYPE_DOUBLE:
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
rv = count * 8;
goto no_packing_needed;
#else
}
return rv;
-no_packing_needed:
- buffer->append (buffer, rv, array);
- return rv;
+//no_packing_needed:
+// buffer->append (buffer, rv, array);
+// return rv;
}
static size_t
static inline uint32_t
parse_fixed_uint32 (const uint8_t *data)
{
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
uint32_t t;
memcpy (&t, data, 4);
return t;
static inline uint64_t
parse_fixed_uint64 (const uint8_t *data)
{
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
uint64_t t;
memcpy (&t, data, 8);
return t;
case PROTOBUF_C_TYPE_FIXED32:
case PROTOBUF_C_TYPE_FLOAT:
count = (scanned_member->len - scanned_member->length_prefix_len) / 4;
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
goto no_unpacking_needed;
#else
for (i = 0; i < count; i++)
case PROTOBUF_C_TYPE_FIXED64:
case PROTOBUF_C_TYPE_DOUBLE:
count = (scanned_member->len - scanned_member->length_prefix_len) / 8;
-#if IS_LITTLE_ENDIAN
+#if 0 //IS_LITTLE_ENDIAN
goto no_unpacking_needed;
#else
for (i = 0; i < count; i++)
*p_n += count;
return TRUE;
-no_unpacking_needed:
- memcpy (array, at, count * siz);
- *p_n += count;
- return TRUE;
+//no_unpacking_needed:
+// memcpy (array, at, count * siz);
+// *p_n += count;
+// return TRUE;
}
static protobuf_c_boolean
/* TODO: expose/use this function if desc->message_init==NULL
(which occurs for old code, and may be useful for certain
programatic techniques for generating descriptors). */
-void
+static void
protobuf_c_message_init_generic (const ProtobufCMessageDescriptor *desc,
ProtobufCMessage *message)
{