Skip to content

Commit 6bbd460

Browse files
Copilotstarseeker
andcommitted
Address build issues in judySArray and judyS2Array
Co-authored-by: starseeker <238416+starseeker@users.noreply.github.com>
1 parent c0d3fac commit 6bbd460

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/cllazyfile/judyS2Array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class judyS2Array {
5151
explicit judyS2Array( const judyS2Array< JudyValue > & other ): _maxKeyLen( other._maxKeyLen ), _success( other._success ) {
5252
_judyarray = judy_clone( other._judyarray );
5353
_buff = new unsigned char[_maxKeyLen];
54-
strncpy( _buff, other._buff, _maxKeyLen );
55-
_buff[ _maxKeyLen ] = '\0'; //ensure that _buff is null-terminated, since strncpy won't necessarily do so
54+
strncpy( reinterpret_cast< char * >( _buff ), reinterpret_cast< const char * >( other._buff ), _maxKeyLen - 1 );
55+
_buff[ _maxKeyLen - 1 ] = '\0'; //ensure that _buff is null-terminated
5656
find( _buff ); //set _lastSlot
5757
}
5858

include/cllazyfile/judySArray.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class judySArray {
3939
explicit judySArray( const judySArray< JudyValue > & other ): _maxKeyLen( other._maxKeyLen ), _success( other._success ) {
4040
_judyarray = judy_clone( other._judyarray );
4141
_buff = new unsigned char[_maxKeyLen];
42-
strncpy( _buff, other._buff, _maxKeyLen );
43-
_buff[ _maxKeyLen ] = '\0'; //ensure that _buff is null-terminated, since strncpy won't necessarily do so
42+
strncpy( reinterpret_cast< char * >( _buff ), reinterpret_cast< const char * >( other._buff ), _maxKeyLen - 1 );
43+
_buff[ _maxKeyLen - 1 ] = '\0'; //ensure that _buff is null-terminated
4444
find( _buff ); //set _lastSlot
4545
}
4646

0 commit comments

Comments
 (0)