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 <campbell@blender.org>2022-09-25 13:27:46 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 15:31:31 +0300
commit21d77a417e17ac92bfc10dbd742c867d4019ce69 (patch)
treeec664b5c6ca7882bcc5a1e1ce09cad67b842af9d /source/blender/blenloader/intern
parentd35a10134cfdbd3e24a56218ef3f05aac2a2fc7e (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/undofile.cc12
-rw-r--r--source/blender/blenloader/intern/writefile.cc14
2 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/undofile.cc b/source/blender/blenloader/intern/undofile.cc
index 4c417c41297..99d1ca336fe 100644
--- a/source/blender/blenloader/intern/undofile.cc
+++ b/source/blender/blenloader/intern/undofile.cc
@@ -233,9 +233,9 @@ bool BLO_memfile_write_file(struct MemFile *memfile, const char *filepath)
for (chunk = static_cast<MemFileChunk *>(memfile->chunks.first); chunk;
chunk = static_cast<MemFileChunk *>(chunk->next)) {
#ifdef _WIN32
- if ((size_t)write(file, chunk->buf, uint(chunk->size)) != chunk->size)
+ if (size_t(write(file, chunk->buf, uint(chunk->size))) != chunk->size)
#else
- if ((size_t)write(file, chunk->buf, chunk->size) != chunk->size)
+ if (size_t(write(file, chunk->buf, chunk->size)) != chunk->size)
#endif
{
break;
@@ -269,19 +269,19 @@ static ssize_t undo_read(FileReader *reader, void *buffer, size_t size)
return 0;
}
- if (seek != (size_t)undo->reader.offset) {
+ if (seek != size_t(undo->reader.offset)) {
chunk = static_cast<MemFileChunk *>(undo->memfile->chunks.first);
seek = 0;
while (chunk) {
- if (seek + chunk->size > (size_t)undo->reader.offset) {
+ if (seek + chunk->size > size_t(undo->reader.offset)) {
break;
}
seek += chunk->size;
chunk = static_cast<MemFileChunk *>(chunk->next);
}
offset = seek;
- seek = (size_t)undo->reader.offset;
+ seek = size_t(undo->reader.offset);
}
if (chunk) {
@@ -323,7 +323,7 @@ static ssize_t undo_read(FileReader *reader, void *buffer, size_t size)
chunk->is_identical_future;
} while (totread < size);
- return (ssize_t)totread;
+ return ssize_t(totread);
}
return 0;
diff --git a/source/blender/blenloader/intern/writefile.cc b/source/blender/blenloader/intern/writefile.cc
index 757bce97bf1..cff17bf186d 100644
--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1256,7 +1256,7 @@ static bool write_file_handle(Main *mainvar,
*
* Note that we *borrow* the pointer to 'DNAstr',
* so writing each time uses the same address and doesn't cause unnecessary undo overhead. */
- writedata(wd, DNA1, (size_t)wd->sdna->data_len, wd->sdna->data);
+ writedata(wd, DNA1, size_t(wd->sdna->data_len), wd->sdna->data);
/* end of file */
memset(&bhead, 0, sizeof(BHead));
@@ -1575,32 +1575,32 @@ int BLO_get_struct_id_by_name(BlendWriter *writer, const char *struct_name)
void BLO_write_int32_array(BlendWriter *writer, uint num, const int32_t *data_ptr)
{
- BLO_write_raw(writer, sizeof(int32_t) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(int32_t) * size_t(num), data_ptr);
}
void BLO_write_uint32_array(BlendWriter *writer, uint num, const uint32_t *data_ptr)
{
- BLO_write_raw(writer, sizeof(uint32_t) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(uint32_t) * size_t(num), data_ptr);
}
void BLO_write_float_array(BlendWriter *writer, uint num, const float *data_ptr)
{
- BLO_write_raw(writer, sizeof(float) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(float) * size_t(num), data_ptr);
}
void BLO_write_double_array(BlendWriter *writer, uint num, const double *data_ptr)
{
- BLO_write_raw(writer, sizeof(double) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(double) * size_t(num), data_ptr);
}
void BLO_write_pointer_array(BlendWriter *writer, uint num, const void *data_ptr)
{
- BLO_write_raw(writer, sizeof(void *) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(void *) * size_t(num), data_ptr);
}
void BLO_write_float3_array(BlendWriter *writer, uint num, const float *data_ptr)
{
- BLO_write_raw(writer, sizeof(float[3]) * (size_t)num, data_ptr);
+ BLO_write_raw(writer, sizeof(float[3]) * size_t(num), data_ptr);
}
void BLO_write_string(BlendWriter *writer, const char *data_ptr)