gmio_stl: prefix enum values of gmio_stl_format with GMIO_STL_FORMAT

This commit is contained in:
Hugues Delorme 2015-04-02 10:58:10 +02:00
parent 027f9bfc2a
commit 7fc0836c2b
3 changed files with 14 additions and 14 deletions

View File

@ -34,7 +34,7 @@ gmio_stl_format_t gmio_stl_get_format(gmio_stream_t *stream)
size_t read_size = 0; size_t read_size = 0;
if (stream == NULL) if (stream == NULL)
return GMIO_STL_UNKNOWN_FORMAT; return GMIO_STL_FORMAT_UNKNOWN;
/* Read a chunk of bytes from stream, then try to find format from that */ /* Read a chunk of bytes from stream, then try to find format from that */
memset(fixed_buffer, 0, GMIO_FIXED_BUFFER_SIZE); memset(fixed_buffer, 0, GMIO_FIXED_BUFFER_SIZE);
@ -54,7 +54,7 @@ gmio_stl_format_t gmio_stl_get_format(gmio_stream_t *stream)
if ((GMIO_STLB_HEADER_SIZE + 4 + facet_count*GMIO_STLB_TRIANGLE_RAWSIZE) if ((GMIO_STLB_HEADER_SIZE + 4 + facet_count*GMIO_STLB_TRIANGLE_RAWSIZE)
== stream_size) == stream_size)
{ {
return GMIO_STL_BINARY_LE_FORMAT; return GMIO_STL_FORMAT_BINARY_LE;
} }
/* Try with byte-reverted facet count */ /* Try with byte-reverted facet count */
@ -62,7 +62,7 @@ gmio_stl_format_t gmio_stl_get_format(gmio_stream_t *stream)
if ((GMIO_STLB_HEADER_SIZE + 4 + facet_count*GMIO_STLB_TRIANGLE_RAWSIZE) if ((GMIO_STLB_HEADER_SIZE + 4 + facet_count*GMIO_STLB_TRIANGLE_RAWSIZE)
== stream_size) == stream_size)
{ {
return GMIO_STL_BINARY_BE_FORMAT; return GMIO_STL_FORMAT_BINARY_BE;
} }
} }
@ -78,10 +78,10 @@ gmio_stl_format_t gmio_stl_get_format(gmio_stream_t *stream)
&& gmio_istarts_with(fixed_buffer + pos, "solid") && gmio_istarts_with(fixed_buffer + pos, "solid")
&& gmio_clocale_isspace(fixed_buffer[pos + 5])) && gmio_clocale_isspace(fixed_buffer[pos + 5]))
{ {
return GMIO_STL_ASCII_FORMAT; return GMIO_STL_FORMAT_ASCII;
} }
} }
/* Fallback case */ /* Fallback case */
return GMIO_STL_UNKNOWN_FORMAT; return GMIO_STL_FORMAT_UNKNOWN;
} }

View File

@ -26,10 +26,10 @@
/*! This enums defines the various STL formats */ /*! This enums defines the various STL formats */
enum gmio_stl_format enum gmio_stl_format
{ {
GMIO_STL_ASCII_FORMAT, /*!< STL ASCII (text) */ GMIO_STL_FORMAT_UNKNOWN = 0, /*!< Unknown STL format */
GMIO_STL_BINARY_LE_FORMAT, /*!< STL binary (little-endian) */ GMIO_STL_FORMAT_ASCII, /*!< STL ASCII (text) */
GMIO_STL_BINARY_BE_FORMAT, /*!< STL binary (big-endian) */ GMIO_STL_FORMAT_BINARY_LE, /*!< STL binary (little-endian) */
GMIO_STL_UNKNOWN_FORMAT GMIO_STL_FORMAT_BINARY_BE /*!< STL binary (big-endian) */
}; };
typedef enum gmio_stl_format gmio_stl_format_t; typedef enum gmio_stl_format gmio_stl_format_t;
@ -41,7 +41,7 @@ GMIO_C_LINKAGE_BEGIN
* It will try to read 512 bytes from \p stream into a buffer and then * It will try to read 512 bytes from \p stream into a buffer and then
* analyses this data to guess the format. * analyses this data to guess the format.
* *
* \retval GMIO_STL_UNKNOWN_FORMAT in case of error. * \retval GMIO_STL_FORMAT_UNKNOWN in case of error.
*/ */
GMIO_LIBSTL_EXPORT GMIO_LIBSTL_EXPORT
gmio_stl_format_t gmio_stl_get_format(gmio_stream_t* stream); gmio_stl_format_t gmio_stl_get_format(gmio_stream_t* stream);

View File

@ -56,19 +56,19 @@ int gmio_stl_read(gmio_transfer_t *trsf, gmio_stl_mesh_creator_t *creator)
const gmio_stl_format_t stl_format = gmio_stl_get_format(&trsf->stream); const gmio_stl_format_t stl_format = gmio_stl_get_format(&trsf->stream);
switch (stl_format) { switch (stl_format) {
case GMIO_STL_ASCII_FORMAT: { case GMIO_STL_FORMAT_ASCII: {
error = gmio_stla_read(trsf, creator); error = gmio_stla_read(trsf, creator);
break; break;
} }
case GMIO_STL_BINARY_BE_FORMAT: { case GMIO_STL_FORMAT_BINARY_BE: {
error = gmio_stlb_read(trsf, creator, GMIO_ENDIANNESS_BIG); error = gmio_stlb_read(trsf, creator, GMIO_ENDIANNESS_BIG);
break; break;
} }
case GMIO_STL_BINARY_LE_FORMAT: { case GMIO_STL_FORMAT_BINARY_LE: {
error = gmio_stlb_read(trsf, creator, GMIO_ENDIANNESS_LITTLE); error = gmio_stlb_read(trsf, creator, GMIO_ENDIANNESS_LITTLE);
break; break;
} }
case GMIO_STL_UNKNOWN_FORMAT: { case GMIO_STL_FORMAT_UNKNOWN: {
error = GMIO_STL_ERROR_UNKNOWN_FORMAT; error = GMIO_STL_ERROR_UNKNOWN_FORMAT;
} }
} /* end switch() */ } /* end switch() */