Use unique_ptr array in PNGLibrary comments method.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3172 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-06-14 15:19:10 +00:00
parent c7ef1607be
commit 5ca03e2263
1 changed files with 2 additions and 2 deletions

View File

@ -304,7 +304,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
if(numComments == 0)
return;
png_text text_ptr[numComments];
unique_ptr<png_text[]> text_ptr = make_ptr<png_text[]>(numComments);
for(uInt32 i = 0; i < numComments; ++i)
{
text_ptr[i].key = (char*) comments[i].first.c_str();
@ -312,7 +312,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[i].text_length = 0;
}
png_set_text(png_ptr, info_ptr, text_ptr, numComments);
png_set_text(png_ptr, info_ptr, text_ptr.get(), numComments);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -