scripts: Make SafeStruct deep-copy strings
Change-Id: I7e31207851ffec447f4f042ccac06916c98dfb58
diff --git a/layers/generated/vk_safe_struct.cpp b/layers/generated/vk_safe_struct.cpp
index 7c6ebe5..2b049ce 100644
--- a/layers/generated/vk_safe_struct.cpp
+++ b/layers/generated/vk_safe_struct.cpp
@@ -37,13 +37,13 @@
safe_VkApplicationInfo::safe_VkApplicationInfo(const VkApplicationInfo* in_struct) :
sType(in_struct->sType),
- pApplicationName(in_struct->pApplicationName),
applicationVersion(in_struct->applicationVersion),
- pEngineName(in_struct->pEngineName),
engineVersion(in_struct->engineVersion),
apiVersion(in_struct->apiVersion)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pApplicationName = SafeStringCopy(in_struct->pApplicationName);
+ pEngineName = SafeStringCopy(in_struct->pEngineName);
}
safe_VkApplicationInfo::safe_VkApplicationInfo() :
@@ -55,34 +55,38 @@
safe_VkApplicationInfo::safe_VkApplicationInfo(const safe_VkApplicationInfo& src)
{
sType = src.sType;
- pApplicationName = src.pApplicationName;
applicationVersion = src.applicationVersion;
- pEngineName = src.pEngineName;
engineVersion = src.engineVersion;
apiVersion = src.apiVersion;
pNext = SafePnextCopy(src.pNext);
+ pApplicationName = SafeStringCopy(src.pApplicationName);
+ pEngineName = SafeStringCopy(src.pEngineName);
}
safe_VkApplicationInfo& safe_VkApplicationInfo::operator=(const safe_VkApplicationInfo& src)
{
if (&src == this) return *this;
+ if (pApplicationName) delete [] pApplicationName;
+ if (pEngineName) delete [] pEngineName;
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
- pApplicationName = src.pApplicationName;
applicationVersion = src.applicationVersion;
- pEngineName = src.pEngineName;
engineVersion = src.engineVersion;
apiVersion = src.apiVersion;
pNext = SafePnextCopy(src.pNext);
+ pApplicationName = SafeStringCopy(src.pApplicationName);
+ pEngineName = SafeStringCopy(src.pEngineName);
return *this;
}
safe_VkApplicationInfo::~safe_VkApplicationInfo()
{
+ if (pApplicationName) delete [] pApplicationName;
+ if (pEngineName) delete [] pEngineName;
if (pNext)
FreePnextChain(pNext);
}
@@ -90,34 +94,40 @@
void safe_VkApplicationInfo::initialize(const VkApplicationInfo* in_struct)
{
sType = in_struct->sType;
- pApplicationName = in_struct->pApplicationName;
applicationVersion = in_struct->applicationVersion;
- pEngineName = in_struct->pEngineName;
engineVersion = in_struct->engineVersion;
apiVersion = in_struct->apiVersion;
pNext = SafePnextCopy(in_struct->pNext);
+ pApplicationName = SafeStringCopy(in_struct->pApplicationName);
+ pEngineName = SafeStringCopy(in_struct->pEngineName);
}
void safe_VkApplicationInfo::initialize(const safe_VkApplicationInfo* src)
{
sType = src->sType;
- pApplicationName = src->pApplicationName;
applicationVersion = src->applicationVersion;
- pEngineName = src->pEngineName;
engineVersion = src->engineVersion;
apiVersion = src->apiVersion;
pNext = SafePnextCopy(src->pNext);
+ pApplicationName = SafeStringCopy(src->pApplicationName);
+ pEngineName = SafeStringCopy(src->pEngineName);
}
safe_VkInstanceCreateInfo::safe_VkInstanceCreateInfo(const VkInstanceCreateInfo* in_struct) :
sType(in_struct->sType),
flags(in_struct->flags),
enabledLayerCount(in_struct->enabledLayerCount),
- ppEnabledLayerNames(in_struct->ppEnabledLayerNames),
- enabledExtensionCount(in_struct->enabledExtensionCount),
- ppEnabledExtensionNames(in_struct->ppEnabledExtensionNames)
+ enabledExtensionCount(in_struct->enabledExtensionCount)
{
pNext = SafePnextCopy(in_struct->pNext);
+ ppEnabledLayerNames = new char *[in_struct->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(in_struct->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[in_struct->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(in_struct->ppEnabledExtensionNames[i]);
+ }
if (in_struct->pApplicationInfo)
pApplicationInfo = new safe_VkApplicationInfo(in_struct->pApplicationInfo);
else
@@ -135,10 +145,16 @@
sType = src.sType;
flags = src.flags;
enabledLayerCount = src.enabledLayerCount;
- ppEnabledLayerNames = src.ppEnabledLayerNames;
enabledExtensionCount = src.enabledExtensionCount;
- ppEnabledExtensionNames = src.ppEnabledExtensionNames;
pNext = SafePnextCopy(src.pNext);
+ ppEnabledLayerNames = new char *[src.enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src.ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src.enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src.ppEnabledExtensionNames[i]);
+ }
if (src.pApplicationInfo)
pApplicationInfo = new safe_VkApplicationInfo(*src.pApplicationInfo);
else
@@ -151,16 +167,34 @@
if (pApplicationInfo)
delete pApplicationInfo;
+ if (ppEnabledLayerNames) {
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ delete [] ppEnabledLayerNames[i];
+ }
+ delete [] ppEnabledLayerNames;
+ }
+ if (ppEnabledExtensionNames) {
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ delete [] ppEnabledExtensionNames[i];
+ }
+ delete [] ppEnabledExtensionNames;
+ }
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
flags = src.flags;
enabledLayerCount = src.enabledLayerCount;
- ppEnabledLayerNames = src.ppEnabledLayerNames;
enabledExtensionCount = src.enabledExtensionCount;
- ppEnabledExtensionNames = src.ppEnabledExtensionNames;
pNext = SafePnextCopy(src.pNext);
+ ppEnabledLayerNames = new char *[src.enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src.ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src.enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src.ppEnabledExtensionNames[i]);
+ }
if (src.pApplicationInfo)
pApplicationInfo = new safe_VkApplicationInfo(*src.pApplicationInfo);
else
@@ -173,6 +207,18 @@
{
if (pApplicationInfo)
delete pApplicationInfo;
+ if (ppEnabledLayerNames) {
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ delete [] ppEnabledLayerNames[i];
+ }
+ delete [] ppEnabledLayerNames;
+ }
+ if (ppEnabledExtensionNames) {
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ delete [] ppEnabledExtensionNames[i];
+ }
+ delete [] ppEnabledExtensionNames;
+ }
if (pNext)
FreePnextChain(pNext);
}
@@ -182,10 +228,16 @@
sType = in_struct->sType;
flags = in_struct->flags;
enabledLayerCount = in_struct->enabledLayerCount;
- ppEnabledLayerNames = in_struct->ppEnabledLayerNames;
enabledExtensionCount = in_struct->enabledExtensionCount;
- ppEnabledExtensionNames = in_struct->ppEnabledExtensionNames;
pNext = SafePnextCopy(in_struct->pNext);
+ ppEnabledLayerNames = new char *[in_struct->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(in_struct->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[in_struct->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(in_struct->ppEnabledExtensionNames[i]);
+ }
if (in_struct->pApplicationInfo)
pApplicationInfo = new safe_VkApplicationInfo(in_struct->pApplicationInfo);
else
@@ -197,10 +249,16 @@
sType = src->sType;
flags = src->flags;
enabledLayerCount = src->enabledLayerCount;
- ppEnabledLayerNames = src->ppEnabledLayerNames;
enabledExtensionCount = src->enabledExtensionCount;
- ppEnabledExtensionNames = src->ppEnabledExtensionNames;
pNext = SafePnextCopy(src->pNext);
+ ppEnabledLayerNames = new char *[src->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src->ppEnabledExtensionNames[i]);
+ }
if (src->pApplicationInfo)
pApplicationInfo = new safe_VkApplicationInfo(*src->pApplicationInfo);
else
@@ -368,12 +426,18 @@
queueCreateInfoCount(in_struct->queueCreateInfoCount),
pQueueCreateInfos(nullptr),
enabledLayerCount(in_struct->enabledLayerCount),
- ppEnabledLayerNames(in_struct->ppEnabledLayerNames),
enabledExtensionCount(in_struct->enabledExtensionCount),
- ppEnabledExtensionNames(in_struct->ppEnabledExtensionNames),
pEnabledFeatures(nullptr)
{
pNext = SafePnextCopy(in_struct->pNext);
+ ppEnabledLayerNames = new char *[in_struct->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(in_struct->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[in_struct->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(in_struct->ppEnabledExtensionNames[i]);
+ }
if (queueCreateInfoCount && in_struct->pQueueCreateInfos) {
pQueueCreateInfos = new safe_VkDeviceQueueCreateInfo[queueCreateInfoCount];
for (uint32_t i=0; i<queueCreateInfoCount; ++i) {
@@ -400,11 +464,17 @@
queueCreateInfoCount = src.queueCreateInfoCount;
pQueueCreateInfos = nullptr;
enabledLayerCount = src.enabledLayerCount;
- ppEnabledLayerNames = src.ppEnabledLayerNames;
enabledExtensionCount = src.enabledExtensionCount;
- ppEnabledExtensionNames = src.ppEnabledExtensionNames;
pEnabledFeatures = nullptr;
pNext = SafePnextCopy(src.pNext);
+ ppEnabledLayerNames = new char *[src.enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src.ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src.enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src.ppEnabledExtensionNames[i]);
+ }
if (queueCreateInfoCount && src.pQueueCreateInfos) {
pQueueCreateInfos = new safe_VkDeviceQueueCreateInfo[queueCreateInfoCount];
for (uint32_t i=0; i<queueCreateInfoCount; ++i) {
@@ -422,6 +492,18 @@
if (pQueueCreateInfos)
delete[] pQueueCreateInfos;
+ if (ppEnabledLayerNames) {
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ delete [] ppEnabledLayerNames[i];
+ }
+ delete [] ppEnabledLayerNames;
+ }
+ if (ppEnabledExtensionNames) {
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ delete [] ppEnabledExtensionNames[i];
+ }
+ delete [] ppEnabledExtensionNames;
+ }
if (pEnabledFeatures)
delete pEnabledFeatures;
if (pNext)
@@ -432,11 +514,17 @@
queueCreateInfoCount = src.queueCreateInfoCount;
pQueueCreateInfos = nullptr;
enabledLayerCount = src.enabledLayerCount;
- ppEnabledLayerNames = src.ppEnabledLayerNames;
enabledExtensionCount = src.enabledExtensionCount;
- ppEnabledExtensionNames = src.ppEnabledExtensionNames;
pEnabledFeatures = nullptr;
pNext = SafePnextCopy(src.pNext);
+ ppEnabledLayerNames = new char *[src.enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src.ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src.enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src.ppEnabledExtensionNames[i]);
+ }
if (queueCreateInfoCount && src.pQueueCreateInfos) {
pQueueCreateInfos = new safe_VkDeviceQueueCreateInfo[queueCreateInfoCount];
for (uint32_t i=0; i<queueCreateInfoCount; ++i) {
@@ -454,6 +542,18 @@
{
if (pQueueCreateInfos)
delete[] pQueueCreateInfos;
+ if (ppEnabledLayerNames) {
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ delete [] ppEnabledLayerNames[i];
+ }
+ delete [] ppEnabledLayerNames;
+ }
+ if (ppEnabledExtensionNames) {
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ delete [] ppEnabledExtensionNames[i];
+ }
+ delete [] ppEnabledExtensionNames;
+ }
if (pEnabledFeatures)
delete pEnabledFeatures;
if (pNext)
@@ -467,11 +567,17 @@
queueCreateInfoCount = in_struct->queueCreateInfoCount;
pQueueCreateInfos = nullptr;
enabledLayerCount = in_struct->enabledLayerCount;
- ppEnabledLayerNames = in_struct->ppEnabledLayerNames;
enabledExtensionCount = in_struct->enabledExtensionCount;
- ppEnabledExtensionNames = in_struct->ppEnabledExtensionNames;
pEnabledFeatures = nullptr;
pNext = SafePnextCopy(in_struct->pNext);
+ ppEnabledLayerNames = new char *[in_struct->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(in_struct->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[in_struct->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(in_struct->ppEnabledExtensionNames[i]);
+ }
if (queueCreateInfoCount && in_struct->pQueueCreateInfos) {
pQueueCreateInfos = new safe_VkDeviceQueueCreateInfo[queueCreateInfoCount];
for (uint32_t i=0; i<queueCreateInfoCount; ++i) {
@@ -490,11 +596,17 @@
queueCreateInfoCount = src->queueCreateInfoCount;
pQueueCreateInfos = nullptr;
enabledLayerCount = src->enabledLayerCount;
- ppEnabledLayerNames = src->ppEnabledLayerNames;
enabledExtensionCount = src->enabledExtensionCount;
- ppEnabledExtensionNames = src->ppEnabledExtensionNames;
pEnabledFeatures = nullptr;
pNext = SafePnextCopy(src->pNext);
+ ppEnabledLayerNames = new char *[src->enabledLayerCount];
+ for (uint32_t i = 0; i < enabledLayerCount; ++i) {
+ (const_cast<const char **>(ppEnabledLayerNames))[i] = SafeStringCopy(src->ppEnabledLayerNames[i]);
+ }
+ ppEnabledExtensionNames = new char *[src->enabledExtensionCount];
+ for (uint32_t i = 0; i < enabledExtensionCount; ++i) {
+ (const_cast<const char **>(ppEnabledExtensionNames))[i] = SafeStringCopy(src->ppEnabledExtensionNames[i]);
+ }
if (queueCreateInfoCount && src->pQueueCreateInfos) {
pQueueCreateInfos = new safe_VkDeviceQueueCreateInfo[queueCreateInfoCount];
for (uint32_t i=0; i<queueCreateInfoCount; ++i) {
@@ -2188,10 +2300,10 @@
sType(in_struct->sType),
flags(in_struct->flags),
stage(in_struct->stage),
- module(in_struct->module),
- pName(in_struct->pName)
+ module(in_struct->module)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pName = SafeStringCopy(in_struct->pName);
if (in_struct->pSpecializationInfo)
pSpecializationInfo = new safe_VkSpecializationInfo(in_struct->pSpecializationInfo);
else
@@ -2209,8 +2321,8 @@
flags = src.flags;
stage = src.stage;
module = src.module;
- pName = src.pName;
pNext = SafePnextCopy(src.pNext);
+ pName = SafeStringCopy(src.pName);
if (src.pSpecializationInfo)
pSpecializationInfo = new safe_VkSpecializationInfo(*src.pSpecializationInfo);
else
@@ -2221,6 +2333,7 @@
{
if (&src == this) return *this;
+ if (pName) delete [] pName;
if (pSpecializationInfo)
delete pSpecializationInfo;
if (pNext)
@@ -2230,8 +2343,8 @@
flags = src.flags;
stage = src.stage;
module = src.module;
- pName = src.pName;
pNext = SafePnextCopy(src.pNext);
+ pName = SafeStringCopy(src.pName);
if (src.pSpecializationInfo)
pSpecializationInfo = new safe_VkSpecializationInfo(*src.pSpecializationInfo);
else
@@ -2242,6 +2355,7 @@
safe_VkPipelineShaderStageCreateInfo::~safe_VkPipelineShaderStageCreateInfo()
{
+ if (pName) delete [] pName;
if (pSpecializationInfo)
delete pSpecializationInfo;
if (pNext)
@@ -2254,8 +2368,8 @@
flags = in_struct->flags;
stage = in_struct->stage;
module = in_struct->module;
- pName = in_struct->pName;
pNext = SafePnextCopy(in_struct->pNext);
+ pName = SafeStringCopy(in_struct->pName);
if (in_struct->pSpecializationInfo)
pSpecializationInfo = new safe_VkSpecializationInfo(in_struct->pSpecializationInfo);
else
@@ -2268,8 +2382,8 @@
flags = src->flags;
stage = src->stage;
module = src->module;
- pName = src->pName;
pNext = SafePnextCopy(src->pNext);
+ pName = SafeStringCopy(src->pName);
if (src->pSpecializationInfo)
pSpecializationInfo = new safe_VkSpecializationInfo(*src->pSpecializationInfo);
else
@@ -10558,13 +10672,13 @@
safe_VkDisplayPropertiesKHR::safe_VkDisplayPropertiesKHR(const VkDisplayPropertiesKHR* in_struct) :
display(in_struct->display),
- displayName(in_struct->displayName),
physicalDimensions(in_struct->physicalDimensions),
physicalResolution(in_struct->physicalResolution),
supportedTransforms(in_struct->supportedTransforms),
planeReorderPossible(in_struct->planeReorderPossible),
persistentContent(in_struct->persistentContent)
{
+ displayName = SafeStringCopy(in_struct->displayName);
}
safe_VkDisplayPropertiesKHR::safe_VkDisplayPropertiesKHR() :
@@ -10574,54 +10688,56 @@
safe_VkDisplayPropertiesKHR::safe_VkDisplayPropertiesKHR(const safe_VkDisplayPropertiesKHR& src)
{
display = src.display;
- displayName = src.displayName;
physicalDimensions = src.physicalDimensions;
physicalResolution = src.physicalResolution;
supportedTransforms = src.supportedTransforms;
planeReorderPossible = src.planeReorderPossible;
persistentContent = src.persistentContent;
+ displayName = SafeStringCopy(src.displayName);
}
safe_VkDisplayPropertiesKHR& safe_VkDisplayPropertiesKHR::operator=(const safe_VkDisplayPropertiesKHR& src)
{
if (&src == this) return *this;
+ if (displayName) delete [] displayName;
display = src.display;
- displayName = src.displayName;
physicalDimensions = src.physicalDimensions;
physicalResolution = src.physicalResolution;
supportedTransforms = src.supportedTransforms;
planeReorderPossible = src.planeReorderPossible;
persistentContent = src.persistentContent;
+ displayName = SafeStringCopy(src.displayName);
return *this;
}
safe_VkDisplayPropertiesKHR::~safe_VkDisplayPropertiesKHR()
{
+ if (displayName) delete [] displayName;
}
void safe_VkDisplayPropertiesKHR::initialize(const VkDisplayPropertiesKHR* in_struct)
{
display = in_struct->display;
- displayName = in_struct->displayName;
physicalDimensions = in_struct->physicalDimensions;
physicalResolution = in_struct->physicalResolution;
supportedTransforms = in_struct->supportedTransforms;
planeReorderPossible = in_struct->planeReorderPossible;
persistentContent = in_struct->persistentContent;
+ displayName = SafeStringCopy(in_struct->displayName);
}
void safe_VkDisplayPropertiesKHR::initialize(const safe_VkDisplayPropertiesKHR* src)
{
display = src->display;
- displayName = src->displayName;
physicalDimensions = src->physicalDimensions;
physicalResolution = src->physicalResolution;
supportedTransforms = src->supportedTransforms;
planeReorderPossible = src->planeReorderPossible;
persistentContent = src->persistentContent;
+ displayName = SafeStringCopy(src->displayName);
}
safe_VkDisplayModeCreateInfoKHR::safe_VkDisplayModeCreateInfoKHR(const VkDisplayModeCreateInfoKHR* in_struct) :
@@ -15488,10 +15604,10 @@
safe_VkDebugMarkerObjectNameInfoEXT::safe_VkDebugMarkerObjectNameInfoEXT(const VkDebugMarkerObjectNameInfoEXT* in_struct) :
sType(in_struct->sType),
objectType(in_struct->objectType),
- object(in_struct->object),
- pObjectName(in_struct->pObjectName)
+ object(in_struct->object)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pObjectName = SafeStringCopy(in_struct->pObjectName);
}
safe_VkDebugMarkerObjectNameInfoEXT::safe_VkDebugMarkerObjectNameInfoEXT() :
@@ -15504,28 +15620,30 @@
sType = src.sType;
objectType = src.objectType;
object = src.object;
- pObjectName = src.pObjectName;
pNext = SafePnextCopy(src.pNext);
+ pObjectName = SafeStringCopy(src.pObjectName);
}
safe_VkDebugMarkerObjectNameInfoEXT& safe_VkDebugMarkerObjectNameInfoEXT::operator=(const safe_VkDebugMarkerObjectNameInfoEXT& src)
{
if (&src == this) return *this;
+ if (pObjectName) delete [] pObjectName;
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
objectType = src.objectType;
object = src.object;
- pObjectName = src.pObjectName;
pNext = SafePnextCopy(src.pNext);
+ pObjectName = SafeStringCopy(src.pObjectName);
return *this;
}
safe_VkDebugMarkerObjectNameInfoEXT::~safe_VkDebugMarkerObjectNameInfoEXT()
{
+ if (pObjectName) delete [] pObjectName;
if (pNext)
FreePnextChain(pNext);
}
@@ -15535,8 +15653,8 @@
sType = in_struct->sType;
objectType = in_struct->objectType;
object = in_struct->object;
- pObjectName = in_struct->pObjectName;
pNext = SafePnextCopy(in_struct->pNext);
+ pObjectName = SafeStringCopy(in_struct->pObjectName);
}
void safe_VkDebugMarkerObjectNameInfoEXT::initialize(const safe_VkDebugMarkerObjectNameInfoEXT* src)
@@ -15544,8 +15662,8 @@
sType = src->sType;
objectType = src->objectType;
object = src->object;
- pObjectName = src->pObjectName;
pNext = SafePnextCopy(src->pNext);
+ pObjectName = SafeStringCopy(src->pObjectName);
}
safe_VkDebugMarkerObjectTagInfoEXT::safe_VkDebugMarkerObjectTagInfoEXT(const VkDebugMarkerObjectTagInfoEXT* in_struct) :
@@ -15622,10 +15740,10 @@
}
safe_VkDebugMarkerMarkerInfoEXT::safe_VkDebugMarkerMarkerInfoEXT(const VkDebugMarkerMarkerInfoEXT* in_struct) :
- sType(in_struct->sType),
- pMarkerName(in_struct->pMarkerName)
+ sType(in_struct->sType)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pMarkerName = SafeStringCopy(in_struct->pMarkerName);
for (uint32_t i=0; i<4; ++i) {
color[i] = in_struct->color[i];
}
@@ -15639,8 +15757,8 @@
safe_VkDebugMarkerMarkerInfoEXT::safe_VkDebugMarkerMarkerInfoEXT(const safe_VkDebugMarkerMarkerInfoEXT& src)
{
sType = src.sType;
- pMarkerName = src.pMarkerName;
pNext = SafePnextCopy(src.pNext);
+ pMarkerName = SafeStringCopy(src.pMarkerName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src.color[i];
}
@@ -15650,12 +15768,13 @@
{
if (&src == this) return *this;
+ if (pMarkerName) delete [] pMarkerName;
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
- pMarkerName = src.pMarkerName;
pNext = SafePnextCopy(src.pNext);
+ pMarkerName = SafeStringCopy(src.pMarkerName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src.color[i];
}
@@ -15665,6 +15784,7 @@
safe_VkDebugMarkerMarkerInfoEXT::~safe_VkDebugMarkerMarkerInfoEXT()
{
+ if (pMarkerName) delete [] pMarkerName;
if (pNext)
FreePnextChain(pNext);
}
@@ -15672,8 +15792,8 @@
void safe_VkDebugMarkerMarkerInfoEXT::initialize(const VkDebugMarkerMarkerInfoEXT* in_struct)
{
sType = in_struct->sType;
- pMarkerName = in_struct->pMarkerName;
pNext = SafePnextCopy(in_struct->pNext);
+ pMarkerName = SafeStringCopy(in_struct->pMarkerName);
for (uint32_t i=0; i<4; ++i) {
color[i] = in_struct->color[i];
}
@@ -15682,8 +15802,8 @@
void safe_VkDebugMarkerMarkerInfoEXT::initialize(const safe_VkDebugMarkerMarkerInfoEXT* src)
{
sType = src->sType;
- pMarkerName = src->pMarkerName;
pNext = SafePnextCopy(src->pNext);
+ pMarkerName = SafeStringCopy(src->pMarkerName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src->color[i];
}
@@ -19052,10 +19172,10 @@
safe_VkDebugUtilsObjectNameInfoEXT::safe_VkDebugUtilsObjectNameInfoEXT(const VkDebugUtilsObjectNameInfoEXT* in_struct) :
sType(in_struct->sType),
objectType(in_struct->objectType),
- objectHandle(in_struct->objectHandle),
- pObjectName(in_struct->pObjectName)
+ objectHandle(in_struct->objectHandle)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pObjectName = SafeStringCopy(in_struct->pObjectName);
}
safe_VkDebugUtilsObjectNameInfoEXT::safe_VkDebugUtilsObjectNameInfoEXT() :
@@ -19068,28 +19188,30 @@
sType = src.sType;
objectType = src.objectType;
objectHandle = src.objectHandle;
- pObjectName = src.pObjectName;
pNext = SafePnextCopy(src.pNext);
+ pObjectName = SafeStringCopy(src.pObjectName);
}
safe_VkDebugUtilsObjectNameInfoEXT& safe_VkDebugUtilsObjectNameInfoEXT::operator=(const safe_VkDebugUtilsObjectNameInfoEXT& src)
{
if (&src == this) return *this;
+ if (pObjectName) delete [] pObjectName;
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
objectType = src.objectType;
objectHandle = src.objectHandle;
- pObjectName = src.pObjectName;
pNext = SafePnextCopy(src.pNext);
+ pObjectName = SafeStringCopy(src.pObjectName);
return *this;
}
safe_VkDebugUtilsObjectNameInfoEXT::~safe_VkDebugUtilsObjectNameInfoEXT()
{
+ if (pObjectName) delete [] pObjectName;
if (pNext)
FreePnextChain(pNext);
}
@@ -19099,8 +19221,8 @@
sType = in_struct->sType;
objectType = in_struct->objectType;
objectHandle = in_struct->objectHandle;
- pObjectName = in_struct->pObjectName;
pNext = SafePnextCopy(in_struct->pNext);
+ pObjectName = SafeStringCopy(in_struct->pObjectName);
}
void safe_VkDebugUtilsObjectNameInfoEXT::initialize(const safe_VkDebugUtilsObjectNameInfoEXT* src)
@@ -19108,8 +19230,8 @@
sType = src->sType;
objectType = src->objectType;
objectHandle = src->objectHandle;
- pObjectName = src->pObjectName;
pNext = SafePnextCopy(src->pNext);
+ pObjectName = SafeStringCopy(src->pObjectName);
}
safe_VkDebugUtilsObjectTagInfoEXT::safe_VkDebugUtilsObjectTagInfoEXT(const VkDebugUtilsObjectTagInfoEXT* in_struct) :
@@ -19186,10 +19308,10 @@
}
safe_VkDebugUtilsLabelEXT::safe_VkDebugUtilsLabelEXT(const VkDebugUtilsLabelEXT* in_struct) :
- sType(in_struct->sType),
- pLabelName(in_struct->pLabelName)
+ sType(in_struct->sType)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pLabelName = SafeStringCopy(in_struct->pLabelName);
for (uint32_t i=0; i<4; ++i) {
color[i] = in_struct->color[i];
}
@@ -19203,8 +19325,8 @@
safe_VkDebugUtilsLabelEXT::safe_VkDebugUtilsLabelEXT(const safe_VkDebugUtilsLabelEXT& src)
{
sType = src.sType;
- pLabelName = src.pLabelName;
pNext = SafePnextCopy(src.pNext);
+ pLabelName = SafeStringCopy(src.pLabelName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src.color[i];
}
@@ -19214,12 +19336,13 @@
{
if (&src == this) return *this;
+ if (pLabelName) delete [] pLabelName;
if (pNext)
FreePnextChain(pNext);
sType = src.sType;
- pLabelName = src.pLabelName;
pNext = SafePnextCopy(src.pNext);
+ pLabelName = SafeStringCopy(src.pLabelName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src.color[i];
}
@@ -19229,6 +19352,7 @@
safe_VkDebugUtilsLabelEXT::~safe_VkDebugUtilsLabelEXT()
{
+ if (pLabelName) delete [] pLabelName;
if (pNext)
FreePnextChain(pNext);
}
@@ -19236,8 +19360,8 @@
void safe_VkDebugUtilsLabelEXT::initialize(const VkDebugUtilsLabelEXT* in_struct)
{
sType = in_struct->sType;
- pLabelName = in_struct->pLabelName;
pNext = SafePnextCopy(in_struct->pNext);
+ pLabelName = SafeStringCopy(in_struct->pLabelName);
for (uint32_t i=0; i<4; ++i) {
color[i] = in_struct->color[i];
}
@@ -19246,8 +19370,8 @@
void safe_VkDebugUtilsLabelEXT::initialize(const safe_VkDebugUtilsLabelEXT* src)
{
sType = src->sType;
- pLabelName = src->pLabelName;
pNext = SafePnextCopy(src->pNext);
+ pLabelName = SafeStringCopy(src->pLabelName);
for (uint32_t i=0; i<4; ++i) {
color[i] = src->color[i];
}
@@ -19256,9 +19380,7 @@
safe_VkDebugUtilsMessengerCallbackDataEXT::safe_VkDebugUtilsMessengerCallbackDataEXT(const VkDebugUtilsMessengerCallbackDataEXT* in_struct) :
sType(in_struct->sType),
flags(in_struct->flags),
- pMessageIdName(in_struct->pMessageIdName),
messageIdNumber(in_struct->messageIdNumber),
- pMessage(in_struct->pMessage),
queueLabelCount(in_struct->queueLabelCount),
pQueueLabels(nullptr),
cmdBufLabelCount(in_struct->cmdBufLabelCount),
@@ -19267,6 +19389,8 @@
pObjects(nullptr)
{
pNext = SafePnextCopy(in_struct->pNext);
+ pMessageIdName = SafeStringCopy(in_struct->pMessageIdName);
+ pMessage = SafeStringCopy(in_struct->pMessage);
if (queueLabelCount && in_struct->pQueueLabels) {
pQueueLabels = new safe_VkDebugUtilsLabelEXT[queueLabelCount];
for (uint32_t i=0; i<queueLabelCount; ++i) {
@@ -19300,9 +19424,7 @@
{
sType = src.sType;
flags = src.flags;
- pMessageIdName = src.pMessageIdName;
messageIdNumber = src.messageIdNumber;
- pMessage = src.pMessage;
queueLabelCount = src.queueLabelCount;
pQueueLabels = nullptr;
cmdBufLabelCount = src.cmdBufLabelCount;
@@ -19310,6 +19432,8 @@
objectCount = src.objectCount;
pObjects = nullptr;
pNext = SafePnextCopy(src.pNext);
+ pMessageIdName = SafeStringCopy(src.pMessageIdName);
+ pMessage = SafeStringCopy(src.pMessage);
if (queueLabelCount && src.pQueueLabels) {
pQueueLabels = new safe_VkDebugUtilsLabelEXT[queueLabelCount];
for (uint32_t i=0; i<queueLabelCount; ++i) {
@@ -19334,6 +19458,8 @@
{
if (&src == this) return *this;
+ if (pMessageIdName) delete [] pMessageIdName;
+ if (pMessage) delete [] pMessage;
if (pQueueLabels)
delete[] pQueueLabels;
if (pCmdBufLabels)
@@ -19345,9 +19471,7 @@
sType = src.sType;
flags = src.flags;
- pMessageIdName = src.pMessageIdName;
messageIdNumber = src.messageIdNumber;
- pMessage = src.pMessage;
queueLabelCount = src.queueLabelCount;
pQueueLabels = nullptr;
cmdBufLabelCount = src.cmdBufLabelCount;
@@ -19355,6 +19479,8 @@
objectCount = src.objectCount;
pObjects = nullptr;
pNext = SafePnextCopy(src.pNext);
+ pMessageIdName = SafeStringCopy(src.pMessageIdName);
+ pMessage = SafeStringCopy(src.pMessage);
if (queueLabelCount && src.pQueueLabels) {
pQueueLabels = new safe_VkDebugUtilsLabelEXT[queueLabelCount];
for (uint32_t i=0; i<queueLabelCount; ++i) {
@@ -19379,6 +19505,8 @@
safe_VkDebugUtilsMessengerCallbackDataEXT::~safe_VkDebugUtilsMessengerCallbackDataEXT()
{
+ if (pMessageIdName) delete [] pMessageIdName;
+ if (pMessage) delete [] pMessage;
if (pQueueLabels)
delete[] pQueueLabels;
if (pCmdBufLabels)
@@ -19393,9 +19521,7 @@
{
sType = in_struct->sType;
flags = in_struct->flags;
- pMessageIdName = in_struct->pMessageIdName;
messageIdNumber = in_struct->messageIdNumber;
- pMessage = in_struct->pMessage;
queueLabelCount = in_struct->queueLabelCount;
pQueueLabels = nullptr;
cmdBufLabelCount = in_struct->cmdBufLabelCount;
@@ -19403,6 +19529,8 @@
objectCount = in_struct->objectCount;
pObjects = nullptr;
pNext = SafePnextCopy(in_struct->pNext);
+ pMessageIdName = SafeStringCopy(in_struct->pMessageIdName);
+ pMessage = SafeStringCopy(in_struct->pMessage);
if (queueLabelCount && in_struct->pQueueLabels) {
pQueueLabels = new safe_VkDebugUtilsLabelEXT[queueLabelCount];
for (uint32_t i=0; i<queueLabelCount; ++i) {
@@ -19427,9 +19555,7 @@
{
sType = src->sType;
flags = src->flags;
- pMessageIdName = src->pMessageIdName;
messageIdNumber = src->messageIdNumber;
- pMessage = src->pMessage;
queueLabelCount = src->queueLabelCount;
pQueueLabels = nullptr;
cmdBufLabelCount = src->cmdBufLabelCount;
@@ -19437,6 +19563,8 @@
objectCount = src->objectCount;
pObjects = nullptr;
pNext = SafePnextCopy(src->pNext);
+ pMessageIdName = SafeStringCopy(src->pMessageIdName);
+ pMessage = SafeStringCopy(src->pMessage);
if (queueLabelCount && src->pQueueLabels) {
pQueueLabels = new safe_VkDebugUtilsLabelEXT[queueLabelCount];
for (uint32_t i=0; i<queueLabelCount; ++i) {
@@ -25273,9 +25401,9 @@
value32(in_struct->value32),
value64(in_struct->value64),
valueFloat(in_struct->valueFloat),
- valueBool(in_struct->valueBool),
- valueString(in_struct->valueString)
+ valueBool(in_struct->valueBool)
{
+ valueString = SafeStringCopy(in_struct->valueString);
}
safe_VkPerformanceValueDataINTEL::safe_VkPerformanceValueDataINTEL() :
@@ -25288,25 +25416,27 @@
value64 = src.value64;
valueFloat = src.valueFloat;
valueBool = src.valueBool;
- valueString = src.valueString;
+ valueString = SafeStringCopy(src.valueString);
}
safe_VkPerformanceValueDataINTEL& safe_VkPerformanceValueDataINTEL::operator=(const safe_VkPerformanceValueDataINTEL& src)
{
if (&src == this) return *this;
+ if (valueString) delete [] valueString;
value32 = src.value32;
value64 = src.value64;
valueFloat = src.valueFloat;
valueBool = src.valueBool;
- valueString = src.valueString;
+ valueString = SafeStringCopy(src.valueString);
return *this;
}
safe_VkPerformanceValueDataINTEL::~safe_VkPerformanceValueDataINTEL()
{
+ if (valueString) delete [] valueString;
}
void safe_VkPerformanceValueDataINTEL::initialize(const VkPerformanceValueDataINTEL* in_struct)
@@ -25315,7 +25445,7 @@
value64 = in_struct->value64;
valueFloat = in_struct->valueFloat;
valueBool = in_struct->valueBool;
- valueString = in_struct->valueString;
+ valueString = SafeStringCopy(in_struct->valueString);
}
void safe_VkPerformanceValueDataINTEL::initialize(const safe_VkPerformanceValueDataINTEL* src)
@@ -25324,7 +25454,7 @@
value64 = src->value64;
valueFloat = src->valueFloat;
valueBool = src->valueBool;
- valueString = src->valueString;
+ valueString = SafeStringCopy(src->valueString);
}
safe_VkInitializePerformanceApiInfoINTEL::safe_VkInitializePerformanceApiInfoINTEL(const VkInitializePerformanceApiInfoINTEL* in_struct) :
diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py
index cee626c..c7a50af 100644
--- a/scripts/helper_file_generator.py
+++ b/scripts/helper_file_generator.py
@@ -1234,6 +1234,7 @@
' if (pCode)\n'
' delete[] reinterpret_cast<const uint8_t *>(pCode);\n' }
copy_pnext = ''
+ copy_strings = ''
for member in item.members:
m_type = member.type
if member.name == 'pNext':
@@ -1246,9 +1247,27 @@
# Ptr types w/o a safe_struct, for non-null case need to allocate new ptr and copy data in
if m_type in ['void', 'char']:
if member.name != 'pNext':
- # For these exceptions just copy initial value over for now
- init_list += '\n %s(in_struct->%s),' % (member.name, member.name)
- init_func_txt += ' %s = in_struct->%s;\n' % (member.name, member.name)
+ if m_type == 'char':
+ # Create deep copies of strings
+ if member.len:
+ copy_strings += ' %s = new char *[in_struct->%s];\n' % (member.name, member.len)
+ copy_strings += ' for (uint32_t i = 0; i < %s; ++i) {\n' % member.len
+ copy_strings += ' (const_cast<const char **>(%s))[i] = SafeStringCopy(in_struct->%s[i]);\n' % (member.name, member.name)
+ copy_strings += ' }\n'
+
+ destruct_txt += ' if (%s) {\n' % member.name
+ destruct_txt += ' for (uint32_t i = 0; i < %s; ++i) {\n' % member.len
+ destruct_txt += ' delete [] %s[i];\n' % member.name
+ destruct_txt += ' }\n'
+ destruct_txt += ' delete [] %s;\n' % member.name
+ destruct_txt += ' }\n'
+ else:
+ copy_strings += ' %s = SafeStringCopy(in_struct->%s);\n' % (member.name, member.name)
+ destruct_txt += ' if (%s) delete [] %s;\n' % (member.name, member.name)
+ else:
+ # For these exceptions just copy initial value over for now
+ init_list += '\n %s(in_struct->%s),' % (member.name, member.name)
+ init_func_txt += ' %s = in_struct->%s;\n' % (member.name, member.name)
default_init_list += '\n %s(nullptr),' % (member.name)
else:
default_init_list += '\n %s(nullptr),' % (member.name)
@@ -1318,7 +1337,7 @@
if item.name in custom_construct_txt:
construct_txt = custom_construct_txt[item.name]
- construct_txt = copy_pnext + construct_txt
+ construct_txt = copy_pnext + copy_strings + construct_txt
if item.name in custom_destruct_txt:
destruct_txt = custom_destruct_txt[item.name]