mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 09:13:14 +00:00
1. Fixed typo
2. Added handler for jpeg memory allocation error
This commit is contained in:
@@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "linux_compression.h"
|
#include "linux_compression.h"
|
||||||
|
#include "../../../microstack/ILibParsers.h";
|
||||||
|
|
||||||
#if defined(JPEGMAXBUF)
|
#if defined(JPEGMAXBUF)
|
||||||
#define MAX_TILE_SIZE JPEGMAXBUF
|
#define MAX_TILE_SIZE JPEGMAXBUF
|
||||||
@@ -40,7 +41,7 @@ void init_destination(j_compress_ptr cinfo)
|
|||||||
{
|
{
|
||||||
JOCTET * next_output_byte;
|
JOCTET * next_output_byte;
|
||||||
if (jpeg_buffer != NULL) { free(jpeg_buffer); }
|
if (jpeg_buffer != NULL) { free(jpeg_buffer); }
|
||||||
jpeg_buffer = malloc(MAX_BUFFER);
|
if ((jpeg_buffer = malloc(MAX_BUFFER)) == NULL) { ILIBCRITICALEXIT(254); }
|
||||||
jpeg_buffer_length = 0;
|
jpeg_buffer_length = 0;
|
||||||
next_output_byte = jpeg_buffer;
|
next_output_byte = jpeg_buffer;
|
||||||
cinfo->dest->next_output_byte = next_output_byte;
|
cinfo->dest->next_output_byte = next_output_byte;
|
||||||
@@ -52,7 +53,7 @@ boolean empty_output_buffer(j_compress_ptr cinfo)
|
|||||||
JOCTET * next_output_byte;
|
JOCTET * next_output_byte;
|
||||||
|
|
||||||
jpeg_buffer_length += MAX_BUFFER;
|
jpeg_buffer_length += MAX_BUFFER;
|
||||||
jpeg_buffer = (unsigned char *) realloc(jpeg_buffer, jpeg_buffer_length + MAX_BUFFER);
|
if ((jpeg_buffer = (unsigned char *)realloc(jpeg_buffer, jpeg_buffer_length + MAX_BUFFER)) == NULL) { ILIBCRITICALEXIT(254); }
|
||||||
next_output_byte = jpeg_buffer + jpeg_buffer_length;
|
next_output_byte = jpeg_buffer + jpeg_buffer_length;
|
||||||
cinfo->dest->next_output_byte = next_output_byte;
|
cinfo->dest->next_output_byte = next_output_byte;
|
||||||
cinfo->dest->free_in_buffer = MAX_BUFFER;
|
cinfo->dest->free_in_buffer = MAX_BUFFER;
|
||||||
@@ -78,7 +79,7 @@ void term_destination (j_compress_ptr cinfo)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
jpeg_buffer = (unsigned char *) realloc(jpeg_buffer, jpeg_buffer_length);
|
if ((jpeg_buffer = (unsigned char *)realloc(jpeg_buffer, jpeg_buffer_length)) == NULL) { ILIBCRITICALEXIT(254); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ void* kvm_mainloopinput(void* parm)
|
|||||||
int ptr = 0;
|
int ptr = 0;
|
||||||
int ptr2 = 0;
|
int ptr2 = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char* pchRequest2[30000];
|
char pchRequest2[30000];
|
||||||
ssize_t cbBytesRead = 0;
|
ssize_t cbBytesRead = 0;
|
||||||
|
|
||||||
while (!g_shutdown)
|
while (!g_shutdown)
|
||||||
|
|||||||
Reference in New Issue
Block a user