diff --git a/OAT.xml b/OAT.xml index 21f1fb39202d9ceeaeaf95c6e48a6ad61c6b13c5..4bc311e9f3b85017e71996595aa397fb6c85aa44 100644 --- a/OAT.xml +++ b/OAT.xml @@ -57,7 +57,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -65,7 +65,9 @@ Note:If the text contains special characters, please escape them according to th - + + + diff --git a/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/egl_core.cpp b/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/egl_core.cpp index 737eb311a9a8f917af2abf3495e016beb0550b68..440996d0b1c771bf1c8fd433d2fce890062eca8b 100644 --- a/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/egl_core.cpp +++ b/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/egl_core.cpp @@ -417,7 +417,7 @@ GLuint EGLCore::loadTexture() //------------------------------------------------------------ // 读文件 FILE *file = fdopen(fd_, "r"); - if (file == NULL) { + if (file == nullptr) { OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "ResfdExecuteCB fdopen failed!"); return false; } @@ -447,7 +447,7 @@ GLuint EGLCore::loadTexture() bmpSize = flen_ - NUM_54; unsigned char *bmpData = (unsigned char *)malloc(bmpSize); - if (bmpData == NULL) { + if (bmpData == nullptr) { OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "EGLCore", "ResfdExecuteCB malloc failed!"); fclose(file); return false; @@ -515,7 +515,7 @@ void EGLCore::DrawBmp(uint32_t fd, uint32_t foff, uint32_t flen, int& hasDraw) OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "Drawbmp"); FILE *file = fdopen(fd, "r"); - if (file == NULL) { + if (file == nullptr) { OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "ResfdExecuteCB fdopen failed!"); return; } @@ -532,7 +532,7 @@ void EGLCore::DrawBmp(uint32_t fd, uint32_t foff, uint32_t flen, int& hasDraw) return; } unsigned char *mediaData = new unsigned char[flen]; - if (mediaData == NULL) { + if (mediaData == nullptr) { OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "new buffer failed!"); fclose(file); return; @@ -546,10 +546,10 @@ void EGLCore::DrawBmp(uint32_t fd, uint32_t foff, uint32_t flen, int& hasDraw) int height = 0; unsigned char *pdata = mediaData + NUM_18; OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "width: %{public}d", *((uint32_t *)pdata)); - width = *((uint32_t *)pdata); + width = *(static_cast(pdata)); pdata = mediaData + NUM_18 + NUM_4; OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "EGLCore", "height: %{public}d", *((uint32_t *)pdata)); - height = *((uint32_t *)pdata); + height = *(static_cast(pdata)); float vertices[] = { // positions // colors // texture coords @@ -859,7 +859,7 @@ GLuint EGLCore::LoadShader(GLenum type, const char* shaderSrc) return PROGRAM_ERROR; } -void EGLCore::checkCompileErrors(unsigned int shader, std::string type) +void EGLCore::CheckCompileErrors(unsigned int shader, std::string type) { int success; char infoLog[NUM_1024]; @@ -894,12 +894,12 @@ GLuint EGLCore::TRCreateProgram(const char *vertexShader, const char *fragShader vertex = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertex, 1, &vertexShader, NULL); glCompileShader(vertex); - checkCompileErrors(vertex, "VERTEX"); + CheckCompileErrors(vertex, "VERTEX"); // fragment Shader fragment = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragment, 1, &fragShader, NULL); glCompileShader(fragment); - checkCompileErrors(fragment, "FRAGMENT"); + CheckCompileErrors(fragment, "FRAGMENT"); GLuint program = glCreateProgram(); if (program == PROGRAM_ERROR) { @@ -913,7 +913,7 @@ GLuint EGLCore::TRCreateProgram(const char *vertexShader, const char *fragShader glAttachShader(program, vertex); glAttachShader(program, fragment); glLinkProgram(program); - checkCompileErrors(program, "PROGRAM"); + CheckCompileErrors(program, "PROGRAM"); GLint linked; glGetProgramiv(program, GL_LINK_STATUS, &linked); if (linked != 0) { diff --git a/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/plugin_render.cpp b/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/plugin_render.cpp index a9472c9283ce9a0904716da6f55918efc10ac238..2a3dde924334387a38369e456813fb32d7f9924f 100644 --- a/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/plugin_render.cpp +++ b/examples/napitutorials/entry/src/main/cpp/ncpp/ffmpegcase/render/plugin_render.cpp @@ -30,22 +30,22 @@ extern "C" { // 自定义 avio_read_packet 函数 - int custom_avio_read_packet(void *opaque, uint8_t *buf, int bufSize) + int CustomAvioReadPacket(void *opaque, uint8_t *buf, int bufSize) { FILE *file = ((FILE *)opaque); // 将 void 指针转换为 int 指针,并取得文件描述符 if (!file) { - OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "custom_avio_read_packet file is null"); + OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "CustomAvioReadPacket file is null"); return AVERROR_EOF; } OH_LOG_Print(LOG_APP, LOG_INFO, 0xFF00, "PluginRender", "read_packet %{public}d", bufSize); size_t bytesRead = fread(buf, 1, bufSize, file); // 从文件描述符中读取数据 if (bytesRead <= 0) { if (feof(file)) { - OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "custom_avio_read_packet file eof %{public}zu", + OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "CustomAvioReadPacket file eof %{public}zu", bytesRead); return AVERROR_EOF; } else { - OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "custom_avio_read_packet file eio"); + OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "PluginRender", "CustomAvioReadPacket file eio"); return AVERROR_EOF; } } @@ -56,7 +56,7 @@ extern "C" { } OH_LOG_Print(LOG_APP, LOG_INFO, 0xFF00, "PluginRender", "read_packet bytes[%{public}zu],bufsize[%{public}d]", bytesRead, bufSize); - return (int)bytesRead; + return static_cast(bytesRead); } int open_codec_context(int *streamIdx, AVCodecContext **decCtx, AVFormatContext *fmtCtx, @@ -540,7 +540,7 @@ static void RescontExecuteCB(napi_env env, void *data) int ret = 0; uint32_t fbufLen = 8192; - unsigned char *fbuf = (unsigned char *)av_malloc(fbufLen); + unsigned char *fbuf = static_cast(av_malloc(fbufLen)); char dumpBuf[256]; uint32_t fd = callbackData->fd; @@ -560,7 +560,7 @@ static void RescontExecuteCB(napi_env env, void *data) int audioStreamIdx = -1; FILE *file = fdopen(fd, "r"); - if (file == NULL) { + if (file == nullptr) { OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "PluginRender", "NapiGetInfo fdopen failed!"); free(fbuf); return; @@ -574,7 +574,7 @@ static void RescontExecuteCB(napi_env env, void *data) return; } OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "PluginRender", "fseek %{public}ld", foff); - avioContext = avio_alloc_context(fbuf, fbufLen, 0, (void *)file, &custom_avio_read_packet, NULL, NULL); + avioContext = avio_alloc_context(fbuf, fbufLen, 0, (void *)file, &CustomAvioReadPacket, NULL, NULL); OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "PluginRender", "avio_alloc_context"); if (!avioContext) { OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "PluginRender", "avio_alloc_context failed"); diff --git a/examples/serviceCode/NodeISayHello.cpp b/examples/serviceCode/NodeISayHello.cpp index 03b481c57da58943e2db0e48f4ab916a9e6a1296..9c6fdbab42be576502d1077b71be624f4bf7a0ec 100644 --- a/examples/serviceCode/NodeISayHello.cpp +++ b/examples/serviceCode/NodeISayHello.cpp @@ -25,7 +25,7 @@ namespace napitest { // 工具提供的业务接口(回调) void NodeISayHello::SayHelloListenerSayHelloStartCallback(SayInfo& info) // 3. 调用注册的NodeISayHelloListenerSayHelloEnd(info: SayInfo)方法 // 工具提供的业务接口(回调) void NodeISayHello::SayHelloListenerSayHelloEndCallback(SayInfo& info) -void NodeISayHello::sayHello(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHello(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 NAPITEST_LOGI("NAPITEST_LOGI sayHello from = %s\r\n", from.c_str()); @@ -66,7 +66,7 @@ void NodeISayHello::sayHello(std::string& from, std::string& to, uint32_t& sayTy } // 调用register注册的回调 -void NodeISayHello::sayHi(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHi(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 NAPITEST_LOGI("NAPITEST_LOGI sayHi from = %s\r\n", from.c_str()); @@ -81,7 +81,7 @@ void NodeISayHello::sayHi(std::string& from, std::string& to, uint32_t& sayType) } // 普通函数调用,返回str -std::string funcTest(bool& v) +std::string FuncTest(bool& v) { if (v) { return "ret is true"; @@ -92,7 +92,7 @@ std::string funcTest(bool& v) // 1.打印值:from, to 以及枚举enum SayType的值 // 2. 将回调值(0, "", "recv hello.")的值传回Js层 -void NodeISayHello::sayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 NAPITEST_LOGI("NAPITEST_LOGI sayHelloWithResponse from = %s\r\n", from.c_str()); diff --git a/examples/serviceCode/NodeISayHello.h b/examples/serviceCode/NodeISayHello.h index ba109a5702997c9a87bec7dcdc16eb8c108336c5..88649966c78009ee4b2794990c8926ce1244db84 100644 --- a/examples/serviceCode/NodeISayHello.h +++ b/examples/serviceCode/NodeISayHello.h @@ -22,11 +22,11 @@ namespace napitest { class NodeISayHello; class NodeISayHello { public: - void sayHello(std::string& from, std::string& to, uint32_t& sayType); - void sayHi(std::string& from, std::string& to, uint32_t& sayType); - void sayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType); + void SayHello(std::string& from, std::string& to, uint32_t& sayType); + void SayHi(std::string& from, std::string& to, uint32_t& sayType); + void SayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType); }; -std::string funcTest(bool& v); +std::string FuncTest(bool& v); } #endif // IMPL_NODEISAYHELLO_H