Skip to content

Commit d06f8ba

Browse files
committed
Fixed Clang warnings
1 parent 01ab12c commit d06f8ba

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

include/lsp-plug.in/fmt/obj/Compressor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace lsp
9393
public:
9494
/**
9595
* Set buffer size
96-
* @param float_bits
96+
* @param float_bits number of bits to encode floating-point number (and logarithm of the buffer size)
9797
* @return status of operation
9898
*/
9999
status_t set_buffer_size(size_t float_bits);
@@ -117,4 +117,4 @@ namespace lsp
117117

118118

119119

120-
#endif /* LSP_PL;UG_IN_FMT_OBJ_COMPRESSOR_H_ */
120+
#endif /* LSP_PLUG_IN_FMT_OBJ_COMPRESSOR_H_ */

include/lsp-plug.in/fmt/obj/Decompressor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ namespace lsp
8383
* Parse compressed OBJ file
8484
* @param handler Wavefront Object file handler
8585
* @param path UTF-8 path to the file
86-
* @param charset character set encoding of the file
8786
* @return status of operation
8887
*/
8988
status_t parse_file(IObjHandler *handler, const char *path);
@@ -92,7 +91,6 @@ namespace lsp
9291
* Parse compressed OBJ file
9392
* @param handler Wavefront Object file handler
9493
* @param path path to the file
95-
* @param charset character set encoding of the file
9694
* @return status of operation
9795
*/
9896
status_t parse_file(IObjHandler *handler, const LSPString *path);
@@ -101,7 +99,6 @@ namespace lsp
10199
* Parse compressed OBJ file
102100
* @param handler Wavefront Object file handler
103101
* @param path path to the file
104-
* @param charset character set encoding of the file
105102
* @return status of operation
106103
*/
107104
status_t parse_file(IObjHandler *handler, const io::Path *path);
@@ -111,7 +108,6 @@ namespace lsp
111108
* @param handler Wavefront Object file handler
112109
* @param is input stream
113110
* @param flags wrap flags
114-
* @param charset character set
115111
* @return status of operation
116112
*/
117113
status_t parse_data(IObjHandler *handler, io::IInStream *is, size_t flags = WRAP_NONE);

src/main/fmt/obj/Compressor.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ namespace lsp
344344
vFloatBuf = ptr;
345345
}
346346

347-
nFloatCap = float_cap;
347+
nFloatCap = uint32_t(float_cap);
348348
nFloatBits = uint32_t(float_bits);
349349

350350
return STATUS_OK;
@@ -422,7 +422,7 @@ namespace lsp
422422
const uint32_t idx = (base - i) % nFloatCap;
423423
if (vFloatBuf[idx] == value)
424424
{
425-
index = i;
425+
index = int32_t(i);
426426
break;
427427
}
428428
}
@@ -457,7 +457,7 @@ namespace lsp
457457
const uint32_t dval = zigzag_encode(diff);
458458
if (dval < delta)
459459
{
460-
index = i;
460+
index = int32_t(i);
461461
delta = dval;
462462
break;
463463
}
@@ -491,14 +491,15 @@ namespace lsp
491491

492492
status_t Compressor::write_indices(const index_t *value, size_t count)
493493
{
494-
int32_t delta = value[0];
494+
int32_t delta = int32_t(value[0]);
495495
status_t res = write_varint_icount(zigzag_encode(delta));
496496
if (res != STATUS_OK)
497497
return res;
498498

499499
for (size_t i=1; i<count; ++i)
500500
{
501-
status_t res = write_varint_icount(zigzag_encode(value[i] - value[0]));
501+
const int32_t diff = int32_t(value[i] - value[0]);
502+
res = write_varint_icount(zigzag_encode(diff));
502503
if (res != STATUS_OK)
503504
return res;
504505
}

src/main/fmt/obj/Decompressor.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ namespace lsp
191191
vFloatBuf = ptr;
192192
nFloatHead = 0;
193193
nFloatSize = 0;
194-
nFloatCap = float_cap;
194+
nFloatCap = uint32_t(float_cap);
195195
nFloatBits = uint32_t(hdr.float_bits);
196196

197197
return STATUS_OK;
@@ -234,7 +234,7 @@ namespace lsp
234234
return (nread < 0) ? status_t(-nread) : STATUS_CORRUPTED;
235235

236236
// Convert subcommand + group to event code
237-
cmd = (group << 2) | cmd;
237+
cmd = uint32_t((group << 2) | cmd);
238238
if (cmd >= sizeof(event_codes))
239239
return STATUS_CORRUPTED;
240240

@@ -283,7 +283,7 @@ namespace lsp
283283
return res;
284284

285285
// Compute floating-point value
286-
int32_t dvalue = zigzag_decode(delta);
286+
int32_t dvalue = zigzag_decode(int32_t(delta));
287287
const int32_t image = vIntBuf[(base - index) % nFloatCap] + dvalue;
288288
value = bin_to_float(image);
289289
}
@@ -374,14 +374,14 @@ namespace lsp
374374
status_t res = read_varint_icount(&value);
375375
if (res != STATUS_OK)
376376
return res;
377-
dst[0] = zigzag_decode(value);
377+
dst[0] = zigzag_decode(int32_t(value));
378378

379379
for (size_t i=1; i<count; ++i)
380380
{
381381
status_t res = read_varint_icount(&value);
382382
if (res != STATUS_OK)
383383
return res;
384-
dst[i] = dst[0] + zigzag_decode(value);
384+
dst[i] = dst[0] + zigzag_decode(int32_t(value));
385385
}
386386

387387
return STATUS_OK;
@@ -425,7 +425,7 @@ namespace lsp
425425
if ((res == STATUS_OK) && (coords > 3))
426426
res = read_float(&w);
427427
if (res == STATUS_OK)
428-
res = handler->add_vertex(x, y, z, w);
428+
res = status_t(handler->add_vertex(x, y, z, w));
429429

430430
return res;
431431
}
@@ -442,7 +442,7 @@ namespace lsp
442442
if ((res == STATUS_OK) && (coords > 3))
443443
res = read_float(&w);
444444
if (res == STATUS_OK)
445-
res = handler->add_param_vertex(x, y, z, w);
445+
res = status_t(handler->add_param_vertex(x, y, z, w));
446446

447447
return res;
448448
}
@@ -459,7 +459,7 @@ namespace lsp
459459
if ((res == STATUS_OK) && (coords > 3))
460460
res = read_float(&nw);
461461
if (res == STATUS_OK)
462-
res = handler->add_normal(nx, ny, nz, nw);
462+
res = status_t(handler->add_normal(nx, ny, nz, nw));
463463

464464
return res;
465465
}
@@ -474,7 +474,7 @@ namespace lsp
474474
if ((res == STATUS_OK) && (coords > 2))
475475
res = read_float(&w);
476476
if (res == STATUS_OK)
477-
res = handler->add_texture_vertex(u, v, w);
477+
res = status_t(handler->add_texture_vertex(u, v, w));
478478
return res;
479479
}
480480

@@ -513,7 +513,7 @@ namespace lsp
513513
}
514514

515515

516-
return handler->add_face(vv, vn, vt, count);
516+
return status_t(handler->add_face(vv, vn, vt, count));
517517
}
518518

519519
status_t Decompressor::parse_line(IObjHandler *handler, bool texcoords)
@@ -534,7 +534,7 @@ namespace lsp
534534
if ((res = read_indices(vt, count, texcoords)) != STATUS_OK)
535535
return res;
536536

537-
return handler->add_line(vv, vt, count);
537+
return status_t(handler->add_line(vv, vt, count));
538538
}
539539

540540
status_t Decompressor::parse_points(IObjHandler *handler)
@@ -552,7 +552,7 @@ namespace lsp
552552
if ((res = read_indices(vv, count, true)) != STATUS_OK)
553553
return res;
554554

555-
return handler->add_points(vv, count);
555+
return status_t(handler->add_points(vv, count));
556556
}
557557

558558
status_t Decompressor::parse_object(IObjHandler *handler)

src/main/runtime/buffer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace lsp
5757
root = advance_ptr_bytes<uint32_t>(ptr, rbuf);
5858
head = 0;
5959
length = 0;
60-
cap = capacity;
60+
cap = uint32_t(capacity);
6161

6262
for (size_t i=0; i < 0x100; ++i)
6363
root[i] = -1;
@@ -218,7 +218,7 @@ namespace lsp
218218
data = ptr;
219219
length = 0;
220220
head = 0;
221-
cap = capacity;
221+
cap = uint32_t(capacity);
222222

223223
return STATUS_OK;
224224
}
@@ -257,7 +257,7 @@ namespace lsp
257257
else
258258
memcpy(&data[ohead], v, count * sizeof(uint8_t));
259259

260-
length = lsp_min(length + count, cap);
260+
length = uint32_t(lsp_min(length + count, cap));
261261
}
262262

263263
status_t dbuffer_t::extract(void *dst, size_t offset, size_t count)

0 commit comments

Comments
 (0)