提交 7288963e 编写于 作者: 饶先宏's avatar 饶先宏

Update object.c

上级 a00a966c
......@@ -324,3 +324,30 @@ void _Assert(const char * pszExpr, const char *pszFileName, unsigned int nLine)
logMsg("Assertion Failed: \"%s\"\nFile=%s, Line=%d\n", pszExpr, pszFileName, nLine);
}
#endif
/*
把一个"7691029B-DAE3-4AC9-9A81-411C1B529039"格式的IID转换成一个IIDTYPE
返回值:
0 -- 成功
否则 -- 格式不对
*/
int str2iid(const char* str, IIDTYPE iid)
{
unsigned int L;
unsigned int s[2];
unsigned int b[8];
if (sscanf_s(str, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", &L, &s[0], &s[1],
&b[0], &b[1], &b[2], &b[3], &b[4], &b[5], &b[6], &b[7]) != 11)
return -1;
#define IMPLEMENT_GUID
#include "../include/guid.h"
{
DEFINE_GUID(temp, L, s[0], s[1], b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
iid[0] = temp[0];
iid[1] = temp[1];
iid[2] = temp[2];
iid[3] = temp[3];
}
#undef IMPLEMENT_GUID
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册