diff --git a/frameworks/buffer_client_producer.h b/frameworks/buffer_client_producer.h index 9c0a918..ffe7c7e 100755 --- a/frameworks/buffer_client_producer.h +++ b/frameworks/buffer_client_producer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -46,7 +46,7 @@ public: * @param [in] whether waiting or not. * wait = 1. waiting util get surface buffer. * wait = 0. No wait to get surface buffer. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* RequestBuffer(uint8_t wait) override; diff --git a/frameworks/buffer_manager.cpp b/frameworks/buffer_manager.cpp index e8a1606..d9edef0 100755 --- a/frameworks/buffer_manager.cpp +++ b/frameworks/buffer_manager.cpp @@ -233,7 +233,7 @@ bool BufferManager::MapBuffer(SurfaceBufferImpl& buffer) const virAddr = grallocFucs_->MmapCache(bufferHandle); } } else { - GRAPHIC_LOGE("No Suport usage."); + GRAPHIC_LOGE("No support usage."); free(bufferHandle); return false; } diff --git a/frameworks/buffer_manager.h b/frameworks/buffer_manager.h index 10e2391..8c7b2d0 100755 --- a/frameworks/buffer_manager.h +++ b/frameworks/buffer_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -45,7 +45,7 @@ public: * @brief Allocate buffer for producer. * @param [in] size, alloc buffer size. * @param [in] usage, alloc buffer usage. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* AllocBuffer(uint32_t size, uint32_t usage); @@ -55,7 +55,7 @@ public: * @param [in] height, alloc buffer height. * @param [in] format, alloc buffer format. * @param [in] usage, alloc buffer usage. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* AllocBuffer(uint32_t width, uint32_t height, uint32_t format, uint32_t usage); diff --git a/frameworks/buffer_queue.cpp b/frameworks/buffer_queue.cpp index 7df7560..3bda84a 100755 --- a/frameworks/buffer_queue.cpp +++ b/frameworks/buffer_queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -263,7 +263,7 @@ int32_t BufferQueue::isValidAttr(uint32_t width, uint32_t height, uint32_t forma { if (width == 0 || height == 0 || strideAlignment <= 0 || format == IMAGE_PIXEL_FORMAT_NONE) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } return SURFACE_ERROR_OK; } @@ -273,7 +273,7 @@ int32_t BufferQueue::Reset(uint32_t size) if (size == 0) { if (isValidAttr(width_, height_, format_, strideAlignment_) != SURFACE_ERROR_OK) { GRAPHIC_LOGI("Invalid Attr."); - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } else { size_ = 0; customSize_ = false; @@ -303,7 +303,7 @@ int32_t BufferQueue::Reset(uint32_t size) void BufferQueue::SetQueueSize(uint8_t queueSize) { if (queueSize > BUFFER_QUEUE_SIZE_MAX || queueSize == queueSize_) { - GRAPHIC_LOGI("The queue count(%u) is invaild", queueSize); + GRAPHIC_LOGI("The queue count(%u) is invalid", queueSize); return; } pthread_mutex_lock(&lock_); diff --git a/frameworks/buffer_queue_producer.cpp b/frameworks/buffer_queue_producer.cpp index 10dd02f..c2896fb 100755 --- a/frameworks/buffer_queue_producer.cpp +++ b/frameworks/buffer_queue_producer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -260,7 +260,7 @@ SurfaceBufferImpl* BufferQueueProducer::RequestBuffer(uint8_t wait) int32_t BufferQueueProducer::EnqueueBuffer(SurfaceBufferImpl& buffer) { - RETURN_VAL_IF_FAIL(bufferQueue_, SURFACE_ERROR_INVAILD_PARAM); + RETURN_VAL_IF_FAIL(bufferQueue_, SURFACE_ERROR_INVALID_PARAM); int32_t ret = bufferQueue_->FlushBuffer(buffer); if (ret == 0) { if (consumerListener_ != nullptr) { @@ -272,8 +272,8 @@ int32_t BufferQueueProducer::EnqueueBuffer(SurfaceBufferImpl& buffer) int32_t BufferQueueProducer::FlushBuffer(SurfaceBufferImpl* buffer) { - RETURN_VAL_IF_FAIL(buffer, SURFACE_ERROR_INVAILD_PARAM); - RETURN_VAL_IF_FAIL(bufferQueue_, SURFACE_ERROR_INVAILD_PARAM); + RETURN_VAL_IF_FAIL(buffer, SURFACE_ERROR_INVALID_PARAM); + RETURN_VAL_IF_FAIL(bufferQueue_, SURFACE_ERROR_INVALID_PARAM); BufferManager* manager = BufferManager::GetInstance(); RETURN_VAL_IF_FAIL(manager, SURFACE_ERROR_NOT_READY); if (buffer->GetUsage() == BUFFER_CONSUMER_USAGE_HARDWARE_CONSUMER_CACHE) { @@ -390,14 +390,14 @@ int32_t BufferQueueProducer::OnIpcMsg(void *ipcMsg, IpcIo *io) { if (ipcMsg == NULL || io == NULL) { GRAPHIC_LOGW("Invalid parameter, null pointer"); - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } uint32_t code; (void)GetCode(ipcMsg, &code); if (code >= MAX_REQUEST_CODE) { GRAPHIC_LOGW("Resquest code(%u) does not support.", code); FreeBuffer(nullptr, ipcMsg); - return SURFACE_ERROR_INVAILD_REQUEST; + return SURFACE_ERROR_INVALID_REQUEST; } return g_ipcMsgHandleList[code](this, ipcMsg, io); } diff --git a/frameworks/buffer_queue_producer.h b/frameworks/buffer_queue_producer.h index f45a303..52faaac 100755 --- a/frameworks/buffer_queue_producer.h +++ b/frameworks/buffer_queue_producer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -47,7 +47,7 @@ public: * @param [in] whether waiting or not. * wait = 1. waiting util get surface buffer. * wait = 0. No wait to get surface buffer. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* RequestBuffer(uint8_t wait) override; diff --git a/frameworks/surface_buffer_impl.cpp b/frameworks/surface_buffer_impl.cpp index 99baee6..26a7c4b 100755 --- a/frameworks/surface_buffer_impl.cpp +++ b/frameworks/surface_buffer_impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -37,10 +37,10 @@ int32_t SurfaceBufferImpl::GetInt32(uint32_t key, int32_t& value) void *data = NULL; uint8_t size; if (GetData(key, &type, &data, &size) != SURFACE_ERROR_OK || type != BUFFER_DATA_TYPE_INT_32) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } if (size != sizeof(value)) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } value = *(reinterpret_cast(data)); return SURFACE_ERROR_OK; @@ -57,10 +57,10 @@ int32_t SurfaceBufferImpl::GetInt64(uint32_t key, int64_t& value) void *data = NULL; uint8_t size; if (GetData(key, &type, &data, &size) != SURFACE_ERROR_OK || type != BUFFER_DATA_TYPE_INT_64) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } if (size != sizeof(value)) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } value = *(reinterpret_cast(data)); return SURFACE_ERROR_OK; @@ -72,8 +72,8 @@ int32_t SurfaceBufferImpl::SetData(uint32_t key, uint8_t type, const void* data, type >= BUFFER_DATA_TYPE_MAX || size <= 0 || size > sizeof(int64_t)) { - GRAPHIC_LOGI("Invaild Param"); - return SURFACE_ERROR_INVAILD_PARAM; + GRAPHIC_LOGI("Invalid Param"); + return SURFACE_ERROR_INVALID_PARAM; } if (extDatas_.size() > MAX_USER_DATA_COUNT) { GRAPHIC_LOGI("No more data can be saved because the storage space is full."); @@ -109,12 +109,12 @@ int32_t SurfaceBufferImpl::SetData(uint32_t key, uint8_t type, const void* data, int32_t SurfaceBufferImpl::GetData(uint32_t key, uint8_t* type, void** data, uint8_t* size) { if ((type == nullptr) || (data == nullptr) || (size == nullptr)) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } std::map::iterator iter = extDatas_.find(key); if (iter == extDatas_.end()) { - return SURFACE_ERROR_INVAILD_PARAM; + return SURFACE_ERROR_INVALID_PARAM; } ExtraData extData = extDatas_[key]; *data = extData.value; diff --git a/frameworks/surface_impl.cpp b/frameworks/surface_impl.cpp index b4d8424..3a07da4 100755 --- a/frameworks/surface_impl.cpp +++ b/frameworks/surface_impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -192,7 +192,7 @@ void SurfaceImpl::SetQueueSize(uint8_t queueSize) uint8_t SurfaceImpl::GetQueueSize() { - RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVAILD_PARAM); + RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVALID_PARAM); uint8_t queueSize = producer_->GetQueueSize(); return queueSize; } @@ -217,8 +217,8 @@ SurfaceBuffer* SurfaceImpl::RequestBuffer(uint8_t wait) int32_t SurfaceImpl::FlushBuffer(SurfaceBuffer* buffer) { - RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVAILD_PARAM); - RETURN_VAL_IF_FAIL(buffer != nullptr, SURFACE_ERROR_INVAILD_PARAM); + RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVALID_PARAM); + RETURN_VAL_IF_FAIL(buffer != nullptr, SURFACE_ERROR_INVALID_PARAM); SurfaceBufferImpl* liteBuffer = reinterpret_cast(buffer); return producer_->FlushBuffer(liteBuffer); } @@ -271,9 +271,9 @@ int32_t SurfaceImpl::IpcRequestHandler(const IpcContext* context, void* ipcMsg, int32_t SurfaceImpl::DoIpcMsg(void* ipcMsg, IpcIo* io) { - RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVAILD_PARAM); - RETURN_VAL_IF_FAIL(ipcMsg != nullptr, SURFACE_ERROR_INVAILD_PARAM); - RETURN_VAL_IF_FAIL(io != nullptr, SURFACE_ERROR_INVAILD_PARAM); + RETURN_VAL_IF_FAIL(producer_, SURFACE_ERROR_INVALID_PARAM); + RETURN_VAL_IF_FAIL(ipcMsg != nullptr, SURFACE_ERROR_INVALID_PARAM); + RETURN_VAL_IF_FAIL(io != nullptr, SURFACE_ERROR_INVALID_PARAM); BufferQueueProducer* bufferQueueProducer = reinterpret_cast(producer_); return bufferQueueProducer->OnIpcMsg(ipcMsg, io); } diff --git a/interfaces/innerkits/buffer_common.h b/interfaces/innerkits/buffer_common.h index bd95091..8634f1f 100755 --- a/interfaces/innerkits/buffer_common.h +++ b/interfaces/innerkits/buffer_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,8 +34,8 @@ namespace OHOS { } enum BufferErrorCode { - SURFACE_ERROR_INVAILD_PARAM = -10, - SURFACE_ERROR_INVAILD_REQUEST, + SURFACE_ERROR_INVALID_PARAM = -10, + SURFACE_ERROR_INVALID_REQUEST, SURFACE_ERROR_NOT_READY, SURFACE_ERROR_SYSTEM_ERROR, SURFACE_ERROR_BUFFER_NOT_EXISTED, diff --git a/interfaces/innerkits/buffer_producer.h b/interfaces/innerkits/buffer_producer.h index 990efb7..420ee71 100755 --- a/interfaces/innerkits/buffer_producer.h +++ b/interfaces/innerkits/buffer_producer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -65,7 +65,7 @@ public: * @param [in] whether waiting or not. * wait = 1. waiting util get surface buffer. * wait = 0. No wait to get surface buffer. - * @returns buffer poiter. + * @returns buffer pointer. */ virtual SurfaceBufferImpl* RequestBuffer(uint8_t wait) = 0; diff --git a/interfaces/innerkits/buffer_queue.h b/interfaces/innerkits/buffer_queue.h index d6c4cdd..072f961 100755 --- a/interfaces/innerkits/buffer_queue.h +++ b/interfaces/innerkits/buffer_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef GRAPHIC_LITE_BUFFER_QUEUE -#define GRAPHIC_LITE_BUFFER_QUEUE +#ifndef GRAPHIC_LITE_BUFFER_QUEUE_H +#define GRAPHIC_LITE_BUFFER_QUEUE_H #include #include @@ -53,7 +53,7 @@ public: * @param [in] whether waiting or not. * wait = 1. waiting util free list has buffer, pop and return it. * wait = 0. No wait, could return null pointer. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* RequestBuffer(uint8_t wait); @@ -68,7 +68,7 @@ public: /** * @brief Acquire buffer. Consumer acquire buffer, which producer has flush and push to free list. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* AcquireBuffer(); diff --git a/interfaces/innerkits/buffer_queue_consumer.h b/interfaces/innerkits/buffer_queue_consumer.h index c615f6f..a5135c6 100755 --- a/interfaces/innerkits/buffer_queue_consumer.h +++ b/interfaces/innerkits/buffer_queue_consumer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,9 +21,7 @@ namespace OHOS { /** - * @brief Surface producer abstract class. Provide request, flush, cancel and set buffer attr ability. - * In multi process, the producer is BufferClientProducer; In single process, it is BufferQueueProducer. - * Using in multi media and graphic for multi process. + * @brief Surface consumer abstract class. Provide acquire, release and set buffer queue ability. */ class BufferQueueConsumer { public: @@ -36,7 +34,7 @@ public: /** * @brief Acquire buffer. When producer has flush and push buffer to free list, * Consumer acquire the buffer. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBufferImpl* AcquireBuffer(); diff --git a/interfaces/innerkits/surface_buffer_impl.h b/interfaces/innerkits/surface_buffer_impl.h index 710c069..c951f71 100755 --- a/interfaces/innerkits/surface_buffer_impl.h +++ b/interfaces/innerkits/surface_buffer_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -230,7 +230,7 @@ public: void SetSize(uint32_t size) override { if (size > bufferData_.size) { - GRAPHIC_LOGI("Input param is invaild"); + GRAPHIC_LOGI("Input param is invalid"); return; } len_ = size; @@ -361,9 +361,9 @@ private: /** * Set extra data for buffer, like . * @key, unique uint32_t. If exited, will overlap; - * @type, value type. Current suport see detail enum OHOS::BUFFER_DATA_TYPE + * @type, value type. Current support see detail enum OHOS::BUFFER_DATA_TYPE * @data, value pointer, which storage the value; - * @size, value lenth. + * @size, value length. */ int32_t SetData(uint32_t key, uint8_t type, const void* data, uint8_t size); int32_t GetData(uint32_t key, uint8_t* type, void** data, uint8_t* size); diff --git a/interfaces/innerkits/surface_impl.h b/interfaces/innerkits/surface_impl.h index 9e0e962..a1b77f7 100755 --- a/interfaces/innerkits/surface_impl.h +++ b/interfaces/innerkits/surface_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -159,7 +159,7 @@ public: * @param [in] whether waiting or not. * wait = 1. waiting util get surface buffer. * wait = 0. No wait to get surface buffer. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBuffer* RequestBuffer(uint8_t wait = 0) override; @@ -174,7 +174,7 @@ public: /** * @brief Acquire buffer. Consumer acquire buffer, which producer has flush and push to free list. - * @returns buffer poiter. + * @returns buffer pointer. */ SurfaceBuffer* AcquireBuffer() override; diff --git a/test/unittest/graphic_surface_test.cpp b/test/unittest/graphic_surface_test.cpp index 24ac4d1..d18d5ba 100755 --- a/test/unittest/graphic_surface_test.cpp +++ b/test/unittest/graphic_surface_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -61,9 +61,9 @@ void SurfaceTest::TearDown(void) * Feature: Surface * Function: new SurfaceBuffer * SubFunction: NA - * FunctionPoints: Surface Buffer initilization. + * FunctionPoints: Surface Buffer initialization. * EnvConditions: NA - * CaseDescription: Verify the Surface Buffer initilization. + * CaseDescription: Verify the Surface Buffer initialization. */ HWTEST_F(SurfaceTest, surface_buffer_001, TestSize.Level1) { @@ -89,9 +89,9 @@ HWTEST_F(SurfaceTest, surface_buffer_001, TestSize.Level1) * Feature: Surface * Function: new SurfaceBuffer(uint32_t size, uint32_t flag, uint32_t usage) * SubFunction: NA - * FunctionPoints: Surface Buffer initilization. + * FunctionPoints: Surface Buffer initialization. * EnvConditions: NA - * CaseDescription: Verify the Surface Buffer initilization. + * CaseDescription: Verify the Surface Buffer initialization. */ HWTEST_F(SurfaceTest, surface_buffer_002, TestSize.Level1) {