gmio_stl: add function gmio_stlb_header_str
This commit is contained in:
parent
b514f12cc3
commit
ce50f76ef0
26
src/gmio_stl/stlb_header.c
Normal file
26
src/gmio_stl/stlb_header.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** gmio
|
||||||
|
** Copyright Fougue (2 Mar. 2015)
|
||||||
|
** contact@fougue.pro
|
||||||
|
**
|
||||||
|
** This software is a reusable library whose purpose is to provide complete
|
||||||
|
** I/O support for various CAD file formats (eg. STL)
|
||||||
|
**
|
||||||
|
** This software is governed by the CeCILL-B license under French law and
|
||||||
|
** abiding by the rules of distribution of free software. You can use,
|
||||||
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
||||||
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "stlb_header.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct gmio_stlb_header gmio_stlb_header_str(const char* str)
|
||||||
|
{
|
||||||
|
struct gmio_stlb_header header = {0};
|
||||||
|
if (str != NULL)
|
||||||
|
strncpy((char*)header.data, str, GMIO_STLB_HEADER_SIZE);
|
||||||
|
return header;
|
||||||
|
}
|
@ -32,5 +32,19 @@ struct gmio_stlb_header
|
|||||||
uint8_t data[GMIO_STLB_HEADER_SIZE];
|
uint8_t data[GMIO_STLB_HEADER_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GMIO_C_LINKAGE_BEGIN
|
||||||
|
|
||||||
|
/*! Returns a gmio_stlb_header object whose contents is a copy of \p str
|
||||||
|
*
|
||||||
|
* Only the first \c GMIO_STLB_HEADER_SIZE characters are copied.
|
||||||
|
*
|
||||||
|
* If the length of \p str is less than \c GMIO_STLB_HEADER_SIZE then the
|
||||||
|
* remaining bytes are filled with zeroes.
|
||||||
|
*/
|
||||||
|
GMIO_LIBSTL_EXPORT
|
||||||
|
struct gmio_stlb_header gmio_stlb_header_str(const char* str);
|
||||||
|
|
||||||
|
GMIO_C_LINKAGE_END
|
||||||
|
|
||||||
#endif /* GMIO_STLB_HEADER_H */
|
#endif /* GMIO_STLB_HEADER_H */
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
Loading…
Reference in New Issue
Block a user