Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart Pointer Recommendations #5607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"files.associations": {
"*.cu": "cuda-cpp",
"array": "c",
"atomic": "c",
"*.tcc": "c",
"cctype": "c",
"clocale": "c",
"cmath": "c",
"cstdarg": "c",
"cstddef": "c",
"cstdint": "c",
"cstdio": "c",
"cstdlib": "c",
"cwchar": "c",
"cwctype": "c",
"deque": "c",
"unordered_map": "c",
"vector": "c",
"exception": "c",
"algorithm": "c",
"map": "c",
"memory": "c",
"memory_resource": "c",
"optional": "c",
"string": "c",
"string_view": "c",
"system_error": "c",
"tuple": "c",
"type_traits": "c",
"utility": "c",
"fstream": "c",
"initializer_list": "c",
"iosfwd": "c",
"istream": "c",
"limits": "c",
"new": "c",
"ostream": "c",
"sstream": "c",
"stdexcept": "c",
"streambuf": "c",
"cinttypes": "c",
"typeinfo": "c"
}
}
2 changes: 2 additions & 0 deletions ijkmedia/ijksdl/gles2/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <assert.h>
#include <stdlib.h>
#include <iostream>
#include <memory>
#include "ijksdl/ijksdl_fourcc.h"
#include "ijksdl/ijksdl_log.h"
#include "ijksdl/ijksdl_gles2.h"
Expand Down
7 changes: 3 additions & 4 deletions ijkmedia/ijksdl/gles2/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ static void IJK_GLES2_printProgramInfo(GLuint program)
}

char buf_stack[32];
char *buf_heap = NULL;
std::unique_ptr<char> buf_heap = std::make_unique<char>(info_len + 1);
char *buf = buf_stack;
GLsizei buf_len = sizeof(buf_stack) - 1;
if (info_len > sizeof(buf_stack)) {
buf_heap = (char*) malloc(info_len + 1);
if (buf_heap) {
buf = buf_heap;
buf_len = info_len;
Expand All @@ -48,8 +47,8 @@ static void IJK_GLES2_printProgramInfo(GLuint program)
glGetProgramInfoLog(program, buf_len, NULL, buf);
ALOGE("[GLES2][Program] error %s\n", buf);

if (buf_heap)
free(buf_heap);
// if (buf_heap)
// free(buf_heap);
}

void IJK_GLES2_Renderer_reset(IJK_GLES2_Renderer *renderer)
Expand Down
7 changes: 3 additions & 4 deletions ijkmedia/ijksdl/gles2/shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ static void IJK_GLES2_printShaderInfo(GLuint shader)
}

char buf_stack[32];
char *buf_heap = NULL;
std::unique_ptr<char> buf_heap = std::make_unique<char>(info_len + 1);
char *buf = buf_stack;
GLsizei buf_len = sizeof(buf_stack) - 1;
if (info_len > sizeof(buf_stack)) {
buf_heap = (char*) malloc(info_len + 1);
if (buf_heap) {
buf = buf_heap;
buf_len = info_len;
Expand All @@ -48,8 +47,8 @@ static void IJK_GLES2_printShaderInfo(GLuint shader)
glGetShaderInfoLog(shader, buf_len, NULL, buf);
ALOGE("[GLES2][Shader] error %s\n", buf);

if (buf_heap)
free(buf_heap);
// if (buf_heap)
// free(buf_heap);
}

GLuint IJK_GLES2_loadShader(GLenum shader_type, const char *shader_source)
Expand Down