提交 c5d47660 编写于 作者: S serb

8240482: Improved WAV file playback

Reviewed-by: amenkov, rhalade, mschoene, prr
上级 16a7483d
/*
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -202,10 +202,14 @@ public:
// (required only if Write() can override the buffer)
bool Allocate(int requestedBufferSize, int extraBytes) {
int fullBufferSize = requestedBufferSize + extraBytes;
int powerOfTwo = 1;
long powerOfTwo = 1;
while (powerOfTwo < fullBufferSize) {
powerOfTwo <<= 1;
}
if (powerOfTwo > INT_MAX || fullBufferSize < 0) {
ERROR0("RingBuffer::Allocate: REQUESTED MEMORY SIZE IS TOO BIG\n");
return false;
}
pBuffer = (Byte*)malloc(powerOfTwo);
if (pBuffer == NULL) {
ERROR0("RingBuffer::Allocate: OUT OF MEMORY\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册