本文整理汇总了C++中read_int32函数的典型用法代码示例。如果您正苦于以下问题:C++ read_int32函数的具体用法?C++ read_int32怎么用?C++ read_int32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_int32函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: execute_common_handle
int32_t execute_common_handle(struct data_buffer* dbuf,int socket_fd,MEM_POOL* mem_pool)
{
struct data_buffer rbuf;
//发数据包
if(socket_write(socket_fd,dbuf->data,dbuf->data_len) <= 0)
return -1;
//接受命名
memset(&rbuf,0,sizeof(struct data_buffer));
rbuf.data_len = sizeof(uint32_t);
rbuf.data = (uint8_t *)mem_pool_malloc(mem_pool,sizeof(uint32_t));
rbuf.size = rbuf.data_len;
if(socket_read(socket_fd,rbuf.data,sizeof(uint32_t)) <= 0)
return -1;
rbuf.data_len = read_int32(&rbuf);
rbuf.data = (uint8_t *)mem_pool_malloc(mem_pool,rbuf.data_len);
rbuf.rpos = 0;
rbuf.size = rbuf.data_len;
if(socket_read(socket_fd,rbuf.data,rbuf.data_len) <= 0)
return -1;
rbuf.rpos += MESSAGE_HEAD_LEN;
uint16_t type = message_type(&rbuf);
if (type != MT_DC_EXE_RS)
return -1;
return read_int32(&rbuf);
}
开发者ID:Alibaba-boonya,项目名称:mile,代码行数:32,代码来源:client.c
示例2: replay_rt_sigaction
int SCOPE
replay_rt_sigaction(const struct syscall_regs * regs)
{
int32_t eax = read_int32();
if (eax == 0) {
int sigsetsize = read_int32();
ASSERT(sigsetsize == regs->esi, regs, "");
ASSERT(sigsetsize == sizeof(k_sigset_t), regs, "[email protected]@#1\n");
uintptr_t oact = read_uint32();
ASSERT(oact == regs->edx, regs, "oact inconsistent: 0x%x != 0x%x\n",
regs->edx, oact);
uintptr_t act = read_uint32();
ASSERT(act == regs->ecx, regs, "act inconsistent: 0x%x != 0x%x\n",
regs->ecx, act);
if (oact != 0)
read_mem(oact, sizeof(struct k_sigaction));
/* we need trace sighandler even in replay */
if (act != 0)
__dup_mem(&state_vector.sigactions[regs->ebx], act,
sizeof(struct k_sigaction));
}
return eax;
}
开发者ID:pi3orama,项目名称:currf2,代码行数:27,代码来源:rt_sigaction.c
示例3: object_class_audioclip_load
struct object_class_audioclip* object_class_audioclip_load(unsigned char* data, size_t start, size_t size)
{
size_t offset = start;
struct object_class_audioclip* object_class = (struct object_class_audioclip*)calloc(1, sizeof(*object_class));
offset += read_int32(data, offset, &object_class->name_len, true);
if (object_class->name_len < 0 || object_class->name_len >(int)size) {
free(object_class);
return NULL;
}
offset += read_buffer(data, offset, &object_class->name, object_class->name_len);
offset = (offset + 3) / 4 * 4;
offset += read_int32(data, offset, &object_class->format, true);
offset += read_int32(data, offset, &object_class->type, true);
offset += read_byte(data, offset, &object_class->is_3d);
offset += read_byte(data, offset, &object_class->use_hardware);
offset = (offset + 3) / 4 * 4;
offset += read_int32(data, offset, &object_class->stream, true);
offset += read_int32(data, offset, &object_class->data_size, true);
offset += read_buffer(data, offset, &object_class->data, object_class->data_size);
return object_class;
}
开发者ID:Avatarchik,项目名称:AssetBundleParser,代码行数:26,代码来源:object_class.c
示例4: process
static void process(ErlDrvData handle, ErlIOVec *ev) {
spidermonkey_drv_t *dd = (spidermonkey_drv_t *) handle;
char *data = ev->binv[1]->orig_bytes;
char *command = read_command(&data);
if (strncmp(command, "ij", 2) == 0) {
char *call_id = read_string(&data);
int thread_stack = read_int32(&data);
if (thread_stack < 8) {
thread_stack = 8;
}
thread_stack = thread_stack * (1024 * 1024);
int heap_size = read_int32(&data) * (1024 * 1024);
dd->vm = sm_initialize(thread_stack, heap_size);
send_ok_response(dd, call_id);
driver_free(call_id);
}
else {
js_call *call_data = (js_call *) driver_alloc(sizeof(js_call));
call_data->driver_data = dd;
call_data->args = ev->binv[1];
driver_binary_inc_refc(call_data->args);
ErlDrvPort port = dd->port;
unsigned long thread_key = (unsigned long) port;
driver_async(dd->port, (unsigned int *) &thread_key, (asyncfun) run_js, (void *) call_data, NULL);
}
driver_free(command);
}
开发者ID:jonte,项目名称:erlang_js,代码行数:27,代码来源:spidermonkey_drv.c
示例5: replay_time
int SCOPE
replay_time(const struct syscall_regs * regs)
{
int32_t eax = read_int32();
int32_t ebx = read_int32();
ASSERT(ebx == regs->ebx, regs, "");
if (ebx != 0)
read_mem(ebx, sizeof(time_t));
return eax;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:10,代码来源:time.c
示例6: read_binary
static void read_binary(parse_info *info, numbuf_t *buf, int wide) {
if (wide <= 4) read_int32(info, &buf->i32, wide);
else {
uint32_t lo, hi; /* in big endian */
read_int32(info, &hi, 4);
read_int32(info, &lo, wide - 4);
buf->i64 = info->endian == BIG_ENDIAN ?
((uint64_t)hi << ((wide-4)<<3)) | lo :
((uint64_t)lo << 32) | hi;
}
}
开发者ID:brimworks,项目名称:lbuffer,代码行数:11,代码来源:lbuffer.c
示例7: checkEquality
static bool
checkEquality(char *jqBase, int32 jqPos, int32 type, JsonbValue *jb)
{
int len;
if (type == jqiAny)
return true;
if (jb->type == jbvBinary)
return false;
if (jb->type != type /* see enums */)
return false;
switch(type)
{
case jqiNull:
return true;
case jqiString:
read_int32(len, jqBase, jqPos);
return (len == jb->val.string.len && memcmp(jb->val.string.val, jqBase + jqPos, len) == 0);
case jqiBool:
read_byte(len, jqBase, jqPos);
return (jb->val.boolean == (bool)len);
case jqiNumeric:
return (compareNumeric((Numeric)(jqBase + jqPos), jb->val.numeric) == 0);
default:
elog(ERROR,"Wrong state");
}
}
开发者ID:niquola,项目名称:fhir_cases_for_jsonp,代码行数:30,代码来源:jsquery_op.c
示例8: test_decompress
void test_decompress(FILE* outFp, FILE* inpFp)
{
static char decBuf[DECODE_RING_BUFFER];
int decOffset = 0;
LZ4_streamDecode_t lz4StreamDecode_body = { 0 };
LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body;
for(;;) {
int cmpBytes = 0;
char cmpBuf[LZ4_COMPRESSBOUND(MESSAGE_MAX_BYTES)];
{
const size_t r0 = read_int32(inpFp, &cmpBytes);
if(r0 != 1 || cmpBytes <= 0) break;
const size_t r1 = read_bin(inpFp, cmpBuf, cmpBytes);
if(r1 != (size_t) cmpBytes) break;
}
{
char* const decPtr = &decBuf[decOffset];
const int decBytes = LZ4_decompress_safe_continue(
lz4StreamDecode, cmpBuf, decPtr, cmpBytes, MESSAGE_MAX_BYTES);
if(decBytes <= 0) break;
decOffset += decBytes;
write_bin(outFp, decPtr, decBytes);
// Wraparound the ringbuffer offset
if(decOffset >= DECODE_RING_BUFFER - MESSAGE_MAX_BYTES) decOffset = 0;
}
}
}
开发者ID:AmEv7Fam,项目名称:opentoonz,代码行数:32,代码来源:blockStreaming_ringBuffer.c
示例9: replay__newselect
int SCOPE
replay__newselect(const struct syscall_regs * regs)
{
int32_t eax = read_int32();
int n;
uint32_t inp;
uint32_t outp;
uint32_t exp;
read_obj(n);
read_obj(inp);
read_obj(outp);
read_obj(exp);
ASSERT(n == regs->ebx, regs, "");
ASSERT(inp == regs->ecx, regs, "");
ASSERT(outp == regs->edx, regs, "");
ASSERT(exp == regs->esi, regs, "");
int fd_bytes = FDS_BYTES(n);
if (inp != 0)
read_mem(inp, fd_bytes);
if (outp != 0)
read_mem(outp, fd_bytes);
if (exp != 0)
read_mem(exp, fd_bytes);
return eax;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:28,代码来源:_newselect.c
示例10: replay_rt_sigprocmask
int SCOPE
replay_rt_sigprocmask(const struct syscall_regs * regs)
{
int32_t ret = read_int32();
if (ret == 0) {
int sigsetsize = read_int32();
ASSERT(sigsetsize == regs->esi, regs, "");
if (sigsetsize == sizeof(k_sigset_t)) {
int oset = read_int32();
ASSERT(oset == regs->edx, regs, "");
if (oset)
read_mem(oset, sigsetsize);
}
}
return ret;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:16,代码来源:rt_sigprocmask.c
示例11: consume_int32
static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr)
{
int32_t val;
val = read_int32(*ptr);
*ptr += 4;
return val;
}
开发者ID:zhoupeng,项目名称:spice4xen,代码行数:7,代码来源:generated_demarshallers.c
示例12: log_error
struct slave_sync_res *parse_master_response(struct mile_packet *packet) {
struct data_buffer* rbuf = packet->rbuf;
struct mile_message_header header;
if (NULL == rbuf) {
log_error( "read buffer is empty");
return NULL;
}
header.version_major = read_int8(rbuf);
header.version_minor = read_int8(rbuf);
header.message_type = read_int16(rbuf);
header.message_id = read_int32(rbuf);
log_debug(
"数据包包头信息 -- 主版本号: %d, 小版本号: %d, 消息类型: 0x%x, 消息id: %d", header.version_major, header.version_minor, header.message_type, header.message_id);
if (MT_DM_RS != header.message_type) {
log_error( "unknown message type: %hu", header.message_type);
return NULL;
}
// read body
struct slave_sync_res *res = (struct slave_sync_res *) (rbuf->data
+ rbuf->rpos);
rbuf->rpos += res->len + sizeof(struct slave_sync_res);
if (rbuf->rpos > rbuf->data_len) {
log_error( "wrong packet lenght.");
return NULL;
}
return res;
}
开发者ID:Alibaba-boonya,项目名称:mile,代码行数:32,代码来源:protocol.cpp
示例13: replay_tty_ioctl
SCOPE int
replay_tty_ioctl(int fd, uint32_t cmd, uint32_t arg,
const struct syscall_regs * regs)
{
/* write eax is done in ioctl.c */
int32_t eax = read_int32();
switch (cmd) {
case TCGETS:
if (arg != 0)
read_mem(arg, sizeof(struct termios));
return eax;
case TIOCGWINSZ:
if (arg != 0)
read_mem(arg, sizeof(struct winsize));
return eax;
case FIONREAD:
if (arg != 0)
read_mem(arg, sizeof(int));
return eax;
case FIONBIO:
return eax;
case TCGETA:
if (arg != 0)
read_mem(arg, sizeof(struct termio));
return eax;
case TCSETA:
return eax;
default:
INJ_WARNING("doesn't know such tty ioctl: 0x%x\n", cmd);
__exit(-1);
}
return eax;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:33,代码来源:ioctl_tty.c
示例14: read_string_val
const char*
read_string_val(bson_iter_t* it) {
int32_t sz = read_int32(it);
const char* p = (const char*)it->ptr;
it->ptr += sz;
it->size += sz;
return p;
}
开发者ID:c4pt0r,项目名称:cbson,代码行数:8,代码来源:cbson.c
示例15: execute_segment_stat_handle
int32_t execute_segment_stat_handle(struct data_buffer* dbuf,int socket_fd,MEM_POOL* mem_pool)
{
struct data_buffer rbuf;
//发数据包
if(socket_write(socket_fd,dbuf->data,dbuf->data_len) <= 0)
return -1;
//接受命名
memset(&rbuf,0,sizeof(struct data_buffer));
rbuf.data_len = sizeof(uint32_t);
rbuf.size = rbuf.data_len;
rbuf.data = (uint8_t *)mem_pool_malloc(mem_pool,sizeof(uint32_t));
if(socket_read(socket_fd,rbuf.data,rbuf.data_len) <= 0)
return -1;
rbuf.data_len = read_int32(&rbuf);
rbuf.data = (uint8_t *)mem_pool_malloc(mem_pool,rbuf.data_len);
rbuf.rpos = 0;
rbuf.size = rbuf.data_len;
if(socket_read(socket_fd,rbuf.data,rbuf.data_len) <= 0)
return -1;
rbuf.rpos += MESSAGE_HEAD_LEN;
uint16_t type = message_type(&rbuf);
if (type != MT_DC_STAT_RS)
return -1;
uint16_t segment_count = read_int16(&rbuf);
uint16_t i;
fprintf(stderr,"%-20s%-20s%-20s%-20s%-20s%-20s%-20s\n","SEGMENT_ID","CREATE_TIME","MODIFY_TIME","CHECKPOINT_TIME","FLAG","ROW_COUNT","DEL_COUNT");
for(i=0; i<segment_count; i++)
{
fprintf(stderr,"%-20u",read_int16(&rbuf));
fprintf(stderr,"%-20llu",read_int64(&rbuf));
fprintf(stderr,"%-20llu",read_int64(&rbuf));
fprintf(stderr,"%-20llu",read_int64(&rbuf));
fprintf(stderr,"%-20u",read_int8(&rbuf));
fprintf(stderr,"%-20u",read_int32(&rbuf));
fprintf(stderr,"%-20u\n",read_int32(&rbuf));
}
return 0;
}
开发者ID:Alibaba-boonya,项目名称:mile,代码行数:46,代码来源:client.c
示例16: replay_pread64
int SCOPE
replay_pread64(const struct syscall_regs * regs)
{
int32_t eax = read_int32();
if (eax > 0)
read_mem(regs->ecx, eax);
return eax;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:8,代码来源:pread64.c
示例17: init_w32
static inline void init_w32 (uint32_t * W, const uint32_t * block)
{
int t;
for (t = 0; t < 16; t++)
W [t] = read_int32 ((char *) (block + t));
for (t = 16; t < 80; t++)
W [t] = rotl32 (1, W [t - 3] ^ W [t - 8] ^ W [t - 14] ^ W [t - 16]);
}
开发者ID:abrauchli,项目名称:allnet,代码行数:8,代码来源:sha.c
示例18: replay_lstat64
int SCOPE
replay_lstat64(const struct syscall_regs * regs)
{
int32_t eax = read_int32();
if (eax >= 0) {
read_mem(regs->ecx, sizeof(struct stat64));
}
return eax;
}
开发者ID:pi3orama,项目名称:Snitchaser,代码行数:9,代码来源:lstat64.c
示例19: objectinfo_getname
char* objectinfo_getname(unsigned char* data, size_t start, size_t size)
{
int name_len;
size_t offset = start;
offset += read_int32(data, offset, &name_len, true);
if (name_len >= 0 && name_len <= (int)size)
return strndup((char*)data + offset, name_len);
return strdup("");
}
开发者ID:Avatarchik,项目名称:AssetBundleParser,代码行数:9,代码来源:object_class.c
示例20: get_heap_string
/* Reads a string index, looks up the string and returns it. Bounds
* checks the string heap index too. */
static MVMString * get_heap_string(MVMThreadContext *tc, MVMCompUnit *cu, ReaderState *rs, MVMuint8 *buffer, size_t offset) {
MVMuint32 heap_index = read_int32(buffer, offset);
if (heap_index >= cu->body.num_strings) {
if (rs)
cleanup_all(tc, rs);
MVM_exception_throw_adhoc(tc, "String heap index beyond end of string heap");
}
return MVM_cu_string(tc, cu, heap_index);
}
开发者ID:tomboy-64,项目名称:MoarVM,代码行数:11,代码来源:bytecode.c
注:本文中的read_int32函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论