Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-03 11:37:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-03 11:37:38 +0400
commitd248f94cf8b3a715297f3e512d0b10c7d7b7a0c1 (patch)
tree71275d90db69d9f434d69bc0422486dd35830fca /source/blender/blenkernel/intern/customdata_file.c
parentca6fa937d498691faf77fa58f7c6c4128ac05866 (diff)
add endian switch functions to replace macros SWITCH_INT/LONG/SHORT, with BLI_endian_switch_int32/int64/float/double...
Diffstat (limited to 'source/blender/blenkernel/intern/customdata_file.c')
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 71801c4729f..5794625efa1 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -32,6 +32,7 @@
#include "BLI_fileops.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLI_endian_switch.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
@@ -165,9 +166,9 @@ static int cdf_read_header(CDataFile *cdf)
header->endian = cdf_endian();
if (cdf->switchendian) {
- SWITCH_INT(header->type);
- SWITCH_INT(header->totlayer);
- SWITCH_INT(header->structbytes);
+ BLI_endian_switch_int32(&header->type);
+ BLI_endian_switch_int32(&header->totlayer);
+ BLI_endian_switch_int32(&header->structbytes);
}
if (!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
@@ -185,10 +186,10 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian) {
- SWITCH_INT(image->width);
- SWITCH_INT(image->height);
- SWITCH_INT(image->tile_size);
- SWITCH_INT(image->structbytes);
+ BLI_endian_switch_int32(&image->width);
+ BLI_endian_switch_int32(&image->height);
+ BLI_endian_switch_int32(&image->tile_size);
+ BLI_endian_switch_int32(&image->structbytes);
}
offset += image->structbytes;
@@ -200,7 +201,7 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian)
- SWITCH_INT(mesh->structbytes);
+ BLI_endian_switch_int32(&mesh->structbytes);
offset += mesh->structbytes;
mesh->structbytes = sizeof(CDataFileMeshHeader);
@@ -219,10 +220,10 @@ static int cdf_read_header(CDataFile *cdf)
return 0;
if (cdf->switchendian) {
- SWITCH_INT(layer->type);
- SWITCH_INT(layer->datatype);
- SWITCH_INT64(layer->datasize);
- SWITCH_INT(layer->structbytes);
+ BLI_endian_switch_int32(&layer->type);
+ BLI_endian_switch_int32(&layer->datatype);
+ BLI_endian_switch_uint64(&layer->datasize);
+ BLI_endian_switch_int32(&layer->structbytes);
}
if (layer->datatype != CDF_DATA_FLOAT)
@@ -329,7 +330,7 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
fdata = data;
for (a = 0; a < size / sizeof(float); a++) {
- SWITCH_INT(fdata[a]);
+ BLI_endian_switch_float(&fdata[a]);
}
}