Skip to content

Commit

Permalink
Merge pull request #100 from ggtakec/update_support_os
Browse files Browse the repository at this point in the history
Changed support OS and Fixed about cppcheck, etc
  • Loading branch information
ggtakec authored Mar 8, 2024
2 parents 4ee881e + 964cc79 commit 2c839fd
Show file tree
Hide file tree
Showing 24 changed files with 434 additions and 175 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,26 @@ jobs:
- rockylinux:9
- rockylinux:8
- centos:centos7
- fedora:39
- fedora:38
- fedora:37
- alpine:3.19
- alpine:3.18

container:
image: ${{ matrix.container }}

steps:
# [NOTE]
# actions/checkout@v3 uses nodejs v16 and will be deprecated.
# However, @v4 does not work on centos7 depending on the glibc version,
# so we will continue to use @v3.
#
# Checks-out your repository under $GITHUB_WORKSPACE, so your
# job can access it
#
- name: Checkout sources
- name: Checkout source code(other than centos7)
if: matrix.container != 'centos:centos7'
uses: actions/checkout@v4

- name: Checkout source code(only centos7)
if: matrix.container == 'centos:centos7'
uses: actions/checkout@v3

#
Expand Down Expand Up @@ -153,18 +160,18 @@ jobs:
# <default tag flag>: If you want to use the created Docker image as the default image, specify "default".
#
imageinfo:
- alpine:3.18,alpine:3.18,alpine,default
- alpine:3.19,alpine:3.19,alpine,default
- ubuntu:22.04,ubuntu:22.04,ubuntu

#
# Run building and pushing helper
#
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

#
# Login to avoid the Docker Hub rate limit
Expand All @@ -178,7 +185,7 @@ jobs:
#
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESSTOKEN }}
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/ostypevars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ elif [ "${CI_OSTYPE}" = "centos:7" ] || [ "${CI_OSTYPE}" = "centos:centos7" ]; t
PKG_EXT="rpm"
IS_OS_CENTOS=1

elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
DIST_TAG="fedora/38"
elif [ "${CI_OSTYPE}" = "fedora:39" ]; then
DIST_TAG="fedora/39"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libfullock-devel nss-devel"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
Expand All @@ -220,8 +220,8 @@ elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
PKG_EXT="rpm"
IS_OS_FEDORA=1

elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
DIST_TAG="fedora/37"
elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
DIST_TAG="fedora/38"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libfullock-devel nss-devel"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
Expand All @@ -234,6 +234,20 @@ elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
PKG_EXT="rpm"
IS_OS_FEDORA=1

elif [ "${CI_OSTYPE}" = "alpine:3.19" ]; then
DIST_TAG="alpine/v3.19"
INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf libtool groff util-linux-misc musl-locales ruby-dev procps libfullock libfullock-dev openssl-dev"
INSTALLER_BIN="apk"
UPDATE_CMD="update"
UPDATE_CMD_ARG="--no-progress"
INSTALL_CMD="add"
INSTALL_CMD_ARG="--no-progress --no-cache"
INSTALL_AUTO_ARG=""
INSTALL_QUIET_ARG="-q"
PKG_OUTPUT_DIR="apk_build"
PKG_EXT="apk"
IS_OS_ALPINE=1

elif [ "${CI_OSTYPE}" = "alpine:3.18" ]; then
DIST_TAG="alpine/v3.18"
INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf libtool groff util-linux-misc musl-locales ruby-dev procps libfullock libfullock-dev openssl-dev"
Expand Down
36 changes: 28 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ EXTRA_DIST=RELEASE_VERSION @CONFIGURECUSTOM@
# Versions of cppcheck below 1.8 perform poorly and the test is
# skipped if those versions are installed.
#
CPPCHECK_NG_VERSION = -e \^0\\. -e \^1\\.[0-7]
CPPCHECK_NG_VER = -e \^0\\. -e \^1\\.[0-7]
CPPCHECK_CMD = cppcheck
CPPCHECK_TARGET = $(SUBDIRS)
CPPCHECK_BUILD_DIR = /tmp/cppcheck
Expand All @@ -43,19 +43,38 @@ CPPCHECK_BASE_OPT = --quiet \
--xml
CPPCHECK_ENABLE_OPT = --enable=warning,style,information,missingInclude
CPPCHECK_IGNORE_OPT = --suppress=unmatchedSuppression
CPPCHECK_INCDIR_OPT = -I . -I lib
CPPCHECK_DEFINE_OPT =

# [NOTE] Switch options
# The options available vary depending on the version.
# There are cases where you use options that do not exist in older
# versions.
#
CPPCHECK_GT207_VER = 2007
CPPCHECK_GT207_ADD_OPT = --suppress=ctuOneDefinitionRuleViolation
CPPCHECK_GE211_VER = 2011
CPPCHECK_GE211_ADD_OPT = --check-level=exhaustive \
--suppress=missingIncludeSystem

cppcheck:
@if command -v $(CPPCHECK_CMD) >/dev/null 2>&1; then \
if ($(CPPCHECK_CMD) --version | sed -e 's|Cppcheck[[:space:]]*||gi' | grep -q $(CPPCHECK_NG_VERSION)); then \
@set -e; \
if command -v $(CPPCHECK_CMD) >/dev/null 2>&1; then \
if ($(CPPCHECK_CMD) --version | sed -e 's|Cppcheck[[:space:]]*||gi' | grep -q $(CPPCHECK_NG_VER)); then \
echo "*** [INFO] cppcheck version below 1.8, so skip to run cppcheck."; \
else \
echo "*** Check all files with CppCheck"; \
if [ -d $(CPPCHECK_BUILD_DIR) ]; then \
rm -rf $(CPPCHECK_BUILD_DIR); \
fi; \
mkdir -p $(CPPCHECK_BUILD_DIR); \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
if test `$(CPPCHECK_CMD) --version | sed -e 's/\./ /g' | awk '{print ($$2 * 1000 + $$3)}'` -le $(CPPCHECK_GT207_VER); then \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
elif test `$(CPPCHECK_CMD) --version | sed -e 's/\./ /g' | awk '{print ($$2 * 1000 + $$3)}'` -lt $(CPPCHECK_GE211_VER); then \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) $(CPPCHECK_GT207_ADD_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
else \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) $(CPPCHECK_GT207_ADD_OPT) $(CPPCHECK_GE211_ADD_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
fi; \
rm -rf $(CPPCHECK_BUILD_DIR); \
fi; \
else \
Expand All @@ -79,16 +98,17 @@ SHELLCHECK_FILES_SH = `grep -ril '^\#!/bin/sh' . | grep '\.sh' | grep -v '\
SHELLCHECK_FILES_INCLUDE_SH = `grep -Lir '^\#!/bin/sh' . | grep '\.sh' | grep -v '\.log' | grep -v '/\.git/' | grep -v '/rpmbuild/' | grep -v '/debian_build/' | grep -v '/autom4te.cache/' | grep -v '/m4/' | grep -v '/install-sh' | grep -v '/ltmain.sh' | tr '\n' ' '`

shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
@set -e; \
if type shellcheck > /dev/null 2>&1; then \
echo "*** Check all files with ShellCheck"; \
if [ -n "$(SHELLCHECK_FILES_NO_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_NO_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_NO_SH); \
fi; \
if [ -n "$(SHELLCHECK_FILES_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_SH); \
fi; \
if [ -n "$(SHELLCHECK_FILES_INCLUDE_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_INCLUDE_IGN_OPT) $(SHELLCHECK_FILES_INCLUDE_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_INCLUDE_IGN_OPT) $(SHELLCHECK_FILES_INCLUDE_SH); \
fi; \
echo " -> No error was detected."; \
echo ""; \
Expand Down
6 changes: 3 additions & 3 deletions buildutils/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: @PACKAGE_NAME@
Section: database
Priority: optional
Maintainer: @DEV_NAME@ <@DEV_EMAIL@>
Build-Depends: @DEBHELPER_DEP@, libfullock-dev (>= 1.0.57), libgcrypt20-dev
Build-Depends: @DEBHELPER_DEP@, libfullock-dev (>= 1.0.59), libgcrypt20-dev
Depends: ${misc:Depends}
Standards-Version: 3.9.8
Homepage: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Expand All @@ -12,14 +12,14 @@ Vcs-Browser: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Package: @PACKAGE_NAME@-dev
Section: devel
Architecture: amd64
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), libfullock-dev (>= 1.0.57), libgcrypt20-dev
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), libfullock-dev (>= 1.0.59), libgcrypt20-dev
Description: @SHORTDESC@ (development)
Development package for building with @PACKAGE_NAME@ shared library.
This package has header files and symbols for it.

Package: @PACKAGE_NAME@
Section: database
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, libfullock (>= 1.0.57)
Depends: ${shlibs:Depends}, ${misc:Depends}, libfullock (>= 1.0.59)
Description: @SHORTDESC@
@DEBLONGDESC@
6 changes: 3 additions & 3 deletions buildutils/k2hash.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ License: @PKGLICENSE@
@RPMPKG_GROUP@
URL: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@
Source0: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@/archive/%{gittag}/%{name}-%{version}.tar.gz
Requires: libfullock%{?_isa} >= 1.0.57
BuildRequires: git-core gcc-c++ make libtool libfullock-devel >= 1.0.57 nss-devel
Requires: libfullock%{?_isa} >= 1.0.59
BuildRequires: git-core gcc-c++ make libtool libfullock-devel >= 1.0.59 nss-devel

%description
@LONGDESC@
Expand Down Expand Up @@ -110,7 +110,7 @@ rm -rf %{buildroot}
#
%package devel
Summary: @SHORTDESC@ (development)
Requires: %{name}%{?_isa} = %{version}-%{release}, libfullock-devel%{?_isa} >= 1.0.57, nss-devel
Requires: %{name}%{?_isa} = %{version}-%{release}, libfullock-devel%{?_isa} >= 1.0.59, nss-devel

%description devel
Development package for building with @PACKAGE_NAME@ shared library.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ AC_ARG_ENABLE(check-depend-libs,
esac]
)
AS_IF([test ${check_depend_libs} = 1], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.57], [], [AC_MSG_ERROR(not found libfullock package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.59], [], [AC_MSG_ERROR(not found libfullock package)])])

#
# CFLAGS/CXXFLAGS
Expand Down
2 changes: 2 additions & 0 deletions lib/k2hattrop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ bool K2hAttrOpsBase::AddAttrOpArray(k2hattroplist_t& attroplist, K2hAttrOpsBase*
return false;
}
for(k2hattroplist_t::const_iterator iter = attroplist.begin(); iter != attroplist.end(); ++iter){
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress useStlAlgorithm
if((*iter)->VerInfo == pattrop->VerInfo){
// found same attrop in list
ERR_K2HPRN("found same attribute operation object(%s) in list.", pattrop->VerInfo.c_str());
Expand Down
4 changes: 2 additions & 2 deletions lib/k2hpagemem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool K2HPageMem::LoadData(bool isPageHead, bool isAllPage)

// copy to inner memory
unsigned char* pOneData = &(pPageHead->data[0]); // so already load head
if(pOneData && 0UL != pPageHead->length){
if(0UL != pPageHead->length){
memcpy(pPageData, pOneData, pPageHead->length);
DataLength = pPageHead->length;
}
Expand Down Expand Up @@ -237,7 +237,7 @@ K2HPage* K2HPageMem::LoadData(off_t offset, size_t length, unsigned char** byDat
size_t this_length = min((pTarget->length - offset), length);

// load data by offset and length
unsigned char* pOffsetData = ADDPTR(&(pTarget->data[0]), offset);
const unsigned char* pOffsetData = ADDPTR(&(pTarget->data[0]), offset);
memcpy(byNext, pOffsetData, this_length);

length -= this_length;
Expand Down
5 changes: 5 additions & 0 deletions lib/k2hqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class K2HLowOpsQueue : public K2HQueue
protected:
virtual bool Read(unsigned char** ppdata, size_t& datalen, int pos = 0, const char* encpass = NULL) const;
virtual bool Push(const unsigned char* bydata, size_t datalen, K2HAttrs* pAttrs, const char* encpass, const time_t* expire);
virtual bool Pop(unsigned char** ppdata, size_t& datalen, K2HAttrs** ppAttrs, const char* encpass) { return K2HQueue::Pop(ppdata, datalen, ppAttrs, encpass); }

bool ReplaceTopQueueKey(const unsigned char* preplacekey, size_t replacekeylen);
unsigned char* GetEdgeQueueKey(size_t& keylen, bool is_top) const;
Expand Down Expand Up @@ -173,7 +174,11 @@ class K2HLowOpsQueue : public K2HQueue
// K2HQueue::GetMarkerName : get marker name. this class method is inherited from base class.
// K2HQueue::GetUniqKey : get uniq queue key name which can be used new queue key name. this method is inherited from base class.
//
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress duplInheritedMember
static unsigned char* GetMarkerName(const unsigned char* pref, size_t preflen, size_t& markerlength) { return K2HQueue::GetMarkerName(pref, preflen, markerlength); }
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress duplInheritedMember
unsigned char* GetUniqKey(size_t& keylen) { return K2HQueue::GetUniqKey(keylen); }
};

Expand Down
36 changes: 24 additions & 12 deletions lib/k2hshm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,19 +886,23 @@ PKINDEX K2HShm::GetKIndex(k2h_hash_t hash, bool isMergeCurmask, bool is_need_loc
return NULL;
}

pKindex = CVT_ABS_PKINDEX(pHead->key_index_area, KIPtrArrayPos, KIArrayPos);
if(pKindex && KINDEX_ASSIGNED == pKindex->assign){
break;
}else if(pKindex && KINDEX_ASSIGNED != pKindex->assign && isMergeCurmask){
// Need to merge position for elements, because cur_mask is changed.
MSG_K2HPRN("Need to check and move hash(%" PRIu64 ") element.", hash);

if(!ArrangeToUpperKIndex(hash, pHead->cur_mask)){
ERR_K2HPRN("Failed to arrange key index.");
return NULL;
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownConditionTrueFalse
if(NULL != (pKindex = CVT_ABS_PKINDEX(pHead->key_index_area, KIPtrArrayPos, KIArrayPos))){
if(KINDEX_ASSIGNED == pKindex->assign){
break;

}else if(KINDEX_ASSIGNED != pKindex->assign && isMergeCurmask){
// Need to merge position for elements, because cur_mask is changed.
MSG_K2HPRN("Need to check and move hash(%" PRIu64 ") element.", hash);

if(!ArrangeToUpperKIndex(hash, pHead->cur_mask)){
ERR_K2HPRN("Failed to arrange key index.");
return NULL;
}
// retry...
return GetKIndex(hash, false, false);
}
// retry...
return GetKIndex(hash, false, false);
}
}
return pKindex;
Expand Down Expand Up @@ -1661,6 +1665,8 @@ K2HPage* K2HShm::ReservePages(size_t length)
K2HPage* pLastPage;
K2HPage* pStartPage = NULL;
unsigned long rpage_count;
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress uninitvar
for(pLastPage = GetPageObject(pHead->pfree_pages, false), rpage_count = 1; pLastPage; pLastPage = GetPageObject(LastPageHead.next, false), rpage_count++){
if(!pLastPage->GetPageHead(&LastPageHead)){
ERR_K2HPRN("Could not load(get) PAGEHEAD data");
Expand All @@ -1681,6 +1687,8 @@ K2HPage* K2HShm::ReservePages(size_t length)

// set prev/next pointer for reserving/new top page object.
K2HPage* pNewFreeTopPage;
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress uninitvar
if(NULL != (pNewFreeTopPage = GetPageObject(LastPageHead.next, false))){
if(!pNewFreeTopPage->SetPageHead(K2HPage::SETHEAD_PREV, NULL)){
ERR_K2HPRN("Could not set prev pointer for new top page object");
Expand Down Expand Up @@ -1897,6 +1905,8 @@ ssize_t K2HShm::Get(const unsigned char* byKey, size_t length, unsigned char** b
K2hAttrOpsMan attrman;
if(!attrman.Initialize(this, byKey, length, *byValue, static_cast<size_t>(vallen), encpass)){
ERR_K2HPRN("Something error occurred during initializing attributes manager class.");
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress identicalInnerCondition
K2H_Delete(pAttrs);
K2H_Free(*byValue);
return -1;
Expand Down Expand Up @@ -2826,6 +2836,8 @@ bool K2HShm::RemoveEx(const unsigned char* byKey, size_t keylength, bool isSubKe
string uniqid;
result = RenameForHistory(byKey, keylength, &uniqid, ptranslist);
if(ppUniqid){
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownConditionTrueFalse
if(!uniqid.empty()){
*ppUniqid = strdup(uniqid.c_str());
}else{
Expand Down
10 changes: 7 additions & 3 deletions lib/k2hshmcomp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ PELEMENT K2HShm::ReserveElement(void* pRelExpArea, size_t ExpLength)
}
K2HLock ALObjFEC(ShmFd, Rel(&(pHead->free_element_count)), K2HLock::RWLOCK); // LOCK

PELEMENT pStartPos = reinterpret_cast<PELEMENT>(pRelExpArea);
PELEMENT pLastPos = ADDPTR(reinterpret_cast<PELEMENT>(pRelExpArea), static_cast<off_t>(ExpLength));
const PELEMENT pStartPos = reinterpret_cast<PELEMENT>(pRelExpArea);
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress constVariablePointer
const PELEMENT pLastPos = ADDPTR(reinterpret_cast<PELEMENT>(pRelExpArea), static_cast<off_t>(ExpLength));

for(PELEMENT pElement = static_cast<PELEMENT>(Abs(pHead->pfree_elements)), pRelElement = pHead->pfree_elements; pElement; pElement = static_cast<PELEMENT>(Abs(pElement->same)), pRelElement = pElement->same){
// check target area
Expand Down Expand Up @@ -744,7 +746,9 @@ bool K2HShm::AreaCompress(bool& isCompressed)
unsigned long page_count = 0UL;
PAGEHEAD CurPageHead;
for(K2HPage* pCurPage = GetPageObject(pHead->pfree_pages, false); pCurPage; pCurPage = GetPageObject(CurPageHead.next, false)){
PPAGEHEAD pRelCurPageHead = pCurPage->GetPageHeadRelAddress();
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress constVariablePointer
const PPAGEHEAD pRelCurPageHead = pCurPage->GetPageHeadRelAddress();
if(pStartPos <= pRelCurPageHead && pRelCurPageHead < pLastPos){
// found
page_count++;
Expand Down
6 changes: 5 additions & 1 deletion lib/k2hshmdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ static inline void DUMP_PRINT_NV(FILE* stream, int nest, const char* name_format
buff[0] = '\0';

if(NULL != name_format){
sprintf(&buff[0], name_format, name);
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress wrongPrintfScanfArgNum
sprintf(buff, name_format, name);
}
for(int cnt = DUMP_NAME_CHAR_COUNT - strlen(&buff[0]); 0 < cnt; cnt--){
strcat(&buff[0], " ");
Expand Down Expand Up @@ -695,6 +697,8 @@ bool K2HShm::DumpQueue(FILE* stream, const unsigned char* byMark, size_t marklen

if(0 == k2hbincmp(bykey, keylen, &(pmarker->byData[pmarker->marker.endoff]), pmarker->marker.endlen)){
// reached end key
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress identicalInnerCondition
K2H_Free(bykey);
break;
}
Expand Down
Loading

0 comments on commit 2c839fd

Please sign in to comment.