mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-29 07:19:42 +08:00
bug fix to service invocation
git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@108 00440858-1255-0410-a3e6-75ea37f81c3a
This commit is contained in:
parent
1f05e6125f
commit
c5ff94bfab
@ -155,8 +155,7 @@ int32_size (int32_t v)
|
|||||||
{
|
{
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
return 10;
|
return 10;
|
||||||
else
|
else if (v < (1<<7))
|
||||||
if (v < (1<<7))
|
|
||||||
return 1;
|
return 1;
|
||||||
else if (v < (1<<14))
|
else if (v < (1<<14))
|
||||||
return 2;
|
return 2;
|
||||||
@ -1602,13 +1601,6 @@ protobuf_c_message_free_unpacked (ProtobufCMessage *message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* === services === */
|
/* === services === */
|
||||||
typedef struct _ServiceMachgen ServiceMachgen;
|
|
||||||
struct _ServiceMachgen
|
|
||||||
{
|
|
||||||
ProtobufCService base;
|
|
||||||
void *service;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void (*DestroyHandler)(void *service);
|
typedef void (*DestroyHandler)(void *service);
|
||||||
typedef void (*GenericHandler)(void *service,
|
typedef void (*GenericHandler)(void *service,
|
||||||
const ProtobufCMessage *input,
|
const ProtobufCMessage *input,
|
||||||
@ -1623,11 +1615,10 @@ service_machgen_invoke(ProtobufCService *service,
|
|||||||
{
|
{
|
||||||
GenericHandler *handlers;
|
GenericHandler *handlers;
|
||||||
GenericHandler handler;
|
GenericHandler handler;
|
||||||
ServiceMachgen *machgen = (ServiceMachgen *) service;
|
|
||||||
PROTOBUF_C_ASSERT (method_index < service->descriptor->n_methods);
|
PROTOBUF_C_ASSERT (method_index < service->descriptor->n_methods);
|
||||||
handlers = (GenericHandler *) machgen->service;
|
handlers = (GenericHandler *) (service + 1);
|
||||||
handler = handlers[method_index];
|
handler = handlers[method_index];
|
||||||
(*handler) (machgen->service, input, closure, closure_data);
|
(*handler) (service, input, closure, closure_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user