mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #32 from WenhaiLin/master
Bug fix:1.Set music volume control as default 2.Fix calculation of base64Encode outLength
This commit is contained in:
@@ -142,15 +142,12 @@ int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char *
|
||||
unsigned int outLength = 0;
|
||||
|
||||
//should be enough to store 6-bit buffers in 8-bit buffers
|
||||
*out = (unsigned char*)malloc(inLength * 3.0f / 4.0f + 1);
|
||||
*out = (unsigned char*)malloc(inLength / 4 * 3 + 1);
|
||||
if( *out ) {
|
||||
int ret = _base64Decode(in, inLength, *out, &outLength);
|
||||
|
||||
if (ret > 0 )
|
||||
if (ret > 0)
|
||||
{
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA)
|
||||
printf("Base64Utils: error decoding");
|
||||
#endif
|
||||
free(*out);
|
||||
*out = nullptr;
|
||||
outLength = 0;
|
||||
@@ -160,7 +157,7 @@ int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char *
|
||||
}
|
||||
|
||||
int base64Encode(const unsigned char *in, unsigned int inLength, char **out) {
|
||||
unsigned int outLength = inLength * 4 / 3 + (inLength % 3 > 0 ? 4 : 0);
|
||||
unsigned int outLength = (inLength + 2) / 3 * 4;
|
||||
|
||||
//should be enough to store 8-bit buffers in 6-bit buffers
|
||||
*out = (char*)malloc(outLength+1);
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -266,6 +267,7 @@ public abstract class Cocos2dxActivity extends Activity {
|
||||
Cocos2dxWebViewHelper.init();
|
||||
Window window = getWindow();
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
}
|
||||
|
||||
//native method,call GLViewImpl::getGLContextAttrs() to get the OpenGL ES context attributions
|
||||
|
||||
Reference in New Issue
Block a user