Skip to content

Commit 32d5ac4

Browse files
committed
mkvmuxerutil: Fix MSVC build.
Avoid a couple implicit casts. Change-Id: I3299272769d15c08c733ced1b0f95bdf75848e6f
1 parent 6397597 commit 32d5ac4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

mkvmuxer/mkvmuxerutil.cc

+12-11
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ uint64_t WriteSimpleBlock(IMkvWriter* writer, const Frame* const frame,
173173
if (writer->Write(frame->frame(), static_cast<uint32_t>(frame->length())))
174174
return 0;
175175

176-
return GetUIntSize(libwebm::kMkvSimpleBlock) + GetCodedUIntSize(size) + 4 +
177-
frame->length();
176+
return static_cast<uint64_t>(GetUIntSize(libwebm::kMkvSimpleBlock) +
177+
GetCodedUIntSize(size) + 4 + frame->length());
178178
}
179179

180180
} // namespace
@@ -229,7 +229,7 @@ uint64_t EbmlMasterElementSize(uint64_t type, uint64_t value) {
229229
// Datasize
230230
ebml_size += GetCodedUIntSize(value);
231231

232-
return ebml_size;
232+
return static_cast<uint64_t>(ebml_size);
233233
}
234234

235235
uint64_t EbmlElementSize(uint64_t type, int64_t value) {
@@ -242,7 +242,7 @@ uint64_t EbmlElementSize(uint64_t type, int64_t value) {
242242
// Size of Datasize
243243
ebml_size++;
244244

245-
return ebml_size;
245+
return static_cast<uint64_t>(ebml_size);
246246
}
247247

248248
uint64_t EbmlElementSize(uint64_t type, uint64_t value) {
@@ -251,10 +251,11 @@ uint64_t EbmlElementSize(uint64_t type, uint64_t value) {
251251

252252
uint64_t EbmlElementSize(uint64_t type, uint64_t value, uint64_t fixed_size) {
253253
// Size of EBML ID
254-
int32_t ebml_size = GetUIntSize(type);
254+
uint64_t ebml_size = static_cast<uint64_t>(GetUIntSize(type));
255255

256256
// Datasize
257-
ebml_size += (fixed_size > 0) ? fixed_size : GetUIntSize(value);
257+
ebml_size +=
258+
(fixed_size > 0) ? fixed_size : static_cast<uint64_t>(GetUIntSize(value));
258259

259260
// Size of Datasize
260261
ebml_size++;
@@ -264,7 +265,7 @@ uint64_t EbmlElementSize(uint64_t type, uint64_t value, uint64_t fixed_size) {
264265

265266
uint64_t EbmlElementSize(uint64_t type, float /* value */) {
266267
// Size of EBML ID
267-
uint64_t ebml_size = GetUIntSize(type);
268+
uint64_t ebml_size = static_cast<uint64_t>(GetUIntSize(type));
268269

269270
// Datasize
270271
ebml_size += sizeof(float);
@@ -280,7 +281,7 @@ uint64_t EbmlElementSize(uint64_t type, const char* value) {
280281
return 0;
281282

282283
// Size of EBML ID
283-
uint64_t ebml_size = GetUIntSize(type);
284+
uint64_t ebml_size = static_cast<uint64_t>(GetUIntSize(type));
284285

285286
// Datasize
286287
ebml_size += strlen(value);
@@ -296,7 +297,7 @@ uint64_t EbmlElementSize(uint64_t type, const uint8_t* value, uint64_t size) {
296297
return 0;
297298

298299
// Size of EBML ID
299-
uint64_t ebml_size = GetUIntSize(type);
300+
uint64_t ebml_size = static_cast<uint64_t>(GetUIntSize(type));
300301

301302
// Datasize
302303
ebml_size += size;
@@ -309,7 +310,7 @@ uint64_t EbmlElementSize(uint64_t type, const uint8_t* value, uint64_t size) {
309310

310311
uint64_t EbmlDateElementSize(uint64_t type) {
311312
// Size of EBML ID
312-
uint64_t ebml_size = GetUIntSize(type);
313+
uint64_t ebml_size = static_cast<uint64_t>(GetUIntSize(type));
313314

314315
// Datasize
315316
ebml_size += kDateElementSize;
@@ -447,7 +448,7 @@ bool WriteEbmlElement(IMkvWriter* writer, uint64_t type, uint64_t value,
447448
if (WriteID(writer, type))
448449
return false;
449450

450-
uint64_t size = GetUIntSize(value);
451+
uint64_t size = static_cast<uint64_t>(GetUIntSize(value));
451452
if (fixed_size > 0) {
452453
if (size > fixed_size)
453454
return false;

0 commit comments

Comments
 (0)