Skip to content

Commit

Permalink
Merge pull request #4 from dbernhard-0x7CD/master
Browse files Browse the repository at this point in the history
Use explicit 0 instead of NULL when setting an element in char array
  • Loading branch information
vpodpecan authored Jan 17, 2023
2 parents b8baaf4 + b1e9244 commit 3ec3e8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lemmagen3/cpp/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static qword abDataStatic[] = DATA_TBL;
#define GETSTRINGMOVE(type, acString, iSize) \
type acString = new char[iSize+1]; \
strncpy(acString, (char*) &abData[iAddr], iSize); \
acString[iSize] = NULL; \
acString[iSize] = 0; \
iAddr += iSize

//-------------------------------------------------------------------------------------------
Expand All @@ -117,7 +117,7 @@ class RdrLemmatizer{

void ToStringHex(ostream &os) const;
void ToString(ostream &os = cout, dword iStartAddr = DataStart, int iDepth = 0,
char *acParSufx = "", char *acParDev = "", char cNewChar=NULL) const;
char *acParSufx = "", char *acParDev = "", char cNewChar=0) const;

void LoadBinary(const char *acFileName);
void LoadBinaryStream(istream &is);
Expand Down
8 changes: 4 additions & 4 deletions src/lemmagen3/cpp/lemmagen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ char *RdrLemmatizer::Lemmatize(const char *acWord) const{
iTmpAddr += ModLen;
unsigned char bChar = abData[iTmpAddr];
GETDWORD(,iTmpAddr,iTmpAddr+CharLen);
if (bChar == NULL && iTmpAddr!=NULL) {
if (bChar == 0 && iTmpAddr!=0) {
//we have a candidate for entireword, redirect addresses
iParentAddr = iAddr;
iAddr = iTmpAddr;
Expand Down Expand Up @@ -161,7 +161,7 @@ char *RdrLemmatizer::Lemmatize(const char *acWord) const{
//do actual lematiration using given rule
memcpy(acReturn, acWord, iStemLen);
memcpy(&acReturn[iStemLen], &abData[iTmpAddr], iToLen);
acReturn[iStemLen + iToLen] = NULL;
acReturn[iStemLen + iToLen] = 0;

return acReturn;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ void RdrLemmatizer::ToString(ostream &os, dword iStartAddr, int iDepth, char *ac
}

//create and display sufixes
if (cNewChar != NULL) {
if (cNewChar != 0) {
int iSufxLen = 1 + iNewSufxLen + strlen(acParSufx) + 1;
int iSufxDevLen = 2 + iNewSufxLen + strlen(acParDev) + 1;

Expand Down Expand Up @@ -289,7 +289,7 @@ void RdrLemmatizer::ToString(ostream &os, dword iStartAddr, int iDepth, char *ac

//display sub nodes
for (int i = 0; i<iSubsNum; i++)
if (iSubs[i]!=NULL) {
if (iSubs[i]!=0) {
ToString(os, iSubs[i], iDepth + 1, acSufx, acSufxDev, bSubs[i]);
if (i<iSubsNum-1) os << endl;
}
Expand Down

0 comments on commit 3ec3e8c

Please sign in to comment.