Skip to content

Commit

Permalink
Fix some static analyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukhnos committed Jan 29, 2017
1 parent e6120e3 commit 113257c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 18 deletions.
20 changes: 11 additions & 9 deletions Modules/Array/LegacyFramework/OVCandidateList.cpp
Expand Up @@ -65,15 +65,17 @@ void OVCandidateList::update(OVCandidate *textbar)
append(const_cast<char*>(list->at(i).c_str()))->
append(" ");
}

int totalpage=(count % perpage) ? (count/perpage)+1 : (count/perpage);
int currentpage=(pos/perpage)+1;
// if (totalpage >1)
// {
sprintf (buf, "(%d/%d)", currentpage, totalpage);
textbar->append(buf);
// }
textbar->update();

if (perpage > 0) {
int totalpage = (count % perpage) ? (count/perpage)+1 : (count/perpage);
int currentpage=(pos/perpage)+1;
// if (totalpage >1)
// {
sprintf (buf, "(%d/%d)", currentpage, totalpage);
textbar->append(buf);
// }
}
textbar->update();
}

OVCandidateList* OVCandidateList::pageUp()
Expand Down
2 changes: 0 additions & 2 deletions Modules/Array/LegacyModule/LegacyOVIMArray.cpp
Expand Up @@ -232,10 +232,8 @@ void OVIMArrayContext::sendAndReset(const char *ch, OVBuffer* buf,
}
}

bool committed = false;
if (!(parent->isForceSP() && notifySP)) {
buf->clear()->append(ch)->send();
committed = true;
}
else {
buf->clear()->update();
Expand Down
18 changes: 12 additions & 6 deletions Modules/Array/OVIMArray.cpp
Expand Up @@ -70,14 +70,20 @@ OVEventHandlingContext* OpenVanilla::OVIMArray::createContext()
delete m_legacyArrayModule;
m_legacyArrayModule = 0;
}
else {
m_legacyArrayModule->setAutoSP(m_cfgAutoSP);
m_legacyArrayModule->setForceSP(m_cfgForceSP);
}
}

m_legacyArrayModule->setAutoSP(m_cfgAutoSP);
m_legacyArrayModule->setForceSP(m_cfgForceSP);
if (m_legacyArrayModule) {
::OVIMArrayContext* legacyContext = static_cast<::OVIMArrayContext*>(m_legacyArrayModule->newContext());
OpenVanilla::OVIMArrayContext* context = new OpenVanilla::OVIMArrayContext(legacyContext);
return context;
}
else {
return nullptr;
}

::OVIMArrayContext* legacyContext = static_cast<::OVIMArrayContext*>(m_legacyArrayModule->newContext());
OpenVanilla::OVIMArrayContext* context = new OpenVanilla::OVIMArrayContext(legacyContext);
return context;
}

const string OpenVanilla::OVIMArray::identifier() const
Expand Down
5 changes: 5 additions & 0 deletions Modules/Array/OVIMArrayContext.cpp
Expand Up @@ -37,6 +37,11 @@ OpenVanilla::OVIMArrayContext::OVIMArrayContext(::OVIMArrayContext* legacyContex
{
}

OpenVanilla::OVIMArrayContext::~OVIMArrayContext()
{
delete m_legacyContext;
}

void OpenVanilla::OVIMArrayContext::startSession(OVLoaderService* loaderService)
{
m_legacyContext->clear();
Expand Down
1 change: 1 addition & 0 deletions Modules/Array/OVIMArrayContext.h
Expand Up @@ -41,6 +41,7 @@ namespace OpenVanilla {
class OVIMArrayContext : public OVEventHandlingContext {
public:
OVIMArrayContext(::OVIMArrayContext* legacyContext);
~OVIMArrayContext();
virtual void startSession(OVLoaderService* loaderService);
virtual void stopSession(OVLoaderService* loaderService);
virtual bool handleKey(OVKey* key, OVTextBuffer* readingText, OVTextBuffer* composingText, OVCandidateService* candidateService, OVLoaderService* loaderService);
Expand Down
Expand Up @@ -47,9 +47,9 @@ - (id)initWithCoder:(NSCoder *)aDecoder
}

- (void)dealloc {
[super dealloc];
[_defaultSelectionKeys release];
[_defaultSelectionKeyTitles release];
[super dealloc];
}

- (IBAction)updateField:(id)sender
Expand Down
7 changes: 7 additions & 0 deletions Source/Mac/OVAddTableBasedInputMethodViewController.mm
Expand Up @@ -43,6 +43,13 @@ @implementation OVAddTableBasedInputMethodViewController
@synthesize moreInfoTextField = _moreInfoTextField;
@synthesize preferencesWindowController = _preferencesWindowController;

- (void)dealloc
{
[_tablePathToBeInstalled release];
[_moduleIdentifierIfInstalled release];
[super dealloc];
}

- (void)loadPreferences
{
// add link to the more info text field
Expand Down

0 comments on commit 113257c

Please sign in to comment.