"checkit_tiff" is an incredibly fast conformance checker for baseline TIFFs (with various extensions), see http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
2.5 KiB

/* rule based checks if given TIFF is a specific baseline TIFF
*
* author: Andreas Romeyke, 2015
* licensed under conditions of libtiff
* (see file LICENSE)
*
*/
#include <assert.h>
#include <string.h>
#include "check.h"
#include "check_helper.h"
/** adds a message to render pipeline
* @pointer to render pipeline
* @src message
* @src_type message rm_type
*/
returncode_t __add_to_render_pipeline_via_strncpy (retmsg_t ** pointer, const char * src, size_t src_len, rm_type_t src_type) {
assert(pointer != NULL);
retmsg_t * actual_render = NULL;
actual_render = *pointer;
assert(actual_render != NULL);
assert(src != NULL);
assert(actual_render->next==NULL);
assert(actual_render->rm_msg != NULL);
retmsg_t * next = malloc ( sizeof(retmsg_t));
if (NULL == next) {
exit( could_not_allocate_memory);
// return could_not_allocate_memory;
}
/*
actual_render->next->rm_msg = malloc ( sizeof(char) * VALUESTRLEN );
if (NULL == actual_render->next->rm_msg) {
exit (could_not_allocate_memory);
// return could_not_allocate_memory;
}
memset( actual_render->next->rm_msg, '\0', VALUESTRLEN);
*/
char * msg = calloc (src_len+1, sizeof(char) );
if (NULL == msg) {
exit (could_not_allocate_memory);
// return could_not_allocate_memory;
}
//strncpy(msg, src, src_len );
memcpy(msg, src,src_len);
actual_render->next = next;
actual_render->next->rm_msg = msg;
actual_render->next->rm_type = src_type;
// fprintf(stderr, "rendertype=%i rendermsg='%s'\n",actual_render->next->rm_type, actual_render->next->rm_msg );
actual_render->next->next=NULL;
actual_render = actual_render->next;
assert(actual_render != NULL);
assert(actual_render->rm_msg != NULL);
*pointer = actual_render;
return is_valid;
}
void __clean_render_pipeline( retmsg_t ** pointer ) {
assert(pointer != NULL);
retmsg_t * actual_render = *pointer;
while (NULL != actual_render) {
retmsg_t * next = actual_render->next;
char * rm_msg = actual_render->rm_msg;
free( actual_render );
if (NULL != rm_msg) {
free( rm_msg );
rm_msg = NULL;
}
actual_render = next;
}
}
/*
returncode_t tifp_check( ctiff_t * ctif) {
if (NULL == ctif) { return code_error_ctif_empty; };
if (0 > ctif->fd) { return code_error_filedescriptor_empty; };
if (NULL == ctif->streamp) { return code_error_streampointer_empty; };
return should_not_occur;
}
*/
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/