various loplugin warnings

Change-Id: I9078ba18d8897a89a472fe75385542dac0c6bf78
This commit is contained in:
Stephan Bergmann
2016-03-03 09:43:06 +01:00
parent fba6f6fb51
commit a39fb49535
22 changed files with 53 additions and 53 deletions

View File

@@ -76,7 +76,7 @@ class convert_gen_impl
// utility functions for converters // utility functions for converters
void lexRead (char *sBuf, int *nResult, int nMax_size); void lexRead (char *sBuf, int *nResult, int nMax_size);
void writeSourceFile(const std::string& line); void writeSourceFile(const std::string& line);
std::string& copySource (char *yyText, bool bDoClear = true); std::string& copySource (char const *yyText, bool bDoClear = true);
protected: protected:
std::string msSourceBuffer, msCopyText; std::string msSourceBuffer, msCopyText;

View File

@@ -36,14 +36,14 @@ class convert_db : public convert_gen_impl
{ {
public: public:
convert_db(l10nMem& crMemory); convert_db(l10nMem& crMemory);
~convert_db(); virtual ~convert_db();
private: private:
static const int NUMFIELD = 16; static const int NUMFIELD = 16;
std::string msFields[NUMFIELD]; std::string msFields[NUMFIELD];
int miSize; int miSize;
void execute(); void execute() override;
bool collectLine(); bool collectLine();
}; };
#endif #endif

View File

@@ -40,7 +40,7 @@ class convert_po : public convert_gen_impl
convert_po(l10nMem& crMemory); convert_po(l10nMem& crMemory);
~convert_po(); virtual ~convert_po();
void startLook (); void startLook ();
void setValue (char *syyText, int iLineCnt); void setValue (char *syyText, int iLineCnt);
@@ -57,15 +57,15 @@ class convert_po : public convert_gen_impl
bool mbFuzzy; bool mbFuzzy;
std::filebuf outBuffer; std::filebuf outBuffer;
void execute(); void execute() override;
void startSave(const std::string& sLanguage, void startSave(const std::string& sLanguage,
const std::string& sFile); const std::string& sFile) override;
void save(const std::string& sFileName, void save(const std::string& sFileName,
const std::string& sKey, const std::string& sKey,
const std::string& sENUStext, const std::string& sENUStext,
const std::string& sText, const std::string& sText,
bool bFuzzy); bool bFuzzy) override;
void endSave(); void endSave() override;
}; };
#endif #endif

View File

@@ -36,10 +36,10 @@ class convert_prop : public convert_gen_impl
{ {
public: public:
convert_prop(l10nMem& crMemory); convert_prop(l10nMem& crMemory);
~convert_prop(); virtual ~convert_prop();
private: private:
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -37,7 +37,7 @@ class convert_src : public convert_gen_impl
bool mbExpectValue; bool mbExpectValue;
convert_src(l10nMem& crMemory); convert_src(l10nMem& crMemory);
~convert_src(); virtual ~convert_src();
void setValue (char *syyText, char *sbuildValue); void setValue (char *syyText, char *sbuildValue);
void setLang (char *syyText, bool bEnUs); void setLang (char *syyText, bool bEnUs);
@@ -47,7 +47,7 @@ class convert_src : public convert_gen_impl
void setCmd (char *syyText); void setCmd (char *syyText);
void setMacro (char *syyText); void setMacro (char *syyText);
void setList (char *syyText); void setList (char *syyText);
void setListItem (char *syyText, bool bIsStart); void setListItem (char const *syyText, bool bIsStart);
void setNL (char *syyText, bool bMacro); void setNL (char *syyText, bool bMacro);
void startBlock (char *syyText); void startBlock (char *syyText);
void stopBlock (char *syyText); void stopBlock (char *syyText);
@@ -67,7 +67,7 @@ class convert_src : public convert_gen_impl
bool mbInListItem; bool mbInListItem;
int miListCount; int miListCount;
int miMacroLevel; int miMacroLevel;
void execute(); void execute() override;
void trim(std::string& sText); void trim(std::string& sText);
void buildKey(std::string& sKey); void buildKey(std::string& sKey);
void insertLanguagePart(std::string& sKey, std::string& sTextType); void insertLanguagePart(std::string& sKey, std::string& sTextType);

View File

@@ -52,7 +52,7 @@ class convert_tree : public convert_gen_impl
} STATE_VAL; } STATE_VAL;
convert_tree(l10nMem& crMemory); convert_tree(l10nMem& crMemory);
~convert_tree(); virtual ~convert_tree();
void setString (char *yytext); void setString (char *yytext);
void setState (char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL); void setState (char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL);
@@ -70,6 +70,6 @@ class convert_tree : public convert_gen_impl
STATE_VAL meStateVal; STATE_VAL meStateVal;
int miCntLanguages; int miCntLanguages;
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -36,7 +36,7 @@ class convert_ulf : public convert_gen_impl
{ {
public: public:
convert_ulf(l10nMem& crMemory); convert_ulf(l10nMem& crMemory);
~convert_ulf(); virtual ~convert_ulf();
void setKey(char *syyText); void setKey(char *syyText);
void setText(char *syyText, bool bIsEnUs); void setText(char *syyText, bool bIsEnUs);
@@ -46,7 +46,7 @@ class convert_ulf : public convert_gen_impl
std::string msKey; std::string msKey;
void execute(); void execute() override;
void handleLines(); void handleLines();
}; };
#endif #endif

View File

@@ -36,7 +36,7 @@ class convert_xcs : public convert_gen_impl
{ {
public: public:
convert_xcs(l10nMem& crMemory); convert_xcs(l10nMem& crMemory);
~convert_xcs(); virtual ~convert_xcs();
void setKey(char *syyText); void setKey(char *syyText);
void unsetKey(char *syyText); void unsetKey(char *syyText);
@@ -47,6 +47,6 @@ class convert_xcs : public convert_gen_impl
std::string msKey; std::string msKey;
bool mbCollectingData; bool mbCollectingData;
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -39,7 +39,7 @@ class convert_xcu : public convert_gen_impl
bool mbNoCollectingData; bool mbNoCollectingData;
convert_xcu(l10nMem& crMemory); convert_xcu(l10nMem& crMemory);
~convert_xcu(); virtual ~convert_xcu();
void pushKey(char *syyText); void pushKey(char *syyText);
void popKey(char *syyText); void popKey(char *syyText);
@@ -55,6 +55,6 @@ class convert_xcu : public convert_gen_impl
int miLevel; int miLevel;
bool mbNoTranslate; bool mbNoTranslate;
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -36,7 +36,7 @@ class convert_xhp : public convert_gen_impl
{ {
public: public:
convert_xhp(l10nMem& crMemory); convert_xhp(l10nMem& crMemory);
~convert_xhp(); virtual ~convert_xhp();
void setString(char *yytext); void setString(char *yytext);
void openTag(char *yytext); void openTag(char *yytext);
@@ -72,6 +72,6 @@ class convert_xhp : public convert_gen_impl
std::string *msLangText; std::string *msLangText;
std::ofstream *mcOutputFiles; std::ofstream *mcOutputFiles;
int miCntLanguages; int miCntLanguages;
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -37,7 +37,7 @@ class convert_xrm : public convert_gen_impl
public: public:
bool mbNoCollectingData; bool mbNoCollectingData;
convert_xrm(l10nMem& crMemory); convert_xrm(l10nMem& crMemory);
~convert_xrm(); virtual ~convert_xrm();
void setId(char *yytext); void setId(char *yytext);
void setLang(char *yytext); void setLang(char *yytext);
@@ -51,6 +51,6 @@ class convert_xrm : public convert_gen_impl
bool mbIsLang; bool mbIsLang;
std::string msTag; std::string msTag;
void execute(); void execute() override;
}; };
#endif #endif

View File

@@ -53,7 +53,7 @@
/******************* G L O B A L D E F I N I T I O N *******************/ /******************* G L O B A L D E F I N I T I O N *******************/
convert_gen_impl * convert_gen_impl::mcImpl = NULL; convert_gen_impl * convert_gen_impl::mcImpl = nullptr;
@@ -198,7 +198,7 @@ bool convert_gen::createDir(std::string& sDir, std::string& sFile)
if (!checkAccess(sNewDir)) if (!checkAccess(sNewDir))
{ {
OS_MKDIR((char *)sNewDir.c_str()); OS_MKDIR(sNewDir.c_str());
} }
} }
@@ -223,7 +223,7 @@ convert_gen_impl::convert_gen_impl(l10nMem& crMemory)
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
convert_gen_impl::~convert_gen_impl() convert_gen_impl::~convert_gen_impl()
{ {
mcImpl = NULL; mcImpl = nullptr;
} }
@@ -252,7 +252,7 @@ bool convert_gen_impl::prepareFile()
inputFile.seekg (0, std::ios::beg); inputFile.seekg (0, std::ios::beg);
// get size, prepare std::string and read whole file // get size, prepare std::string and read whole file
inputFile.read((char *)msSourceBuffer.c_str(), msSourceBuffer.size()); inputFile.read(const_cast<char *>(msSourceBuffer.c_str()), msSourceBuffer.size());
if ((unsigned int)inputFile.gcount() != msSourceBuffer.size()) if ((unsigned int)inputFile.gcount() != msSourceBuffer.size())
throw l10nMem::showError("cannot read whole file"); throw l10nMem::showError("cannot read whole file");
inputFile.close(); inputFile.close();
@@ -325,7 +325,7 @@ void convert_gen_impl::writeSourceFile(const std::string& line)
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
std::string& convert_gen_impl::copySource(char *yyText, bool bDoClear) std::string& convert_gen_impl::copySource(char const *yyText, bool bDoClear)
{ {
int nL; int nL;

View File

@@ -87,7 +87,7 @@ bool convert_db::collectLine()
{ {
if (i >= NUMFIELD) if (i >= NUMFIELD)
{ {
l10nMem::showError((char*)"TOO many fields", miLineNo); l10nMem::showError("TOO many fields", miLineNo);
} }
msFields[i++] = msSourceBuffer.substr(iStart, miSourceReadIndex - iStart); msFields[i++] = msSourceBuffer.substr(iStart, miSourceReadIndex - iStart);
iStart = miSourceReadIndex +1; iStart = miSourceReadIndex +1;

View File

@@ -32,7 +32,7 @@
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
convert_prop::convert_prop(l10nMem& crMemory) : convert_gen_impl(crMemory) convert_prop::convert_prop(l10nMem& crMemory) : convert_gen_impl(crMemory)
{ {
throw mcMemory.showError(std::string("convert_prop not implemented")); throw l10nMem::showError(std::string("convert_prop not implemented"));
} }
@@ -47,5 +47,5 @@ convert_prop::~convert_prop()
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
void convert_prop::execute() void convert_prop::execute()
{ {
throw mcMemory.showError(std::string("convert_prop::execute not implemented")); throw l10nMem::showError(std::string("convert_prop::execute not implemented"));
} }

View File

@@ -75,8 +75,8 @@ void convert_src::setValue(char *syyText, char *sbuildValue)
if (mbInList && !mbInListItem) if (mbInList && !mbInListItem)
{ {
setListItem((char *)"", true); setListItem("", true);
setListItem((char *)"", false); setListItem("", false);
} }
msValue = sbuildValue; msValue = sbuildValue;
mbValuePresent = true; mbValuePresent = true;
@@ -92,7 +92,7 @@ void convert_src::setLang(char *syyText, bool bEnUs)
mbEnUs = bEnUs; mbEnUs = bEnUs;
if (!bEnUs && mbExpectValue) if (!bEnUs && mbExpectValue)
mcMemory.showError(useText); l10nMem::showError(useText);
} }
@@ -258,7 +258,7 @@ void convert_src::stopBlock(char *syyText)
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
void convert_src::setListItem(char *syyText, bool bIsStart) void convert_src::setListItem(char const *syyText, bool bIsStart)
{ {
copySource(syyText); copySource(syyText);

View File

@@ -32,7 +32,7 @@
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
convert_tree::convert_tree(l10nMem& crMemory) convert_tree::convert_tree(l10nMem& crMemory)
: convert_gen_impl(crMemory), : convert_gen_impl(crMemory),
mcOutputFiles(NULL), mcOutputFiles(nullptr),
meStateTag(STATE_TAG_NONE), meStateTag(STATE_TAG_NONE),
meStateVal(STATE_VAL_NONE), meStateVal(STATE_VAL_NONE),
miCntLanguages(0) miCntLanguages(0)
@@ -103,7 +103,7 @@ void convert_tree::execute()
// TreeWrap::yylex(); // TreeWrap::yylex();
// dump last line // dump last line
copySourceSpecial(NULL,3); copySourceSpecial(nullptr,3);
} }

View File

@@ -74,7 +74,7 @@ void convert_ulf::setText(char *syyText, bool bIsEnUs)
if (!bIsEnUs) if (!bIsEnUs)
mcMemory.showError(sText); l10nMem::showError(sText);
} }

View File

@@ -78,12 +78,12 @@ void convert_xcs::setKey(char *syyText)
// is it to be translated // is it to be translated
if (sText.find("oor:localized=") == std::string::npos) if (sText.find("oor:localized=") == std::string::npos)
return; return;
// locate key (is any) // locate key (is any)
nL = sText.find("oor:name=\""); nL = sText.find("oor:name=\"");
if (nL == (int)std::string::npos) if (nL == (int)std::string::npos)
return; return;
sHead = sText.substr(nL+10); sHead = sText.substr(nL+10);
nL = sHead.find("\""); nL = sHead.find("\"");
msKey = sHead.substr(0,nL); msKey = sHead.substr(0,nL);

View File

@@ -124,7 +124,7 @@ void convert_xcu::startCollectData(char *syyText)
else else
{ {
std::string sErr = sTag.substr(nL,5) + " is not en-US"; std::string sErr = sTag.substr(nL,5) + " is not en-US";
mcMemory.showError(sErr); l10nMem::showError(sErr);
} }
} }
} }

View File

@@ -33,8 +33,8 @@
convert_xhp::convert_xhp(l10nMem& crMemory) convert_xhp::convert_xhp(l10nMem& crMemory)
: convert_gen_impl(crMemory), : convert_gen_impl(crMemory),
meExpectValue(VALUE_NOT_USED), meExpectValue(VALUE_NOT_USED),
msLangText(NULL), msLangText(nullptr),
mcOutputFiles(NULL), mcOutputFiles(nullptr),
miCntLanguages(0) miCntLanguages(0)
{ {
// xhp files are written through a local routine // xhp files are written through a local routine
@@ -102,7 +102,7 @@ void convert_xhp::execute()
// XhpWrap::yylex(); // XhpWrap::yylex();
// dump last line // dump last line
copySourceSpecial(NULL,3); copySourceSpecial(nullptr,3);
} }
@@ -219,7 +219,7 @@ void convert_xhp::setLang(char *yytext)
if (sLang == "en-US") if (sLang == "en-US")
meExpectValue = VALUE_IS_TAG_TRANS; meExpectValue = VALUE_IS_TAG_TRANS;
else else
mcMemory.showError(sLang + " is no en-US language"); l10nMem::showError(sLang + " is no en-US language");
break; break;
case VALUE_IS_VALUE_TAG: case VALUE_IS_VALUE_TAG:

View File

@@ -106,7 +106,7 @@ void convert_xrm::setLang(char *yytext)
if (sLang == "en-US") if (sLang == "en-US")
mbIsLang = true; mbIsLang = true;
else else
mcMemory.showError(sLang + " is no en-US language"); l10nMem::showError(sLang + " is no en-US language");
} }
} }

View File

@@ -35,7 +35,7 @@
/******************* G L O B A L D E F I N I T I O N *******************/ /******************* G L O B A L D E F I N I T I O N *******************/
l10nMem_impl * l10nMem_impl::mcImpl = NULL; l10nMem_impl * l10nMem_impl::mcImpl = nullptr;
bool l10nMem_impl::mbVerbose = false; bool l10nMem_impl::mbVerbose = false;
bool l10nMem_impl::mbDebug = false; bool l10nMem_impl::mbDebug = false;
@@ -701,9 +701,9 @@ void l10nMem_impl::convEntryKey(int iLineNo,
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
void l10nMem_impl::convertToInetString(std::string& sText) void l10nMem_impl::convertToInetString(std::string& sText)
{ {
static const char *replacingStr[] = {"&", "\'", ">", "<", "\"", NULL }; static const char *replacingStr[] = {"&", "\'", ">", "<", "\"", nullptr };
static const int replacingLen[] = {1, 1, 1, 1, 1, 0 }; static const int replacingLen[] = {1, 1, 1, 1, 1, 0 };
static const char *newStr[] = {"&amp;", "&apos;", "&gt;", "&lt;", "&quot;", NULL }; static const char *newStr[] = {"&amp;", "&apos;", "&gt;", "&lt;", "&quot;", nullptr };
static const int newLen[] = {5, 6, 4, 4, 6, 0 }; static const int newLen[] = {5, 6, 4, 4, 6, 0 };
int i, pos; int i, pos;
@@ -722,9 +722,9 @@ static const int newLen[] = {5, 6, 4, 4, 6,
/********************** I M P L E M E N T A T I O N **********************/ /********************** I M P L E M E N T A T I O N **********************/
void l10nMem_impl::convertFromInetString(std::string& sText) void l10nMem_impl::convertFromInetString(std::string& sText)
{ {
static const char *replacingStr[] = {"&amp;", "&apos;", "&gt;", "&lt;", "&quot;", NULL }; static const char *replacingStr[] = {"&amp;", "&apos;", "&gt;", "&lt;", "&quot;", nullptr };
static const int replacingLen[] = {5, 6, 4, 4, 6, 0 }; static const int replacingLen[] = {5, 6, 4, 4, 6, 0 };
static const char *newStr[] = {"&", "\'", ">", "<", "\"", NULL }; static const char *newStr[] = {"&", "\'", ">", "<", "\"", nullptr };
static const int newLen[] = {1, 1, 1, 1, 1, 0 }; static const int newLen[] = {1, 1, 1, 1, 1, 0 };
int i, pos; int i, pos;