mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 10:44:28 +00:00
Add uuid wrapper API call ast_uuid_generate_str().
* Updated test_uuid.c to test the new API call. * Made system use the new API call to eliminate "10's of lines" where used. * Fixed untested ast_strdup() return in stasis_subscribe() by eliminating the need for it. struct stasis_subscription now contains the uniqueid[] string. * Fixed some issues in exchangecal_write_event(): Create uid with enough space for a UUID string to avoid a realloc. Fix off by one error if the calendar event provided a UUID string. There is no need to check for NULL before calling ast_free(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -50,7 +50,23 @@ AST_TEST_DEFINE(uuid)
|
||||
break;
|
||||
}
|
||||
|
||||
/* First, make sure that we can generate a UUID */
|
||||
/* Use method of generating UUID directly as a string. */
|
||||
ast_uuid_generate_str(uuid_str, sizeof(uuid_str));
|
||||
if (strlen(uuid_str) != (AST_UUID_STR_LEN - 1)) {
|
||||
ast_test_status_update(test, "Failed to directly generate UUID string\n");
|
||||
goto end;
|
||||
}
|
||||
ast_test_status_update(test, "Generate UUID direct to string, got %s\n", uuid_str);
|
||||
|
||||
/* Now convert the direct UUID string to a UUID */
|
||||
uuid1 = ast_str_to_uuid(uuid_str);
|
||||
if (!uuid1) {
|
||||
ast_test_status_update(test, "Unable to convert direct UUID string %s to UUID\n", uuid_str);
|
||||
goto end;
|
||||
}
|
||||
ast_free(uuid1);
|
||||
|
||||
/* Make sure that we can generate a UUID */
|
||||
uuid1 = ast_uuid_generate();
|
||||
if (!uuid1) {
|
||||
ast_test_status_update(test, "Unable to generate a UUID\n");
|
||||
@@ -71,7 +87,7 @@ AST_TEST_DEFINE(uuid)
|
||||
goto end;
|
||||
}
|
||||
|
||||
ast_test_status_update(test, "Converted uuid to string, got %s\n", uuid_str);
|
||||
ast_test_status_update(test, "Second generated UUID converted to string, got %s\n", uuid_str);
|
||||
|
||||
/* Now convert the string back to a UUID */
|
||||
uuid2 = ast_str_to_uuid(uuid_str);
|
||||
|
Reference in New Issue
Block a user