Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/autopr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
pull-requests: write
steps:
- name: Create PR
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const { repo, owner } = context.repo;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:

env:
NODE_VERSION: 22
PYTHON_VERSION: 3.x
JAVA_VERSION: 17
PYTHON_VERSION: 3.13
JAVA_VERSION: 21

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.57
1.6.58
2 changes: 1 addition & 1 deletion c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ option(BUILD_SHARED_LIB "Build a shared library" ON)
if(CMAKE_COMPILER_IS_GNUCC)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D VERSION='\"${PROJECT_VERSION}\"' -s -pedantic -std=c17 -Wall -Wextra -Wno-strict-prototypes -Wcast-align -Wundef -Wformat -Wformat-security")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D VERSION='\"${PROJECT_VERSION}\"' -s -pedantic -std=c2x -Wall -Wextra -Wno-strict-prototypes -Wcast-align -Wundef -Wformat -Wformat-security")

if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
Expand Down
2 changes: 1 addition & 1 deletion c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ endif
# Test C code compatibility with C++
.PHONY: testcpp
testcpp:
find ./src/numkey -type f -name '*.h' -exec gcc -c -pedantic -Werror -Wall -Wextra -Wcast-align -Wundef -Wformat -Wformat-security -std=c++17 -x c++ -o /dev/null {} \;
find ./src/numkey -type f -name '*.h' -exec gcc -c -pedantic -Werror -Wall -Wextra -Wcast-align -Wundef -Wformat -Wformat-security -std=c++23 -x c++ -o /dev/null {} \;

# use clang-tidy
.PHONY: tidy
Expand Down
2 changes: 1 addition & 1 deletion c/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME = "NumKey"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 1.6.57
PROJECT_NUMBER = 1.6.58

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
2 changes: 1 addition & 1 deletion c/nk/nk.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../src/numkey/numkey.h"

Expand Down
6 changes: 4 additions & 2 deletions c/src/numkey/binsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// @author Nicola Asuni <[email protected]>
// @link https://github.com/tecnickcom/binsearch
// @license MIT (see LICENSE file)
// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com
// @copyright (c) 2017-2025 Nicola Asuni - Tecnick.com

/**
* @file binsearch.h
Expand Down Expand Up @@ -44,6 +44,7 @@
#include <inttypes.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -989,7 +990,8 @@ static inline void mmap_binfile(const char *file, mmfile_t *mf)
mf->dlength = 0;
mf->nrows = 0;
struct stat statbuf;
if (((mf->fd = open(file, O_RDONLY)) < 0) || (fstat(mf->fd, &statbuf) < 0))
mf->fd = open(file, O_RDONLY);
if ((mf->fd < 0) || (fstat(mf->fd, &statbuf) < 0))
{
return;
}
Expand Down
1 change: 1 addition & 0 deletions c/src/numkey/countrykey.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define NUMKEY_COUNTRYKEY_H

#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>

/**
Expand Down
10 changes: 7 additions & 3 deletions c/src/numkey/hex.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// NumKey
//
// hex.h
//
// @category Libraries
Expand All @@ -18,9 +16,12 @@
#define NUMKEY_HEX_H

#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

/** @brief Returns uint64_t hexadecimal string (16 characters).
*
*
*
* @param n Number to parse
* @param str String buffer to be returned (it must be sized 17 bytes at least).
Expand All @@ -36,6 +37,9 @@ static inline size_t hex_uint64_t(uint64_t n, char *str)
}

/** @brief Parses a 16 chars hexadecimal string and returns the code.
*
* This function parses a hexadecimal string and returns the corresponding
* unsigned integer number.
*
* @param s Hexadecimal string to parse (it must contain 16 hexadecimal characters).
*
Expand Down Expand Up @@ -69,4 +73,4 @@ static inline uint64_t parse_hex_uint64_t(const char *s)
return v;
}

#endif // NUMKEY_HEX_H
#endif // NUMKEY_HEX_H
1 change: 1 addition & 0 deletions c/src/numkey/numkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define NUMKEY_NUMKEY_H

#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>
#include "hex.h"

Expand Down
1 change: 1 addition & 0 deletions c/src/numkey/prefixkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define NUMKEY_PREFIXKEY_H

#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>

#define PKNUMMAXLEN 15 //!< Maximum number of digits to store for the prefixkey.
Expand Down
20 changes: 13 additions & 7 deletions c/src/numkey/set.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// NumKey
//
// set.h
//
// @category Libraries
Expand All @@ -18,7 +16,7 @@
#define NUMKEY_SET_H

#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>

#define RADIX_SORT_COUNT_BLOCK \
uint32_t c7[256]= {0}, c6[256]= {0}, c5[256]= {0}, c4[256]= {0}, c3[256]= {0}, c2[256]= {0}, c1[256]= {0}, c0[256]= {0}; \
Expand Down Expand Up @@ -137,8 +135,13 @@ static inline void reverse_uint64_t(uint64_t *arr, uint64_t nitems)
{
uint64_t *last = (arr + nitems);
uint64_t tmp = 0;
while ((arr != last) && (arr != --last))
while (arr != last)
{
--last;
if (arr == last)
{
break;
}
tmp = *last;
*last = *arr;
*arr++ = tmp;
Expand All @@ -163,9 +166,12 @@ static inline uint64_t *unique_uint64_t(uint64_t *arr, uint64_t nitems)
uint64_t *p = arr;
while (++arr != last)
{
if ((*p != *arr) && (*p++ != *arr))
if (*p != *arr)
{
*p = *arr;
if (*p++ != *arr)
{
*p = *arr;
}
}
}
return ++p;
Expand Down Expand Up @@ -243,4 +249,4 @@ static inline uint64_t *union_uint64_t(uint64_t *a_arr, uint64_t a_nitems, uint6
return o_arr;
}

#endif // NUMKEY_SET_H
#endif // NUMKEY_SET_H
Loading
Loading