未验证 提交 c737d839 编写于 作者: O openharmony_ci 提交者: Gitee

!765 修改代码review意见

Merge pull request !765 from piggyguy_jdx/codereview
......@@ -430,7 +430,7 @@ uint32_t Text::CalculateLineWithEllipsis(uint32_t begin, uint32_t textLen, int16
uint32_t Text::GetTextStrLen()
{
return strlen(text_);
return (text_ != nullptr) ? (strlen(text_)) : 0;
}
uint32_t Text::GetTextLine(uint32_t begin, uint32_t textLen, int16_t width, uint16_t lineNum, uint8_t letterSpace,
......
......@@ -132,7 +132,7 @@ RetCode CacheManager::Open(const char* path, const Style& style, CacheEntry& ent
}
SelectEntryToReplace(indexHitted);
if (entryArr_[indexHitted].dsc_.path != nullptr) {
if ((entryArr_[indexHitted].dsc_.path != nullptr) && (entryArr_[indexHitted].dsc_.decoder != nullptr)) {
entryArr_[indexHitted].dsc_.decoder->Close(entryArr_[indexHitted].dsc_);
}
......@@ -161,13 +161,11 @@ RetCode CacheManager::Close(const char* path)
continue;
}
if (strcmp(entryArr_[index].dsc_.path, path) == 0) {
entryArr_[index].dsc_.decoder->Close(entryArr_[index].dsc_);
Clear(entryArr_[index]);
break;
}
} else {
if (entryArr_[index].dsc_.path == path) {
entryArr_[index].dsc_.decoder->Close(entryArr_[index].dsc_);
Clear(entryArr_[index]);
break;
}
......@@ -199,7 +197,6 @@ RetCode CacheManager::Reset()
for (uint16_t index = 0; index < GetSize(); index++) {
if (entryArr_[index].dsc_.path != nullptr) {
entryArr_[index].dsc_.decoder->Close(entryArr_[index].dsc_);
Clear(entryArr_[index]);
}
}
......@@ -209,6 +206,9 @@ RetCode CacheManager::Reset()
RetCode CacheManager::ReadToCache(CacheEntry& entry)
{
if (entry.dsc_.decoder == nullptr) {
return RetCode::FAIL;
}
return entry.dsc_.decoder->ReadToCache(entry.dsc_);
}
......
......@@ -482,8 +482,14 @@ protected:
uint8_t fontOpa;
FontStyle fontStyle;
Text* textComment;
TextParam()
TextParam() : text(nullptr), position({0, 0}), fontOpa(0)
{
fontColor.full = 0;
fontStyle.direct = UITextLanguageDirect::TEXT_DIRECT_LTR;
fontStyle.align = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT;
fontStyle.fontSize = 0;
fontStyle.letterSpace = 0;
fontStyle.fontName = nullptr;
textComment = new Text;
}
......
......@@ -19,15 +19,19 @@
namespace OHOS {
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), guiThread_(nullptr), taskThread_(nullptr)
{
if (ui_ != nullptr) {
ui_->setupUi(this);
CreateGUIThread();
CreateTaskThread();
CreateSocketThread();
}
}
MainWidget::~MainWidget()
{
if (ui_ != nullptr) {
delete ui_;
}
if (guiThread_ != nullptr) {
guiThread_->Quit();
guiThread_->wait();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册