From b1e9244e2d8004145286f82d2394425b2af4521b Mon Sep 17 00:00:00 2001 From: dbernhard Date: Wed, 7 Dec 2022 22:55:45 +0100 Subject: [PATCH] Use explicit 0 instead of NULL when setting an element in char array --- src/lemmagen3/cpp/definitions.h | 4 ++-- src/lemmagen3/cpp/lemmagen.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lemmagen3/cpp/definitions.h b/src/lemmagen3/cpp/definitions.h index 72f122e..727a7bd 100755 --- a/src/lemmagen3/cpp/definitions.h +++ b/src/lemmagen3/cpp/definitions.h @@ -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 //------------------------------------------------------------------------------------------- @@ -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); diff --git a/src/lemmagen3/cpp/lemmagen.cpp b/src/lemmagen3/cpp/lemmagen.cpp index b859b6a..a6ddc22 100755 --- a/src/lemmagen3/cpp/lemmagen.cpp +++ b/src/lemmagen3/cpp/lemmagen.cpp @@ -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; @@ -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; } @@ -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; @@ -289,7 +289,7 @@ void RdrLemmatizer::ToString(ostream &os, dword iStartAddr, int iDepth, char *ac //display sub nodes for (int i = 0; i