代码拉取完成,页面将自动刷新
同步操作将从 openes/FileServer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/******************************************************************************
* 文件名称: msg.c
* 内容摘要: 消息处理
* 创建者の: 孔佳伟
* 个人主页: https://gitee.com/thin-wind/jump
* 修改记录:
******************************************************************************/
#include "msg.h"
#include <string.h>
#include <stdlib.h>
/******************************************************************************
* 函数名称: MESSAGE* MessageNew(uint16_t type,
uint16_t cmd,
uint16_t index,
uint16_t total,
const uint8_t* payload,
uint32_t length)
* 功能说明: 创建消息对象
* 输入参数: uint16_t type --类型
uint16_t cmd --指令
uint16_t index --数据包序号索引
uint16_t total --数据总包数
const uint8_t* payload --数据区首地址
uint32_t length --数据长度
* 输出参数: 无
* 函数返回: 无
* 其它说明: 无
******************************************************************************/
MESSAGE* MessageNew(uint16_t type,
uint16_t cmd,
uint16_t index,
uint16_t total,
const uint8_t* payload,
uint32_t length)
{
MESSAGE* msg = malloc(sizeof(MESSAGE) + length);
if(NULL == msg)
return NULL;
if(NULL == payload)
return NULL;
msg->type = type;
msg->cmd = cmd;
msg->index = index;
msg->total = total;
msg->length = length;
// msg 是 MESSAGE 类型的,msg+1 则指向 msg->payload,注意柔性数组本身并不占用内存空间
if(NULL != payload)
memcpy(msg + 1, payload, length);
return msg;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。