From: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
vz puts uuids into curly braces. Simply introduce new contstant to reflect this
and get rid of magic +2 in code.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 12 ++++++------
src/vz/vz_utils.h | 2 ++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 7646796..187fcec 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -239,7 +239,7 @@ prlsdkConnect(vzConnPtr privconn)
PRL_HANDLE job = PRL_INVALID_HANDLE;
PRL_HANDLE result = PRL_INVALID_HANDLE;
PRL_HANDLE response = PRL_INVALID_HANDLE;
- char session_uuid[VIR_UUID_STRING_BUFLEN + 2];
+ char session_uuid[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 buflen = ARRAY_CARDINALITY(session_uuid);
pret = PrlSrv_Create(&privconn->server);
@@ -319,7 +319,7 @@ prlsdkUUIDFormat(const unsigned char *uuid, char *uuidstr)
static PRL_HANDLE
prlsdkSdkDomainLookupByUUID(vzConnPtr privconn, const unsigned char *uuid)
{
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_HANDLE sdkdom = PRL_INVALID_HANDLE;
prlsdkUUIDFormat(uuid, uuidstr);
@@ -368,7 +368,7 @@ prlsdkGetDomainIds(PRL_HANDLE sdkdom,
char **name,
unsigned char *uuid)
{
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 len;
PRL_RESULT pret;
@@ -1725,7 +1725,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
vzConnPtr privconn = opaque;
PRL_RESULT pret = PRL_ERR_FAILURE;
PRL_HANDLE_TYPE handleType;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
unsigned char uuid[VIR_UUID_BUFLEN];
PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
PRL_EVENT_TYPE prlEventType;
@@ -3483,7 +3483,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
{
PRL_RESULT pret;
size_t i;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
bool needBoot = true;
char *mask = NULL;
@@ -4073,7 +4073,7 @@ int prlsdkMigrate(virDomainObjPtr dom, const char* uri_str,
vzDomObjPtr privdom = dom->privateData;
virURIPtr uri = NULL;
PRL_HANDLE job = PRL_INVALID_HANDLE;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ char uuidstr[VZ_UUID_STRING_BUFLEN];
PRL_UINT32 vzflags = PRLSDK_MIGRATION_FLAGS;
uri = virURIParse(uri_str);
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index a779b03..98a8f77 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -55,6 +55,8 @@
# define PARALLELS_REQUIRED_BRIDGED_NETWORK "Bridged"
# define PARALLELS_BRIDGED_NETWORK_TYPE "bridged"
+# define VZ_UUID_STRING_BUFLEN (VIR_UUID_STRING_BUFLEN + 2)
+
struct _vzConn {
virMutex lock;
--
1.7.1