* \brief UUID wrapper (libuuid part)
* @author Seiji Munetoh <munetoh@users.sourceforge.jp>
* @date 2010-11-29
- * cleanup 2011-10-07 SM
+ * cleanup 2011-12-31 SM
*
* Linux uses libuuid
*
myUUID.clock_seq_hi_and_reserved = uu[8];
if ((myUUID.clock_seq_hi_and_reserved & 0xc0) != 0x80) {
- ERROR("uuid_time() - bad UUID variant (0x%02x) found, can't extract timestamp\n",
+ LOG(LOG_ERR, "uuid_time() - bad UUID variant (0x%02x) found, can't extract timestamp\n",
(myUUID.clock_seq_hi_and_reserved & 0xc0) >> 4);
return (time_t)-1;
}
uuid = xmalloc(sizeof(PTS_UUID)); // BYTE[16]
if (uuid == NULL) {
+ LOG(LOG_ERR, "no memory");
return NULL;
}
* free UUID
*/
void freeUuid(PTS_UUID *uuid) {
+ /* check */
+ if (uuid == NULL) {
+ LOG(LOG_ERR, "null input");
+ return;
+ }
+
xfree(uuid);
}
uuid_t uu;
int rc;
+ /* check */
+ if (str == NULL) {
+ LOG(LOG_ERR, "null input");
+ return NULL;
+ }
+
rc = uuid_parse(str, uu);
if (rc != 0) {
- ERROR("getUuidFromString() - uuid_parse fail, rc=%d, UUID='%s'\n",
+ LOG(LOG_ERR, "getUuidFromString() - uuid_parse fail, rc=%d, UUID='%s'",
rc, str);
return NULL;
}
uuid = xmalloc(sizeof(PTS_UUID));
if (uuid == NULL) {
- ERROR("\n");
+ LOG(LOG_ERR, "no memory");
return NULL;
}
memcpy(uuid, uu, 16);
char *str_uuid;
uuid_t uu;
+ /* check */
+ if (uuid == NULL) {
+ LOG(LOG_ERR, "null input");
+ return NULL;
+ }
+
str_uuid = xmalloc(37);
if (str_uuid == NULL) {
+ LOG(LOG_ERR, "no memory");
return NULL;
}
/* check */
if (uuid == NULL) {
- ERROR("null input\n");
+ LOG(LOG_ERR, "null input\n");
return NULL;
}
pdt = xmalloc(sizeof(PTS_DateTime));
if (pdt == NULL) {
+ LOG(LOG_ERR, "no memory");
return NULL;
}
memcpy(pdt, &time, (9*4));
pdt = xmalloc(sizeof(PTS_DateTime));
if (pdt == NULL) {
+ LOG(LOG_ERR, "no memory");
return NULL;
}
memcpy(pdt, &ttm, (9*4));