/* 'checkit_tiff' is a conformance checker for baseline TIFFs
 *
 * author: Andreas Romeyke, 2015-2025
 * licensed under conditions of libtiff
 * (see http://libtiff.maptools.org/misc.html)
 *
 */

#include <assert.h>
#include "strcopy.h"
#include <string.h>

void cit_strcopy(char *dest, size_t dsize, const char *src, size_t slen) {
    /* assert slen has enough space in dsize */
    assert(dsize > slen);
    assert(dest != NULL);
    if (dest) dest[0] = 0; /* if dest is not empty */
    if (slen <dsize) { /* if enough space, copy */
        memcpy(dest, src, slen);
	    dest[slen] = 0; /* set null terminator at end */
    }
}



