mirror of https://github.com/stella-emu/stella.git
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:
parent
c7ef1607be
commit
5ca03e2263
|
@ -304,7 +304,7 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
|
||||||
if(numComments == 0)
|
if(numComments == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_text text_ptr[numComments];
|
unique_ptr<png_text[]> text_ptr = make_ptr<png_text[]>(numComments);
|
||||||
for(uInt32 i = 0; i < numComments; ++i)
|
for(uInt32 i = 0; i < numComments; ++i)
|
||||||
{
|
{
|
||||||
text_ptr[i].key = (char*) comments[i].first.c_str();
|
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].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr[i].text_length = 0;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
Loading…
Reference in New Issue