diff --git a/src/core/codestream/ojph_codestream_local.cpp b/src/core/codestream/ojph_codestream_local.cpp index 8936d5b..e899740 100644 --- a/src/core/codestream/ojph_codestream_local.cpp +++ b/src/core/codestream/ojph_codestream_local.cpp @@ -654,21 +654,17 @@ namespace ojph { for (ui32 i = 0; i < num_comments; ++i) { - char* data = comments[i].data; - ui32 Rcom = comments[i].Rcom; - ui32 len = comments[i].len; - t = swap_byte(JP2K_MARKER::COM); if (file->write(&t, 2) != 2) OJPH_ERROR(0x00030028, "Error writing to file"); - t = swap_byte((ui16)(len + 4)); + t = swap_byte((ui16)(comments[i].len + 4)); if (file->write(&t, 2) != 2) OJPH_ERROR(0x00030029, "Error writing to file"); //1 for General use (IS 8859-15:1999 (Latin) values) - t = swap_byte(Rcom); + t = swap_byte(comments[i].Rcom); if (file->write(&t, 2) != 2) OJPH_ERROR(0x0003002A, "Error writing to file"); - if (file->write(data, len) != len) + if (file->write(comments[i].data, len) != len) OJPH_ERROR(0x0003002B, "Error writing to file"); } }