From 5b234c915bd64ad3f5319dc2fb373eb92a21d4ce Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:09:17 +0900 Subject: [PATCH 01/23] alglib: Change from NULL to nullptr --- libs/alglib/src/alglibmisc.cpp | 28 +- libs/alglib/src/ap.cpp | 482 +++++++++++++++--------------- libs/alglib/src/ap.h | 10 +- libs/alglib/src/dataanalysis.cpp | 264 ++++++++-------- libs/alglib/src/diffequations.cpp | 32 +- libs/alglib/src/diffequations.h | 4 +- libs/alglib/src/integration.cpp | 108 +++---- libs/alglib/src/integration.h | 42 +-- libs/alglib/src/interpolation.cpp | 226 +++++++------- libs/alglib/src/interpolation.h | 16 +- libs/alglib/src/linalg.cpp | 168 +++++------ libs/alglib/src/optimization.cpp | 284 +++++++++--------- libs/alglib/src/optimization.h | 76 ++--- libs/alglib/src/solvers.cpp | 122 ++++---- libs/alglib/src/solvers.h | 8 +- 15 files changed, 935 insertions(+), 935 deletions(-) diff --git a/libs/alglib/src/alglibmisc.cpp b/libs/alglib/src/alglibmisc.cpp index db16d6c1fc..c4acb2e67d 100644 --- a/libs/alglib/src/alglibmisc.cpp +++ b/libs/alglib/src/alglibmisc.cpp @@ -49,19 +49,19 @@ Initialized with HQRNDRandomize() or HQRNDSeed(). *************************************************************************/ _hqrndstate_owner::_hqrndstate_owner() { - p_struct = (alglib_impl::hqrndstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::hqrndstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::hqrndstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::hqrndstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_hqrndstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_hqrndstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _hqrndstate_owner::_hqrndstate_owner(const _hqrndstate_owner &rhs) { - p_struct = (alglib_impl::hqrndstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::hqrndstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::hqrndstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::hqrndstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_hqrndstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_hqrndstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -70,7 +70,7 @@ _hqrndstate_owner& _hqrndstate_owner::operator=(const _hqrndstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_hqrndstate_clear(p_struct); - if( !alglib_impl::_hqrndstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_hqrndstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -382,19 +382,19 @@ double hqrndcontinuous(const hqrndstate &state, const real_1d_array &x, const ae *************************************************************************/ _kdtree_owner::_kdtree_owner() { - p_struct = (alglib_impl::kdtree*)alglib_impl::ae_malloc(sizeof(alglib_impl::kdtree), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::kdtree*)alglib_impl::ae_malloc(sizeof(alglib_impl::kdtree), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_kdtree_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_kdtree_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _kdtree_owner::_kdtree_owner(const _kdtree_owner &rhs) { - p_struct = (alglib_impl::kdtree*)alglib_impl::ae_malloc(sizeof(alglib_impl::kdtree), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::kdtree*)alglib_impl::ae_malloc(sizeof(alglib_impl::kdtree), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_kdtree_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_kdtree_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -403,7 +403,7 @@ _kdtree_owner& _kdtree_owner::operator=(const _kdtree_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_kdtree_clear(p_struct); - if( !alglib_impl::_kdtree_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_kdtree_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } diff --git a/libs/alglib/src/ap.cpp b/libs/alglib/src/ap.cpp index b1dbd7075b..69823ad4bf 100644 --- a/libs/alglib/src/ap.cpp +++ b/libs/alglib/src/ap.cpp @@ -120,14 +120,14 @@ void* ae_align(void *ptr, size_t alignment) void ae_break(ae_state *state, ae_error_type error_type, const char *msg) { #ifndef AE_USE_CPP_ERROR_HANDLING - if( state!=NULL ) + if( state!=nullptr ) { - if( state->thread_exception_handler!=NULL ) + if( state->thread_exception_handler!=nullptr ) state->thread_exception_handler(state); ae_state_clear(state); state->last_error = error_type; state->error_msg = msg; - if( state->break_jump!=NULL ) + if( state->break_jump!=nullptr ) longjmp(*(state->break_jump), 1); else abort(); @@ -135,9 +135,9 @@ void ae_break(ae_state *state, ae_error_type error_type, const char *msg) else abort(); #else - if( state!=NULL ) + if( state!=nullptr ) { - if( state->thread_exception_handler!=NULL ) + if( state->thread_exception_handler!=nullptr ) state->thread_exception_handler(state); ae_state_clear(state); state->last_error = error_type; @@ -150,15 +150,15 @@ void ae_break(ae_state *state, ae_error_type error_type, const char *msg) void* aligned_malloc(size_t size, size_t alignment) { if( size==0 ) - return NULL; + return nullptr; if( alignment<=1 ) { /* no alignment, just call malloc */ void *block; void **p; ; block = malloc(sizeof(void*)+size); - if( block==NULL ) - return NULL; + if( block==nullptr ) + return nullptr; p = (void**)block; *p = block; #ifdef AE_USE_ALLOC_COUNTER @@ -172,8 +172,8 @@ void* aligned_malloc(size_t size, size_t alignment) void *block; char *result; block = malloc(alignment-1+sizeof(void*)+size); - if( block==NULL ) - return NULL; + if( block==nullptr ) + return nullptr; result = (char*)block+sizeof(void*); /*if( (result-(char*)0)%alignment!=0 ) result += alignment - (result-(char*)0)%alignment;*/ @@ -189,7 +189,7 @@ void* aligned_malloc(size_t size, size_t alignment) void aligned_free(void *block) { void *p; - if( block==NULL ) + if( block==nullptr ) return; p = *((void**)((char*)block-sizeof(void*))); free(p); @@ -201,19 +201,19 @@ void aligned_free(void *block) /************************************************************************ Malloc's memory with automatic alignment. -Returns NULL when zero size is specified. +Returns nullptr when zero size is specified. Error handling: -* if state is NULL, returns NULL on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns nullptr on allocation error +* if state is not nullptr, calls ae_break() on allocation error ************************************************************************/ void* ae_malloc(size_t size, ae_state *state) { void *result; if( size==0 ) - return NULL; + return nullptr; result = aligned_malloc(size,AE_DATA_ALIGN); - if( result==NULL && state!=NULL) + if( result==nullptr && state!=nullptr) { char buf[256]; sprintf(buf, "ae_malloc(): out of memory (attempted to allocate %llu bytes)", (unsigned long long)size); @@ -224,7 +224,7 @@ void* ae_malloc(size_t size, ae_state *state) void ae_free(void *p) { - if( p!=NULL ) + if( p!=nullptr ) aligned_free(p); } @@ -251,7 +251,7 @@ void ae_matrix_update_row_pointers(ae_matrix *dst, void *storage) pp_ptr[i] = p_base; } else - dst->ptr.pp_void = NULL; + dst->ptr.pp_void = nullptr; } /************************************************************************ @@ -302,15 +302,15 @@ void ae_state_init(ae_state *state) * p_next points to itself because: * * correct program should be able to detect end of the list * by looking at the ptr field. - * * NULL p_next may be used to distinguish automatic blocks + * * nullptr p_next may be used to distinguish automatic blocks * (in the list) from non-automatic (not in the list) */ state->last_block.p_next = &(state->last_block); - state->last_block.deallocator = NULL; + state->last_block.deallocator = nullptr; state->last_block.ptr = DYN_BOTTOM; state->p_top_block = &(state->last_block); #ifndef AE_USE_CPP_ERROR_HANDLING - state->break_jump = NULL; + state->break_jump = nullptr; #endif state->error_msg = ""; @@ -348,9 +348,9 @@ void ae_state_init(ae_state *state) /* * set threading information */ - state->worker_thread = NULL; - state->parent_task = NULL; - state->thread_exception_handler = NULL; + state->worker_thread = nullptr; + state->parent_task = nullptr; + state->thread_exception_handler = nullptr; } @@ -369,7 +369,7 @@ void ae_state_clear(ae_state *state) /************************************************************************ This function sets jump buffer for error handling. -buf may be NULL. +buf may be nullptr. ************************************************************************/ void ae_state_set_break_jump(ae_state *state, jmp_buf *buf) { @@ -390,7 +390,7 @@ variable (local is even better). void ae_frame_make(ae_state *state, ae_frame *tmp) { tmp->db_marker.p_next = state->p_top_block; - tmp->db_marker.deallocator = NULL; + tmp->db_marker.deallocator = nullptr; tmp->db_marker.ptr = DYN_FRAME; state->p_top_block = &tmp->db_marker; } @@ -404,7 +404,7 @@ void ae_frame_leave(ae_state *state) { while( state->p_top_block->ptr!=DYN_FRAME && state->p_top_block->ptr!=DYN_BOTTOM) { - if( state->p_top_block->ptr!=NULL && state->p_top_block->deallocator!=NULL) + if( state->p_top_block->ptr!=nullptr && state->p_top_block->deallocator!=nullptr) ((ae_deallocator)(state->p_top_block->deallocator))(state->p_top_block->ptr); state->p_top_block = state->p_top_block->p_next; } @@ -433,14 +433,14 @@ This function malloc's dynamic block: block destination block, assumed to be uninitialized size size (in bytes) -state ALGLIB environment state. May be NULL. +state ALGLIB environment state. May be nullptr. make_automatic if true, vector is added to the dynamic block list block is assumed to be uninitialized, its fields are ignored. Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success NOTES: @@ -449,20 +449,20 @@ Error handling: ae_bool ae_db_malloc(ae_dyn_block *block, ae_int_t size, ae_state *state, ae_bool make_automatic) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(size>=0, "ae_db_malloc(): negative size", state); if( size<0 ) return ae_false; /* alloc */ block->ptr = ae_malloc((size_t)size, state); - if( block->ptr==NULL && size!=0 ) + if( block->ptr==nullptr && size!=0 ) return ae_false; - if( make_automatic && state!=NULL ) + if( make_automatic && state!=nullptr ) ae_db_attach(block, state); else - block->p_next = NULL; + block->p_next = nullptr; block->deallocator = ae_free; return ae_true; } @@ -482,8 +482,8 @@ This function: * preserves automatic state Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success NOTES: @@ -492,17 +492,17 @@ Error handling: ae_bool ae_db_realloc(ae_dyn_block *block, ae_int_t size, ae_state *state) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(size>=0, "ae_db_realloc(): negative size", state); if( size<0 ) return ae_false; /* realloc */ - if( block->ptr!=NULL ) + if( block->ptr!=nullptr ) ((ae_deallocator)block->deallocator)(block->ptr); block->ptr = ae_malloc((size_t)size, state); - if( block->ptr==NULL && size!=0 ) + if( block->ptr==nullptr && size!=0 ) return ae_false; block->deallocator = ae_free; return ae_true; @@ -521,9 +521,9 @@ block destination block (initialized) ************************************************************************/ void ae_db_free(ae_dyn_block *block) { - if( block->ptr!=NULL ) + if( block->ptr!=nullptr ) ((ae_deallocator)block->deallocator)(block->ptr); - block->ptr = NULL; + block->ptr = nullptr; block->deallocator = ae_free; } @@ -537,7 +537,7 @@ etc.) unchanged. ************************************************************************/ void ae_db_swap(ae_dyn_block *block1, ae_dyn_block *block2) { - void (*deallocator)(void*) = NULL; + void (*deallocator)(void*) = nullptr; void * volatile ptr; ptr = block1->ptr; deallocator = block1->deallocator; @@ -559,8 +559,8 @@ state ALGLIB environment state make_automatic if true, vector is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -568,8 +568,8 @@ dst is assumed to be uninitialized, its fields are ignored. ae_bool ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state, ae_bool make_automatic) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(size>=0, "ae_vector_init(): negative size", state); if( size<0 ) return ae_false; @@ -593,8 +593,8 @@ state ALGLIB environment state make_automatic if true, vector is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -634,8 +634,8 @@ newsize vector size, may be zero state ALGLIB environment state Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success NOTES: @@ -646,8 +646,8 @@ Error handling: ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(newsize>=0, "ae_vector_set_length(): negative size", state); if( newsize<0 ) return ae_false; @@ -735,8 +735,8 @@ state ALGLIB environment state make_automatic if true, matrix is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -744,8 +744,8 @@ dst is assumed to be uninitialized, its fields are ignored. ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(rows>=0 && cols>=0, "ae_matrix_init(): negative length", state); if( rows<0 || cols<0 ) return ae_false; @@ -780,8 +780,8 @@ state ALGLIB environment state make_automatic if true, matrix is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -830,8 +830,8 @@ cols size, may be zero state ALGLIB environment state Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success NOTES: @@ -842,8 +842,8 @@ Error handling: ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state) { /* ensure that size is >=0 - two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */ - if( state!=NULL ) + two ways to exit: 1) through ae_assert, if we have non-nullptr state, 2) by returning ae_false */ + if( state!=nullptr ) ae_assert(rows>=0 && cols>=0, "ae_matrix_set_length(): negative length", state); if( rows<0 || cols<0 ) return ae_false; @@ -941,28 +941,28 @@ dst destination smart pointer. already allocated, but not initialized. subscriber pointer to pointer which receives updates in the internal object stored in ae_smart_ptr. Any update to - dst->ptr is translated to subscriber. Can be NULL. + dst->ptr is translated to subscriber. Can be nullptr. state ALGLIB environment state make_automatic if true, smart pointer is added to the dynamic block list -After initialization, smart pointer stores NULL pointer. +After initialization, smart pointer stores nullptr pointer. Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success ************************************************************************/ ae_bool ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *state, ae_bool make_automatic) { dst->subscriber = subscriber; - dst->ptr = NULL; - if( dst->subscriber!=NULL ) + dst->ptr = nullptr; + if( dst->subscriber!=nullptr ) *(dst->subscriber) = dst->ptr; dst->is_owner = ae_false; dst->is_dynamic = ae_false; dst->frame_entry.deallocator = ae_smart_ptr_destroy; dst->frame_entry.ptr = dst; - if( make_automatic && state!=NULL ) + if( make_automatic && state!=nullptr ) ae_db_attach(&dst->frame_entry, state); return ae_true; } @@ -973,14 +973,14 @@ This function clears smart pointer structure. dst destination smart pointer. -After call to this function smart pointer contains NULL reference, which -is propagated to its subscriber (in cases non-NULL subscruber was +After call to this function smart pointer contains nullptr reference, which +is propagated to its subscriber (in cases non-nullptr subscruber was specified during pointer creation). ************************************************************************/ void ae_smart_ptr_clear(void *_dst) { ae_smart_ptr *dst = (ae_smart_ptr*)_dst; - if( dst->is_owner && dst->ptr!=NULL ) + if( dst->is_owner && dst->ptr!=nullptr ) { dst->destroy(dst->ptr); if( dst->is_dynamic ) @@ -988,10 +988,10 @@ void ae_smart_ptr_clear(void *_dst) } dst->is_owner = ae_false; dst->is_dynamic = ae_false; - dst->ptr = NULL; - dst->destroy = NULL; - if( dst->subscriber!=NULL ) - *(dst->subscriber) = NULL; + dst->ptr = nullptr; + dst->destroy = nullptr; + if( dst->subscriber!=nullptr ) + *(dst->subscriber) = nullptr; } @@ -1017,19 +1017,19 @@ is_dynamic whether object is dynamic - clearing such object ae_free() for memory occupied by object. destroy destructor function -In case smart pointer already contains non-NULL value and owns this value, +In case smart pointer already contains non-nullptr value and owns this value, it is freed before assigning new pointer. -Changes in pointer are propagated to its subscriber (in case non-NULL +Changes in pointer are propagated to its subscriber (in case non-nullptr subscriber was specified during pointer creation). -You can specify NULL new_ptr, in which case is_owner/destroy are ignored. +You can specify nullptr new_ptr, in which case is_owner/destroy are ignored. ************************************************************************/ void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner, ae_bool is_dynamic, void (*destroy)(void*)) { - if( dst->is_owner && dst->ptr!=NULL ) + if( dst->is_owner && dst->ptr!=nullptr ) dst->destroy(dst->ptr); - if( new_ptr!=NULL ) + if( new_ptr!=nullptr ) { dst->ptr = new_ptr; dst->is_owner = is_owner; @@ -1038,23 +1038,23 @@ void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner, ae_ } else { - dst->ptr = NULL; + dst->ptr = nullptr; dst->is_owner = ae_false; dst->is_dynamic = ae_false; - dst->destroy = NULL; + dst->destroy = nullptr; } - if( dst->subscriber!=NULL ) + if( dst->subscriber!=nullptr ) *(dst->subscriber) = dst->ptr; } /************************************************************************ This function releases pointer owned by ae_smart_ptr structure: -* all internal fields are set to NULL +* all internal fields are set to nullptr * destructor function for internal pointer is NOT called even when we own this pointer. After this call ae_smart_ptr releases ownership of its pointer and passes it to caller. -* changes in pointer are propagated to its subscriber (in case non-NULL +* changes in pointer are propagated to its subscriber (in case non-nullptr subscriber was specified during pointer creation). dst destination smart pointer. @@ -1063,10 +1063,10 @@ void ae_smart_ptr_release(ae_smart_ptr *dst) { dst->is_owner = ae_false; dst->is_dynamic = ae_false; - dst->ptr = NULL; - dst->destroy = NULL; - if( dst->subscriber!=NULL ) - *(dst->subscriber) = NULL; + dst->ptr = nullptr; + dst->destroy = nullptr; + if( dst->subscriber!=nullptr ) + *(dst->subscriber) = nullptr; } /************************************************************************ @@ -1205,7 +1205,7 @@ void x_vector_clear(x_vector *dst) { if( dst->owner==OWN_AE ) aligned_free(dst->ptr); - dst->ptr = NULL; + dst->ptr = nullptr; dst->cnt = 0; } @@ -2783,7 +2783,7 @@ void ae_init_lock(ae_lock *lock) lock->p_lock = (ae_int_t*)ae_align((void*)(&lock->buf),AE_LOCK_ALIGNMENT); lock->p_lock[0] = 0; #elif AE_OS==AE_POSIX - pthread_mutex_init(&lock->mutex, NULL); + pthread_mutex_init(&lock->mutex, nullptr); #else lock->is_locked = ae_false; #endif @@ -2874,8 +2874,8 @@ state ALGLIB environment state make_automatic if true, pool is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -2887,17 +2887,17 @@ ae_bool ae_shared_pool_init(void *_dst, ae_state *state, ae_bool make_automatic) dst = (ae_shared_pool*)_dst; /* init */ - dst->seed_object = NULL; - dst->recycled_objects = NULL; - dst->recycled_entries = NULL; - dst->enumeration_counter = NULL; + dst->seed_object = nullptr; + dst->recycled_objects = nullptr; + dst->recycled_entries = nullptr; + dst->enumeration_counter = nullptr; dst->size_of_object = 0; - dst->init = NULL; - dst->init_copy = NULL; - dst->destroy = NULL; + dst->init = nullptr; + dst->init_copy = nullptr; + dst->destroy = nullptr; dst->frame_entry.deallocator = ae_shared_pool_destroy; dst->frame_entry.ptr = dst; - if( make_automatic && state!=NULL ) + if( make_automatic && state!=nullptr ) ae_db_attach(&dst->frame_entry, state); ae_init_lock(&dst->pool_lock); return ae_true; @@ -2915,15 +2915,15 @@ static void ae_shared_pool_internalclear(ae_shared_pool *dst) ae_shared_pool_entry *ptr, *tmp; /* destroy seed */ - if( dst->seed_object!=NULL ) + if( dst->seed_object!=nullptr ) { dst->destroy((void*)dst->seed_object); ae_free((void*)dst->seed_object); - dst->seed_object = NULL; + dst->seed_object = nullptr; } /* destroy recycled objects */ - for(ptr=dst->recycled_objects; ptr!=NULL;) + for(ptr=dst->recycled_objects; ptr!=nullptr;) { tmp = (ae_shared_pool_entry*)ptr->next_entry; dst->destroy(ptr->obj); @@ -2931,16 +2931,16 @@ static void ae_shared_pool_internalclear(ae_shared_pool *dst) ae_free(ptr); ptr = tmp; } - dst->recycled_objects = NULL; + dst->recycled_objects = nullptr; /* destroy recycled entries */ - for(ptr=dst->recycled_entries; ptr!=NULL;) + for(ptr=dst->recycled_entries; ptr!=nullptr;) { tmp = (ae_shared_pool_entry*)ptr->next_entry; ae_free(ptr); ptr = tmp; } - dst->recycled_entries = NULL; + dst->recycled_entries = nullptr; } @@ -2953,8 +2953,8 @@ state ALGLIB environment state make_automatic if true, pool is added to the dynamic block list Error handling: -* if state is NULL, returns ae_false on allocation error -* if state is not NULL, calls ae_break() on allocation error +* if state is nullptr, returns ae_false on allocation error +* if state is not nullptr, calls ae_break() on allocation error * returns ae_true on success dst is assumed to be uninitialized, its fields are ignored. @@ -2980,25 +2980,25 @@ ae_bool ae_shared_pool_init_copy(void *_dst, void *_src, ae_state *state, ae_boo ae_init_lock(&dst->pool_lock); /* copy seed object */ - if( src->seed_object!=NULL ) + if( src->seed_object!=nullptr ) { dst->seed_object = ae_malloc(dst->size_of_object, state); - if( dst->seed_object==NULL ) + if( dst->seed_object==nullptr ) return ae_false; if( !dst->init_copy(dst->seed_object, src->seed_object, state, ae_false) ) return ae_false; } /* copy recycled objects */ - dst->recycled_objects = NULL; - for(ptr=src->recycled_objects; ptr!=NULL; ptr=(ae_shared_pool_entry*)ptr->next_entry) + dst->recycled_objects = nullptr; + for(ptr=src->recycled_objects; ptr!=nullptr; ptr=(ae_shared_pool_entry*)ptr->next_entry) { ae_shared_pool_entry *tmp; tmp = (ae_shared_pool_entry*)ae_malloc(sizeof(ae_shared_pool_entry), state); - if( tmp==NULL ) + if( tmp==nullptr ) return ae_false; tmp->obj = ae_malloc(dst->size_of_object, state); - if( tmp->obj==NULL ) + if( tmp->obj==nullptr ) return ae_false; if( !dst->init_copy(tmp->obj, ptr->obj, state, ae_false) ) return ae_false; @@ -3007,10 +3007,10 @@ ae_bool ae_shared_pool_init_copy(void *_dst, void *_src, ae_state *state, ae_boo } /* recycled entries are not copied because they do not store any information */ - dst->recycled_entries = NULL; + dst->recycled_entries = nullptr; /* enumeration counter is reset on copying */ - dst->enumeration_counter = NULL; + dst->enumeration_counter = nullptr; /* initialize frame record */ dst->frame_entry.deallocator = ae_shared_pool_destroy; @@ -3038,14 +3038,14 @@ void ae_shared_pool_clear(void *_dst) ae_shared_pool_internalclear(dst); /* clear fields */ - dst->seed_object = NULL; - dst->recycled_objects = NULL; - dst->recycled_entries = NULL; - dst->enumeration_counter = NULL; + dst->seed_object = nullptr; + dst->recycled_objects = nullptr; + dst->recycled_entries = nullptr; + dst->enumeration_counter = nullptr; dst->size_of_object = 0; - dst->init = NULL; - dst->init_copy = NULL; - dst->destroy = NULL; + dst->init = nullptr; + dst->init_copy = nullptr; + dst->destroy = nullptr; } @@ -3076,7 +3076,7 @@ NOTE: this function is NOT thread-safe. It does not acquire pool lock, so ae_bool ae_shared_pool_is_initialized(void *_dst) { ae_shared_pool *dst = (ae_shared_pool*)_dst; - return dst->seed_object!=NULL; + return dst->seed_object!=nullptr; } @@ -3115,7 +3115,7 @@ void ae_shared_pool_set_seed( /* set seed object */ dst->seed_object = ae_malloc(size_of_object, state); - ae_assert(dst->seed_object!=NULL, "ALGLIB: unable to allocate memory for ae_shared_pool_set_seed()", state); + ae_assert(dst->seed_object!=nullptr, "ALGLIB: unable to allocate memory for ae_shared_pool_set_seed()", state); ae_assert( init_copy(dst->seed_object, seed_object, state, ae_false), "ALGLIB: unable to initialize seed in ae_shared_pool_set_seed()", @@ -3127,7 +3127,7 @@ void ae_shared_pool_set_seed( This function retrieves a copy of the seed object from the pool and stores it to target smart pointer ptr. -In case target pointer owns non-NULL value, it is deallocated before +In case target pointer owns non-nullptr value, it is deallocated before storing value retrieved from pool. Target pointer becomes owner of the value which was retrieved from pool. @@ -3147,7 +3147,7 @@ void ae_shared_pool_retrieve( /* assert that pool was seeded */ ae_assert( - pool->seed_object!=NULL, + pool->seed_object!=nullptr, "ALGLIB: shared pool is not seeded, PoolRetrieve() failed", state); @@ -3155,7 +3155,7 @@ void ae_shared_pool_retrieve( ae_acquire_lock(&pool->pool_lock); /* try to reuse recycled objects */ - if( pool->recycled_objects!=NULL ) + if( pool->recycled_objects!=nullptr ) { void *new_obj; ae_shared_pool_entry *result; @@ -3164,7 +3164,7 @@ void ae_shared_pool_retrieve( result = pool->recycled_objects; pool->recycled_objects = (ae_shared_pool_entry*)pool->recycled_objects->next_entry; new_obj = result->obj; - result->obj = NULL; + result->obj = nullptr; /* move entry to list of recycled entries */ result->next_entry = pool->recycled_entries; @@ -3183,7 +3183,7 @@ void ae_shared_pool_retrieve( /* create new object from seed */ new_obj = ae_malloc(pool->size_of_object, state); - ae_assert(new_obj!=NULL, "ALGLIB: unable to allocate memory for ae_shared_pool_retrieve()", state); + ae_assert(new_obj!=nullptr, "ALGLIB: unable to allocate memory for ae_shared_pool_retrieve()", state); ae_assert( pool->init_copy(new_obj, pool->seed_object, state, ae_false), "ALGLIB: unable to initialize object in ae_shared_pool_retrieve()", @@ -3198,7 +3198,7 @@ void ae_shared_pool_retrieve( This function recycles object owned by smart pointer by moving it to internal storage of the shared pool. -Source pointer must own the object. After function is over, it owns NULL +Source pointer must own the object. After function is over, it owns nullptr pointer. pool pool @@ -3217,19 +3217,19 @@ void ae_shared_pool_recycle( /* assert that pool was seeded */ ae_assert( - pool->seed_object!=NULL, + pool->seed_object!=nullptr, "ALGLIB: shared pool is not seeded, PoolRecycle() failed", state); /* assert that pointer non-null and owns the object */ ae_assert(pptr->is_owner, "ALGLIB: pptr in ae_shared_pool_recycle() does not own its pointer", state); - ae_assert(pptr->ptr!=NULL, "ALGLIB: pptr in ae_shared_pool_recycle() is NULL", state); + ae_assert(pptr->ptr!=nullptr, "ALGLIB: pptr in ae_shared_pool_recycle() is nullptr", state); /* acquire lock */ ae_acquire_lock(&pool->pool_lock); /* acquire shared pool entry (reuse one from recycled_entries or malloc new one) */ - if( pool->recycled_entries!=NULL ) + if( pool->recycled_entries!=nullptr ) { /* reuse previously allocated entry */ new_entry = pool->recycled_entries; @@ -3245,7 +3245,7 @@ void ae_shared_pool_recycle( */ ae_release_lock(&pool->pool_lock); new_entry = (ae_shared_pool_entry*)ae_malloc(sizeof(ae_shared_pool_entry), state); - ae_assert(new_entry!=NULL, "ALGLIB: unable to allocate memory in ae_shared_pool_recycle()", state); + ae_assert(new_entry!=nullptr, "ALGLIB: unable to allocate memory in ae_shared_pool_recycle()", state); ae_acquire_lock(&pool->pool_lock); } @@ -3281,7 +3281,7 @@ void ae_shared_pool_clear_recycled( ae_shared_pool_entry *ptr, *tmp; /* clear recycled objects */ - for(ptr=pool->recycled_objects; ptr!=NULL;) + for(ptr=pool->recycled_objects; ptr!=nullptr;) { tmp = (ae_shared_pool_entry*)ptr->next_entry; pool->destroy(ptr->obj); @@ -3289,7 +3289,7 @@ void ae_shared_pool_clear_recycled( ae_free(ptr); ptr = tmp; } - pool->recycled_objects = NULL; + pool->recycled_objects = nullptr; } @@ -3298,15 +3298,15 @@ This function allows to enumerate recycled elements of the shared pool. It stores pointer to the first recycled object in the smart pointer. IMPORTANT: -* in case target pointer owns non-NULL value, it is deallocated before +* in case target pointer owns non-nullptr value, it is deallocated before storing value retrieved from pool. * recycled object IS NOT removed from pool * target pointer DOES NOT become owner of the new value * this function IS NOT thread-safe * you SHOULD NOT modify shared pool during enumeration (although you can modify state of the objects retrieved from pool) -* in case there is no recycled objects in the pool, NULL is stored to pptr -* in case pool is not seeded, NULL is stored to pptr +* in case there is no recycled objects in the pool, nullptr is stored to pptr +* in case pool is not seeded, nullptr is stored to pptr pool pool pptr pointer to ae_smart_ptr structure @@ -3323,9 +3323,9 @@ void ae_shared_pool_first_recycled( pool->enumeration_counter = pool->recycled_objects; /* exit on empty list */ - if( pool->enumeration_counter==NULL ) + if( pool->enumeration_counter==nullptr ) { - ae_smart_ptr_assign(pptr, NULL, ae_false, ae_false, NULL); + ae_smart_ptr_assign(pptr, nullptr, ae_false, ae_false, nullptr); return; } @@ -3339,15 +3339,15 @@ This function allows to enumerate recycled elements of the shared pool. It stores pointer to the next recycled object in the smart pointer. IMPORTANT: -* in case target pointer owns non-NULL value, it is deallocated before +* in case target pointer owns non-nullptr value, it is deallocated before storing value retrieved from pool. * recycled object IS NOT removed from pool * target pointer DOES NOT become owner of the new value * this function IS NOT thread-safe * you SHOULD NOT modify shared pool during enumeration (although you can modify state of the objects retrieved from pool) -* in case there is no recycled objects left in the pool, NULL is stored. -* in case pool is not seeded, NULL is stored. +* in case there is no recycled objects left in the pool, nullptr is stored. +* in case pool is not seeded, nullptr is stored. pool pool pptr pointer to ae_smart_ptr structure @@ -3361,9 +3361,9 @@ void ae_shared_pool_next_recycled( (void)state; /* exit on end of list */ - if( pool->enumeration_counter==NULL ) + if( pool->enumeration_counter==nullptr ) { - ae_smart_ptr_assign(pptr, NULL, ae_false, ae_false, NULL); + ae_smart_ptr_assign(pptr, nullptr, ae_false, ae_false, nullptr); return; } @@ -3371,9 +3371,9 @@ void ae_shared_pool_next_recycled( pool->enumeration_counter = (ae_shared_pool_entry*)pool->enumeration_counter->next_entry; /* exit on empty list */ - if( pool->enumeration_counter==NULL ) + if( pool->enumeration_counter==nullptr ) { - ae_smart_ptr_assign(pptr, NULL, ae_false, ae_false, NULL); + ae_smart_ptr_assign(pptr, nullptr, ae_false, ae_false, nullptr); return; } @@ -3403,14 +3403,14 @@ void ae_shared_pool_reset( ae_shared_pool_internalclear(pool); /* clear fields */ - pool->seed_object = NULL; - pool->recycled_objects = NULL; - pool->recycled_entries = NULL; - pool->enumeration_counter = NULL; + pool->seed_object = nullptr; + pool->recycled_objects = nullptr; + pool->recycled_entries = nullptr; + pool->enumeration_counter = nullptr; pool->size_of_object = 0; - pool->init = NULL; - pool->init_copy = NULL; - pool->destroy = NULL; + pool->init = nullptr; + pool->init_copy = nullptr; + pool->destroy = nullptr; } @@ -5897,7 +5897,7 @@ Matrices and vectors ********************************************************************/ alglib::ae_vector_wrapper::ae_vector_wrapper() { - p_vec = NULL; + p_vec = nullptr; } alglib::ae_vector_wrapper::~ae_vector_wrapper() @@ -5908,17 +5908,17 @@ alglib::ae_vector_wrapper::~ae_vector_wrapper() void alglib::ae_vector_wrapper::setlength(ae_int_t iLen) { - if( p_vec==NULL ) - throw alglib::ap_error("ALGLIB: setlength() error, p_vec==NULL (array was not correctly initialized)"); + if( p_vec==nullptr ) + throw alglib::ap_error("ALGLIB: setlength() error, p_vec==nullptr (array was not correctly initialized)"); if( p_vec!=&vec ) throw alglib::ap_error("ALGLIB: setlength() error, p_vec!=&vec (attempt to resize frozen array)"); - if( !ae_vector_set_length(p_vec, iLen, NULL) ) + if( !ae_vector_set_length(p_vec, iLen, nullptr) ) throw alglib::ap_error("ALGLIB: malloc error"); } alglib::ae_int_t alglib::ae_vector_wrapper::length() const { - if( p_vec==NULL ) + if( p_vec==nullptr ) return 0; return p_vec->cnt; } @@ -5937,7 +5937,7 @@ void alglib::ae_vector_wrapper::allocate_own(ae_int_t size, alglib_impl::ae_data if( p_vec==&vec ) ae_vector_clear(p_vec); p_vec = &vec; - if( !ae_vector_init(p_vec, size, datatype, NULL, false) ) + if( !ae_vector_init(p_vec, size, datatype, nullptr, false) ) throw alglib::ap_error("ALGLIB: malloc error"); } @@ -5953,14 +5953,14 @@ alglib_impl::ae_vector* alglib::ae_vector_wrapper::c_ptr() void alglib::ae_vector_wrapper::create(const alglib::ae_vector_wrapper &rhs) { - if( rhs.p_vec!=NULL ) + if( rhs.p_vec!=nullptr ) { p_vec = &vec; - if( !ae_vector_init_copy(p_vec, rhs.p_vec, NULL, ae_false) ) + if( !ae_vector_init_copy(p_vec, rhs.p_vec, nullptr, ae_false) ) throw alglib::ap_error("ALGLIB: malloc error!"); } else - p_vec = NULL; + p_vec = nullptr; } void alglib::ae_vector_wrapper::create(const char *s, alglib_impl::ae_datatype datatype) @@ -6000,27 +6000,27 @@ void alglib::ae_vector_wrapper::assign(const alglib::ae_vector_wrapper &rhs) { if( this==&rhs ) return; - if( p_vec==&vec || p_vec==NULL ) + if( p_vec==&vec || p_vec==nullptr ) { // // Assignment to non-proxy object // ae_vector_clear(p_vec); - if( rhs.p_vec!=NULL ) + if( rhs.p_vec!=nullptr ) { p_vec = &vec; - if( !ae_vector_init_copy(p_vec, rhs.p_vec, NULL, ae_false) ) + if( !ae_vector_init_copy(p_vec, rhs.p_vec, nullptr, ae_false) ) throw alglib::ap_error("ALGLIB: malloc error!"); } else - p_vec = NULL; + p_vec = nullptr; } else { // // Assignment to proxy object // - if( rhs.p_vec==NULL ) + if( rhs.p_vec==nullptr ) throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes dont match)"); if( rhs.p_vec->datatype!=p_vec->datatype ) throw alglib::ap_error("ALGLIB: incorrect assignment to array (types dont match)"); @@ -6047,7 +6047,7 @@ alglib::boolean_1d_array::boolean_1d_array(const alglib::boolean_1d_array &rhs) alglib::boolean_1d_array::boolean_1d_array(alglib_impl::ae_vector *p) { - p_vec = NULL; + p_vec = nullptr; attach_to(p); } @@ -6113,7 +6113,7 @@ alglib::integer_1d_array::integer_1d_array() alglib::integer_1d_array::integer_1d_array(alglib_impl::ae_vector *p) { - p_vec = NULL; + p_vec = nullptr; attach_to(p); } @@ -6189,7 +6189,7 @@ alglib::real_1d_array::real_1d_array() alglib::real_1d_array::real_1d_array(alglib_impl::ae_vector *p) { - p_vec = NULL; + p_vec = nullptr; attach_to(p); } @@ -6265,7 +6265,7 @@ alglib::complex_1d_array::complex_1d_array() alglib::complex_1d_array::complex_1d_array(alglib_impl::ae_vector *p) { - p_vec = NULL; + p_vec = nullptr; attach_to(p); } @@ -6339,7 +6339,7 @@ std::string alglib::complex_1d_array::tostring(int dps) const alglib::ae_matrix_wrapper::ae_matrix_wrapper() { - p_mat = NULL; + p_mat = nullptr; } alglib::ae_matrix_wrapper::~ae_matrix_wrapper() @@ -6356,14 +6356,14 @@ const alglib::ae_matrix_wrapper& alglib::ae_matrix_wrapper::operator=(const algl void alglib::ae_matrix_wrapper::create(const ae_matrix_wrapper &rhs) { - if( rhs.p_mat!=NULL ) + if( rhs.p_mat!=nullptr ) { p_mat = &mat; - if( !ae_matrix_init_copy(p_mat, rhs.p_mat, NULL, ae_false) ) + if( !ae_matrix_init_copy(p_mat, rhs.p_mat, nullptr, ae_false) ) throw alglib::ap_error("ALGLIB: malloc error!"); } else - p_mat = NULL; + p_mat = nullptr; } void alglib::ae_matrix_wrapper::create(const char *s, alglib_impl::ae_datatype datatype) @@ -6409,20 +6409,20 @@ void alglib::ae_matrix_wrapper::assign(const alglib::ae_matrix_wrapper &rhs) { if( this==&rhs ) return; - if( p_mat==&mat || p_mat==NULL ) + if( p_mat==&mat || p_mat==nullptr ) { // // Assignment to non-proxy object // ae_matrix_clear(p_mat); - if( rhs.p_mat!=NULL ) + if( rhs.p_mat!=nullptr ) { p_mat = &mat; - if( !ae_matrix_init_copy(p_mat, rhs.p_mat, NULL, ae_false) ) + if( !ae_matrix_init_copy(p_mat, rhs.p_mat, nullptr, ae_false) ) throw alglib::ap_error("ALGLIB: malloc error!"); } else - p_mat = NULL; + p_mat = nullptr; } else { @@ -6430,7 +6430,7 @@ void alglib::ae_matrix_wrapper::assign(const alglib::ae_matrix_wrapper &rhs) // Assignment to proxy object // ae_int_t i; - if( rhs.p_mat==NULL ) + if( rhs.p_mat==nullptr ) throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes dont match)"); if( rhs.p_mat->datatype!=p_mat->datatype ) throw alglib::ap_error("ALGLIB: incorrect assignment to array (types dont match)"); @@ -6445,24 +6445,24 @@ void alglib::ae_matrix_wrapper::assign(const alglib::ae_matrix_wrapper &rhs) void alglib::ae_matrix_wrapper::setlength(ae_int_t rows, ae_int_t cols) { - if( p_mat==NULL ) - throw alglib::ap_error("ALGLIB: setlength() error, p_mat==NULL (array was not correctly initialized)"); + if( p_mat==nullptr ) + throw alglib::ap_error("ALGLIB: setlength() error, p_mat==nullptr (array was not correctly initialized)"); if( p_mat!=&mat ) throw alglib::ap_error("ALGLIB: setlength() error, p_mat!=&mat (attempt to resize frozen array)"); - if( !ae_matrix_set_length(p_mat, rows, cols, NULL) ) + if( !ae_matrix_set_length(p_mat, rows, cols, nullptr) ) throw alglib::ap_error("ALGLIB: malloc error"); } alglib::ae_int_t alglib::ae_matrix_wrapper::rows() const { - if( p_mat==NULL ) + if( p_mat==nullptr ) return 0; return p_mat->rows; } alglib::ae_int_t alglib::ae_matrix_wrapper::cols() const { - if( p_mat==NULL ) + if( p_mat==nullptr ) return 0; return p_mat->cols; } @@ -6474,7 +6474,7 @@ bool alglib::ae_matrix_wrapper::isempty() const alglib::ae_int_t alglib::ae_matrix_wrapper::getstride() const { - if( p_mat==NULL ) + if( p_mat==nullptr ) return 0; return p_mat->stride; } @@ -6493,7 +6493,7 @@ void alglib::ae_matrix_wrapper::allocate_own(ae_int_t rows, ae_int_t cols, algli if( p_mat==&mat ) ae_matrix_clear(p_mat); p_mat = &mat; - if( !ae_matrix_init(p_mat, rows, cols, datatype, NULL, false) ) + if( !ae_matrix_init(p_mat, rows, cols, datatype, nullptr, false) ) throw alglib::ap_error("ALGLIB: malloc error"); } @@ -6519,7 +6519,7 @@ alglib::boolean_2d_array::boolean_2d_array(const alglib::boolean_2d_array &rhs) alglib::boolean_2d_array::boolean_2d_array(alglib_impl::ae_matrix *p) { - p_mat = NULL; + p_mat = nullptr; attach_to(p); } @@ -6590,7 +6590,7 @@ alglib::integer_2d_array::integer_2d_array(const alglib::integer_2d_array &rhs) alglib::integer_2d_array::integer_2d_array(alglib_impl::ae_matrix *p) { - p_mat = NULL; + p_mat = nullptr; attach_to(p); } @@ -6661,7 +6661,7 @@ alglib::real_2d_array::real_2d_array(const alglib::real_2d_array &rhs) alglib::real_2d_array::real_2d_array(alglib_impl::ae_matrix *p) { - p_mat = NULL; + p_mat = nullptr; attach_to(p); } @@ -6732,7 +6732,7 @@ alglib::complex_2d_array::complex_2d_array(const alglib::complex_2d_array &rhs) alglib::complex_2d_array::complex_2d_array(alglib_impl::ae_matrix *p) { - p_mat = NULL; + p_mat = nullptr; attach_to(p); } @@ -6835,11 +6835,11 @@ alglib::ae_int_t alglib::my_stricmp(const char *s1, const char *s2) // // handle special cases // - if(s1==NULL && s2!=NULL) + if(s1==nullptr && s2!=nullptr) return -1; - if(s1!=NULL && s2==NULL) + if(s1!=nullptr && s2==nullptr) return +1; - if(s1==NULL && s2==NULL) + if(s1==nullptr && s2==nullptr) return 0; // @@ -6870,8 +6870,8 @@ char* alglib::filter_spaces(const char *s) char *r; char *r0; n = strlen(s); - r = (char*)alglib_impl::ae_malloc(n+1, NULL); - if( r==NULL ) + r = (char*)alglib_impl::ae_malloc(n+1, nullptr); + if( r==nullptr ) throw ap_error("malloc error"); for(i=0,r0=r; i<=n; i++,s++) if( !isspace(*s) ) @@ -6938,7 +6938,7 @@ void alglib::str_matrix_create(const char *src, std::vector< std::vectorback().size()==0 || p_mat->back().size()!=(*p_mat)[0].size() ) throw alglib::ap_error("Incorrect initializer for matrix"); src = strchr(src, ']'); - if( src==NULL ) + if( src==nullptr ) throw alglib::ap_error("Incorrect initializer for matrix"); src++; if( *src==',' ) @@ -6966,7 +6966,7 @@ ae_bool alglib::parse_bool_delim(const char *s, const char *delim) strncpy(buf, s, strlen(p)); if( my_stricmp(buf, p)==0 ) { - if( s[strlen(p)]==0 || strchr(delim,s[strlen(p)])==NULL ) + if( s[strlen(p)]==0 || strchr(delim,s[strlen(p)])==nullptr ) throw alglib::ap_error("Cannot parse value"); return ae_false; } @@ -6977,7 +6977,7 @@ ae_bool alglib::parse_bool_delim(const char *s, const char *delim) strncpy(buf, s, strlen(p)); if( my_stricmp(buf, p)==0 ) { - if( s[strlen(p)]==0 || strchr(delim,s[strlen(p)])==NULL ) + if( s[strlen(p)]==0 || strchr(delim,s[strlen(p)])==nullptr ) throw alglib::ap_error("Cannot parse value"); return ae_true; } @@ -7002,11 +7002,11 @@ alglib::ae_int_t alglib::parse_int_delim(const char *s, const char *delim) // if( *s=='-' || *s=='+' ) s++; - if( *s==0 || strchr("1234567890",*s)==NULL) + if( *s==0 || strchr("1234567890",*s)==nullptr) throw alglib::ap_error("Cannot parse value"); - while( *s!=0 && strchr("1234567890",*s)!=NULL ) + while( *s!=0 && strchr("1234567890",*s)!=nullptr ) s++; - if( *s==0 || strchr(delim,*s)==NULL ) + if( *s==0 || strchr(delim,*s)==nullptr ) throw alglib::ap_error("Cannot parse value"); // convert and ensure that value fits into ae_int_t @@ -7046,18 +7046,18 @@ bool alglib::_parse_real_delim(const char *s, const char *delim, double *result, // [sign] [ddd] [.] [ddd] [e|E[sign]ddd] // has_digits = false; - if( *s!=0 && strchr("1234567890",*s)!=NULL ) + if( *s!=0 && strchr("1234567890",*s)!=nullptr ) { has_digits = true; - while( *s!=0 && strchr("1234567890",*s)!=NULL ) + while( *s!=0 && strchr("1234567890",*s)!=nullptr ) s++; } if( *s=='.' ) s++; - if( *s!=0 && strchr("1234567890",*s)!=NULL ) + if( *s!=0 && strchr("1234567890",*s)!=nullptr ) { has_digits = true; - while( *s!=0 && strchr("1234567890",*s)!=NULL ) + while( *s!=0 && strchr("1234567890",*s)!=nullptr ) s++; } if (!has_digits ) @@ -7067,12 +7067,12 @@ bool alglib::_parse_real_delim(const char *s, const char *delim, double *result, s++; if( *s=='-' || *s=='+' ) s++; - if( *s==0 || strchr("1234567890",*s)==NULL ) + if( *s==0 || strchr("1234567890",*s)==nullptr ) return false; - while( *s!=0 && strchr("1234567890",*s)!=NULL ) + while( *s!=0 && strchr("1234567890",*s)!=nullptr ) s++; } - if( *s==0 || strchr(delim,*s)==NULL ) + if( *s==0 || strchr(delim,*s)==nullptr ) return false; *new_s = s; @@ -7085,7 +7085,7 @@ bool alglib::_parse_real_delim(const char *s, const char *delim, double *result, buf[*new_s-p] = 0; loc = localeconv(); t = strchr(buf,'.'); - if( t!=NULL ) + if( t!=nullptr ) *t = *loc->decimal_point; *result = atof(buf); return true; @@ -7096,7 +7096,7 @@ bool alglib::_parse_real_delim(const char *s, const char *delim, double *result, // check delimiter and update *new_s // s += 3; - if( *s==0 || strchr(delim,*s)==NULL ) + if( *s==0 || strchr(delim,*s)==nullptr ) return false; *new_s = s; @@ -7137,7 +7137,7 @@ alglib::complex alglib::parse_complex_delim(const char *s, const char *delim) if( !_parse_real_delim(s, "i", &c_result.y, &new_s) ) throw alglib::ap_error("Cannot parse value"); s = new_s+1; - if( *s==0 || strchr(delim,*s)==NULL ) + if( *s==0 || strchr(delim,*s)==nullptr ) throw alglib::ap_error("Cannot parse value"); return c_result; } @@ -7148,12 +7148,12 @@ alglib::complex alglib::parse_complex_delim(const char *s, const char *delim) s = new_s+1; if( *s==0 ) throw alglib::ap_error("Cannot parse value"); - if( strchr(delim,*s)!=NULL ) + if( strchr(delim,*s)!=nullptr ) { c_result.x = 0; return c_result; } - if( strchr("+-",*s)!=NULL ) + if( strchr("+-",*s)!=nullptr ) { if( !_parse_real_delim(s, delim, &c_result.x, &new_s) ) throw alglib::ap_error("Cannot parse value"); @@ -7487,7 +7487,7 @@ std::string alglib::xtrim(std::string s) { char *pstr = (char*)malloc(s.length()+1); char *p2 = pstr; - if( pstr==NULL ) + if( pstr==nullptr ) throw "xalloc in xtrim()"; try { @@ -7574,7 +7574,7 @@ bool alglib::opendataset(std::string file, dataset *pdataset) // // Read data // - if( pdataset==NULL ) + if( pdataset==nullptr ) return false; if( !readstrings(file, &Lines, "//") ) return false; @@ -7710,7 +7710,7 @@ bool alglib::opendataset(std::string file, dataset *pdataset) // // Read data // - if( pdataset==NULL ) + if( pdataset==nullptr ) return false; if( !readstrings(file, &Lines, "//") ) return false; @@ -8422,7 +8422,7 @@ important when A or x contain infinities/NANs). * Y may be referenced by cy (pointer to ae_complex) or dy (pointer to array of double precision pair) depending on what type of output you wish. Pass pointer to Y as one of these parameters, - AND SET OTHER PARAMETER TO NULL. + AND SET OTHER PARAMETER TO nullptr. * both A and x must be aligned; y may be non-aligned. *************************************************************************/ void _ialglib_cmv(ae_int_t m, ae_int_t n, const double *a, const double *x, ae_complex *cy, double *dy, ae_int_t stride, ae_complex alpha, ae_complex beta) @@ -8446,7 +8446,7 @@ void _ialglib_cmv(ae_int_t m, ae_int_t n, const double *a, const double *x, ae_c pa += 2; pb += 2; } - if( cy!=NULL ) + if( cy!=nullptr ) { double tx = (beta.x*cy->x-beta.y*cy->y)+(alpha.x*v0-alpha.y*v1); double ty = (beta.x*cy->y+beta.y*cy->x)+(alpha.x*v1+alpha.y*v0); @@ -8487,7 +8487,7 @@ important when A or x contain infinities/NANs). * Y may be referenced by cy (pointer to ae_complex) or dy (pointer to array of double precision pair) depending on what type of output you wish. Pass pointer to Y as one of these parameters, - AND SET OTHER PARAMETER TO NULL. + AND SET OTHER PARAMETER TO nullptr. * both A and x must be aligned; y may be non-aligned. This function supports SSE2; it can be used when: @@ -8511,10 +8511,10 @@ void _ialglib_cmv_sse2(ae_int_t m, ae_int_t n, const double *a, const double *x, m2 = m/2; parow = a; - if( cy!=NULL ) + if( cy!=nullptr ) { dy = (double*)cy; - cy = NULL; + cy = nullptr; } vbeta = _mm_loadh_pd(_mm_load_sd(&beta.x),&beta.y); vbetax = _mm_unpacklo_pd(vbeta,vbeta); @@ -9285,7 +9285,7 @@ ae_bool _ialglib_cmatrixgemm(ae_int_t m, } if( beta.x==0 && beta.y==0 ) _ialglib_vzero_complex(n, crow, 1); - cmv(n, k, b, abuf, crow, NULL, 1, alpha, beta); + cmv(n, k, b, abuf, crow, nullptr, 1, alpha, beta); crow += _c_stride; } return ae_true; @@ -9364,7 +9364,7 @@ ae_bool _ialglib_cmatrixrighttrsm(ae_int_t m, alpha.x = -beta.x; alpha.y = -beta.y; _ialglib_vcopy_dcomplex(i, abuf+2*i, alglib_c_block, tmpbuf, 1, "No conj"); - cmv(m, i, xbuf, tmpbuf, NULL, xbuf+2*i, alglib_c_block, alpha, beta); + cmv(m, i, xbuf, tmpbuf, nullptr, xbuf+2*i, alglib_c_block, alpha, beta); } _ialglib_mcopyunblock_complex(m, n, xbuf, 0, _x, _x_stride); } @@ -9381,7 +9381,7 @@ ae_bool _ialglib_cmatrixrighttrsm(ae_int_t m, alpha.x = -beta.x; alpha.y = -beta.y; _ialglib_vcopy_dcomplex(n-1-i, pdiag+2*alglib_c_block, alglib_c_block, tmpbuf, 1, "No conj"); - cmv(m, n-1-i, xbuf+2*(i+1), tmpbuf, NULL, xbuf+2*i, alglib_c_block, alpha, beta); + cmv(m, n-1-i, xbuf+2*(i+1), tmpbuf, nullptr, xbuf+2*i, alglib_c_block, alpha, beta); } _ialglib_mcopyunblock_complex(m, n, xbuf, 0, _x, _x_stride); } @@ -9546,7 +9546,7 @@ ae_bool _ialglib_cmatrixlefttrsm(ae_int_t m, alpha.x = -beta.x; alpha.y = -beta.y; _ialglib_vcopy_dcomplex(m-1-i, pdiag+2, 1, tmpbuf, 1, "No conj"); - cmv(n, m-1-i, xbuf+2*(i+1), tmpbuf, NULL, xbuf+2*i, alglib_c_block, alpha, beta); + cmv(n, m-1-i, xbuf+2*(i+1), tmpbuf, nullptr, xbuf+2*i, alglib_c_block, alpha, beta); } _ialglib_mcopyunblock_complex(m, n, xbuf, 1, _x, _x_stride); } @@ -9562,7 +9562,7 @@ ae_bool _ialglib_cmatrixlefttrsm(ae_int_t m, alpha.x = -beta.x; alpha.y = -beta.y; _ialglib_vcopy_dcomplex(i, arow, 1, tmpbuf, 1, "No conj"); - cmv(n, i, xbuf, tmpbuf, NULL, xbuf+2*i, alglib_c_block, alpha, beta); + cmv(n, i, xbuf, tmpbuf, nullptr, xbuf+2*i, alglib_c_block, alpha, beta); } _ialglib_mcopyunblock_complex(m, n, xbuf, 1, _x, _x_stride); } @@ -9724,7 +9724,7 @@ ae_bool _ialglib_cmatrixsyrk(ae_int_t n, for(i=0,arow=abuf,crow=cbuf; i(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_clusterizerstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -152,7 +152,7 @@ _clusterizerstate_owner& _clusterizerstate_owner::operator=(const _clusterizerst if( this==&rhs ) return *this; alglib_impl::_clusterizerstate_clear(p_struct); - if( !alglib_impl::_clusterizerstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_clusterizerstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -282,19 +282,19 @@ NOTE: there is one-to-one correspondence between merges described by Z and *************************************************************************/ _ahcreport_owner::_ahcreport_owner() { - p_struct = (alglib_impl::ahcreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::ahcreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::ahcreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::ahcreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_ahcreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_ahcreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _ahcreport_owner::_ahcreport_owner(const _ahcreport_owner &rhs) { - p_struct = (alglib_impl::ahcreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::ahcreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::ahcreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::ahcreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_ahcreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_ahcreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -303,7 +303,7 @@ _ahcreport_owner& _ahcreport_owner::operator=(const _ahcreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_ahcreport_clear(p_struct); - if( !alglib_impl::_ahcreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_ahcreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -377,19 +377,19 @@ FORMAL DESCRIPTION OF FIELDS: *************************************************************************/ _kmeansreport_owner::_kmeansreport_owner() { - p_struct = (alglib_impl::kmeansreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::kmeansreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::kmeansreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::kmeansreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_kmeansreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_kmeansreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _kmeansreport_owner::_kmeansreport_owner(const _kmeansreport_owner &rhs) { - p_struct = (alglib_impl::kmeansreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::kmeansreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::kmeansreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::kmeansreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_kmeansreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_kmeansreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -398,7 +398,7 @@ _kmeansreport_owner& _kmeansreport_owner::operator=(const _kmeansreport_owner &r if( this==&rhs ) return *this; alglib_impl::_kmeansreport_clear(p_struct); - if( !alglib_impl::_kmeansreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_kmeansreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1193,19 +1193,19 @@ void kmeansgenerate(const real_2d_array &xy, const ae_int_t npoints, const ae_in *************************************************************************/ _decisionforest_owner::_decisionforest_owner() { - p_struct = (alglib_impl::decisionforest*)alglib_impl::ae_malloc(sizeof(alglib_impl::decisionforest), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::decisionforest*)alglib_impl::ae_malloc(sizeof(alglib_impl::decisionforest), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_decisionforest_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_decisionforest_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _decisionforest_owner::_decisionforest_owner(const _decisionforest_owner &rhs) { - p_struct = (alglib_impl::decisionforest*)alglib_impl::ae_malloc(sizeof(alglib_impl::decisionforest), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::decisionforest*)alglib_impl::ae_malloc(sizeof(alglib_impl::decisionforest), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_decisionforest_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_decisionforest_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1214,7 +1214,7 @@ _decisionforest_owner& _decisionforest_owner::operator=(const _decisionforest_ow if( this==&rhs ) return *this; alglib_impl::_decisionforest_clear(p_struct); - if( !alglib_impl::_decisionforest_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_decisionforest_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1260,19 +1260,19 @@ decisionforest::~decisionforest() *************************************************************************/ _dfreport_owner::_dfreport_owner() { - p_struct = (alglib_impl::dfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::dfreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::dfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::dfreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_dfreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_dfreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _dfreport_owner::_dfreport_owner(const _dfreport_owner &rhs) { - p_struct = (alglib_impl::dfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::dfreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::dfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::dfreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_dfreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_dfreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1281,7 +1281,7 @@ _dfreport_owner& _dfreport_owner::operator=(const _dfreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_dfreport_clear(p_struct); - if( !alglib_impl::_dfreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_dfreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1718,19 +1718,19 @@ double dfavgrelerror(const decisionforest &df, const real_2d_array &xy, const ae *************************************************************************/ _linearmodel_owner::_linearmodel_owner() { - p_struct = (alglib_impl::linearmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::linearmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linearmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::linearmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linearmodel_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_linearmodel_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _linearmodel_owner::_linearmodel_owner(const _linearmodel_owner &rhs) { - p_struct = (alglib_impl::linearmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::linearmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linearmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::linearmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linearmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linearmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1739,7 +1739,7 @@ _linearmodel_owner& _linearmodel_owner::operator=(const _linearmodel_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_linearmodel_clear(p_struct); - if( !alglib_impl::_linearmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linearmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1799,19 +1799,19 @@ not be used outside ALGLIB. *************************************************************************/ _lrreport_owner::_lrreport_owner() { - p_struct = (alglib_impl::lrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lrreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lrreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lrreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_lrreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _lrreport_owner::_lrreport_owner(const _lrreport_owner &rhs) { - p_struct = (alglib_impl::lrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lrreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lrreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lrreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lrreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1820,7 +1820,7 @@ _lrreport_owner& _lrreport_owner::operator=(const _lrreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_lrreport_clear(p_struct); - if( !alglib_impl::_lrreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lrreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2624,19 +2624,19 @@ NOTE 2: on classification problems RMSError/AvgError/AvgRelError contain *************************************************************************/ _modelerrors_owner::_modelerrors_owner() { - p_struct = (alglib_impl::modelerrors*)alglib_impl::ae_malloc(sizeof(alglib_impl::modelerrors), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::modelerrors*)alglib_impl::ae_malloc(sizeof(alglib_impl::modelerrors), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_modelerrors_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_modelerrors_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _modelerrors_owner::_modelerrors_owner(const _modelerrors_owner &rhs) { - p_struct = (alglib_impl::modelerrors*)alglib_impl::ae_malloc(sizeof(alglib_impl::modelerrors), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::modelerrors*)alglib_impl::ae_malloc(sizeof(alglib_impl::modelerrors), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_modelerrors_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_modelerrors_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2645,7 +2645,7 @@ _modelerrors_owner& _modelerrors_owner::operator=(const _modelerrors_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_modelerrors_clear(p_struct); - if( !alglib_impl::_modelerrors_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_modelerrors_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2691,19 +2691,19 @@ modelerrors::~modelerrors() *************************************************************************/ _multilayerperceptron_owner::_multilayerperceptron_owner() { - p_struct = (alglib_impl::multilayerperceptron*)alglib_impl::ae_malloc(sizeof(alglib_impl::multilayerperceptron), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::multilayerperceptron*)alglib_impl::ae_malloc(sizeof(alglib_impl::multilayerperceptron), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_multilayerperceptron_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_multilayerperceptron_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _multilayerperceptron_owner::_multilayerperceptron_owner(const _multilayerperceptron_owner &rhs) { - p_struct = (alglib_impl::multilayerperceptron*)alglib_impl::ae_malloc(sizeof(alglib_impl::multilayerperceptron), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::multilayerperceptron*)alglib_impl::ae_malloc(sizeof(alglib_impl::multilayerperceptron), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_multilayerperceptron_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_multilayerperceptron_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2712,7 +2712,7 @@ _multilayerperceptron_owner& _multilayerperceptron_owner::operator=(const _multi if( this==&rhs ) return *this; alglib_impl::_multilayerperceptron_clear(p_struct); - if( !alglib_impl::_multilayerperceptron_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_multilayerperceptron_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -5889,19 +5889,19 @@ double smp_mlperrorsparsesubset(const multilayerperceptron &network, const spars *************************************************************************/ _logitmodel_owner::_logitmodel_owner() { - p_struct = (alglib_impl::logitmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::logitmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::logitmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::logitmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_logitmodel_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_logitmodel_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _logitmodel_owner::_logitmodel_owner(const _logitmodel_owner &rhs) { - p_struct = (alglib_impl::logitmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::logitmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::logitmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::logitmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_logitmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_logitmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -5910,7 +5910,7 @@ _logitmodel_owner& _logitmodel_owner::operator=(const _logitmodel_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_logitmodel_clear(p_struct); - if( !alglib_impl::_logitmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_logitmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -5958,19 +5958,19 @@ MNLReport structure contains information about training process: *************************************************************************/ _mnlreport_owner::_mnlreport_owner() { - p_struct = (alglib_impl::mnlreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mnlreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mnlreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mnlreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mnlreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mnlreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mnlreport_owner::_mnlreport_owner(const _mnlreport_owner &rhs) { - p_struct = (alglib_impl::mnlreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mnlreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mnlreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mnlreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mnlreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mnlreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -5979,7 +5979,7 @@ _mnlreport_owner& _mnlreport_owner::operator=(const _mnlreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mnlreport_clear(p_struct); - if( !alglib_impl::_mnlreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mnlreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -6371,19 +6371,19 @@ You should use ALGLIB functions in order to work with this object. *************************************************************************/ _mcpdstate_owner::_mcpdstate_owner() { - p_struct = (alglib_impl::mcpdstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mcpdstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mcpdstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mcpdstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mcpdstate_owner::_mcpdstate_owner(const _mcpdstate_owner &rhs) { - p_struct = (alglib_impl::mcpdstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mcpdstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mcpdstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mcpdstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -6392,7 +6392,7 @@ _mcpdstate_owner& _mcpdstate_owner::operator=(const _mcpdstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mcpdstate_clear(p_struct); - if( !alglib_impl::_mcpdstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mcpdstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -6450,19 +6450,19 @@ This structure is a MCPD training report: *************************************************************************/ _mcpdreport_owner::_mcpdreport_owner() { - p_struct = (alglib_impl::mcpdreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mcpdreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mcpdreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mcpdreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mcpdreport_owner::_mcpdreport_owner(const _mcpdreport_owner &rhs) { - p_struct = (alglib_impl::mcpdreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mcpdreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mcpdreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mcpdreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mcpdreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -6471,7 +6471,7 @@ _mcpdreport_owner& _mcpdreport_owner::operator=(const _mcpdreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mcpdreport_clear(p_struct); - if( !alglib_impl::_mcpdreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mcpdreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -7447,19 +7447,19 @@ Neural networks ensemble *************************************************************************/ _mlpensemble_owner::_mlpensemble_owner() { - p_struct = (alglib_impl::mlpensemble*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpensemble), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpensemble*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpensemble), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpensemble_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mlpensemble_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mlpensemble_owner::_mlpensemble_owner(const _mlpensemble_owner &rhs) { - p_struct = (alglib_impl::mlpensemble*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpensemble), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpensemble*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpensemble), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpensemble_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpensemble_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -7468,7 +7468,7 @@ _mlpensemble_owner& _mlpensemble_owner::operator=(const _mlpensemble_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mlpensemble_clear(p_struct); - if( !alglib_impl::_mlpensemble_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpensemble_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -8170,19 +8170,19 @@ NOTE 2: on classification problems RMSError/AvgError/AvgRelError contain *************************************************************************/ _mlpreport_owner::_mlpreport_owner() { - p_struct = (alglib_impl::mlpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mlpreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mlpreport_owner::_mlpreport_owner(const _mlpreport_owner &rhs) { - p_struct = (alglib_impl::mlpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -8191,7 +8191,7 @@ _mlpreport_owner& _mlpreport_owner::operator=(const _mlpreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mlpreport_clear(p_struct); - if( !alglib_impl::_mlpreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -8237,19 +8237,19 @@ Cross-validation estimates of generalization error *************************************************************************/ _mlpcvreport_owner::_mlpcvreport_owner() { - p_struct = (alglib_impl::mlpcvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpcvreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpcvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpcvreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpcvreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mlpcvreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mlpcvreport_owner::_mlpcvreport_owner(const _mlpcvreport_owner &rhs) { - p_struct = (alglib_impl::mlpcvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpcvreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlpcvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlpcvreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlpcvreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpcvreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -8258,7 +8258,7 @@ _mlpcvreport_owner& _mlpcvreport_owner::operator=(const _mlpcvreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mlpcvreport_clear(p_struct); - if( !alglib_impl::_mlpcvreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlpcvreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -8307,19 +8307,19 @@ functions to work with this object. *************************************************************************/ _mlptrainer_owner::_mlptrainer_owner() { - p_struct = (alglib_impl::mlptrainer*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlptrainer), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlptrainer*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlptrainer), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlptrainer_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mlptrainer_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mlptrainer_owner::_mlptrainer_owner(const _mlptrainer_owner &rhs) { - p_struct = (alglib_impl::mlptrainer*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlptrainer), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mlptrainer*)alglib_impl::ae_malloc(sizeof(alglib_impl::mlptrainer), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mlptrainer_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlptrainer_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -8328,7 +8328,7 @@ _mlptrainer_owner& _mlptrainer_owner::operator=(const _mlptrainer_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mlptrainer_clear(p_struct); - if( !alglib_impl::_mlptrainer_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mlptrainer_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -9530,7 +9530,7 @@ INPUT PARAMETERS: NPoints - dataset size, NPoints>=0 NVars - number of independent variables, NVars>=1 -ÂÛÕÎÄÍÛÅ ÏÀÐÀÌÅÒÐÛ: +�������� ���������: Info - return code: * -4, if SVD subroutine haven't converged * -1, if wrong parameters has been passed (NPoints<0, @@ -22307,7 +22307,7 @@ void mlpgradbatch(multilayerperceptron* network, mlpproperties(network, &nin, &nout, &wcount, _state); rvectorsetlengthatleast(grad, wcount, _state); ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { sgrad->f = 0.0; for(i=0; i<=wcount-1; i++) @@ -22323,7 +22323,7 @@ void mlpgradbatch(multilayerperceptron* network, grad->ptr.p_double[i] = 0.0; } ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { *e = *e+sgrad->f; for(i=0; i<=wcount-1; i++) @@ -22433,7 +22433,7 @@ void mlpgradbatchsparse(multilayerperceptron* network, mlpproperties(network, &nin, &nout, &wcount, _state); rvectorsetlengthatleast(grad, wcount, _state); ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { sgrad->f = 0.0; for(i=0; i<=wcount-1; i++) @@ -22449,7 +22449,7 @@ void mlpgradbatchsparse(multilayerperceptron* network, grad->ptr.p_double[i] = 0.0; } ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { *e = *e+sgrad->f; for(i=0; i<=wcount-1; i++) @@ -22589,7 +22589,7 @@ void mlpgradbatchsubset(multilayerperceptron* network, mlpproperties(network, &nin, &nout, &wcount, _state); rvectorsetlengthatleast(grad, wcount, _state); ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { sgrad->f = 0.0; for(i=0; i<=wcount-1; i++) @@ -22605,7 +22605,7 @@ void mlpgradbatchsubset(multilayerperceptron* network, grad->ptr.p_double[i] = 0.0; } ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { *e = *e+sgrad->f; for(i=0; i<=wcount-1; i++) @@ -22753,7 +22753,7 @@ void mlpgradbatchsparsesubset(multilayerperceptron* network, mlpproperties(network, &nin, &nout, &wcount, _state); rvectorsetlengthatleast(grad, wcount, _state); ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { sgrad->f = 0.0; for(i=0; i<=wcount-1; i++) @@ -22769,7 +22769,7 @@ void mlpgradbatchsparsesubset(multilayerperceptron* network, grad->ptr.p_double[i] = 0.0; } ae_shared_pool_first_recycled(&network->gradbuf, &_sgrad, _state); - while(sgrad!=NULL) + while(sgrad!=nullptr) { *e = *e+sgrad->f; for(i=0; i<=wcount-1; i++) @@ -31811,7 +31811,7 @@ void mlpkfoldcv(mlptrainer* s, * Calculate value for NGrad */ ae_shared_pool_first_recycled(&pooldatacv, &_sdatacv, _state); - while(sdatacv!=NULL) + while(sdatacv!=nullptr) { rep->ngrad = rep->ngrad+sdatacv->ngrad; ae_shared_pool_next_recycled(&pooldatacv, &_sdatacv, _state); @@ -33459,7 +33459,7 @@ static void mlptrain_mlptrainnetworkx(mlptrainer* s, */ bestrmserror = ae_maxrealnumber; ae_shared_pool_first_recycled(sessions, &_psession, _state); - while(psession!=NULL) + while(psession!=nullptr) { if( ae_fp_less(psession->bestrmserror,bestrmserror) ) { @@ -34481,7 +34481,7 @@ static void mlptrain_initmlptrnsessions(multilayerperceptron* networktrained, * Clear sessions stored in the pool. */ ae_shared_pool_first_recycled(sessions, &_p, _state); - while(p!=NULL) + while(p!=nullptr) { ae_assert(mlpsamearchitecture(&p->network, networktrained, _state), "InitMLPTrnSessions: internal consistency error", _state); p->bestrmserror = ae_maxrealnumber; @@ -34940,7 +34940,7 @@ INPUT PARAMETERS: NPoints - dataset size, NPoints>=0 NVars - number of independent variables, NVars>=1 -ÂÛÕÎÄÍÛÅ ÏÀÐÀÌÅÒÐÛ: +�������� ���������: Info - return code: * -4, if SVD subroutine haven't converged * -1, if wrong parameters has been passed (NPoints<0, diff --git a/libs/alglib/src/diffequations.cpp b/libs/alglib/src/diffequations.cpp index b3600378cc..68c63fe7c8 100644 --- a/libs/alglib/src/diffequations.cpp +++ b/libs/alglib/src/diffequations.cpp @@ -42,19 +42,19 @@ namespace alglib *************************************************************************/ _odesolverstate_owner::_odesolverstate_owner() { - p_struct = (alglib_impl::odesolverstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::odesolverstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_odesolverstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_odesolverstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _odesolverstate_owner::_odesolverstate_owner(const _odesolverstate_owner &rhs) { - p_struct = (alglib_impl::odesolverstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::odesolverstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_odesolverstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_odesolverstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -63,7 +63,7 @@ _odesolverstate_owner& _odesolverstate_owner::operator=(const _odesolverstate_ow if( this==&rhs ) return *this; alglib_impl::_odesolverstate_clear(p_struct); - if( !alglib_impl::_odesolverstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_odesolverstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -109,19 +109,19 @@ odesolverstate::~odesolverstate() *************************************************************************/ _odesolverreport_owner::_odesolverreport_owner() { - p_struct = (alglib_impl::odesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::odesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_odesolverreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_odesolverreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _odesolverreport_owner::_odesolverreport_owner(const _odesolverreport_owner &rhs) { - p_struct = (alglib_impl::odesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::odesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::odesolverreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_odesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_odesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -130,7 +130,7 @@ _odesolverreport_owner& _odesolverreport_owner::operator=(const _odesolverreport if( this==&rhs ) return *this; alglib_impl::_odesolverreport_clear(p_struct); - if( !alglib_impl::_odesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_odesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -328,8 +328,8 @@ void odesolversolve(odesolverstate &state, void (*diff)(const real_1d_array &y, double x, real_1d_array &dy, void *ptr), void *ptr){ alglib_impl::ae_state _alglib_env_state; - if( diff==NULL ) - throw ap_error("ALGLIB: error in 'odesolversolve()' (diff is NULL)"); + if( diff==nullptr ) + throw ap_error("ALGLIB: error in 'odesolversolve()' (diff is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { diff --git a/libs/alglib/src/diffequations.h b/libs/alglib/src/diffequations.h index f288f9baf2..772fc844a0 100644 --- a/libs/alglib/src/diffequations.h +++ b/libs/alglib/src/diffequations.h @@ -193,7 +193,7 @@ This function is used to launcn iterations of ODE solver It accepts following parameters: diff - callback which calculates dy/dx for given y and x - ptr - optional pointer which is passed to diff; can be NULL + ptr - optional pointer which is passed to diff; can be nullptr -- ALGLIB -- @@ -202,7 +202,7 @@ It accepts following parameters: *************************************************************************/ void odesolversolve(odesolverstate &state, void (*diff)(const real_1d_array &y, double x, real_1d_array &dy, void *ptr), - void *ptr = NULL); + void *ptr = nullptr); /************************************************************************* diff --git a/libs/alglib/src/integration.cpp b/libs/alglib/src/integration.cpp index c0d910c389..40c7254c81 100644 --- a/libs/alglib/src/integration.cpp +++ b/libs/alglib/src/integration.cpp @@ -53,12 +53,12 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-1], alpha coefficients - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-1], alpha coefficients + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the quadrature formula, N>=1 + Mu0 � zeroth moment of the weight function. + N � number of nodes of the quadrature formula, N>=1 OUTPUT PARAMETERS: Info - error code: @@ -105,14 +105,14 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients - Beta – array[0..N-2], beta coefficients. + Alpha � array[0..N-2], alpha coefficients + Beta � array[0..N-2], beta coefficients. Zero-indexed element is not used, may be arbitrary. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - B – right boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=3 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + B � right boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=3 (including the left and right boundary nodes). OUTPUT PARAMETERS: @@ -160,13 +160,13 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients. - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-2], alpha coefficients. + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=2 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=2 (including the left boundary node). OUTPUT PARAMETERS: @@ -380,12 +380,12 @@ and zero moment Mu0 INPUT PARAMETERS: - Alpha – alpha coefficients, array[0..floor(3*K/2)]. - Beta – beta coefficients, array[0..ceil(3*K/2)]. + Alpha � alpha coefficients, array[0..floor(3*K/2)]. + Beta � beta coefficients, array[0..ceil(3*K/2)]. Beta[0] is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the Gauss-Kronrod quadrature formula, + Mu0 � zeroth moment of the weight function. + N � number of nodes of the Gauss-Kronrod quadrature formula, N >= 3, N = 2*K+1. @@ -615,19 +615,19 @@ Integration report: *************************************************************************/ _autogkreport_owner::_autogkreport_owner() { - p_struct = (alglib_impl::autogkreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::autogkreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_autogkreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_autogkreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _autogkreport_owner::_autogkreport_owner(const _autogkreport_owner &rhs) { - p_struct = (alglib_impl::autogkreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::autogkreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_autogkreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_autogkreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -636,7 +636,7 @@ _autogkreport_owner& _autogkreport_owner::operator=(const _autogkreport_owner &r if( this==&rhs ) return *this; alglib_impl::_autogkreport_clear(p_struct); - if( !alglib_impl::_autogkreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_autogkreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -688,19 +688,19 @@ use. You should use ALGLIB functions to work with this class: *************************************************************************/ _autogkstate_owner::_autogkstate_owner() { - p_struct = (alglib_impl::autogkstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::autogkstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_autogkstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_autogkstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _autogkstate_owner::_autogkstate_owner(const _autogkstate_owner &rhs) { - p_struct = (alglib_impl::autogkstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::autogkstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::autogkstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_autogkstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_autogkstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -709,7 +709,7 @@ _autogkstate_owner& _autogkstate_owner::operator=(const _autogkstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_autogkstate_clear(p_struct); - if( !alglib_impl::_autogkstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_autogkstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -904,8 +904,8 @@ void autogkintegrate(autogkstate &state, void (*func)(double x, double xminusa, double bminusx, double &y, void *ptr), void *ptr){ alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'autogkintegrate()' (func is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'autogkintegrate()' (func is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -1014,12 +1014,12 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-1], alpha coefficients - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-1], alpha coefficients + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the quadrature formula, N>=1 + Mu0 � zeroth moment of the weight function. + N � number of nodes of the quadrature formula, N>=1 OUTPUT PARAMETERS: Info - error code: @@ -1123,14 +1123,14 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients - Beta – array[0..N-2], beta coefficients. + Alpha � array[0..N-2], alpha coefficients + Beta � array[0..N-2], beta coefficients. Zero-indexed element is not used, may be arbitrary. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - B – right boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=3 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + B � right boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=3 (including the left and right boundary nodes). OUTPUT PARAMETERS: @@ -1317,13 +1317,13 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients. - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-2], alpha coefficients. + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=2 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=2 (including the left boundary node). OUTPUT PARAMETERS: @@ -1818,12 +1818,12 @@ and zero moment Mu0 INPUT PARAMETERS: - Alpha – alpha coefficients, array[0..floor(3*K/2)]. - Beta – beta coefficients, array[0..ceil(3*K/2)]. + Alpha � alpha coefficients, array[0..floor(3*K/2)]. + Beta � beta coefficients, array[0..ceil(3*K/2)]. Beta[0] is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the Gauss-Kronrod quadrature formula, + Mu0 � zeroth moment of the weight function. + N � number of nodes of the Gauss-Kronrod quadrature formula, N >= 3, N = 2*K+1. diff --git a/libs/alglib/src/integration.h b/libs/alglib/src/integration.h index b0f25c37fb..aaafb116d3 100644 --- a/libs/alglib/src/integration.h +++ b/libs/alglib/src/integration.h @@ -183,12 +183,12 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-1], alpha coefficients - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-1], alpha coefficients + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the quadrature formula, N>=1 + Mu0 � zeroth moment of the weight function. + N � number of nodes of the quadrature formula, N>=1 OUTPUT PARAMETERS: Info - error code: @@ -222,14 +222,14 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients - Beta – array[0..N-2], beta coefficients. + Alpha � array[0..N-2], alpha coefficients + Beta � array[0..N-2], beta coefficients. Zero-indexed element is not used, may be arbitrary. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - B – right boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=3 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + B � right boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=3 (including the left and right boundary nodes). OUTPUT PARAMETERS: @@ -264,13 +264,13 @@ and zeroth moment Mu0 Mu0 = integral(W(x)dx,a,b) INPUT PARAMETERS: - Alpha – array[0..N-2], alpha coefficients. - Beta – array[0..N-1], beta coefficients + Alpha � array[0..N-2], alpha coefficients. + Beta � array[0..N-1], beta coefficients Zero-indexed element is not used. Beta[I]>0 - Mu0 – zeroth moment of the weighting function. - A – left boundary of the integration interval. - N – number of nodes of the quadrature formula, N>=2 + Mu0 � zeroth moment of the weighting function. + A � left boundary of the integration interval. + N � number of nodes of the quadrature formula, N>=2 (including the left boundary node). OUTPUT PARAMETERS: @@ -418,12 +418,12 @@ and zero moment Mu0 INPUT PARAMETERS: - Alpha – alpha coefficients, array[0..floor(3*K/2)]. - Beta – beta coefficients, array[0..ceil(3*K/2)]. + Alpha � alpha coefficients, array[0..floor(3*K/2)]. + Beta � beta coefficients, array[0..ceil(3*K/2)]. Beta[0] is not used and may be arbitrary. Beta[I]>0. - Mu0 – zeroth moment of the weight function. - N – number of nodes of the Gauss-Kronrod quadrature formula, + Mu0 � zeroth moment of the weight function. + N � number of nodes of the Gauss-Kronrod quadrature formula, N >= 3, N = 2*K+1. @@ -677,7 +677,7 @@ This function is used to launcn iterations of the 1-dimensional integrator It accepts following parameters: func - callback which calculates f(x) for given x - ptr - optional pointer which is passed to func; can be NULL + ptr - optional pointer which is passed to func; can be nullptr -- ALGLIB -- @@ -686,7 +686,7 @@ It accepts following parameters: *************************************************************************/ void autogkintegrate(autogkstate &state, void (*func)(double x, double xminusa, double bminusx, double &y, void *ptr), - void *ptr = NULL); + void *ptr = nullptr); /************************************************************************* diff --git a/libs/alglib/src/interpolation.cpp b/libs/alglib/src/interpolation.cpp index e6c5dc66cd..de50890739 100644 --- a/libs/alglib/src/interpolation.cpp +++ b/libs/alglib/src/interpolation.cpp @@ -42,19 +42,19 @@ IDW interpolant. *************************************************************************/ _idwinterpolant_owner::_idwinterpolant_owner() { - p_struct = (alglib_impl::idwinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::idwinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::idwinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::idwinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_idwinterpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_idwinterpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _idwinterpolant_owner::_idwinterpolant_owner(const _idwinterpolant_owner &rhs) { - p_struct = (alglib_impl::idwinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::idwinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::idwinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::idwinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_idwinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_idwinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -63,7 +63,7 @@ _idwinterpolant_owner& _idwinterpolant_owner::operator=(const _idwinterpolant_ow if( this==&rhs ) return *this; alglib_impl::_idwinterpolant_clear(p_struct); - if( !alglib_impl::_idwinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_idwinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -331,19 +331,19 @@ Barycentric interpolant. *************************************************************************/ _barycentricinterpolant_owner::_barycentricinterpolant_owner() { - p_struct = (alglib_impl::barycentricinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::barycentricinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_barycentricinterpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_barycentricinterpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _barycentricinterpolant_owner::_barycentricinterpolant_owner(const _barycentricinterpolant_owner &rhs) { - p_struct = (alglib_impl::barycentricinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::barycentricinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_barycentricinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_barycentricinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -352,7 +352,7 @@ _barycentricinterpolant_owner& _barycentricinterpolant_owner::operator=(const _b if( this==&rhs ) return *this; alglib_impl::_barycentricinterpolant_clear(p_struct); - if( !alglib_impl::_barycentricinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_barycentricinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1573,19 +1573,19 @@ double polynomialcalccheb2(const double a, const double b, const real_1d_array & *************************************************************************/ _spline1dinterpolant_owner::_spline1dinterpolant_owner() { - p_struct = (alglib_impl::spline1dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline1dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline1dinterpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_spline1dinterpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _spline1dinterpolant_owner::_spline1dinterpolant_owner(const _spline1dinterpolant_owner &rhs) { - p_struct = (alglib_impl::spline1dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline1dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline1dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline1dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1594,7 +1594,7 @@ _spline1dinterpolant_owner& _spline1dinterpolant_owner::operator=(const _spline1 if( this==&rhs ) return *this; alglib_impl::_spline1dinterpolant_clear(p_struct); - if( !alglib_impl::_spline1dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline1dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3314,19 +3314,19 @@ Polynomial fitting report: *************************************************************************/ _polynomialfitreport_owner::_polynomialfitreport_owner() { - p_struct = (alglib_impl::polynomialfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::polynomialfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::polynomialfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::polynomialfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_polynomialfitreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_polynomialfitreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _polynomialfitreport_owner::_polynomialfitreport_owner(const _polynomialfitreport_owner &rhs) { - p_struct = (alglib_impl::polynomialfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::polynomialfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::polynomialfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::polynomialfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_polynomialfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_polynomialfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3335,7 +3335,7 @@ _polynomialfitreport_owner& _polynomialfitreport_owner::operator=(const _polynom if( this==&rhs ) return *this; alglib_impl::_polynomialfitreport_clear(p_struct); - if( !alglib_impl::_polynomialfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_polynomialfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3386,19 +3386,19 @@ Barycentric fitting report: *************************************************************************/ _barycentricfitreport_owner::_barycentricfitreport_owner() { - p_struct = (alglib_impl::barycentricfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::barycentricfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_barycentricfitreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_barycentricfitreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _barycentricfitreport_owner::_barycentricfitreport_owner(const _barycentricfitreport_owner &rhs) { - p_struct = (alglib_impl::barycentricfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::barycentricfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::barycentricfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_barycentricfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_barycentricfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3407,7 +3407,7 @@ _barycentricfitreport_owner& _barycentricfitreport_owner::operator=(const _baryc if( this==&rhs ) return *this; alglib_impl::_barycentricfitreport_clear(p_struct); - if( !alglib_impl::_barycentricfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_barycentricfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3461,19 +3461,19 @@ Spline1DFitHermite). Modern fitting functions do NOT fill these fields: *************************************************************************/ _spline1dfitreport_owner::_spline1dfitreport_owner() { - p_struct = (alglib_impl::spline1dfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline1dfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline1dfitreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_spline1dfitreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _spline1dfitreport_owner::_spline1dfitreport_owner(const _spline1dfitreport_owner &rhs) { - p_struct = (alglib_impl::spline1dfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline1dfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline1dfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline1dfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline1dfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3482,7 +3482,7 @@ _spline1dfitreport_owner& _spline1dfitreport_owner::operator=(const _spline1dfit if( this==&rhs ) return *this; alglib_impl::_spline1dfitreport_clear(p_struct); - if( !alglib_impl::_spline1dfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline1dfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3557,19 +3557,19 @@ fields are initialized. *************************************************************************/ _lsfitreport_owner::_lsfitreport_owner() { - p_struct = (alglib_impl::lsfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lsfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lsfitreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_lsfitreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _lsfitreport_owner::_lsfitreport_owner(const _lsfitreport_owner &rhs) { - p_struct = (alglib_impl::lsfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lsfitreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lsfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lsfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3578,7 +3578,7 @@ _lsfitreport_owner& _lsfitreport_owner::operator=(const _lsfitreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_lsfitreport_clear(p_struct); - if( !alglib_impl::_lsfitreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lsfitreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3627,19 +3627,19 @@ Never try to access its fields directly! *************************************************************************/ _lsfitstate_owner::_lsfitstate_owner() { - p_struct = (alglib_impl::lsfitstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lsfitstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lsfitstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_lsfitstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _lsfitstate_owner::_lsfitstate_owner(const _lsfitstate_owner &rhs) { - p_struct = (alglib_impl::lsfitstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lsfitstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lsfitstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lsfitstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lsfitstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3648,7 +3648,7 @@ _lsfitstate_owner& _lsfitstate_owner::operator=(const _lsfitstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_lsfitstate_clear(p_struct); - if( !alglib_impl::_lsfitstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lsfitstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -6800,8 +6800,8 @@ void lsfitfit(lsfitstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (func is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (func is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -6814,7 +6814,7 @@ void lsfitfit(lsfitstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.c, state.f, ptr); continue; } @@ -6836,10 +6836,10 @@ void lsfitfit(lsfitstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (func is NULL)"); - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (grad is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (func is nullptr)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (grad is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -6857,7 +6857,7 @@ void lsfitfit(lsfitstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.c, state.f, ptr); continue; } @@ -6880,12 +6880,12 @@ void lsfitfit(lsfitstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (func is NULL)"); - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (grad is NULL)"); - if( hess==NULL ) - throw ap_error("ALGLIB: error in 'lsfitfit()' (hess is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (func is nullptr)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (grad is nullptr)"); + if( hess==nullptr ) + throw ap_error("ALGLIB: error in 'lsfitfit()' (hess is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -6908,7 +6908,7 @@ void lsfitfit(lsfitstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.c, state.f, ptr); continue; } @@ -7089,19 +7089,19 @@ functions instead. *************************************************************************/ _pspline2interpolant_owner::_pspline2interpolant_owner() { - p_struct = (alglib_impl::pspline2interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline2interpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::pspline2interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline2interpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_pspline2interpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_pspline2interpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _pspline2interpolant_owner::_pspline2interpolant_owner(const _pspline2interpolant_owner &rhs) { - p_struct = (alglib_impl::pspline2interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline2interpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::pspline2interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline2interpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_pspline2interpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_pspline2interpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -7110,7 +7110,7 @@ _pspline2interpolant_owner& _pspline2interpolant_owner::operator=(const _pspline if( this==&rhs ) return *this; alglib_impl::_pspline2interpolant_clear(p_struct); - if( !alglib_impl::_pspline2interpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_pspline2interpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -7159,19 +7159,19 @@ functions instead. *************************************************************************/ _pspline3interpolant_owner::_pspline3interpolant_owner() { - p_struct = (alglib_impl::pspline3interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline3interpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::pspline3interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline3interpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_pspline3interpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_pspline3interpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _pspline3interpolant_owner::_pspline3interpolant_owner(const _pspline3interpolant_owner &rhs) { - p_struct = (alglib_impl::pspline3interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline3interpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::pspline3interpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::pspline3interpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_pspline3interpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_pspline3interpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -7180,7 +7180,7 @@ _pspline3interpolant_owner& _pspline3interpolant_owner::operator=(const _pspline if( this==&rhs ) return *this; alglib_impl::_pspline3interpolant_clear(p_struct); - if( !alglib_impl::_pspline3interpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_pspline3interpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -7825,19 +7825,19 @@ functions to use this object. *************************************************************************/ _rbfmodel_owner::_rbfmodel_owner() { - p_struct = (alglib_impl::rbfmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::rbfmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_rbfmodel_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_rbfmodel_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _rbfmodel_owner::_rbfmodel_owner(const _rbfmodel_owner &rhs) { - p_struct = (alglib_impl::rbfmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfmodel), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::rbfmodel*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfmodel), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_rbfmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_rbfmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -7846,7 +7846,7 @@ _rbfmodel_owner& _rbfmodel_owner::operator=(const _rbfmodel_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_rbfmodel_clear(p_struct); - if( !alglib_impl::_rbfmodel_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_rbfmodel_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -7894,19 +7894,19 @@ RBF solution report: *************************************************************************/ _rbfreport_owner::_rbfreport_owner() { - p_struct = (alglib_impl::rbfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::rbfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_rbfreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_rbfreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _rbfreport_owner::_rbfreport_owner(const _rbfreport_owner &rhs) { - p_struct = (alglib_impl::rbfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::rbfreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::rbfreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_rbfreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_rbfreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -7915,7 +7915,7 @@ _rbfreport_owner& _rbfreport_owner::operator=(const _rbfreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_rbfreport_clear(p_struct); - if( !alglib_impl::_rbfreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_rbfreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -8932,19 +8932,19 @@ void rbfunpack(const rbfmodel &s, ae_int_t &nx, ae_int_t &ny, real_2d_array &xwr *************************************************************************/ _spline2dinterpolant_owner::_spline2dinterpolant_owner() { - p_struct = (alglib_impl::spline2dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline2dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline2dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline2dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline2dinterpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_spline2dinterpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _spline2dinterpolant_owner::_spline2dinterpolant_owner(const _spline2dinterpolant_owner &rhs) { - p_struct = (alglib_impl::spline2dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline2dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline2dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline2dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline2dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline2dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -8953,7 +8953,7 @@ _spline2dinterpolant_owner& _spline2dinterpolant_owner::operator=(const _spline2 if( this==&rhs ) return *this; alglib_impl::_spline2dinterpolant_clear(p_struct); - if( !alglib_impl::_spline2dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline2dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -9486,19 +9486,19 @@ void spline2dunpack(const spline2dinterpolant &c, ae_int_t &m, ae_int_t &n, real *************************************************************************/ _spline3dinterpolant_owner::_spline3dinterpolant_owner() { - p_struct = (alglib_impl::spline3dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline3dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline3dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline3dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline3dinterpolant_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_spline3dinterpolant_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _spline3dinterpolant_owner::_spline3dinterpolant_owner(const _spline3dinterpolant_owner &rhs) { - p_struct = (alglib_impl::spline3dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline3dinterpolant), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::spline3dinterpolant*)alglib_impl::ae_malloc(sizeof(alglib_impl::spline3dinterpolant), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_spline3dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline3dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -9507,7 +9507,7 @@ _spline3dinterpolant_owner& _spline3dinterpolant_owner::operator=(const _spline3 if( this==&rhs ) return *this; alglib_impl::_spline3dinterpolant_clear(p_struct); - if( !alglib_impl::_spline3dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_spline3dinterpolant_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } diff --git a/libs/alglib/src/interpolation.h b/libs/alglib/src/interpolation.h index f2c9d34a75..cba2a3556f 100644 --- a/libs/alglib/src/interpolation.h +++ b/libs/alglib/src/interpolation.h @@ -3391,9 +3391,9 @@ These functions accept following parameters: hess - callback which calculates function (or merit function) value func, gradient grad and Hessian hess at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr NOTES: @@ -3435,19 +3435,19 @@ These functions accept following parameters: *************************************************************************/ void lsfitfit(lsfitstate &state, void (*func)(const real_1d_array &c, const real_1d_array &x, double &func, void *ptr), - void (*rep)(const real_1d_array &c, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &c, double func, void *ptr) = nullptr, + void *ptr = nullptr); void lsfitfit(lsfitstate &state, void (*func)(const real_1d_array &c, const real_1d_array &x, double &func, void *ptr), void (*grad)(const real_1d_array &c, const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), - void (*rep)(const real_1d_array &c, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &c, double func, void *ptr) = nullptr, + void *ptr = nullptr); void lsfitfit(lsfitstate &state, void (*func)(const real_1d_array &c, const real_1d_array &x, double &func, void *ptr), void (*grad)(const real_1d_array &c, const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), void (*hess)(const real_1d_array &c, const real_1d_array &x, double &func, real_1d_array &grad, real_2d_array &hess, void *ptr), - void (*rep)(const real_1d_array &c, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &c, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* diff --git a/libs/alglib/src/linalg.cpp b/libs/alglib/src/linalg.cpp index 3ad4e93bfd..b23cc665da 100644 --- a/libs/alglib/src/linalg.cpp +++ b/libs/alglib/src/linalg.cpp @@ -1818,7 +1818,7 @@ Input parameters: VTNeeded - 0, 1 or 2. See the description of the parameter VT. AdditionalMemory - If the parameter: - * equals 0, the algorithm doesn’t use additional + * equals 0, the algorithm doesn�t use additional memory (lower requirements, lower performance). * equals 1, the algorithm uses additional memory of size min(M,N)*min(M,N) of real numbers. @@ -1837,7 +1837,7 @@ Output parameters: within [0..M-1, 0..Min(M,N)-1]. if UNeeded=2, U contains matrix U wholly. Array whose indexes range within [0..M-1, 0..M-1]. - VT - if VTNeeded=0, VT isn’t changed, the right singular vectors + VT - if VTNeeded=0, VT isn�t changed, the right singular vectors are not calculated. if VTNeeded=1, VT contains right singular vectors (first min(M,N) rows of matrix V^T). Array whose indexes range @@ -1885,7 +1885,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in the matrix columns. @@ -1934,7 +1934,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..M-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..M-1]. The eigenvectors are stored in the matrix columns. @@ -1989,7 +1989,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..I2-I1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..I2-I1]. In that case, the eigenvectors are stored in the matrix columns. @@ -2043,7 +2043,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in the matrix columns. @@ -2097,7 +2097,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..M-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..M-1]. The eigenvectors are stored in the matrix columns. @@ -2157,7 +2157,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..I2-I1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..I2-I1]. In that case, the eigenvectors are stored in the matrix @@ -2226,7 +2226,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the product of a given matrix (from the left) and the eigenvectors matrix (from the right); * 2, Z contains the eigenvectors. @@ -3673,19 +3673,19 @@ Matrix inverse report: *************************************************************************/ _matinvreport_owner::_matinvreport_owner() { - p_struct = (alglib_impl::matinvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::matinvreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::matinvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::matinvreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_matinvreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_matinvreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _matinvreport_owner::_matinvreport_owner(const _matinvreport_owner &rhs) { - p_struct = (alglib_impl::matinvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::matinvreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::matinvreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::matinvreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_matinvreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_matinvreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3694,7 +3694,7 @@ _matinvreport_owner& _matinvreport_owner::operator=(const _matinvreport_owner &r if( this==&rhs ) return *this; alglib_impl::_matinvreport_clear(p_struct); - if( !alglib_impl::_matinvreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_matinvreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -4086,7 +4086,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of SPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -4095,10 +4095,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -4133,7 +4133,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of SPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -4142,10 +4142,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -4198,10 +4198,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -4248,10 +4248,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -4297,7 +4297,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of HPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -4306,10 +4306,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -4344,7 +4344,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of HPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -4353,10 +4353,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -4409,10 +4409,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -4459,10 +4459,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -4740,19 +4740,19 @@ Never try to access its fields directly! *************************************************************************/ _sparsematrix_owner::_sparsematrix_owner() { - p_struct = (alglib_impl::sparsematrix*)alglib_impl::ae_malloc(sizeof(alglib_impl::sparsematrix), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::sparsematrix*)alglib_impl::ae_malloc(sizeof(alglib_impl::sparsematrix), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_sparsematrix_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_sparsematrix_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _sparsematrix_owner::_sparsematrix_owner(const _sparsematrix_owner &rhs) { - p_struct = (alglib_impl::sparsematrix*)alglib_impl::ae_malloc(sizeof(alglib_impl::sparsematrix), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::sparsematrix*)alglib_impl::ae_malloc(sizeof(alglib_impl::sparsematrix), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_sparsematrix_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_sparsematrix_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -4761,7 +4761,7 @@ _sparsematrix_owner& _sparsematrix_owner::operator=(const _sparsematrix_owner &r if( this==&rhs ) return *this; alglib_impl::_sparsematrix_clear(p_struct); - if( !alglib_impl::_sparsematrix_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_sparsematrix_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -6057,19 +6057,19 @@ You should use ALGLIB functions to work with this object. *************************************************************************/ _normestimatorstate_owner::_normestimatorstate_owner() { - p_struct = (alglib_impl::normestimatorstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::normestimatorstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::normestimatorstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::normestimatorstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_normestimatorstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_normestimatorstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _normestimatorstate_owner::_normestimatorstate_owner(const _normestimatorstate_owner &rhs) { - p_struct = (alglib_impl::normestimatorstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::normestimatorstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::normestimatorstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::normestimatorstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_normestimatorstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_normestimatorstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -6078,7 +6078,7 @@ _normestimatorstate_owner& _normestimatorstate_owner::operator=(const _normestim if( this==&rhs ) return *this; alglib_impl::_normestimatorstate_clear(p_struct); - if( !alglib_impl::_normestimatorstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_normestimatorstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -6562,7 +6562,7 @@ Input parameters: (A must be square matrix) As the determinant is equal to the product of squares of diagonal elements, -it’s not necessary to specify which triangle - lower or upper - the matrix +it�s not necessary to specify which triangle - lower or upper - the matrix is stored in. Result: @@ -6600,7 +6600,7 @@ Input parameters: (A must be square matrix) As the determinant is equal to the product of squares of diagonal elements, -it’s not necessary to specify which triangle - lower or upper - the matrix +it�s not necessary to specify which triangle - lower or upper - the matrix is stored in. Result: @@ -6642,10 +6642,10 @@ Input parameters: (A must be square matrix) IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -6685,10 +6685,10 @@ Input parameters: (A must be square matrix) IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -6757,7 +6757,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in matrix columns. It should @@ -6767,7 +6767,7 @@ Output parameters: Result: True, if the problem was solved successfully. False, if the error occurred during the Cholesky decomposition of matrix - B (the matrix isn’t positive-definite) or during the work of the iterative + B (the matrix isn�t positive-definite) or during the work of the iterative algorithm for solving the symmetric eigenproblem. See also the GeneralizedSymmetricDefiniteEVDReduce subroutine. @@ -6973,7 +6973,7 @@ void rmatrixinvupdatecolumn(real_2d_array &inva, const ae_int_t n, const ae_int_ /************************************************************************* Inverse matrix update by the Sherman-Morrison formula -The algorithm computes the inverse of matrix A+u*v’ by using the given matrix +The algorithm computes the inverse of matrix A+u*v� by using the given matrix A^-1 and the vectors u and v. Input parameters: @@ -15134,7 +15134,7 @@ Input parameters: VTNeeded - 0, 1 or 2. See the description of the parameter VT. AdditionalMemory - If the parameter: - * equals 0, the algorithm doesn’t use additional + * equals 0, the algorithm doesn�t use additional memory (lower requirements, lower performance). * equals 1, the algorithm uses additional memory of size min(M,N)*min(M,N) of real numbers. @@ -15153,7 +15153,7 @@ Output parameters: within [0..M-1, 0..Min(M,N)-1]. if UNeeded=2, U contains matrix U wholly. Array whose indexes range within [0..M-1, 0..M-1]. - VT - if VTNeeded=0, VT isn’t changed, the right singular vectors + VT - if VTNeeded=0, VT isn�t changed, the right singular vectors are not calculated. if VTNeeded=1, VT contains right singular vectors (first min(M,N) rows of matrix V^T). Array whose indexes range @@ -15470,7 +15470,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in the matrix columns. @@ -15537,7 +15537,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..M-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..M-1]. The eigenvectors are stored in the matrix columns. @@ -15614,7 +15614,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..I2-I1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..I2-I1]. In that case, the eigenvectors are stored in the matrix columns. @@ -15688,7 +15688,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in the matrix columns. @@ -15825,7 +15825,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..M-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..M-1]. The eigenvectors are stored in the matrix columns. @@ -15972,7 +15972,7 @@ Output parameters: W - array of the eigenvalues found. Array whose index ranges within [0..I2-I1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..I2-I1]. In that case, the eigenvectors are stored in the matrix @@ -16128,7 +16128,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains the product of a given matrix (from the left) and the eigenvectors matrix (from the right); * 2, Z contains the eigenvectors. @@ -27563,7 +27563,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of SPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -27572,10 +27572,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -27679,10 +27679,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -27729,7 +27729,7 @@ by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: - A=U’*U or A = L*L'. + A=U�*U or A = L*L'. Output of HPDMatrixCholesky subroutine. N - size of matrix A (optional) : * if given, only principal NxN submatrix is processed and @@ -27738,10 +27738,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, lower half is used. @@ -27845,10 +27845,10 @@ Input parameters: matrix size (A must be square matrix) IsUpper - storage type (optional): * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -32863,7 +32863,7 @@ Input parameters: (A must be square matrix) As the determinant is equal to the product of squares of diagonal elements, -it’s not necessary to specify which triangle - lower or upper - the matrix +it�s not necessary to specify which triangle - lower or upper - the matrix is stored in. Result: @@ -32911,10 +32911,10 @@ Input parameters: (A must be square matrix) IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used/changed by + triangle, and the lower triangle isn�t used/changed by function * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used/changed by + triangle, and the upper triangle isn�t used/changed by function * if not given, both lower and upper triangles must be filled. @@ -32986,7 +32986,7 @@ Output parameters: D - eigenvalues in ascending order. Array whose index ranges within [0..N-1]. Z - if ZNeeded is equal to: - * 0, Z hasn’t changed; + * 0, Z hasn�t changed; * 1, Z contains eigenvectors. Array whose indexes range within [0..N-1, 0..N-1]. The eigenvectors are stored in matrix columns. It should @@ -32996,7 +32996,7 @@ Output parameters: Result: True, if the problem was solved successfully. False, if the error occurred during the Cholesky decomposition of matrix - B (the matrix isn’t positive-definite) or during the work of the iterative + B (the matrix isn�t positive-definite) or during the work of the iterative algorithm for solving the symmetric eigenproblem. See also the GeneralizedSymmetricDefiniteEVDReduce subroutine. @@ -33656,7 +33656,7 @@ void rmatrixinvupdatecolumn(/* Real */ ae_matrix* inva, /************************************************************************* Inverse matrix update by the Sherman-Morrison formula -The algorithm computes the inverse of matrix A+u*v’ by using the given matrix +The algorithm computes the inverse of matrix A+u*v� by using the given matrix A^-1 and the vectors u and v. Input parameters: diff --git a/libs/alglib/src/optimization.cpp b/libs/alglib/src/optimization.cpp index 8ac0a056fa..3960b39895 100644 --- a/libs/alglib/src/optimization.cpp +++ b/libs/alglib/src/optimization.cpp @@ -52,19 +52,19 @@ You should use ALGLIB functions to work with this object. *************************************************************************/ _mincgstate_owner::_mincgstate_owner() { - p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mincgstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mincgstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mincgstate_owner::_mincgstate_owner(const _mincgstate_owner &rhs) { - p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -73,7 +73,7 @@ _mincgstate_owner& _mincgstate_owner::operator=(const _mincgstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mincgstate_clear(p_struct); - if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mincgstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -119,19 +119,19 @@ mincgstate::~mincgstate() *************************************************************************/ _mincgreport_owner::_mincgreport_owner() { - p_struct = (alglib_impl::mincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mincgreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_mincgreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _mincgreport_owner::_mincgreport_owner(const _mincgreport_owner &rhs) { - p_struct = (alglib_impl::mincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::mincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::mincgreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_mincgreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mincgreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -140,7 +140,7 @@ _mincgreport_owner& _mincgreport_owner::operator=(const _mincgreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_mincgreport_clear(p_struct); - if( !alglib_impl::_mincgreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_mincgreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -783,8 +783,8 @@ void mincgoptimize(mincgstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'mincgoptimize()' (func is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'mincgoptimize()' (func is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -797,7 +797,7 @@ void mincgoptimize(mincgstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -818,8 +818,8 @@ void mincgoptimize(mincgstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'mincgoptimize()' (grad is NULL)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'mincgoptimize()' (grad is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -832,7 +832,7 @@ void mincgoptimize(mincgstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -1019,19 +1019,19 @@ object *************************************************************************/ _minbleicstate_owner::_minbleicstate_owner() { - p_struct = (alglib_impl::minbleicstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minbleicstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minbleicstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minbleicstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minbleicstate_owner::_minbleicstate_owner(const _minbleicstate_owner &rhs) { - p_struct = (alglib_impl::minbleicstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minbleicstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minbleicstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minbleicstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1040,7 +1040,7 @@ _minbleicstate_owner& _minbleicstate_owner::operator=(const _minbleicstate_owner if( this==&rhs ) return *this; alglib_impl::_minbleicstate_clear(p_struct); - if( !alglib_impl::_minbleicstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minbleicstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1114,19 +1114,19 @@ There are additional fields which can be used for debugging: *************************************************************************/ _minbleicreport_owner::_minbleicreport_owner() { - p_struct = (alglib_impl::minbleicreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minbleicreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minbleicreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minbleicreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minbleicreport_owner::_minbleicreport_owner(const _minbleicreport_owner &rhs) { - p_struct = (alglib_impl::minbleicreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minbleicreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minbleicreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minbleicreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minbleicreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1135,7 +1135,7 @@ _minbleicreport_owner& _minbleicreport_owner::operator=(const _minbleicreport_ow if( this==&rhs ) return *this; alglib_impl::_minbleicreport_clear(p_struct); - if( !alglib_impl::_minbleicreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minbleicreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1893,8 +1893,8 @@ void minbleicoptimize(minbleicstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'minbleicoptimize()' (func is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'minbleicoptimize()' (func is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -1907,7 +1907,7 @@ void minbleicoptimize(minbleicstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -1928,8 +1928,8 @@ void minbleicoptimize(minbleicstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'minbleicoptimize()' (grad is NULL)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'minbleicoptimize()' (grad is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -1942,7 +1942,7 @@ void minbleicoptimize(minbleicstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -2126,19 +2126,19 @@ void minbleicsetgradientcheck(const minbleicstate &state, const double teststep) *************************************************************************/ _minlbfgsstate_owner::_minlbfgsstate_owner() { - p_struct = (alglib_impl::minlbfgsstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlbfgsstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlbfgsstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minlbfgsstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minlbfgsstate_owner::_minlbfgsstate_owner(const _minlbfgsstate_owner &rhs) { - p_struct = (alglib_impl::minlbfgsstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlbfgsstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlbfgsstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlbfgsstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2147,7 +2147,7 @@ _minlbfgsstate_owner& _minlbfgsstate_owner::operator=(const _minlbfgsstate_owner if( this==&rhs ) return *this; alglib_impl::_minlbfgsstate_clear(p_struct); - if( !alglib_impl::_minlbfgsstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlbfgsstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2193,19 +2193,19 @@ minlbfgsstate::~minlbfgsstate() *************************************************************************/ _minlbfgsreport_owner::_minlbfgsreport_owner() { - p_struct = (alglib_impl::minlbfgsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlbfgsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlbfgsreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minlbfgsreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minlbfgsreport_owner::_minlbfgsreport_owner(const _minlbfgsreport_owner &rhs) { - p_struct = (alglib_impl::minlbfgsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlbfgsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlbfgsreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlbfgsreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlbfgsreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2214,7 +2214,7 @@ _minlbfgsreport_owner& _minlbfgsreport_owner::operator=(const _minlbfgsreport_ow if( this==&rhs ) return *this; alglib_impl::_minlbfgsreport_clear(p_struct); - if( !alglib_impl::_minlbfgsreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlbfgsreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2857,8 +2857,8 @@ void minlbfgsoptimize(minlbfgsstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'minlbfgsoptimize()' (func is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'minlbfgsoptimize()' (func is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -2871,7 +2871,7 @@ void minlbfgsoptimize(minlbfgsstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -2892,8 +2892,8 @@ void minlbfgsoptimize(minlbfgsstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'minlbfgsoptimize()' (grad is NULL)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'minlbfgsoptimize()' (grad is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -2906,7 +2906,7 @@ void minlbfgsoptimize(minlbfgsstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -3094,19 +3094,19 @@ object *************************************************************************/ _minqpstate_owner::_minqpstate_owner() { - p_struct = (alglib_impl::minqpstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minqpstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minqpstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minqpstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minqpstate_owner::_minqpstate_owner(const _minqpstate_owner &rhs) { - p_struct = (alglib_impl::minqpstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minqpstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minqpstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minqpstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3115,7 +3115,7 @@ _minqpstate_owner& _minqpstate_owner::operator=(const _minqpstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_minqpstate_clear(p_struct); - if( !alglib_impl::_minqpstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minqpstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3186,19 +3186,19 @@ Completion codes: *************************************************************************/ _minqpreport_owner::_minqpreport_owner() { - p_struct = (alglib_impl::minqpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minqpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minqpreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minqpreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minqpreport_owner::_minqpreport_owner(const _minqpreport_owner &rhs) { - p_struct = (alglib_impl::minqpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minqpreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minqpreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minqpreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minqpreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3207,7 +3207,7 @@ _minqpreport_owner& _minqpreport_owner::operator=(const _minqpreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_minqpreport_clear(p_struct); - if( !alglib_impl::_minqpreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minqpreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -3333,9 +3333,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -3382,9 +3382,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -3441,9 +3441,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -3965,19 +3965,19 @@ to work with it. *************************************************************************/ _minlmstate_owner::_minlmstate_owner() { - p_struct = (alglib_impl::minlmstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlmstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlmstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minlmstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minlmstate_owner::_minlmstate_owner(const _minlmstate_owner &rhs) { - p_struct = (alglib_impl::minlmstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlmstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlmstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlmstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -3986,7 +3986,7 @@ _minlmstate_owner& _minlmstate_owner::operator=(const _minlmstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_minlmstate_clear(p_struct); - if( !alglib_impl::_minlmstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlmstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -4051,19 +4051,19 @@ Optimization report, filled by MinLMResults() function *************************************************************************/ _minlmreport_owner::_minlmreport_owner() { - p_struct = (alglib_impl::minlmreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlmreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlmreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minlmreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minlmreport_owner::_minlmreport_owner(const _minlmreport_owner &rhs) { - p_struct = (alglib_impl::minlmreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minlmreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minlmreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minlmreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlmreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -4072,7 +4072,7 @@ _minlmreport_owner& _minlmreport_owner::operator=(const _minlmreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_minlmreport_clear(p_struct); - if( !alglib_impl::_minlmreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minlmreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -4882,8 +4882,8 @@ void minlmoptimize(minlmstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( fvec==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (fvec is NULL)"); + if( fvec==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (fvec is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -4896,7 +4896,7 @@ void minlmoptimize(minlmstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -4918,10 +4918,10 @@ void minlmoptimize(minlmstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( fvec==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (fvec is NULL)"); - if( jac==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is NULL)"); + if( fvec==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (fvec is nullptr)"); + if( jac==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -4939,7 +4939,7 @@ void minlmoptimize(minlmstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -4962,12 +4962,12 @@ void minlmoptimize(minlmstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is NULL)"); - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (grad is NULL)"); - if( hess==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (hess is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is nullptr)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (grad is nullptr)"); + if( hess==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (hess is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -4990,7 +4990,7 @@ void minlmoptimize(minlmstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -5012,10 +5012,10 @@ void minlmoptimize(minlmstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is NULL)"); - if( jac==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is nullptr)"); + if( jac==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -5033,7 +5033,7 @@ void minlmoptimize(minlmstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -5056,12 +5056,12 @@ void minlmoptimize(minlmstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is NULL)"); - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (grad is NULL)"); - if( jac==NULL ) - throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (func is nullptr)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (grad is nullptr)"); + if( jac==nullptr ) + throw ap_error("ALGLIB: error in 'minlmoptimize()' (jac is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -5084,7 +5084,7 @@ void minlmoptimize(minlmstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -5413,19 +5413,19 @@ void minlmsetgradientcheck(const minlmstate &state, const double teststep) *************************************************************************/ _minasastate_owner::_minasastate_owner() { - p_struct = (alglib_impl::minasastate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasastate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minasastate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasastate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minasastate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minasastate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minasastate_owner::_minasastate_owner(const _minasastate_owner &rhs) { - p_struct = (alglib_impl::minasastate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasastate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minasastate*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasastate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minasastate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minasastate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -5434,7 +5434,7 @@ _minasastate_owner& _minasastate_owner::operator=(const _minasastate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_minasastate_clear(p_struct); - if( !alglib_impl::_minasastate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minasastate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -5480,19 +5480,19 @@ minasastate::~minasastate() *************************************************************************/ _minasareport_owner::_minasareport_owner() { - p_struct = (alglib_impl::minasareport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasareport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minasareport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasareport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minasareport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_minasareport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _minasareport_owner::_minasareport_owner(const _minasareport_owner &rhs) { - p_struct = (alglib_impl::minasareport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasareport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::minasareport*)alglib_impl::ae_malloc(sizeof(alglib_impl::minasareport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_minasareport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minasareport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -5501,7 +5501,7 @@ _minasareport_owner& _minasareport_owner::operator=(const _minasareport_owner &r if( this==&rhs ) return *this; alglib_impl::_minasareport_clear(p_struct); - if( !alglib_impl::_minasareport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_minasareport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -5802,8 +5802,8 @@ void minasaoptimize(minasastate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( grad==NULL ) - throw ap_error("ALGLIB: error in 'minasaoptimize()' (grad is NULL)"); + if( grad==nullptr ) + throw ap_error("ALGLIB: error in 'minasaoptimize()' (grad is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -5816,7 +5816,7 @@ void minasaoptimize(minasastate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } @@ -19116,9 +19116,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -19170,9 +19170,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. diff --git a/libs/alglib/src/optimization.h b/libs/alglib/src/optimization.h index eb62e951ca..9417733749 100644 --- a/libs/alglib/src/optimization.h +++ b/libs/alglib/src/optimization.h @@ -1387,9 +1387,9 @@ These functions accept following parameters: grad - callback which calculates function (or merit function) value func and gradient grad at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr NOTES: @@ -1429,12 +1429,12 @@ These functions accept following parameters: *************************************************************************/ void mincgoptimize(mincgstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void mincgoptimize(mincgstate &state, void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* @@ -1918,9 +1918,9 @@ These functions accept following parameters: grad - callback which calculates function (or merit function) value func and gradient grad at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr NOTES: @@ -1960,12 +1960,12 @@ These functions accept following parameters: *************************************************************************/ void minbleicoptimize(minbleicstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minbleicoptimize(minbleicstate &state, void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* @@ -2401,9 +2401,9 @@ These functions accept following parameters: grad - callback which calculates function (or merit function) value func and gradient grad at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr NOTES: @@ -2443,12 +2443,12 @@ These functions accept following parameters: *************************************************************************/ void minlbfgsoptimize(minlbfgsstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minlbfgsoptimize(minlbfgsstate &state, void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* @@ -2623,9 +2623,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -2665,9 +2665,9 @@ INPUT PARAMETERS: A - matrix, array[N,N] IsUpper - (optional) storage type: * if True, symmetric matrix A is given by its upper - triangle, and the lower triangle isn’t used + triangle, and the lower triangle isn�t used * if False, symmetric matrix A is given by its lower - triangle, and the upper triangle isn’t used + triangle, and the upper triangle isn�t used * if not given, both lower and upper triangles must be filled. @@ -3396,9 +3396,9 @@ These functions accept following parameters: jac - callback which calculates function vector fi[] and Jacobian jac at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr NOTES: @@ -3421,30 +3421,30 @@ These functions accept following parameters: *************************************************************************/ void minlmoptimize(minlmstate &state, void (*fvec)(const real_1d_array &x, real_1d_array &fi, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minlmoptimize(minlmstate &state, void (*fvec)(const real_1d_array &x, real_1d_array &fi, void *ptr), void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minlmoptimize(minlmstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), void (*hess)(const real_1d_array &x, double &func, real_1d_array &grad, real_2d_array &hess, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minlmoptimize(minlmstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); void minlmoptimize(minlmstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* @@ -3687,9 +3687,9 @@ These functions accept following parameters: grad - callback which calculates function (or merit function) value func and gradient grad at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr -- ALGLIB -- @@ -3698,8 +3698,8 @@ These functions accept following parameters: *************************************************************************/ void minasaoptimize(minasastate &state, void (*grad)(const real_1d_array &x, double &func, real_1d_array &grad, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* diff --git a/libs/alglib/src/solvers.cpp b/libs/alglib/src/solvers.cpp index 33bb9047a4..a6e9ac5b7c 100644 --- a/libs/alglib/src/solvers.cpp +++ b/libs/alglib/src/solvers.cpp @@ -42,19 +42,19 @@ namespace alglib *************************************************************************/ _densesolverreport_owner::_densesolverreport_owner() { - p_struct = (alglib_impl::densesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::densesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_densesolverreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_densesolverreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _densesolverreport_owner::_densesolverreport_owner(const _densesolverreport_owner &rhs) { - p_struct = (alglib_impl::densesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::densesolverreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_densesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_densesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -63,7 +63,7 @@ _densesolverreport_owner& _densesolverreport_owner::operator=(const _densesolver if( this==&rhs ) return *this; alglib_impl::_densesolverreport_clear(p_struct); - if( !alglib_impl::_densesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_densesolverreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -109,19 +109,19 @@ densesolverreport::~densesolverreport() *************************************************************************/ _densesolverlsreport_owner::_densesolverlsreport_owner() { - p_struct = (alglib_impl::densesolverlsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverlsreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::densesolverlsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverlsreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_densesolverlsreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_densesolverlsreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _densesolverlsreport_owner::_densesolverlsreport_owner(const _densesolverlsreport_owner &rhs) { - p_struct = (alglib_impl::densesolverlsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverlsreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::densesolverlsreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::densesolverlsreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_densesolverlsreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_densesolverlsreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -130,7 +130,7 @@ _densesolverlsreport_owner& _densesolverlsreport_owner::operator=(const _denseso if( this==&rhs ) return *this; alglib_impl::_densesolverlsreport_clear(p_struct); - if( !alglib_impl::_densesolverlsreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_densesolverlsreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1139,19 +1139,19 @@ You should use ALGLIB functions to work with this object. *************************************************************************/ _linlsqrstate_owner::_linlsqrstate_owner() { - p_struct = (alglib_impl::linlsqrstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linlsqrstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linlsqrstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_linlsqrstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _linlsqrstate_owner::_linlsqrstate_owner(const _linlsqrstate_owner &rhs) { - p_struct = (alglib_impl::linlsqrstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linlsqrstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linlsqrstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linlsqrstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1160,7 +1160,7 @@ _linlsqrstate_owner& _linlsqrstate_owner::operator=(const _linlsqrstate_owner &r if( this==&rhs ) return *this; alglib_impl::_linlsqrstate_clear(p_struct); - if( !alglib_impl::_linlsqrstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linlsqrstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1206,19 +1206,19 @@ linlsqrstate::~linlsqrstate() *************************************************************************/ _linlsqrreport_owner::_linlsqrreport_owner() { - p_struct = (alglib_impl::linlsqrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linlsqrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linlsqrreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_linlsqrreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _linlsqrreport_owner::_linlsqrreport_owner(const _linlsqrreport_owner &rhs) { - p_struct = (alglib_impl::linlsqrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::linlsqrreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::linlsqrreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_linlsqrreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linlsqrreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1227,7 +1227,7 @@ _linlsqrreport_owner& _linlsqrreport_owner::operator=(const _linlsqrreport_owner if( this==&rhs ) return *this; alglib_impl::_linlsqrreport_clear(p_struct); - if( !alglib_impl::_linlsqrreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_linlsqrreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1542,19 +1542,19 @@ Never try to access its fields directly! *************************************************************************/ _lincgstate_owner::_lincgstate_owner() { - p_struct = (alglib_impl::lincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lincgstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_lincgstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _lincgstate_owner::_lincgstate_owner(const _lincgstate_owner &rhs) { - p_struct = (alglib_impl::lincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lincgstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lincgstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lincgstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1563,7 +1563,7 @@ _lincgstate_owner& _lincgstate_owner::operator=(const _lincgstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_lincgstate_clear(p_struct); - if( !alglib_impl::_lincgstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lincgstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -1609,19 +1609,19 @@ lincgstate::~lincgstate() *************************************************************************/ _lincgreport_owner::_lincgreport_owner() { - p_struct = (alglib_impl::lincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lincgreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_lincgreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _lincgreport_owner::_lincgreport_owner(const _lincgreport_owner &rhs) { - p_struct = (alglib_impl::lincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::lincgreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::lincgreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_lincgreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lincgreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -1630,7 +1630,7 @@ _lincgreport_owner& _lincgreport_owner::operator=(const _lincgreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_lincgreport_clear(p_struct); - if( !alglib_impl::_lincgreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_lincgreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2007,19 +2007,19 @@ void lincgsetxrep(const lincgstate &state, const bool needxrep) *************************************************************************/ _nleqstate_owner::_nleqstate_owner() { - p_struct = (alglib_impl::nleqstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::nleqstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_nleqstate_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_nleqstate_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _nleqstate_owner::_nleqstate_owner(const _nleqstate_owner &rhs) { - p_struct = (alglib_impl::nleqstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqstate), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::nleqstate*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqstate), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_nleqstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_nleqstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2028,7 +2028,7 @@ _nleqstate_owner& _nleqstate_owner::operator=(const _nleqstate_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_nleqstate_clear(p_struct); - if( !alglib_impl::_nleqstate_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_nleqstate_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2074,19 +2074,19 @@ nleqstate::~nleqstate() *************************************************************************/ _nleqreport_owner::_nleqreport_owner() { - p_struct = (alglib_impl::nleqreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::nleqreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_nleqreport_init(p_struct, NULL, ae_false) ) + if( !alglib_impl::_nleqreport_init(p_struct, nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } _nleqreport_owner::_nleqreport_owner(const _nleqreport_owner &rhs) { - p_struct = (alglib_impl::nleqreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqreport), NULL); - if( p_struct==NULL ) + p_struct = (alglib_impl::nleqreport*)alglib_impl::ae_malloc(sizeof(alglib_impl::nleqreport), nullptr); + if( p_struct==nullptr ) throw ap_error("ALGLIB: malloc error"); - if( !alglib_impl::_nleqreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_nleqreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); } @@ -2095,7 +2095,7 @@ _nleqreport_owner& _nleqreport_owner::operator=(const _nleqreport_owner &rhs) if( this==&rhs ) return *this; alglib_impl::_nleqreport_clear(p_struct); - if( !alglib_impl::_nleqreport_init_copy(p_struct, const_cast(rhs.p_struct), NULL, ae_false) ) + if( !alglib_impl::_nleqreport_init_copy(p_struct, const_cast(rhs.p_struct), nullptr, ae_false) ) throw ap_error("ALGLIB: malloc error"); return *this; } @@ -2437,10 +2437,10 @@ void nleqsolve(nleqstate &state, void *ptr) { alglib_impl::ae_state _alglib_env_state; - if( func==NULL ) - throw ap_error("ALGLIB: error in 'nleqsolve()' (func is NULL)"); - if( jac==NULL ) - throw ap_error("ALGLIB: error in 'nleqsolve()' (jac is NULL)"); + if( func==nullptr ) + throw ap_error("ALGLIB: error in 'nleqsolve()' (func is nullptr)"); + if( jac==nullptr ) + throw ap_error("ALGLIB: error in 'nleqsolve()' (jac is nullptr)"); alglib_impl::ae_state_init(&_alglib_env_state); try { @@ -2458,7 +2458,7 @@ void nleqsolve(nleqstate &state, } if( state.xupdated ) { - if( rep!=NULL ) + if( rep!=nullptr ) rep(state.x, state.f, ptr); continue; } diff --git a/libs/alglib/src/solvers.h b/libs/alglib/src/solvers.h index 3c94873dd4..ed740b9881 100644 --- a/libs/alglib/src/solvers.h +++ b/libs/alglib/src/solvers.h @@ -1628,9 +1628,9 @@ These functions accept following parameters: jac - callback which calculates function vector fi[] and Jacobian jac at given point x rep - optional callback which is called after each iteration - can be NULL + can be nullptr ptr - optional pointer which is passed to func/grad/hess/jac/rep - can be NULL + can be nullptr -- ALGLIB -- @@ -1640,8 +1640,8 @@ These functions accept following parameters: void nleqsolve(nleqstate &state, void (*func)(const real_1d_array &x, double &func, void *ptr), void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr), - void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, - void *ptr = NULL); + void (*rep)(const real_1d_array &x, double func, void *ptr) = nullptr, + void *ptr = nullptr); /************************************************************************* From 8d23e4a47f05f71af4f075f805478e90783ff081 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:09:57 +0900 Subject: [PATCH 02/23] alglib: Change from NULL to nullptr --- libs/alglib/tests/test_c.cpp | 48 ++++++++++++++++++------------------ libs/alglib/tests/test_x.cpp | 4 +-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libs/alglib/tests/test_c.cpp b/libs/alglib/tests/test_c.cpp index 1f23e62c98..fd28432cff 100644 --- a/libs/alglib/tests/test_c.cpp +++ b/libs/alglib/tests/test_c.cpp @@ -78371,12 +78371,12 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) * b) "conventional local" is valid by default * b) unitinitialized shared pool is "not initialized" */ - if( prec2!=NULL ) + if( prec2!=nullptr ) { ae_frame_leave(_state); return result; } - if( !(&seedrec1!=NULL) ) + if( !(&seedrec1!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78404,7 +78404,7 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) seedrec2.bval = !seedrec2.bval; seedrec2.recval.i1val.ptr.p_int[0] = seedrec2.recval.i1val.ptr.p_int[0]+1; ae_shared_pool_retrieve(&pool, &_prec2, _state); - if( !(prec2!=NULL) ) + if( !(prec2!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78454,13 +78454,13 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) ae_shared_pool_retrieve(&pool, &_prec2, _state); prec2->recval.ival = prec2->recval.ival+1; ae_shared_pool_recycle(&pool, &_prec2, _state); - if( prec2!=NULL ) + if( prec2!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_retrieve(&pool, &_prec2, _state); - if( !(prec2!=NULL) ) + if( !(prec2!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78473,7 +78473,7 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) ae_shared_pool_recycle(&pool, &_prec2, _state); ae_shared_pool_clear_recycled(&pool, _state); ae_shared_pool_retrieve(&pool, &_prec2, _state); - if( !(prec2!=NULL) ) + if( !(prec2!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78506,7 +78506,7 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) val101cnt = 0; val102cnt = 0; ae_shared_pool_first_recycled(&pool, &_prec2, _state); - while(prec2!=NULL) + while(prec2!=nullptr) { if( prec2->recval.ival==100 ) { @@ -78531,7 +78531,7 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) val101cnt = 0; val102cnt = 0; ae_shared_pool_first_recycled(&pool, &_prec2, _state); - while(prec2!=NULL) + while(prec2!=nullptr) { if( prec2->recval.ival==100 ) { @@ -78564,14 +78564,14 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) */ testalglibbasicsunit_createpoolandrecords(&seedrec2, &seedrec2copy, &pool, _state); ae_shared_pool_set_seed(&pool2, &pool, sizeof(pool), ae_shared_pool_init, ae_shared_pool_init_copy, ae_shared_pool_destroy, _state); - if( ppool0!=NULL||ppool1!=NULL ) + if( ppool0!=nullptr||ppool1!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_retrieve(&pool2, &_ppool0, _state); ae_shared_pool_retrieve(&pool2, &_ppool1, _state); - if( !(ppool0!=NULL&&ppool1!=NULL) ) + if( !(ppool0!=nullptr&&ppool1!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78635,50 +78635,50 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) ae_shared_pool_recycle(&pool, &_p2, _state); ae_shared_pool_recycle(&pool, &_p0, _state); ae_shared_pool_first_recycled(&pool, &_p0, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( p0!=NULL ) + if( p0!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_reset(&pool, _state); ae_shared_pool_first_recycled(&pool, &_p0, _state); - if( p0!=NULL ) + if( p0!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( p0!=NULL ) + if( p0!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( p0!=NULL ) + if( p0!=nullptr ) { ae_frame_leave(_state); return result; } ae_shared_pool_next_recycled(&pool, &_p0, _state); - if( p0!=NULL ) + if( p0!=nullptr ) { ae_frame_leave(_state); return result; @@ -78695,13 +78695,13 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) ae_shared_pool_recycle(&pool, &_p2, _state); ae_shared_pool_recycle(&pool, &_p0, _state); ae_shared_pool_first_recycled(&pool, &_p0, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; } ae_shared_pool_clear_recycled(&pool, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; @@ -78712,13 +78712,13 @@ static ae_bool testalglibbasicsunit_sharedpoolerrors(ae_state *_state) */ testalglibbasicsunit_createpoolandrecords(&seedrec2, &seedrec2copy, &pool, _state); ae_shared_pool_retrieve(&pool, &_p0, _state); - if( !(p0!=NULL) ) + if( !(p0!=nullptr) ) { ae_frame_leave(_state); return result; } - ae_smart_ptr_assign(&_p0, NULL, ae_false, ae_false, NULL); - if( p0!=NULL ) + ae_smart_ptr_assign(&_p0, nullptr, ae_false, ae_false, nullptr); + if( p0!=nullptr ) { ae_frame_leave(_state); return result; @@ -79065,7 +79065,7 @@ static ae_bool testalglibbasicsunit_performtestpoolsum(ae_state *_state) testalglibbasicsunit_parallelpoolsum(&pool, 0, n, _state); sum = 0; ae_shared_pool_first_recycled(&pool, &_ptr, _state); - while(ptr!=NULL) + while(ptr!=nullptr) { sum = sum+ptr->val; ae_shared_pool_next_recycled(&pool, &_ptr, _state); diff --git a/libs/alglib/tests/test_x.cpp b/libs/alglib/tests/test_x.cpp index d53d4f059e..c337778411 100644 --- a/libs/alglib/tests/test_x.cpp +++ b/libs/alglib/tests/test_x.cpp @@ -1096,7 +1096,7 @@ int main() double epsg = 1.0E-9; mincgcreate(1, x, state); mincgsetcond(state, epsg, 0.0, 0.0, 0); - mincgoptimize(state, func505_grad, NULL, &x0); + mincgoptimize(state, func505_grad, nullptr, &x0); mincgresults(state, x, rep); issue505_passed = issue505_passed && (fabs(4*pow(x[0]-x0,3)) Date: Sun, 21 Jul 2019 19:10:51 +0900 Subject: [PATCH 03/23] opmapcontrol: Change from NULL to nullptr --- libs/opmapcontrol/src/core/pureimagecache.cpp | 8 ++++---- .../opmapcontrol/src/mapwidget/opmapwidget.cpp | 14 +++++++------- .../src/mapwidget/waypointitem.cpp | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libs/opmapcontrol/src/core/pureimagecache.cpp b/libs/opmapcontrol/src/core/pureimagecache.cpp index efda418754..8eb601feca 100644 --- a/libs/opmapcontrol/src/core/pureimagecache.cpp +++ b/libs/opmapcontrol/src/core/pureimagecache.cpp @@ -103,7 +103,7 @@ namespace core { return false; } QSqlQuery query(db); - query.exec("CREATE TABLE IF NOT EXISTS Tiles (id INTEGER NOT NULL PRIMARY KEY, X INTEGER NOT NULL, Y INTEGER NOT NULL, Zoom INTEGER NOT NULL, Type INTEGER NOT NULL,Date TEXT)"); + query.exec("CREATE TABLE IF NOT EXISTS Tiles (id INTEGER NOT nullptr PRIMARY KEY, X INTEGER NOT nullptr, Y INTEGER NOT nullptr, Zoom INTEGER NOT nullptr, Type INTEGER NOT nullptr,Date TEXT)"); if(query.numRowsAffected()==-1) { #ifdef DEBUG_PUREIMAGECACHE @@ -112,7 +112,7 @@ namespace core { db.close(); return false; } - query.exec("CREATE TABLE IF NOT EXISTS TilesData (id INTEGER NOT NULL PRIMARY KEY CONSTRAINT fk_Tiles_id REFERENCES Tiles(id) ON DELETE CASCADE, Tile BLOB NULL)"); + query.exec("CREATE TABLE IF NOT EXISTS TilesData (id INTEGER NOT nullptr PRIMARY KEY CONSTRAINT fk_Tiles_id REFERENCES Tiles(id) ON DELETE CASCADE, Tile BLOB nullptr)"); if(query.numRowsAffected()==-1) { #ifdef DEBUG_PUREIMAGECACHE @@ -126,7 +126,7 @@ namespace core { "BEFORE INSERT ON [TilesData] " "FOR EACH ROW BEGIN " "SELECT RAISE(ROLLBACK, 'insert on table TilesData violates foreign key constraint fki_TilesData_id_Tiles_id') " - "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS nullptr; " "END"); if(query.numRowsAffected()==-1) { @@ -141,7 +141,7 @@ namespace core { "BEFORE UPDATE ON [TilesData] " "FOR EACH ROW BEGIN " "SELECT RAISE(ROLLBACK, 'update on table TilesData violates foreign key constraint fku_TilesData_id_Tiles_id') " - "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS NULL; " + "WHERE (SELECT id FROM Tiles WHERE id = NEW.id) IS nullptr; " "END"); if(query.numRowsAffected()==-1) { diff --git a/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp b/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp index d1aa7ce03d..08824ea5ca 100644 --- a/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp +++ b/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp @@ -137,24 +137,24 @@ namespace mapcontrol void OPMapWidget::DeleteUAV(int id) { - UAVItem* uav = UAVS.value(id, NULL); + UAVItem* uav = UAVS.value(id, nullptr); UAVS.remove(id); if (uav) { delete uav; - uav = NULL; + uav = nullptr; } - QGraphicsItemGroup* wpLine = waypointLines.value(id, NULL); + QGraphicsItemGroup* wpLine = waypointLines.value(id, nullptr); waypointLines.remove(id); if (wpLine) { delete wpLine; - wpLine = NULL; + wpLine = nullptr; } } /** - * @return The reference to the UAVItem or NULL if no item exists yet + * @return The reference to the UAVItem or nullptr if no item exists yet * @see AddUAV() for adding a not yet existing UAV to the map */ UAVItem* OPMapWidget::GetUAV(int id) @@ -169,7 +169,7 @@ namespace mapcontrol QGraphicsItemGroup* OPMapWidget::waypointLine(int id) { - return waypointLines.value(id, NULL); + return waypointLines.value(id, nullptr); } void OPMapWidget::SetShowUAV(const bool &value) @@ -312,7 +312,7 @@ namespace mapcontrol ConnectWP(item); item->setParentItem(map); -// QGraphicsItemGroup* wpLine = waypointLines.value(id, NULL); +// QGraphicsItemGroup* wpLine = waypointLines.value(id, nullptr); // if (!wpLine) // { // wpLine = new QGraphicsItemGroup(map); diff --git a/libs/opmapcontrol/src/mapwidget/waypointitem.cpp b/libs/opmapcontrol/src/mapwidget/waypointitem.cpp index 99d6312b1f..67ff8264ed 100644 --- a/libs/opmapcontrol/src/mapwidget/waypointitem.cpp +++ b/libs/opmapcontrol/src/mapwidget/waypointitem.cpp @@ -34,10 +34,10 @@ namespace mapcontrol WayPointItem::WayPointItem(const internals::PointLatLng &wp_coord, double const& altitude, MapGraphicItem *map, OPMapWidget *parent, const QString &description) : GraphicsItem(map, parent), autoreachedEnabled(true), - text(NULL), - textBG(NULL), - numberI(NULL), - numberIBG(NULL), + text(nullptr), + textBG(nullptr), + numberI(nullptr), + numberIBG(nullptr), reached(false), description(description), shownumber(true), @@ -201,10 +201,10 @@ namespace mapcontrol void WayPointItem::SetShowNumber(const bool &value) { shownumber=value; - if((numberI==NULL) && value) + if((numberI==nullptr) && value) { - Q_ASSERT(numberI == NULL); - Q_ASSERT(numberIBG == NULL); + Q_ASSERT(numberI == nullptr); + Q_ASSERT(numberIBG == nullptr); numberI=new QGraphicsSimpleTextItem(this); numberIBG=new QGraphicsRectItem(this); numberIBG->setBrush(Qt::black); @@ -219,9 +219,9 @@ namespace mapcontrol else if (!value && numberI) { delete numberI; - numberI = NULL; + numberI = nullptr; delete numberIBG; - numberIBG = NULL; + numberIBG = nullptr; } this->update(); From 8ee010ab0ceaafa72ffe3f8d565dad8c55a68f3e Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:11:21 +0900 Subject: [PATCH 04/23] qwt: Change from NULL to nullptr --- libs/qwt/qwt_abstract_scale.cpp | 6 +++--- libs/qwt/qwt_abstract_slider.cpp | 2 +- libs/qwt/qwt_abstract_slider.h | 2 +- libs/qwt/qwt_analog_clock.cpp | 4 ++-- libs/qwt/qwt_analog_clock.h | 2 +- libs/qwt/qwt_arrow_button.cpp | 2 +- libs/qwt/qwt_arrow_button.h | 2 +- libs/qwt/qwt_compass.h | 2 +- libs/qwt/qwt_counter.h | 2 +- libs/qwt/qwt_dial.cpp | 10 +++++----- libs/qwt/qwt_dial.h | 2 +- libs/qwt/qwt_dyngrid_layout.cpp | 12 ++++++------ libs/qwt/qwt_knob.h | 2 +- libs/qwt/qwt_layout_metrics.h | 12 ++++++------ libs/qwt/qwt_legend.cpp | 18 +++++++++--------- libs/qwt/qwt_legend.h | 2 +- libs/qwt/qwt_legend_item.cpp | 2 +- libs/qwt/qwt_magnifier.cpp | 6 +++--- libs/qwt/qwt_paint_buffer.h | 4 ++-- libs/qwt/qwt_panner.cpp | 12 ++++++------ libs/qwt/qwt_picker.cpp | 12 ++++++------ libs/qwt/qwt_plot_axis.cpp | 28 ++++++++++++++-------------- libs/qwt/qwt_plot_canvas.cpp | 10 +++++----- libs/qwt/qwt_plot_canvas.h | 2 +- libs/qwt/qwt_plot_curve.cpp | 4 ++-- libs/qwt/qwt_plot_curve.h | 2 +- libs/qwt/qwt_plot_dict.cpp | 6 +++--- libs/qwt/qwt_plot_item.cpp | 8 ++++---- libs/qwt/qwt_plot_item.h | 4 ++-- libs/qwt/qwt_plot_magnifier.cpp | 4 ++-- libs/qwt/qwt_plot_panner.cpp | 6 +++--- libs/qwt/qwt_plot_picker.cpp | 4 ++-- libs/qwt/qwt_plot_scaleitem.cpp | 4 ++-- libs/qwt/qwt_plot_zoomer.cpp | 2 +- libs/qwt/qwt_thermo.h | 2 +- libs/qwt/qwt_wheel.h | 2 +- 36 files changed, 103 insertions(+), 103 deletions(-) diff --git a/libs/qwt/qwt_abstract_scale.cpp b/libs/qwt/qwt_abstract_scale.cpp index 1f89a45a09..75b540e7e0 100644 --- a/libs/qwt/qwt_abstract_scale.cpp +++ b/libs/qwt/qwt_abstract_scale.cpp @@ -216,10 +216,10 @@ int QwtAbstractScale::scaleMaxMajor() const */ void QwtAbstractScale::setAbstractScaleDraw(QwtAbstractScaleDraw *scaleDraw) { - if ( scaleDraw == NULL || scaleDraw == d_data->scaleDraw ) + if ( scaleDraw == nullptr || scaleDraw == d_data->scaleDraw ) return; - if ( d_data->scaleDraw != NULL ) + if ( d_data->scaleDraw != nullptr ) scaleDraw->setScaleDiv(d_data->scaleDraw->scaleDiv()); delete d_data->scaleDraw; @@ -261,7 +261,7 @@ void QwtAbstractScale::updateScaleDraw() */ void QwtAbstractScale::setScaleEngine(QwtScaleEngine *scaleEngine) { - if ( scaleEngine != NULL && scaleEngine != d_data->scaleEngine ) { + if ( scaleEngine != nullptr && scaleEngine != d_data->scaleEngine ) { delete d_data->scaleEngine; d_data->scaleEngine = scaleEngine; } diff --git a/libs/qwt/qwt_abstract_slider.cpp b/libs/qwt/qwt_abstract_slider.cpp index 0f4dcb2bb2..b585debbe5 100644 --- a/libs/qwt/qwt_abstract_slider.cpp +++ b/libs/qwt/qwt_abstract_slider.cpp @@ -52,7 +52,7 @@ class QwtAbstractSlider::PrivateData */ QwtAbstractSlider::QwtAbstractSlider( Qt::Orientation orientation, QWidget *parent): - QWidget(parent, NULL) + QWidget(parent, nullptr) { d_data = new QwtAbstractSlider::PrivateData; d_data->orientation = orientation; diff --git a/libs/qwt/qwt_abstract_slider.h b/libs/qwt/qwt_abstract_slider.h index 3a4a48fe43..30e085f06f 100644 --- a/libs/qwt/qwt_abstract_slider.h +++ b/libs/qwt/qwt_abstract_slider.h @@ -55,7 +55,7 @@ class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange ScrPage }; - explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL); + explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = nullptr); virtual ~QwtAbstractSlider(); void setUpdateTime(int t); diff --git a/libs/qwt/qwt_analog_clock.cpp b/libs/qwt/qwt_analog_clock.cpp index e42c6b6616..644db4176a 100644 --- a/libs/qwt/qwt_analog_clock.cpp +++ b/libs/qwt/qwt_analog_clock.cpp @@ -69,7 +69,7 @@ void QwtAnalogClock::initClock() QwtDialSimpleNeedle::Arrow, true, handColor, knobColor); hand->setWidth(width); - d_hand[i] = NULL; + d_hand[i] = nullptr; setHand((Hand)i, hand); } } @@ -113,7 +113,7 @@ void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle) QwtDialNeedle *QwtAnalogClock::hand(Hand hd) { if ( hd < 0 || hd >= NHands ) - return NULL; + return nullptr; return d_hand[hd]; } diff --git a/libs/qwt/qwt_analog_clock.h b/libs/qwt/qwt_analog_clock.h index a660a9d4ee..45ca63e38d 100644 --- a/libs/qwt/qwt_analog_clock.h +++ b/libs/qwt/qwt_analog_clock.h @@ -60,7 +60,7 @@ class QWT_EXPORT QwtAnalogClock: public QwtDial NHands }; - explicit QwtAnalogClock(QWidget* parent = NULL); + explicit QwtAnalogClock(QWidget* parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtAnalogClock(QWidget* parent, const char *name); #endif diff --git a/libs/qwt/qwt_arrow_button.cpp b/libs/qwt/qwt_arrow_button.cpp index d51c445ad9..7113e56e9f 100644 --- a/libs/qwt/qwt_arrow_button.cpp +++ b/libs/qwt/qwt_arrow_button.cpp @@ -82,7 +82,7 @@ QwtArrowButton::QwtArrowButton(int num, QwtArrowButton::~QwtArrowButton() { delete d_data; - d_data = NULL; + d_data = nullptr; } /*! diff --git a/libs/qwt/qwt_arrow_button.h b/libs/qwt/qwt_arrow_button.h index a47d3236f5..fc697498d5 100644 --- a/libs/qwt/qwt_arrow_button.h +++ b/libs/qwt/qwt_arrow_button.h @@ -23,7 +23,7 @@ class QWT_EXPORT QwtArrowButton : public QPushButton { public: - explicit QwtArrowButton (int num, Qt::ArrowType, QWidget *parent = NULL); + explicit QwtArrowButton (int num, Qt::ArrowType, QWidget *parent = nullptr); virtual ~QwtArrowButton(); Qt::ArrowType arrowType() const; diff --git a/libs/qwt/qwt_compass.h b/libs/qwt/qwt_compass.h index ed6d06d0a9..cb73cc7712 100644 --- a/libs/qwt/qwt_compass.h +++ b/libs/qwt/qwt_compass.h @@ -50,7 +50,7 @@ class QWT_EXPORT QwtCompass: public QwtDial Q_OBJECT public: - explicit QwtCompass( QWidget* parent = NULL); + explicit QwtCompass( QWidget* parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtCompass(QWidget* parent, const char *name); #endif diff --git a/libs/qwt/qwt_counter.h b/libs/qwt/qwt_counter.h index bda399cce3..b7f1959b76 100644 --- a/libs/qwt/qwt_counter.h +++ b/libs/qwt/qwt_counter.h @@ -83,7 +83,7 @@ class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange ButtonCnt }; - explicit QwtCounter(QWidget *parent = NULL); + explicit QwtCounter(QWidget *parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtCounter(QWidget *parent, const char *name); #endif diff --git a/libs/qwt/qwt_dial.cpp b/libs/qwt/qwt_dial.cpp index 35f77b022b..ca15829046 100644 --- a/libs/qwt/qwt_dial.cpp +++ b/libs/qwt/qwt_dial.cpp @@ -108,7 +108,7 @@ uint QwtDialScaleDraw::penWidth() const */ QwtText QwtDialScaleDraw::label(double value) const { - if ( d_parent == NULL ) + if ( d_parent == nullptr ) return QwtRoundScaleDraw::label(value); return d_parent->scaleLabel(value); @@ -668,7 +668,7 @@ void QwtDial::drawNeedle(QPainter *painter, const QPoint ¢er, void QwtDial::drawScale(QPainter *painter, const QPoint ¢er, int radius, double origin, double minArc, double maxArc) const { - if ( d_data->scaleDraw == NULL ) + if ( d_data->scaleDraw == nullptr ) return; origin -= 270.0; // hardcoded origin of QwtScaleDraw @@ -831,7 +831,7 @@ void QwtDial::setScale(int maxMajIntv, int maxMinIntv, double step) A wrapper method for accessing the scale draw. - options == 0\n - No visible scale: setScaleDraw(NULL) + No visible scale: setScaleDraw(nullptr) - options & ScaleBackbone\n En/disable the backbone of the scale. - options & ScaleTicks\n @@ -844,10 +844,10 @@ void QwtDial::setScale(int maxMajIntv, int maxMinIntv, double step) void QwtDial::setScaleOptions(int options) { if ( options == 0 ) - setScaleDraw(NULL); + setScaleDraw(nullptr); QwtDialScaleDraw *sd = d_data->scaleDraw; - if ( sd == NULL ) + if ( sd == nullptr ) return; sd->enableComponent(QwtAbstractScaleDraw::Backbone, diff --git a/libs/qwt/qwt_dial.h b/libs/qwt/qwt_dial.h index 37e5e783fe..fdcdc9c076 100644 --- a/libs/qwt/qwt_dial.h +++ b/libs/qwt/qwt_dial.h @@ -112,7 +112,7 @@ class QWT_EXPORT QwtDial: public QwtAbstractSlider RotateScale }; - explicit QwtDial( QWidget *parent = NULL); + explicit QwtDial( QWidget *parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtDial( QWidget *parent, const char *name); #endif diff --git a/libs/qwt/qwt_dyngrid_layout.cpp b/libs/qwt/qwt_dyngrid_layout.cpp index ac98ad1c03..c1f403df26 100644 --- a/libs/qwt/qwt_dyngrid_layout.cpp +++ b/libs/qwt/qwt_dyngrid_layout.cpp @@ -32,25 +32,25 @@ class QwtDynGridLayout::PrivateData virtual QLayoutItem *current() { if (d_iterator == d_data->itemList.end()) - return NULL; + return nullptr; return *d_iterator; } virtual QLayoutItem *next() { if (d_iterator == d_data->itemList.end()) - return NULL; + return nullptr; d_iterator++; if (d_iterator == d_data->itemList.end()) - return NULL; + return nullptr; return *d_iterator; } virtual QLayoutItem *takeCurrent() { if ( d_iterator == d_data->itemList.end() ) - return NULL; + return nullptr; QLayoutItem *item = *d_iterator; @@ -269,7 +269,7 @@ QSizePolicy::ExpandData QwtDynGridLayout::expanding() const QLayoutItem *QwtDynGridLayout::itemAt( int index ) const { if ( index < 0 || index >= d_data->itemList.count() ) - return NULL; + return nullptr; return d_data->itemList.at(index); } @@ -277,7 +277,7 @@ QLayoutItem *QwtDynGridLayout::itemAt( int index ) const QLayoutItem *QwtDynGridLayout::takeAt( int index ) { if ( index < 0 || index >= d_data->itemList.count() ) - return NULL; + return nullptr; d_data->isDirty = true; return d_data->itemList.takeAt(index); diff --git a/libs/qwt/qwt_knob.h b/libs/qwt/qwt_knob.h index ee43aa71b4..d3c5bc1254 100644 --- a/libs/qwt/qwt_knob.h +++ b/libs/qwt/qwt_knob.h @@ -48,7 +48,7 @@ class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScale enum Symbol { Line, Dot }; - explicit QwtKnob(QWidget* parent = NULL); + explicit QwtKnob(QWidget* parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtKnob(QWidget* parent, const char *name); #endif diff --git a/libs/qwt/qwt_layout_metrics.h b/libs/qwt/qwt_layout_metrics.h index 4cb35b02af..332e8b8d9f 100644 --- a/libs/qwt/qwt_layout_metrics.h +++ b/libs/qwt/qwt_layout_metrics.h @@ -48,8 +48,8 @@ class QWT_EXPORT QwtMetricsMap int screenToLayoutY(int y) const; int layoutToScreenY(int y) const; - QPoint layoutToDevice(const QPoint &, const QPainter * = NULL) const; - QPoint deviceToLayout(const QPoint &, const QPainter * = NULL) const; + QPoint layoutToDevice(const QPoint &, const QPainter * = nullptr) const; + QPoint deviceToLayout(const QPoint &, const QPainter * = nullptr) const; QPoint screenToLayout(const QPoint &) const; QPoint layoutToScreen(const QPoint &point) const; @@ -59,15 +59,15 @@ class QWT_EXPORT QwtMetricsMap QSize screenToLayout(const QSize &) const; QSize layoutToScreen(const QSize &) const; - QRect layoutToDevice(const QRect &, const QPainter * = NULL) const; - QRect deviceToLayout(const QRect &, const QPainter * = NULL) const; + QRect layoutToDevice(const QRect &, const QPainter * = nullptr) const; + QRect deviceToLayout(const QRect &, const QPainter * = nullptr) const; QRect screenToLayout(const QRect &) const; QRect layoutToScreen(const QRect &) const; QwtPolygon layoutToDevice(const QwtPolygon &, - const QPainter * = NULL) const; + const QPainter * = nullptr) const; QwtPolygon deviceToLayout(const QwtPolygon &, - const QPainter * = NULL) const; + const QPainter * = nullptr) const; #if QT_VERSION < 0x040000 static QwtPolygon translate(const QWMatrix &, const QwtPolygon &); diff --git a/libs/qwt/qwt_legend.cpp b/libs/qwt/qwt_legend.cpp index c06236471f..05bc4a2103 100644 --- a/libs/qwt/qwt_legend.cpp +++ b/libs/qwt/qwt_legend.cpp @@ -202,7 +202,7 @@ uint QwtLegend::PrivateData::LegendMap::count() const inline const QWidget *QwtLegend::PrivateData::LegendMap::find(const QwtLegendItemManager *item) const { if ( !d_itemMap.contains((QwtLegendItemManager *)item) ) - return NULL; + return nullptr; return d_itemMap[(QwtLegendItemManager *)item]; } @@ -210,7 +210,7 @@ inline const QWidget *QwtLegend::PrivateData::LegendMap::find(const QwtLegendIte inline QWidget *QwtLegend::PrivateData::LegendMap::find(const QwtLegendItemManager *item) { if ( !d_itemMap.contains((QwtLegendItemManager *)item) ) - return NULL; + return nullptr; return d_itemMap[(QwtLegendItemManager *)item]; } @@ -219,7 +219,7 @@ inline const QwtLegendItemManager *QwtLegend::PrivateData::LegendMap::find( const QWidget *widget) const { if ( !d_widgetMap.contains((QWidget *)widget) ) - return NULL; + return nullptr; return d_widgetMap[(QWidget *)widget]; } @@ -228,7 +228,7 @@ inline QwtLegendItemManager *QwtLegend::PrivateData::LegendMap::find( const QWidget *widget) { if ( !d_widgetMap.contains((QWidget *)widget) ) - return NULL; + return nullptr; return (QwtLegendItemManager *)d_widgetMap[(QWidget *)widget]; } @@ -377,7 +377,7 @@ const QWidget *QwtLegend::contentsWidget() const */ void QwtLegend::insert(const QwtLegendItemManager *plotItem, QWidget *legendItem) { - if ( legendItem == NULL || plotItem == NULL ) + if ( legendItem == nullptr || plotItem == nullptr ) return; QWidget *contentsWidget = d_data->view->contentsWidget; @@ -403,7 +403,7 @@ void QwtLegend::insert(const QwtLegendItemManager *plotItem, QWidget *legendItem // set tab focus chain - QWidget *w = NULL; + QWidget *w = nullptr; #if QT_VERSION < 0x040000 QLayoutIterator layoutIterator = @@ -420,7 +420,7 @@ void QwtLegend::insert(const QwtLegendItemManager *plotItem, QWidget *legendItem } } } - if ( parentWidget() && parentWidget()->layout() == NULL ) { + if ( parentWidget() && parentWidget()->layout() == nullptr ) { /* updateGeometry() doesn't post LayoutRequest in certain situations, like when we are hidden. But we want the @@ -441,7 +441,7 @@ void QwtLegend::insert(const QwtLegendItemManager *plotItem, QWidget *legendItem Find the widget that represents a plot item \param plotItem Plot item - \return Widget on the legend, or NULL + \return Widget on the legend, or nullptr */ QWidget *QwtLegend::find(const QwtLegendItemManager *plotItem) const { @@ -452,7 +452,7 @@ QWidget *QwtLegend::find(const QwtLegendItemManager *plotItem) const Find the widget that represents a plot item \param plotItem Plot item - \return Widget on the legend, or NULL + \return Widget on the legend, or nullptr */ QwtLegendItemManager *QwtLegend::find(const QWidget *legendItem) const { diff --git a/libs/qwt/qwt_legend.h b/libs/qwt/qwt_legend.h index 4d73069921..e45cb6bfe3 100644 --- a/libs/qwt/qwt_legend.h +++ b/libs/qwt/qwt_legend.h @@ -72,7 +72,7 @@ class QWT_EXPORT QwtLegend : public QFrame CheckableItem }; - explicit QwtLegend(QWidget *parent = NULL); + explicit QwtLegend(QWidget *parent = nullptr); virtual ~QwtLegend(); void setDisplayPolicy(LegendDisplayPolicy policy, int mode); diff --git a/libs/qwt/qwt_legend_item.cpp b/libs/qwt/qwt_legend_item.cpp index 2e32a794c2..b6b4812388 100644 --- a/libs/qwt/qwt_legend_item.cpp +++ b/libs/qwt/qwt_legend_item.cpp @@ -114,7 +114,7 @@ void QwtLegendItem::init(const QwtText &text) QwtLegendItem::~QwtLegendItem() { delete d_data; - d_data = NULL; + d_data = nullptr; } /*! diff --git a/libs/qwt/qwt_magnifier.cpp b/libs/qwt/qwt_magnifier.cpp index 61b0d8ee16..6ddbdcb8da 100644 --- a/libs/qwt/qwt_magnifier.cpp +++ b/libs/qwt/qwt_magnifier.cpp @@ -319,7 +319,7 @@ bool QwtMagnifier::eventFilter(QObject *o, QEvent *e) */ void QwtMagnifier::widgetMousePressEvent(QMouseEvent *me) { - if ( me->button() != d_data->mouseButton || parentWidget() == NULL ) + if ( me->button() != d_data->mouseButton || parentWidget() == nullptr ) return; #if QT_VERSION < 0x040000 @@ -451,7 +451,7 @@ QWidget *QwtMagnifier::parentWidget() if ( parent()->inherits("QWidget") ) return (QWidget *)parent(); - return NULL; + return nullptr; } const QWidget *QwtMagnifier::parentWidget() const @@ -459,6 +459,6 @@ const QWidget *QwtMagnifier::parentWidget() const if ( parent()->inherits("QWidget") ) return (const QWidget *)parent(); - return NULL; + return nullptr; } diff --git a/libs/qwt/qwt_paint_buffer.h b/libs/qwt/qwt_paint_buffer.h index af51f50f5c..b96be523ed 100644 --- a/libs/qwt/qwt_paint_buffer.h +++ b/libs/qwt/qwt_paint_buffer.h @@ -30,11 +30,11 @@ class QWT_EXPORT QwtPaintBuffer { public: explicit QwtPaintBuffer(); - explicit QwtPaintBuffer(QPaintDevice *, const QRect &, QPainter *p = NULL); + explicit QwtPaintBuffer(QPaintDevice *, const QRect &, QPainter *p = nullptr); virtual ~QwtPaintBuffer(); - void open(QPaintDevice *, const QRect &, QPainter *p = NULL); + void open(QPaintDevice *, const QRect &, QPainter *p = nullptr); void close(); QPainter *painter(); diff --git a/libs/qwt/qwt_panner.cpp b/libs/qwt/qwt_panner.cpp index deae929181..7bd36c7438 100644 --- a/libs/qwt/qwt_panner.cpp +++ b/libs/qwt/qwt_panner.cpp @@ -63,8 +63,8 @@ class QwtPanner::PrivateData abortKey(Qt::Key_Escape), abortKeyState(Qt::NoButton), #ifndef QT_NO_CURSOR - cursor(NULL), - restoreCursor(NULL), + cursor(nullptr), + restoreCursor(nullptr), hasCursor(false), #endif isEnabled(false) { @@ -327,7 +327,7 @@ void QwtPanner::paintEvent(QPaintEvent *pe) */ bool QwtPanner::eventFilter(QObject *o, QEvent *e) { - if ( o == NULL || o != parentWidget() ) + if ( o == nullptr || o != parentWidget() ) return false; switch(e->type()) { @@ -376,7 +376,7 @@ void QwtPanner::widgetMousePressEvent(QMouseEvent *me) return; QWidget *w = parentWidget(); - if ( w == NULL ) + if ( w == nullptr ) return; #if QT_VERSION < 0x040000 @@ -518,7 +518,7 @@ void QwtPanner::showCursor(bool on) return; QWidget *w = parentWidget(); - if ( w == NULL || d_data->cursor == NULL ) + if ( w == nullptr || d_data->cursor == nullptr ) return; d_data->hasCursor = on; @@ -538,7 +538,7 @@ void QwtPanner::showCursor(bool on) if ( d_data->restoreCursor ) { w->setCursor(*d_data->restoreCursor); delete d_data->restoreCursor; - d_data->restoreCursor = NULL; + d_data->restoreCursor = nullptr; } else w->unsetCursor(); } diff --git a/libs/qwt/qwt_picker.cpp b/libs/qwt/qwt_picker.cpp index 2ddd892769..605c9f0f45 100644 --- a/libs/qwt/qwt_picker.cpp +++ b/libs/qwt/qwt_picker.cpp @@ -270,8 +270,8 @@ void QwtPicker::init(QWidget *parent, int selectionFlags, { d_data = new PrivateData; - d_data->rubberBandWidget = NULL; - d_data->trackerWidget = NULL; + d_data->rubberBandWidget = nullptr; + d_data->trackerWidget = nullptr; d_data->rubberBand = rubberBand; d_data->enabled = false; @@ -281,7 +281,7 @@ void QwtPicker::init(QWidget *parent, int selectionFlags, d_data->trackerPosition = QPoint(-1, -1); d_data->mouseTracking = false; - d_data->stateMachine = NULL; + d_data->stateMachine = nullptr; setSelectionFlags(selectionFlags); if ( parent ) { @@ -349,7 +349,7 @@ QwtPickerMachine *QwtPicker::stateMachine(int flags) const if ( flags & PolygonSelection ) { return new QwtPickerPolygonMachine(); } - return NULL; + return nullptr; } //! Return the parent widget, where the selection happens @@ -359,7 +359,7 @@ QWidget *QwtPicker::parentWidget() if ( obj && obj->isWidgetType() ) return (QWidget *)obj; - return NULL; + return nullptr; } //! Return the parent widget, where the selection happens @@ -369,7 +369,7 @@ const QWidget *QwtPicker::parentWidget() const if ( obj && obj->isWidgetType() ) return (QWidget *)obj; - return NULL; + return nullptr; } /*! diff --git a/libs/qwt/qwt_plot_axis.cpp b/libs/qwt/qwt_plot_axis.cpp index 5f1a9a501f..7a7fd41f34 100644 --- a/libs/qwt/qwt_plot_axis.cpp +++ b/libs/qwt/qwt_plot_axis.cpp @@ -87,12 +87,12 @@ void QwtPlot::deleteAxesData() for( int axisId = 0; axisId < axisCnt; axisId++) { delete d_axisData[axisId]->scaleEngine; delete d_axisData[axisId]; - d_axisData[axisId] = NULL; + d_axisData[axisId] = nullptr; } } /*! - \return specified axis, or NULL if axisId is invalid. + \return specified axis, or nullptr if axisId is invalid. \param axisId axis index */ const QwtScaleWidget *QwtPlot::axisWidget(int axisId) const @@ -100,11 +100,11 @@ const QwtScaleWidget *QwtPlot::axisWidget(int axisId) const if (axisValid(axisId)) return d_axisData[axisId]->scaleWidget; - return NULL; + return nullptr; } /*! - \return specified axis, or NULL if axisId is invalid. + \return specified axis, or nullptr if axisId is invalid. \param axisId axis index */ QwtScaleWidget *QwtPlot::axisWidget(int axisId) @@ -112,7 +112,7 @@ QwtScaleWidget *QwtPlot::axisWidget(int axisId) if (axisValid(axisId)) return d_axisData[axisId]->scaleWidget; - return NULL; + return nullptr; } /*! @@ -125,7 +125,7 @@ QwtScaleWidget *QwtPlot::axisWidget(int axisId) */ void QwtPlot::setAxisScaleEngine(int axisId, QwtScaleEngine *scaleEngine) { - if (axisValid(axisId) && scaleEngine != NULL ) { + if (axisValid(axisId) && scaleEngine != nullptr ) { AxisData &d = *d_axisData[axisId]; delete d.scaleEngine; @@ -143,7 +143,7 @@ QwtScaleEngine *QwtPlot::axisScaleEngine(int axisId) if (axisValid(axisId)) return d_axisData[axisId]->scaleEngine; else - return NULL; + return nullptr; } //! \return Scale engine for a specific axis @@ -152,7 +152,7 @@ const QwtScaleEngine *QwtPlot::axisScaleEngine(int axisId) const if (axisValid(axisId)) return d_axisData[axisId]->scaleEngine; else - return NULL; + return nullptr; } /*! \return \c true if autoscaling is enabled @@ -232,7 +232,7 @@ int QwtPlot::axisMaxMinor(int axisId) const const QwtScaleDiv *QwtPlot::axisScaleDiv(int axisId) const { if (!axisValid(axisId)) - return NULL; + return nullptr; return &d_axisData[axisId]->scaleDiv; } @@ -251,7 +251,7 @@ const QwtScaleDiv *QwtPlot::axisScaleDiv(int axisId) const QwtScaleDiv *QwtPlot::axisScaleDiv(int axisId) { if (!axisValid(axisId)) - return NULL; + return nullptr; return &d_axisData[axisId]->scaleDiv; } @@ -259,13 +259,13 @@ QwtScaleDiv *QwtPlot::axisScaleDiv(int axisId) /*! \returns the scale draw of a specified axis \param axisId axis index - \return specified scaleDraw for axis, or NULL if axis is invalid. + \return specified scaleDraw for axis, or nullptr if axis is invalid. \sa QwtScaleDraw */ const QwtScaleDraw *QwtPlot::axisScaleDraw(int axisId) const { if (!axisValid(axisId)) - return NULL; + return nullptr; return axisWidget(axisId)->scaleDraw(); } @@ -273,13 +273,13 @@ const QwtScaleDraw *QwtPlot::axisScaleDraw(int axisId) const /*! \returns the scale draw of a specified axis \param axisId axis index - \return specified scaleDraw for axis, or NULL if axis is invalid. + \return specified scaleDraw for axis, or nullptr if axis is invalid. \sa QwtScaleDraw */ QwtScaleDraw *QwtPlot::axisScaleDraw(int axisId) { if (!axisValid(axisId)) - return NULL; + return nullptr; return axisWidget(axisId)->scaleDraw(); } diff --git a/libs/qwt/qwt_plot_canvas.cpp b/libs/qwt/qwt_plot_canvas.cpp index 1980bb46f4..084f2672fd 100644 --- a/libs/qwt/qwt_plot_canvas.cpp +++ b/libs/qwt/qwt_plot_canvas.cpp @@ -31,7 +31,7 @@ class QwtPlotCanvas::PrivateData PrivateData(): focusIndicator(NoFocusIndicator), paintAttributes(0), - cache(NULL) { + cache(nullptr) { } ~PrivateData() { @@ -82,7 +82,7 @@ QwtPlot *QwtPlotCanvas::plot() if ( w && w->inherits("QwtPlot") ) return (QwtPlot *)w; - return NULL; + return nullptr; } //! Return parent plot widget @@ -92,7 +92,7 @@ const QwtPlot *QwtPlotCanvas::plot() const if ( w && w->inherits("QwtPlot") ) return (QwtPlot *)w; - return NULL; + return nullptr; } /*! @@ -118,7 +118,7 @@ void QwtPlotCanvas::setPaintAttribute(PaintAttribute attribute, bool on) switch(attribute) { case PaintCached: { if ( on ) { - if ( d_data->cache == NULL ) + if ( d_data->cache == nullptr ) d_data->cache = new QPixmap(); if ( isVisible() ) { @@ -128,7 +128,7 @@ void QwtPlotCanvas::setPaintAttribute(PaintAttribute attribute, bool on) } } else { delete d_data->cache; - d_data->cache = NULL; + d_data->cache = nullptr; } break; } diff --git a/libs/qwt/qwt_plot_canvas.h b/libs/qwt/qwt_plot_canvas.h index f3ff0ffa21..d8dcec3b7d 100644 --- a/libs/qwt/qwt_plot_canvas.h +++ b/libs/qwt/qwt_plot_canvas.h @@ -103,7 +103,7 @@ class QWT_EXPORT QwtPlotCanvas : public QFrame virtual void drawContents(QPainter *); virtual void drawFocusIndicator(QPainter *); - void drawCanvas(QPainter *painter = NULL); + void drawCanvas(QPainter *painter = nullptr); private: void setSystemBackground(bool); diff --git a/libs/qwt/qwt_plot_curve.cpp b/libs/qwt/qwt_plot_curve.cpp index 6e8eba8764..eb824f6b62 100644 --- a/libs/qwt/qwt_plot_curve.cpp +++ b/libs/qwt/qwt_plot_curve.cpp @@ -541,7 +541,7 @@ void QwtPlotCurve::setRawData(const double *xData, const double *yData, int size QwtDoubleRect QwtPlotCurve::boundingRect() const { - if ( d_xy == NULL ) + if ( d_xy == nullptr ) return QwtDoubleRect(1.0, 1.0, -2.0, -2.0); // invalid return d_xy->boundingRect(); @@ -1266,7 +1266,7 @@ int QwtPlotCurve::dataSize() const int QwtPlotCurve::closestPoint(const QPoint &pos, double *dist) const { - if ( plot() == NULL || dataSize() <= 0 ) + if ( plot() == nullptr || dataSize() <= 0 ) return -1; const QwtScaleMap xMap = plot()->canvasMap(xAxis()); diff --git a/libs/qwt/qwt_plot_curve.h b/libs/qwt/qwt_plot_curve.h index 5e92194649..c0f77ee6b3 100644 --- a/libs/qwt/qwt_plot_curve.h +++ b/libs/qwt/qwt_plot_curve.h @@ -118,7 +118,7 @@ class QWT_EXPORT QwtPlotCurve: public QwtPlotItem #endif void setData(const QwtData &data); - int closestPoint(const QPoint &pos, double *dist = NULL) const; + int closestPoint(const QPoint &pos, double *dist = nullptr) const; QwtData &data(); const QwtData &data() const; diff --git a/libs/qwt/qwt_plot_dict.cpp b/libs/qwt/qwt_plot_dict.cpp index 2de1b4826d..f0729b20a8 100644 --- a/libs/qwt/qwt_plot_dict.cpp +++ b/libs/qwt/qwt_plot_dict.cpp @@ -23,7 +23,7 @@ class QwtPlotDict::PrivateData { public: void insertItem(QwtPlotItem *item) { - if ( item == NULL ) + if ( item == nullptr ) return; // Unfortunately there is no inSort operation @@ -51,7 +51,7 @@ class QwtPlotDict::PrivateData } void removeItem(QwtPlotItem *item) { - if ( item == NULL ) + if ( item == nullptr ) return; int i = 0; @@ -162,7 +162,7 @@ void QwtPlotDict::detachItems(int rtti, bool autoDelete) ++it; // increment before removing item from the list if ( rtti == QwtPlotItem::Rtti_PlotItem || item->rtti() == rtti ) { - item->attach(NULL); + item->attach(nullptr); if ( autoDelete ) delete item; } diff --git a/libs/qwt/qwt_plot_item.cpp b/libs/qwt/qwt_plot_item.cpp index aacceb9853..ade7098960 100644 --- a/libs/qwt/qwt_plot_item.cpp +++ b/libs/qwt/qwt_plot_item.cpp @@ -17,7 +17,7 @@ class QwtPlotItem::PrivateData { public: PrivateData(): - plot(NULL), + plot(nullptr), isVisible(true), attributes(0), #if QT_VERSION >= 0x040000 @@ -53,7 +53,7 @@ QwtPlotItem::QwtPlotItem(const QwtText &title) //! Destroy the QwtPlotItem QwtPlotItem::~QwtPlotItem() { - attach(NULL); + attach(nullptr); delete d_data; } @@ -62,7 +62,7 @@ QwtPlotItem::~QwtPlotItem() This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if - necessary). If a NULL argument is passed, it will detach from any QwtPlot it + necessary). If a nullptr argument is passed, it will detach from any QwtPlot it was attached to. \sa QwtPlotItem::detach() @@ -411,7 +411,7 @@ void QwtPlotItem::updateLegend(QwtLegend *legend) const QWidget *lgdItem = legend->find(this); if ( testItemAttribute(QwtPlotItem::Legend) ) { - if ( lgdItem == NULL ) { + if ( lgdItem == nullptr ) { lgdItem = legendItem(); if ( lgdItem ) { if ( lgdItem->inherits("QwtLegendItem") ) { diff --git a/libs/qwt/qwt_plot_item.h b/libs/qwt/qwt_plot_item.h index 8d1397e23e..954ac9e521 100644 --- a/libs/qwt/qwt_plot_item.h +++ b/libs/qwt/qwt_plot_item.h @@ -65,11 +65,11 @@ class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager \brief This method detaches a QwtPlotItem from any QwtPlot it has been associated with. - detach() is equivalent to calling attach( NULL ) + detach() is equivalent to calling attach( nullptr ) \sa attach( QwtPlot* plot ) */ void detach() { - attach(NULL); + attach(nullptr); } QwtPlot *plot() const; diff --git a/libs/qwt/qwt_plot_magnifier.cpp b/libs/qwt/qwt_plot_magnifier.cpp index e13a441658..3aa07cf293 100644 --- a/libs/qwt/qwt_plot_magnifier.cpp +++ b/libs/qwt/qwt_plot_magnifier.cpp @@ -83,7 +83,7 @@ QwtPlotCanvas *QwtPlotMagnifier::canvas() if ( w && w->inherits("QwtPlotCanvas") ) return (QwtPlotCanvas *)w; - return NULL; + return nullptr; } //! Return Observed plot canvas @@ -102,7 +102,7 @@ QwtPlot *QwtPlotMagnifier::plot() return (QwtPlot *)w; } - return NULL; + return nullptr; } //! Return plot widget, containing the observed plot canvas diff --git a/libs/qwt/qwt_plot_panner.cpp b/libs/qwt/qwt_plot_panner.cpp index a706b14d05..9e0f2cf0ae 100644 --- a/libs/qwt/qwt_plot_panner.cpp +++ b/libs/qwt/qwt_plot_panner.cpp @@ -89,7 +89,7 @@ QwtPlotCanvas *QwtPlotPanner::canvas() if ( w && w->inherits("QwtPlotCanvas") ) return (QwtPlotCanvas *)w; - return NULL; + return nullptr; } //! Return Observed plot canvas @@ -108,7 +108,7 @@ QwtPlot *QwtPlotPanner::plot() return (QwtPlot *)w; } - return NULL; + return nullptr; } //! Return plot widget, containing the observed plot canvas @@ -131,7 +131,7 @@ void QwtPlotPanner::moveCanvas(int dx, int dy) return; QwtPlot *plot = QwtPlotPanner::plot(); - if ( plot == NULL ) + if ( plot == nullptr ) return; const bool doAutoReplot = plot->autoReplot(); diff --git a/libs/qwt/qwt_plot_picker.cpp b/libs/qwt/qwt_plot_picker.cpp index 1bbff38814..03b1c49bdd 100644 --- a/libs/qwt/qwt_plot_picker.cpp +++ b/libs/qwt/qwt_plot_picker.cpp @@ -104,7 +104,7 @@ QwtPlotCanvas *QwtPlotPicker::canvas() if ( w && w->inherits("QwtPlotCanvas") ) return (QwtPlotCanvas *)w; - return NULL; + return nullptr; } //! Return Observed plot canvas @@ -123,7 +123,7 @@ QwtPlot *QwtPlotPicker::plot() return (QwtPlot *)w; } - return NULL; + return nullptr; } //! Return plot widget, containing the observed plot canvas diff --git a/libs/qwt/qwt_plot_scaleitem.cpp b/libs/qwt/qwt_plot_scaleitem.cpp index ea6ec8b026..604d0165fd 100644 --- a/libs/qwt/qwt_plot_scaleitem.cpp +++ b/libs/qwt/qwt_plot_scaleitem.cpp @@ -211,7 +211,7 @@ QFont QwtPlotScaleItem::font() const */ void QwtPlotScaleItem::setScaleDraw(QwtScaleDraw *scaleDraw) { - if ( scaleDraw == NULL ) + if ( scaleDraw == nullptr ) return; if ( scaleDraw != d_data->scaleDraw ) @@ -430,7 +430,7 @@ void QwtPlotScaleItem::updateScaleDiv(const QwtScaleDiv& xScaleDiv, void QwtPlotScaleItem::updateBorders() { const QwtPlot *plt = plot(); - if ( plt == NULL || !d_data->scaleDivFromAxis ) + if ( plt == nullptr || !d_data->scaleDivFromAxis ) return; const QRect r = plt->canvas()->contentsRect(); diff --git a/libs/qwt/qwt_plot_zoomer.cpp b/libs/qwt/qwt_plot_zoomer.cpp index ab8350f9a4..b1d40d311b 100644 --- a/libs/qwt/qwt_plot_zoomer.cpp +++ b/libs/qwt/qwt_plot_zoomer.cpp @@ -203,7 +203,7 @@ QwtDoubleRect QwtPlotZoomer::zoomBase() const void QwtPlotZoomer::setZoomBase(bool doReplot) { QwtPlot *plt = plot(); - if ( plt == NULL ) + if ( plt == nullptr ) return; if ( doReplot ) diff --git a/libs/qwt/qwt_thermo.h b/libs/qwt/qwt_thermo.h index 8d02927a8a..5103a9bcd8 100644 --- a/libs/qwt/qwt_thermo.h +++ b/libs/qwt/qwt_thermo.h @@ -103,7 +103,7 @@ class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale BottomScale }; - explicit QwtThermo(QWidget *parent = NULL); + explicit QwtThermo(QWidget *parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtThermo(QWidget *parent, const char *name); #endif diff --git a/libs/qwt/qwt_wheel.h b/libs/qwt/qwt_wheel.h index a9649ddffe..f7b5884620 100644 --- a/libs/qwt/qwt_wheel.h +++ b/libs/qwt/qwt_wheel.h @@ -32,7 +32,7 @@ class QWT_EXPORT QwtWheel : public QwtAbstractSlider Q_PROPERTY( double mass READ mass WRITE setMass ) public: - explicit QwtWheel(QWidget *parent = NULL); + explicit QwtWheel(QWidget *parent = nullptr); #if QT_VERSION < 0x040000 explicit QwtWheel(QWidget *parent, const char *name); #endif From 1c2f37f1e65dff6a42db726d1fa8a4bd56428ed9 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:12:12 +0900 Subject: [PATCH 05/23] quazip: Change from NULL to nullptr --- libs/thirdParty/quazip/qioapi.cpp | 6 ++-- libs/thirdParty/quazip/quagzipfile.cpp | 6 ++-- libs/thirdParty/quazip/quagzipfile.h | 2 +- libs/thirdParty/quazip/quaziodevice.cpp | 20 ++++++------- libs/thirdParty/quazip/quaziodevice.h | 2 +- libs/thirdParty/quazip/quazip.cpp | 32 ++++++++++---------- libs/thirdParty/quazip/quazip.h | 8 ++--- libs/thirdParty/quazip/quazipfile.cpp | 40 ++++++++++++------------- libs/thirdParty/quazip/quazipfile.h | 20 ++++++------- 9 files changed, 68 insertions(+), 68 deletions(-) diff --git a/libs/thirdParty/quazip/qioapi.cpp b/libs/thirdParty/quazip/qioapi.cpp index 52141644f5..8a6bce10dd 100644 --- a/libs/thirdParty/quazip/qioapi.cpp +++ b/libs/thirdParty/quazip/qioapi.cpp @@ -58,12 +58,12 @@ voidpf ZCALLBACK qiodevice_open_file_func ( if (iodevice->isOpen()) { if (iodevice->isSequential()) { iodevice->close(); - return NULL; + return nullptr; } else { return iodevice; } } else - return NULL; + return nullptr; } @@ -150,5 +150,5 @@ void fill_qiodevice_filefunc ( pzlib_filefunc_def->zseek_file = qiodevice_seek_file_func; pzlib_filefunc_def->zclose_file = qiodevice_close_file_func; pzlib_filefunc_def->zerror_file = qiodevice_error_file_func; - pzlib_filefunc_def->opaque = NULL; + pzlib_filefunc_def->opaque = nullptr; } diff --git a/libs/thirdParty/quazip/quagzipfile.cpp b/libs/thirdParty/quazip/quagzipfile.cpp index be07ffe602..7675371c77 100644 --- a/libs/thirdParty/quazip/quagzipfile.cpp +++ b/libs/thirdParty/quazip/quagzipfile.cpp @@ -7,9 +7,9 @@ class QuaGzipFilePrivate { friend class QuaGzipFile; QString fileName; gzFile gzd; - inline QuaGzipFilePrivate(): gzd(NULL) {} + inline QuaGzipFilePrivate(): gzd(nullptr) {} inline QuaGzipFilePrivate(const QString &fileName): - fileName(fileName), gzd(NULL) {} + fileName(fileName), gzd(nullptr) {} template bool open(FileId id, QIODevice::OpenMode mode, QString &error); gzFile open(int fd, const char *modeString); @@ -52,7 +52,7 @@ bool QuaGzipFilePrivate::open(FileId id, QIODevice::OpenMode mode, return false; } gzd = open(id, modeString); - if (gzd == NULL) { + if (gzd == nullptr) { error = QuaGzipFile::trUtf8("Could not gzopen() file"); return false; } diff --git a/libs/thirdParty/quazip/quagzipfile.h b/libs/thirdParty/quazip/quagzipfile.h index 63bfdfdf71..c7d6bbf458 100644 --- a/libs/thirdParty/quazip/quagzipfile.h +++ b/libs/thirdParty/quazip/quagzipfile.h @@ -31,7 +31,7 @@ class QUAZIP_EXPORT QuaGzipFile: public QIODevice { \param fileName The name of the GZIP file. \param parent The parent object, as per QObject logic. */ - QuaGzipFile(const QString &fileName, QObject *parent = NULL); + QuaGzipFile(const QString &fileName, QObject *parent = nullptr); /// Destructor. virtual ~QuaGzipFile(); /// Sets the name of the GZIP file to be opened. diff --git a/libs/thirdParty/quazip/quaziodevice.cpp b/libs/thirdParty/quazip/quaziodevice.cpp index f1480f21e9..95dc808975 100644 --- a/libs/thirdParty/quazip/quaziodevice.cpp +++ b/libs/thirdParty/quazip/quaziodevice.cpp @@ -23,20 +23,20 @@ class QuaZIODevicePrivate { QuaZIODevicePrivate::QuaZIODevicePrivate(QIODevice *io): io(io), - inBuf(NULL), + inBuf(nullptr), inBufPos(0), inBufSize(0), - outBuf(NULL), + outBuf(nullptr), outBufPos(0), outBufSize(0), zBufError(false) { - zins.zalloc = (alloc_func) NULL; - zins.zfree = (free_func) NULL; - zins.opaque = NULL; - zouts.zalloc = (alloc_func) NULL; - zouts.zfree = (free_func) NULL; - zouts.opaque = NULL; + zins.zalloc = (alloc_func) nullptr; + zins.zfree = (free_func) nullptr; + zins.opaque = nullptr; + zouts.zalloc = (alloc_func) nullptr; + zouts.zfree = (free_func) nullptr; + zouts.opaque = nullptr; inBuf = new char[QUAZIO_INBUFSIZE]; outBuf = new char[QUAZIO_OUTBUFSIZE]; #ifdef QUAZIP_ZIODEVICE_DEBUG_OUTPUT @@ -57,9 +57,9 @@ QuaZIODevicePrivate::~QuaZIODevicePrivate() #ifdef QUAZIP_ZIODEVICE_DEBUG_INPUT indebug.close(); #endif - if (inBuf != NULL) + if (inBuf != nullptr) delete[] inBuf; - if (outBuf != NULL) + if (outBuf != nullptr) delete[] outBuf; } diff --git a/libs/thirdParty/quazip/quaziodevice.h b/libs/thirdParty/quazip/quaziodevice.h index 8c284566ee..dc3b370431 100644 --- a/libs/thirdParty/quazip/quaziodevice.h +++ b/libs/thirdParty/quazip/quaziodevice.h @@ -22,7 +22,7 @@ class QUAZIP_EXPORT QuaZIODevice: public QIODevice { \param io The QIODevice to read/write. \param parent The parent object, as per QObject logic. */ - QuaZIODevice(QIODevice *io, QObject *parent = NULL); + QuaZIODevice(QIODevice *io, QObject *parent = nullptr); /// Destructor. ~QuaZIODevice(); /// Flushes data waiting to be written. diff --git a/libs/thirdParty/quazip/quazip.cpp b/libs/thirdParty/quazip/quazip.cpp index 73e172fbe6..3e7a0b9d43 100644 --- a/libs/thirdParty/quazip/quazip.cpp +++ b/libs/thirdParty/quazip/quazip.cpp @@ -68,7 +68,7 @@ class QuaZipPrivate { q(q), fileNameCodec(QTextCodec::codecForLocale()), commentCodec(QTextCodec::codecForLocale()), - ioDevice(NULL), + ioDevice(nullptr), mode(QuaZip::mdNotOpen), hasCurrentFile_f(false), zipError(UNZ_OK), @@ -79,7 +79,7 @@ class QuaZipPrivate { fileNameCodec(QTextCodec::codecForLocale()), commentCodec(QTextCodec::codecForLocale()), zipName(zipName), - ioDevice(NULL), + ioDevice(nullptr), mode(QuaZip::mdNotOpen), hasCurrentFile_f(false), zipError(UNZ_OK), @@ -129,7 +129,7 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) return false; } QIODevice *ioDevice = p->ioDevice; - if (ioDevice == NULL) { + if (ioDevice == nullptr) { if (p->zipName.isEmpty()) { qWarning("QuaZip::open(): set either ZIP file name or IO device first"); return false; @@ -140,7 +140,7 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) switch(mode) { case mdUnzip: p->unzFile_f=unzOpen2(ioDevice, ioApi); - if(p->unzFile_f!=NULL) { + if(p->unzFile_f!=nullptr) { p->mode=mode; p->ioDevice = ioDevice; return true; @@ -157,9 +157,9 @@ bool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi) mode==mdCreate?APPEND_STATUS_CREATE: mode==mdAppend?APPEND_STATUS_CREATEAFTER: APPEND_STATUS_ADDINZIP, - NULL, + nullptr, ioApi); - if(p->zipFile_f!=NULL) { + if(p->zipFile_f!=nullptr) { p->mode=mode; p->ioDevice = ioDevice; return true; @@ -192,7 +192,7 @@ void QuaZip::close() case mdAppend: case mdAdd: p->zipError=zipClose(p->zipFile_f, - p->comment.isNull() ? NULL + p->comment.isNull() ? nullptr : p->commentCodec->fromUnicode(p->comment).constData()); break; default: @@ -202,7 +202,7 @@ void QuaZip::close() // opened by name, need to delete the internal IO device if (!p->zipName.isEmpty()) { delete p->ioDevice; - p->ioDevice = NULL; + p->ioDevice = nullptr; } if(p->zipError==UNZ_OK) p->mode=mdNotOpen; @@ -215,7 +215,7 @@ void QuaZip::setZipName(const QString& zipName) return; } p->zipName=zipName; - p->ioDevice = NULL; + p->ioDevice = nullptr; } void QuaZip::setIoDevice(QIODevice *ioDevice) @@ -273,7 +273,7 @@ bool QuaZip::setCurrentFile(const QString& fileName, CaseSensitivity cs) return true; } // Unicode-aware reimplementation of the unzLocateFile function - if(p->unzFile_f==NULL) { + if(p->unzFile_f==nullptr) { p->zipError=UNZ_PARAMERROR; return false; } @@ -335,14 +335,14 @@ bool QuaZip::getCurrentFileInfo(QuaZipFileInfo *info)const QByteArray fileName; QByteArray extra; QByteArray comment; - if(info==NULL) return false; + if(info==nullptr) return false; if(!isOpen()||!hasCurrentFile()) return false; - if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, &info_z, NULL, 0, NULL, 0, NULL, 0))!=UNZ_OK) + if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, &info_z, nullptr, 0, nullptr, 0, nullptr, 0))!=UNZ_OK) return false; fileName.resize(info_z.size_filename); extra.resize(info_z.size_file_extra); comment.resize(info_z.size_file_comment); - if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, NULL, + if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, nullptr, fileName.data(), fileName.size(), extra.data(), extra.size(), comment.data(), comment.size()))!=UNZ_OK) @@ -376,8 +376,8 @@ QString QuaZip::getCurrentFileName()const } if(!isOpen()||!hasCurrentFile()) return QString(); QByteArray fileName(MAX_FILE_NAME_LENGTH, 0); - if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, NULL, fileName.data(), fileName.size(), - NULL, 0, NULL, 0))!=UNZ_OK) + if((fakeThis->p->zipError=unzGetCurrentFileInfo(p->unzFile_f, nullptr, fileName.data(), fileName.size(), + nullptr, 0, nullptr, 0))!=UNZ_OK) return QString(); return p->fileNameCodec->toUnicode(fileName.constData()); } @@ -420,7 +420,7 @@ QString QuaZip::getZipName() const QIODevice *QuaZip::getIoDevice() const { if (!p->zipName.isEmpty()) // opened by name, using an internal QIODevice - return NULL; + return nullptr; return p->ioDevice; } diff --git a/libs/thirdParty/quazip/quazip.h b/libs/thirdParty/quazip/quazip.h index c61922caa8..01088875f1 100644 --- a/libs/thirdParty/quazip/quazip.h +++ b/libs/thirdParty/quazip/quazip.h @@ -159,10 +159,10 @@ class QUAZIP_EXPORT QuaZip { * \return \c true if successful, \c false otherwise. * * \note ZIP/UNZIP API open calls do not return error code - they - * just return \c NULL indicating an error. But to make things + * just return \c nullptr indicating an error. But to make things * easier, quazip.h header defines additional error code \c * UNZ_ERROROPEN and getZipError() will return it if the open call - * of the ZIP/UNZIP API returns \c NULL. + * of the ZIP/UNZIP API returns \c nullptr. * * Argument \a ioApi specifies IO function set for ZIP/UNZIP * package to use. See unzip.h, zip.h and ioapi.h for details. Note @@ -179,7 +179,7 @@ class QUAZIP_EXPORT QuaZip { * In short: just forget about the \a ioApi argument and you'll be * fine. **/ - bool open(Mode mode, zlib_filefunc_def *ioApi =NULL); + bool open(Mode mode, zlib_filefunc_def *ioApi =nullptr); /// Closes ZIP file. /** Call getZipError() to determine if the close was successful. The * underlying QIODevice is also closed, regardless of whether it was @@ -331,7 +331,7 @@ class QUAZIP_EXPORT QuaZip { * Does nothing and returns \c false in any of the following cases. * - ZIP is not open; * - ZIP does not have current file; - * - \a info is \c NULL; + * - \a info is \c nullptr; * * In all these cases getZipError() returns \c UNZ_OK since there * is no ZIP/UNZIP API call. diff --git a/libs/thirdParty/quazip/quazipfile.cpp b/libs/thirdParty/quazip/quazipfile.cpp index 2189baa68a..587921f63d 100644 --- a/libs/thirdParty/quazip/quazipfile.cpp +++ b/libs/thirdParty/quazip/quazipfile.cpp @@ -75,7 +75,7 @@ class QuaZipFilePrivate { void setZipError(int zipError) const; /// The constructor for the corresponding QuaZipFile constructor. inline QuaZipFilePrivate(QuaZipFile *q): - q(q), zip(NULL), internal(true), zipError(UNZ_OK) {} + q(q), zip(nullptr), internal(true), zipError(UNZ_OK) {} /// The constructor for the corresponding QuaZipFile constructor. inline QuaZipFilePrivate(QuaZipFile *q, const QString &zipName): q(q), internal(true), zipError(UNZ_OK) @@ -143,18 +143,18 @@ QuaZipFile::~QuaZipFile() QString QuaZipFile::getZipName() const { - return p->zip==NULL ? QString() : p->zip->getZipName(); + return p->zip==nullptr ? QString() : p->zip->getZipName(); } QuaZip *QuaZipFile::getZip() const { - return p->internal ? NULL : p->zip; + return p->internal ? nullptr : p->zip; } QString QuaZipFile::getActualFileName()const { p->setZipError(UNZ_OK); - if (p->zip == NULL || (openMode() & WriteOnly)) + if (p->zip == nullptr || (openMode() & WriteOnly)) return QString(); QString name=p->zip->getCurrentFileName(); if(name.isNull()) @@ -168,7 +168,7 @@ void QuaZipFile::setZipName(const QString& zipName) qWarning("QuaZipFile::setZipName(): file is already open - can not set ZIP name"); return; } - if(p->zip!=NULL && p->internal) + if(p->zip!=nullptr && p->internal) delete p->zip; p->zip=new QuaZip(zipName); p->internal=true; @@ -180,7 +180,7 @@ void QuaZipFile::setZip(QuaZip *zip) qWarning("QuaZipFile::setZip(): file is already open - can not set ZIP"); return; } - if(p->zip!=NULL && p->internal) + if(p->zip!=nullptr && p->internal) delete p->zip; p->zip=zip; p->fileName=QString(); @@ -189,7 +189,7 @@ void QuaZipFile::setZip(QuaZip *zip) void QuaZipFile::setFileName(const QString& fileName, QuaZip::CaseSensitivity cs) { - if(p->zip==NULL) { + if(p->zip==nullptr) { qWarning("QuaZipFile::setFileName(): call setZipName() first"); return; } @@ -219,7 +219,7 @@ void QuaZipFilePrivate::setZipError(int zipError) const bool QuaZipFile::open(OpenMode mode) { - return open(mode, NULL); + return open(mode, nullptr); } bool QuaZipFile::open(OpenMode mode, int *method, int *level, bool raw, const char *password) @@ -245,8 +245,8 @@ bool QuaZipFile::open(OpenMode mode, int *method, int *level, bool raw, const ch return false; } } else { - if(p->zip==NULL) { - qWarning("QuaZipFile::open(): zip is NULL"); + if(p->zip==nullptr) { + qWarning("QuaZipFile::open(): zip is nullptr"); return false; } if(p->zip->getMode()!=QuaZip::mdUnzip) { @@ -287,8 +287,8 @@ bool QuaZipFile::open(OpenMode mode, const QuaZipNewInfo& info, qWarning("QuaZipFile::open(): write mode is incompatible with internal QuaZip approach"); return false; } - if(p->zip==NULL) { - qWarning("QuaZipFile::open(): zip is NULL"); + if(p->zip==nullptr) { + qWarning("QuaZipFile::open(): zip is nullptr"); return false; } if(p->zip->getMode()!=QuaZip::mdCreate&&p->zip->getMode()!=QuaZip::mdAppend&&p->zip->getMode()!=QuaZip::mdAdd) { @@ -338,7 +338,7 @@ bool QuaZipFile::isSequential()const qint64 QuaZipFile::pos()const { - if(p->zip==NULL) { + if(p->zip==nullptr) { qWarning("QuaZipFile::pos(): call setZipName() or setZip() first"); return -1; } @@ -357,7 +357,7 @@ qint64 QuaZipFile::pos()const bool QuaZipFile::atEnd()const { - if(p->zip==NULL) { + if(p->zip==nullptr) { qWarning("QuaZipFile::atEnd(): call setZipName() or setZip() first"); return false; } @@ -389,8 +389,8 @@ qint64 QuaZipFile::csize()const { unz_file_info info_z; p->setZipError(UNZ_OK); - if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return -1; - p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, NULL, 0, NULL, 0, NULL, 0)); + if(p->zip==nullptr||p->zip->getMode()!=QuaZip::mdUnzip) return -1; + p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, nullptr, 0, nullptr, 0, nullptr, 0)); if(p->zipError!=UNZ_OK) return -1; return info_z.compressed_size; @@ -400,8 +400,8 @@ qint64 QuaZipFile::usize()const { unz_file_info info_z; p->setZipError(UNZ_OK); - if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return -1; - p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, NULL, 0, NULL, 0, NULL, 0)); + if(p->zip==nullptr||p->zip->getMode()!=QuaZip::mdUnzip) return -1; + p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, nullptr, 0, nullptr, 0, nullptr, 0)); if(p->zipError!=UNZ_OK) return -1; return info_z.uncompressed_size; @@ -409,7 +409,7 @@ qint64 QuaZipFile::usize()const bool QuaZipFile::getFileInfo(QuaZipFileInfo *info) { - if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return false; + if(p->zip==nullptr||p->zip->getMode()!=QuaZip::mdUnzip) return false; p->zip->getCurrentFileInfo(info); p->setZipError(p->zip->getZipError()); return p->zipError==UNZ_OK; @@ -418,7 +418,7 @@ bool QuaZipFile::getFileInfo(QuaZipFileInfo *info) void QuaZipFile::close() { p->resetZipError(); - if(p->zip==NULL||!p->zip->isOpen()) return; + if(p->zip==nullptr||!p->zip->isOpen()) return; if(!isOpen()) { qWarning("QuaZipFile::close(): file isn't open"); return; diff --git a/libs/thirdParty/quazip/quazipfile.h b/libs/thirdParty/quazip/quazipfile.h index 80435ef375..6007f4469c 100644 --- a/libs/thirdParty/quazip/quazipfile.h +++ b/libs/thirdParty/quazip/quazipfile.h @@ -106,7 +106,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * QuaZipFile constructed by this constructor can be used for read * only access. Use QuaZipFile(QuaZip*,QObject*) for writing. **/ - QuaZipFile(const QString& zipName, QObject *parent =NULL); + QuaZipFile(const QString& zipName, QObject *parent =nullptr); /// Constructs a QuaZipFile instance. /** \a parent argument specifies this object's parent object, \a * zipName specifies ZIP archive file name and \a fileName and \a cs @@ -118,7 +118,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * \sa QuaZip::setCurrentFile() **/ QuaZipFile(const QString& zipName, const QString& fileName, - QuaZip::CaseSensitivity cs =QuaZip::csDefault, QObject *parent =NULL); + QuaZip::CaseSensitivity cs =QuaZip::csDefault, QObject *parent =nullptr); /// Constructs a QuaZipFile instance. /** \a parent argument specifies this object's parent object. * @@ -168,7 +168,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * zip.close(); * \endcode **/ - QuaZipFile(QuaZip *zip, QObject *parent =NULL); + QuaZipFile(QuaZip *zip, QObject *parent =nullptr); /// Destroys a QuaZipFile instance. /** Closes file if open, destructs internal QuaZip object (if it * exists and \em is internal, of course). @@ -186,7 +186,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { **/ QString getZipName()const; /// Returns a pointer to the associated QuaZip object. - /** Returns \c NULL if there is no associated QuaZip or it is + /** Returns \c nullptr if there is no associated QuaZip or it is * internal (so you will not mess with it). **/ QuaZip* getZip()const; @@ -292,10 +292,10 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { /// Opens a file for reading. /** \overload * Argument \a password specifies a password to decrypt the file. If - * it is NULL then this function behaves just like open(OpenMode). + * it is nullptr then this function behaves just like open(OpenMode). **/ inline bool open(OpenMode mode, const char *password) - {return open(mode, NULL, NULL, false, password);} + {return open(mode, nullptr, nullptr, false, password);} /// Opens a file for reading. /** \overload * Argument \a password specifies a password to decrypt the file. @@ -305,17 +305,17 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * * If raw is \c true then no decompression is performed. * - * \a method should not be \c NULL. \a level can be \c NULL if you + * \a method should not be \c nullptr. \a level can be \c nullptr if you * don't want to know the compression level. **/ - bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =NULL); + bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =nullptr); /// Opens a file for writing. /** \a info argument specifies information about file. It should at * least specify a correct file name. Also, it is a good idea to * specify correct timestamp (by default, current time will be * used). See QuaZipNewInfo. * - * The \a password argument specifies the password for crypting. Pass NULL + * The \a password argument specifies the password for crypting. Pass nullptr * if you don't need any crypting. The \a crc argument was supposed * to be used for crypting too, but then it turned out that it's * false information, so you need to set it to 0 unless you want to @@ -338,7 +338,7 @@ class QUAZIP_EXPORT QuaZipFile: public QIODevice { * algorithms tuning. See deflateInit2() in zlib. **/ bool open(OpenMode mode, const QuaZipNewInfo& info, - const char *password =NULL, quint32 crc =0, + const char *password =nullptr, quint32 crc =0, int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false, int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY); /// Returns \c true, but \ref quazipfile-sequential "beware"! From cf385fb999e818ca021e05439cbbdb8a86e7a820 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:12:35 +0900 Subject: [PATCH 06/23] comm: Change from NULL to nullptr --- src/comm/HexSpinBox.cpp | 4 ++-- src/comm/LinkManager.cc | 2 +- src/comm/MAVLinkProtocol.cc | 2 +- src/comm/OpalLink.cc | 2 +- src/comm/ParameterList.cc | 8 ++++---- src/comm/QGCFlightGearLink.cc | 12 ++++++------ src/comm/QGCJSBSimLink.cc | 8 ++++---- src/comm/QGCXPlaneLink.cc | 12 ++++++------ src/comm/SerialInterface.h | 4 ++-- src/comm/TCPLink.cc | 12 ++++++------ src/comm/TLogReplayLink.cc | 2 +- src/comm/UASObject.cc | 16 ++++++++-------- src/comm/UDPLink.cc | 4 ++-- src/comm/XbeeLink.cpp | 12 ++++++------ 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/comm/HexSpinBox.cpp b/src/comm/HexSpinBox.cpp index 878e9409e6..76cd7091e1 100644 --- a/src/comm/HexSpinBox.cpp +++ b/src/comm/HexSpinBox.cpp @@ -3,7 +3,7 @@ #include HexSpinBox::HexSpinBox(QWidget *parent) - : QSpinBox(parent), validator(NULL) + : QSpinBox(parent), validator(nullptr) { setRange(0, 0x7fffffff); validator = new QRegExpValidator(QRegExp("[0-9A-Fa-f]{1,8}"), this); @@ -14,7 +14,7 @@ HexSpinBox::~HexSpinBox(void) if(this->validator) { delete this->validator; - this->validator = NULL; + this->validator = nullptr; } } diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index f6cfaf6ae6..b2f4f18174 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -338,7 +338,7 @@ void LinkManager::removeLink(LinkInterface *link) { // This is called with a LINK_ID not an interface. needs mor rework //This function is not yet supported, it will be once we support multiple MAVs - Q_ASSERT(link == nullptr); // This shoud not be called, assert if it anything but NULL + Q_ASSERT(link == nullptr); // This shoud not be called, assert if it anything but nullptr } void LinkManager::removeLink(int linkId) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 644736dd9c..ed2f5af966 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -256,7 +256,7 @@ void MAVLinkProtocol::handleMessage(LinkInterface *link, const mavlink_message_t // If the matching UAS object does not yet exist, it has to be created // before emitting the packetReceived signal - Q_ASSERT_X(m_connectionManager != NULL, "MAVLinkProtocol::receiveBytes", " error:m_connectionManager == NULL"); + Q_ASSERT_X(m_connectionManager != nullptr, "MAVLinkProtocol::receiveBytes", " error:m_connectionManager == nullptr"); UASInterface* uas = m_connectionManager->getUas(message.sysid); // Check and (if necessary) create UAS object diff --git a/src/comm/OpalLink.cc b/src/comm/OpalLink.cc index f9138dfa09..cf4b9376e7 100644 --- a/src/comm/OpalLink.cc +++ b/src/comm/OpalLink.cc @@ -39,7 +39,7 @@ OpalLink::OpalLink() : receiveBuffer(new QQueue()), systemID(1), componentID(1), - params(NULL), + params(nullptr), opalInstID(101), sendRCValues(false), sendRawController(false), diff --git a/src/comm/ParameterList.cc b/src/comm/ParameterList.cc index a52cc9f16a..cf98f241d2 100644 --- a/src/comm/ParameterList.cc +++ b/src/comm/ParameterList.cc @@ -107,13 +107,13 @@ void ParameterList::getParameterList(QMap *opalParams) /* outputs */ unsigned short numParams; - unsigned short *idParam=NULL; + unsigned short *idParam=nullptr; unsigned short maxPathLen; - char **paths=NULL; + char **paths=nullptr; unsigned short maxNameLen; - char **names=NULL; + char **names=nullptr; unsigned short maxVarLen; - char **var=NULL; + char **var=nullptr; int returnValue; diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc index 51766a8bdf..c6cc8a5827 100644 --- a/src/comm/QGCFlightGearLink.cc +++ b/src/comm/QGCFlightGearLink.cc @@ -44,9 +44,9 @@ This file is part of the QGROUNDCONTROL project #include QGCFlightGearLink::QGCFlightGearLink(UASInterface* mav, QString startupArguments, QString remoteHost, QHostAddress host, quint16 port) : - socket(NULL), - process(NULL), - terraSync(NULL), + socket(nullptr), + process(nullptr), + terraSync(nullptr), flightGearVersion(0), startupArguments(startupArguments), _sensorHilEnabled(true), @@ -393,19 +393,19 @@ bool QGCFlightGearLink::disconnectSimulation() { process->close(); delete process; - process = NULL; + process = nullptr; } if (terraSync) { terraSync->close(); delete terraSync; - terraSync = NULL; + terraSync = nullptr; } if (socket) { socket->close(); delete socket; - socket = NULL; + socket = nullptr; } connectState = false; diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc index 65944d3a2c..3820d49f6d 100644 --- a/src/comm/QGCJSBSimLink.cc +++ b/src/comm/QGCJSBSimLink.cc @@ -42,8 +42,8 @@ This file is part of the QGROUNDCONTROL project #include QGCJSBSimLink::QGCJSBSimLink(UASInterface* mav, QString startupArguments, QString remoteHost, QHostAddress host, quint16 port) : - socket(NULL), - process(NULL), + socket(nullptr), + process(nullptr), startupArguments(startupArguments) { this->host = host; @@ -278,13 +278,13 @@ bool QGCJSBSimLink::disconnectSimulation() { process->close(); delete process; - process = NULL; + process = nullptr; } if (socket) { socket->close(); delete socket; - socket = NULL; + socket = nullptr; } connectState = false; diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index 8c20b7e3f5..2034370ae6 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -47,9 +47,9 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress mav(mav), remoteHost(QHostAddress("127.0.0.1")), remotePort(49000), - socket(NULL), - process(NULL), - terraSync(NULL), + socket(nullptr), + process(nullptr), + terraSync(nullptr), barometerOffsetkPa(15.0f), airframeID(QGCXPlaneLink::AIRFRAME_UNKNOWN), xPlaneConnected(false), @@ -782,19 +782,19 @@ bool QGCXPlaneLink::disconnectSimulation() { process->close(); delete process; - process = NULL; + process = nullptr; } if (terraSync) { terraSync->close(); delete terraSync; - terraSync = NULL; + terraSync = nullptr; } if (socket) { socket->close(); delete socket; - socket = NULL; + socket = nullptr; } emit simulationDisconnected(); diff --git a/src/comm/SerialInterface.h b/src/comm/SerialInterface.h index 9e334d27c2..f33e17b26d 100644 --- a/src/comm/SerialInterface.h +++ b/src/comm/SerialInterface.h @@ -149,7 +149,7 @@ class SerialQserial : public SerialInterface void aboutToClose(); public: SerialQserial(QString porthandle, QIODevice::OpenModeFlag flag=QIODevice::ReadWrite) - : _port(NULL) { + : _port(nullptr) { QObject::connect(_port,SIGNAL(aboutToClose()),this,SIGNAL(aboutToClose())); settings.setBaudRate(QPortSettings::BAUDR_57600); settings.setStopBits(QPortSettings::STOP_1); @@ -161,7 +161,7 @@ class SerialQserial : public SerialInterface } ~SerialQserial() { delete _port; - _port = NULL; + _port = nullptr; } virtual bool isOpen() { return _port->isOpen(); diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index 29297d0c24..8609d82fcc 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -42,7 +42,7 @@ TCPLink::TCPLink(const QHostAddress &hostAddress, const QString &hostName, quint _hostAddress(hostAddress), _port(socketPort), _asServer(asServer), - _socket(NULL) + _socket(nullptr) { _server.setMaxPendingConnections(1); _linkId = getNextLinkId(); @@ -225,7 +225,7 @@ void TCPLink::_socketDisconnected() Q_ASSERT(_socket); _socket->deleteLater(); - _socket = NULL; + _socket = nullptr; emit disconnected(); emit connected(false); @@ -254,11 +254,11 @@ bool TCPLink::connect() void TCPLink::newConnection() { - if (_socket != NULL) + if (_socket != nullptr) disconnect(); _socket = _server.nextPendingConnection(); - if (_socket == NULL) + if (_socket == nullptr) return; qDebug() << _hostAddress.toString() << ": new connection"; @@ -274,7 +274,7 @@ void TCPLink::newConnection() bool TCPLink::_hardwareConnect(void) { - Q_ASSERT(_socket == NULL); + Q_ASSERT(_socket == nullptr); if (_asServer) { @@ -313,7 +313,7 @@ bool TCPLink::_hardwareConnect(void) emit communicationError(getName(), "Connection Failed"); } delete _socket; - _socket = NULL; + _socket = nullptr; return false; } diff --git a/src/comm/TLogReplayLink.cc b/src/comm/TLogReplayLink.cc index a2b167f14c..82fc4fb269 100644 --- a/src/comm/TLogReplayLink.cc +++ b/src/comm/TLogReplayLink.cc @@ -13,7 +13,7 @@ TLogReplayLink::TLogReplayLink(QObject *parent) : m_speedVar(50), m_posVar(0), m_mavlinkDecoder(new MAVLinkDecoder()), - m_mavlinkInspector(NULL) + m_mavlinkInspector(nullptr) { Q_UNUSED(parent); } diff --git a/src/comm/UASObject.cc b/src/comm/UASObject.cc index 3c714c3f4a..7c831edbd3 100644 --- a/src/comm/UASObject.cc +++ b/src/comm/UASObject.cc @@ -8,10 +8,10 @@ #include UASObject::UASObject(QObject *parent) : QObject(parent), - m_vehicleOverview(NULL), - m_relPositionOverview(NULL), - m_absPositionOverview(NULL), - m_missionOverview(NULL) + m_vehicleOverview(nullptr), + m_relPositionOverview(nullptr), + m_absPositionOverview(nullptr), + m_missionOverview(nullptr) { m_vehicleOverview = new VehicleOverview(this); m_relPositionOverview = new RelPositionOverview(this); @@ -22,13 +22,13 @@ UASObject::UASObject(QObject *parent) : QObject(parent), UASObject::~UASObject() { delete m_vehicleOverview; - m_vehicleOverview = NULL; + m_vehicleOverview = nullptr; delete m_relPositionOverview; - m_relPositionOverview = NULL; + m_relPositionOverview = nullptr; delete m_absPositionOverview; - m_absPositionOverview = NULL; + m_absPositionOverview = nullptr; delete m_missionOverview; - m_missionOverview = NULL; + m_missionOverview = nullptr; } VehicleOverview* UASObject::getVehicleOverview() diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index 14d435a2be..09397ca27d 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -43,7 +43,7 @@ This file is part of the QGROUNDCONTROL project UDPLink::UDPLink(QHostAddress host, quint16 port) : - socket(NULL), + socket(nullptr), connectState(false), _shouldRestartConnection(false), _running(false) @@ -106,7 +106,7 @@ void UDPLink::run() if (!_running) { socket->deleteLater(); - socket = NULL; + socket = nullptr; connectState = false; emit disconnected(); emit connected(false); diff --git a/src/comm/XbeeLink.cpp b/src/comm/XbeeLink.cpp index 1cd4de0e13..33fb915624 100644 --- a/src/comm/XbeeLink.cpp +++ b/src/comm/XbeeLink.cpp @@ -7,9 +7,9 @@ #include XbeeLink::XbeeLink(QString portName, int baudRate) : - m_xbeeCon(NULL), + m_xbeeCon(nullptr), m_id(-1), - m_portName(NULL), + m_portName(nullptr), m_portNameLength(0), m_baudRate(baudRate), m_connected(false), @@ -33,7 +33,7 @@ XbeeLink::~XbeeLink() if(m_portName) { delete m_portName; - m_portName = NULL; + m_portName = nullptr; } this->disconnect(); } @@ -64,7 +64,7 @@ bool XbeeLink::setPortName(QString portName) if(m_portName) { delete m_portName; - m_portName = NULL; + m_portName = nullptr; } QStringList list = portName.split(QRegExp("\\s+"),QString::SkipEmptyParts); if(list.size()>0) @@ -180,7 +180,7 @@ bool XbeeLink::disconnect() if(this->m_xbeeCon) { xbee_end(); - this->m_xbeeCon = NULL; + this->m_xbeeCon = nullptr; } this->m_connected = false; @@ -219,7 +219,7 @@ void XbeeLink::readBytes() { xbee_pkt *xbeePkt; xbeePkt = xbee_getpacketwait(this->m_xbeeCon); - if(!(NULL==xbeePkt)) + if(!(nullptr==xbeePkt)) { QByteArray data; for(unsigned int i=0;i<=xbeePkt->datalen;i++) From 937eedbefb6d661ec16e611d5c04038a89ecacec Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:12:49 +0900 Subject: [PATCH 07/23] uas: Change from NULL to nullptr --- src/uas/LogDownloadDialog.cc | 24 ++++++++++++------------ src/uas/QGCMAVLinkUASFactory.cc | 2 +- src/uas/QGCMAVLinkUASFactory.h | 2 +- src/uas/UAS.cc | 4 ++-- src/uas/UASManager.cc | 20 ++++++++++---------- src/uas/UASManager.h | 4 ++-- src/uas/UASWaypointManager.cc | 14 +++++++------- src/uas/UASWaypointManager.h | 4 ++-- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/uas/LogDownloadDialog.cc b/src/uas/LogDownloadDialog.cc index 0694ea359e..47ddbf6a5f 100644 --- a/src/uas/LogDownloadDialog.cc +++ b/src/uas/LogDownloadDialog.cc @@ -72,9 +72,9 @@ uint LogDownloadDescriptor::logSize() LogDownloadDialog::LogDownloadDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LogDownloadDialog), - m_uas(NULL), - m_downloadSet(NULL), - m_downloadFile(NULL), + m_uas(nullptr), + m_downloadSet(nullptr), + m_downloadFile(nullptr), m_downloadID(0), m_downloadLastTimestamp(0), m_downloadOffset(0), @@ -114,13 +114,13 @@ void LogDownloadDialog::resetDownload() { if (m_downloadSet){ delete m_downloadSet; - m_downloadSet = NULL; + m_downloadSet = nullptr; } if (m_downloadFile){ m_downloadFile->close(); m_downloadFile->deleteLater(); - m_downloadFile = NULL; + m_downloadFile = nullptr; } m_downloadID = 0; @@ -156,7 +156,7 @@ void LogDownloadDialog::setActiveUAS(UASInterface *uas) removeConnections(uas); } - if (uas == NULL) + if (uas == nullptr) return; m_uas = uas; @@ -217,7 +217,7 @@ void LogDownloadDialog::getSelectedLogs() void LogDownloadDialog::eraseAllLogs() { - if (m_uas == NULL) + if (m_uas == nullptr) return; int button = QMessageBox::critical(this, tr("Erase All Logs"), @@ -300,7 +300,7 @@ void LogDownloadDialog::logEntry(int uasId, uint32_t time_utc, uint32_t size, ui "id=" << id << " num_logs=" << num_logs << ", last_log_num=" << last_log_num; ui->tableWidget->setSortingEnabled(false); - if (m_uas == NULL) + if (m_uas == nullptr) return; LogDownloadDescriptor *logItem = new LogDownloadDescriptor(id, time_utc, size); @@ -341,11 +341,11 @@ void LogDownloadDialog::logData(uint32_t uasId, uint32_t ofs, uint16_t id, QLOG_DEBUG() << "logData ofs:" << ofs << " id:" << id << " count:" << count /*<< " data:" << data*/; #endif - if (m_uas == NULL || m_downloadSet == NULL) + if (m_uas == nullptr || m_downloadSet == nullptr) return; if (m_uas->getUASID() != static_cast(uasId)) return; - if(m_downloadFile == NULL){ + if(m_downloadFile == nullptr){ QLOG_ERROR() << "No file open to save log info"; return; } @@ -399,7 +399,7 @@ void LogDownloadDialog::logData(uint32_t uasId, uint32_t ofs, uint16_t id, m_downloadStart.start(); m_downloadFile->close(); delete m_downloadFile; - m_downloadFile = NULL; + m_downloadFile = nullptr; issueDownloadRequest(); return; } @@ -422,7 +422,7 @@ void LogDownloadDialog::logData(uint32_t uasId, uint32_t ofs, uint16_t id, void LogDownloadDialog::processDownloadedLogData() { // Process incoming log data and trigger next request for more - if (m_downloadSet==NULL || m_downloadSet->size() == 0) + if (m_downloadSet==nullptr || m_downloadSet->size() == 0) return; uint highest = 0; diff --git a/src/uas/QGCMAVLinkUASFactory.cc b/src/uas/QGCMAVLinkUASFactory.cc index c33aff9671..444dfa3499 100644 --- a/src/uas/QGCMAVLinkUASFactory.cc +++ b/src/uas/QGCMAVLinkUASFactory.cc @@ -10,7 +10,7 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte { QPointer p; - if (parent != NULL) + if (parent != nullptr) { p = parent; } diff --git a/src/uas/QGCMAVLinkUASFactory.h b/src/uas/QGCMAVLinkUASFactory.h index 3c864a61c3..89c3bd7806 100644 --- a/src/uas/QGCMAVLinkUASFactory.h +++ b/src/uas/QGCMAVLinkUASFactory.h @@ -22,7 +22,7 @@ class QGCMAVLinkUASFactory : public QObject explicit QGCMAVLinkUASFactory(QObject *parent = 0); /** @brief Create a new UAS object using MAVLink as protocol */ - static UASInterface* createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, mavlink_heartbeat_t* heartbeat, QObject* parent=NULL); + static UASInterface* createUAS(MAVLinkProtocol* mavlink, LinkInterface* link, int sysid, mavlink_heartbeat_t* heartbeat, QObject* parent=nullptr); signals: diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index e287de7720..45d81a1dda 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -146,7 +146,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), paramsOnceRequested(false), - paramManager(NULL), + paramManager(nullptr), simulation(0), @@ -2947,7 +2947,7 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double && (! manualControl)) { const QMap* params = parameters[uasId]; - if (params == NULL + if (params == nullptr || ! params->contains("RCMAP_ROLL") || ! params->contains("RCMAP_PITCH") || ! params->contains("RCMAP_YAW") diff --git a/src/uas/UASManager.cc b/src/uas/UASManager.cc index 8167067ac4..e32e42258f 100644 --- a/src/uas/UASManager.cc +++ b/src/uas/UASManager.cc @@ -229,8 +229,8 @@ void UASManager::uavChangedHomePosition(int uav, double lat, double lon, double * This class implements the singleton design pattern and has therefore only a private constructor. **/ UASManager::UASManager() : - activeUAS(NULL), - offlineUASWaypointManager(NULL), + activeUAS(nullptr), + offlineUASWaypointManager(nullptr), homeLat(32.835354), homeLon(-117.162774), homeAlt(25.0), @@ -257,7 +257,7 @@ void UASManager::addUAS(UASInterface* uas) // returns the UAS once the UASCreated() signal // is emitted. The code is thus NOT redundant. bool firstUAS = false; - if (activeUAS == NULL) + if (activeUAS == nullptr) { firstUAS = true; activeUAS = uas; @@ -333,8 +333,8 @@ void UASManager::removeUAS(UASInterface* uas) { // sends a null pointer if no UAS is present any more. // It requires listeners of activeUASSet signal to - // check for NULL, otherwise bad stuff will happen! - activeUAS = NULL; + // check for nullptr, otherwise bad stuff will happen! + activeUAS = nullptr; emit activeUASSet(activeUAS); } } @@ -365,7 +365,7 @@ UASWaypointManager *UASManager::getActiveUASWaypointManager() } if (!offlineUASWaypointManager) { - offlineUASWaypointManager = new UASWaypointManager(NULL); + offlineUASWaypointManager = new UASWaypointManager(nullptr); } return offlineUASWaypointManager; @@ -429,7 +429,7 @@ void UASManager::configureActiveUAS() UASInterface* UASManager::getUASForId(int id) { - UASInterface* system = NULL; + UASInterface* system = nullptr; foreach(UASInterface* sys, systems) { if (sys->getUASID() == id) { @@ -437,15 +437,15 @@ UASInterface* UASManager::getUASForId(int id) } } - // Return NULL if not found + // Return nullptr if not found return system; } void UASManager::setActiveUAS(UASInterface* uas) { - if (uas != NULL) { + if (uas != nullptr) { activeUASMutex.lock(); - if (activeUAS != NULL) { + if (activeUAS != nullptr) { emit activeUASStatusChanged(activeUAS, false); emit activeUASStatusChanged(activeUAS->getUASID(), false); } diff --git a/src/uas/UASManager.h b/src/uas/UASManager.h index b721f6de5a..c381fe5738 100644 --- a/src/uas/UASManager.h +++ b/src/uas/UASManager.h @@ -54,7 +54,7 @@ class UASManager : public QObject /** * @brief Get the currently selected UAS * - * @return NULL pointer if no UAS exists, active UAS else + * @return nullptr pointer if no UAS exists, active UAS else **/ UASInterface* getActiveUAS(); /** @@ -71,7 +71,7 @@ class UASManager : public QObject * in the range of 1 - 127 by the MAVLINK protocol. * * @param id unique system / aircraft id - * @return UAS with the given ID, NULL pointer else + * @return UAS with the given ID, nullptr pointer else **/ UASInterface* getUASForId(int id); diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index f837cfbac5..8339d9e4c0 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -50,7 +50,7 @@ UASWaypointManager::UASWaypointManager(UAS* _uas) current_partner_systemid(0), current_partner_compid(MAV_COMP_ID_PRIMARY), read_to_edit(false), - currentWaypointEditable(NULL), + currentWaypointEditable(nullptr), protocol_timer(this), standalone(false), uasid(0), @@ -331,7 +331,7 @@ void UASWaypointManager::handleWaypointCurrent(quint8 systemId, quint8 compId, m void UASWaypointManager::notifyOfChangeEditable(Waypoint* wp) { // If only one waypoint was changed, emit only WP signal - if (wp != NULL) { + if (wp != nullptr) { emit waypointEditableChanged(uasid, wp); } else { emit waypointEditableListChanged(); @@ -341,7 +341,7 @@ void UASWaypointManager::notifyOfChangeEditable(Waypoint* wp) void UASWaypointManager::notifyOfChangeViewOnly(Waypoint* wp) { - if (wp != NULL) { + if (wp != nullptr) { emit waypointViewOnlyChanged(uasid, wp); } else { emit waypointViewOnlyListChanged(); @@ -414,7 +414,7 @@ void UASWaypointManager::addWaypointEditable(Waypoint *wp, bool enforceFirstActi if (wp) { // Check if this is the first waypoint in an offline list - if (waypointsEditable.count() == 0 && uas == NULL) + if (waypointsEditable.count() == 0 && uas == nullptr) MainWindow::instance()->showCriticalMessage(tr("OFFLINE Waypoint Editing Mode"), tr("You are in offline editing mode. Make sure to save your mission to a file before connecting to a system - you will need to load the file into the system, the offline list will be cleared on connect.")); wp->setId(waypointsEditable.count()); @@ -438,7 +438,7 @@ void UASWaypointManager::addWaypointEditable(Waypoint *wp, bool enforceFirstActi Waypoint* UASWaypointManager::createWaypoint(bool enforceFirstActive) { // Check if this is the first waypoint in an offline list - if (waypointsEditable.count() == 0 && uas == NULL) + if (waypointsEditable.count() == 0 && uas == nullptr) MainWindow::instance()->showCriticalMessage(tr("OFFLINE Waypoint Editing Mode"), tr("You are in offline editing mode. Make sure to save your mission to a file before connecting to a system - you will need to load the file into the system, the offline list will be cleared on connect.")); Waypoint* wp = new Waypoint(); @@ -479,7 +479,7 @@ int UASWaypointManager::removeWaypoint(quint16 seq) waypointsEditable.removeAt(seq); delete t; - t = NULL; + t = nullptr; for(int i = seq; i < waypointsEditable.count(); i++) { @@ -1163,7 +1163,7 @@ const Waypoint *UASWaypointManager::getWaypoint(int index) if (index > 0 || index < waypointsEditable.count()){ return waypointsEditable[index]; } else { - return NULL; + return nullptr; } } diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index a2ccb569ea..763cdecdef 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -64,7 +64,7 @@ class UASWaypointManager : public QObject }; ///< The possible states for the waypoint protocol public: - UASWaypointManager(UAS* uas=NULL); ///< Standard constructor + UASWaypointManager(UAS* uas=nullptr); ///< Standard constructor ~UASWaypointManager(); bool guidedModeSupported(); @@ -100,7 +100,7 @@ class UASWaypointManager : public QObject const QList getGlobalFrameWaypointList(); ///< Returns a global waypoint list const QList getGlobalFrameAndNavTypeWaypointList(bool onlypath); ///< Returns a global waypoint list containing only waypoints suitable for navigation. Actions and other mission items are filtered out. const QList getNavTypeWaypointList(); ///< Returns a waypoint list containing only waypoints suitable for navigation. Actions and other mission items are filtered out. - const Waypoint* getWaypoint(int index); ///< Returns the waypoint at index, or NULL if not valid. + const Waypoint* getWaypoint(int index); ///< Returns the waypoint at index, or nullptr if not valid. int getIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list int getGlobalFrameIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list, counting only global waypoints int getGlobalFrameAndNavTypeIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list, counting only global AND navigation mode waypoints From 5a590fd0773b5a9201c9cb988bb1920e2921baea Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:13:14 +0900 Subject: [PATCH 08/23] ui: Change from NULL to nullptr --- src/ui/AP2DataPlot2D.cpp | 26 +++++++++++++------------- src/ui/AP2DataPlot2D.h | 4 ++-- src/ui/ApmToolBar.cc | 2 +- src/ui/AutoUpdateCheck.cc | 12 ++++++------ src/ui/AutoUpdateDialog.cc | 14 +++++++------- src/ui/CameraView.cc | 18 +++++++++--------- src/ui/CameraView.h | 2 +- src/ui/CommConfigurationWindow.cc | 2 +- src/ui/EKFMonitor.cpp | 4 ++-- src/ui/GoogleElevationData.cpp | 12 ++++++------ src/ui/HDDisplay.cc | 6 +++--- src/ui/HSIDisplay.cc | 6 +++--- src/ui/HUD.cc | 24 ++++++++++++------------ src/ui/HUD.h | 2 +- src/ui/JoystickWidget.cc | 4 ++-- src/ui/MAVLinkSettingsWidget.cc | 2 +- src/ui/MainWindow.cc | 22 +++++++++++----------- src/ui/MapWidget.cc | 8 ++++---- src/ui/MissionElevationDisplay.cpp | 16 ++++++++-------- src/ui/ObjectDetectionView.cc | 4 ++-- src/ui/OgreWidget.cc | 2 +- src/ui/PrimaryFlightDisplay.cc | 4 ++-- src/ui/PrimaryFlightDisplay.h | 2 +- src/ui/PrimaryFlightDisplayQML.cpp | 4 ++-- src/ui/QGCHilConfiguration.h | 2 +- src/ui/QGCMAVLinkInspector.cc | 12 ++++++------ src/ui/QGCMAVLinkLogPlayer.cc | 6 +++--- src/ui/QGCParamWidget.cc | 10 +++++----- src/ui/QGCRGBDView.cc | 2 +- src/ui/QGCSettingsWidget.cc | 6 +++--- src/ui/QGCStatusBar.cc | 6 +++--- src/ui/QGCToolBar.cc | 14 +++++++------- src/ui/QGCVehicleConfig.cc | 6 +++--- src/ui/QGCWaypointListMulti.cc | 4 ++-- src/ui/SlugsDataSensorView.cc | 4 ++-- src/ui/SlugsHilSim.cc | 8 ++++---- src/ui/VibrationMonitor.cpp | 4 ++-- src/ui/WaypointEditableView.cc | 6 +++--- src/ui/WaypointList.cc | 4 ++-- src/ui/WaypointList.h | 2 +- src/ui/XbeeConfigurationWindow.cpp | 4 ++-- 41 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/ui/AP2DataPlot2D.cpp b/src/ui/AP2DataPlot2D.cpp index dea65cafcf..8690b8a3b8 100644 --- a/src/ui/AP2DataPlot2D.cpp +++ b/src/ui/AP2DataPlot2D.cpp @@ -50,16 +50,16 @@ This file is part of the APM_PLANNER project #define ROW_HEIGHT_PADDING 3 //Number of additional pixels over font height for each row for the table/excel view. AP2DataPlot2D::AP2DataPlot2D(QWidget *parent) : QWidget(parent), - m_updateTimer(NULL), + m_updateTimer(nullptr), m_graphCount(0), - m_plot(NULL), - m_wideAxisRect(NULL), + m_plot(nullptr), + m_wideAxisRect(nullptr), m_currentIndex(0), m_startIndex(0), - m_uas(NULL), - m_axisGroupingDialog(NULL), + m_uas(nullptr), + m_axisGroupingDialog(nullptr), m_tlogReplayEnabled(false), - m_logDownloadDialog(NULL), + m_logDownloadDialog(nullptr), m_statusTextPos(0), m_lastHorizontalScrollerVal(0) { @@ -271,7 +271,7 @@ void AP2DataPlot2D::showEvent(QShowEvent *evt) { m_updateTimer->stop(); m_updateTimer->deleteLater(); - m_updateTimer = NULL; + m_updateTimer = nullptr; } m_updateTimer = new QTimer(this); connect(m_updateTimer,SIGNAL(timeout()),m_plot,SLOT(replot())); @@ -285,7 +285,7 @@ void AP2DataPlot2D::hideEvent(QHideEvent *evt) { m_updateTimer->stop(); m_updateTimer->deleteLater(); - m_updateTimer = NULL; + m_updateTimer = nullptr; } QWidget::hideEvent(evt); } @@ -643,13 +643,13 @@ AP2DataPlot2D::~AP2DataPlot2D() { m_updateTimer->stop(); m_updateTimer->deleteLater(); - m_updateTimer = NULL; + m_updateTimer = nullptr; } if (m_axisGroupingDialog) { m_axisGroupingDialog->close(); delete m_axisGroupingDialog; - m_axisGroupingDialog = NULL; + m_axisGroupingDialog = nullptr; } for (int i=0;ihide(); m_logDownloadDialog->deleteLater(); - m_logDownloadDialog = NULL; + m_logDownloadDialog = nullptr; } } diff --git a/src/ui/AP2DataPlot2D.h b/src/ui/AP2DataPlot2D.h index bfbbec7f05..a368c9cc4b 100644 --- a/src/ui/AP2DataPlot2D.h +++ b/src/ui/AP2DataPlot2D.h @@ -116,7 +116,7 @@ private slots: int getStatusTextPos(); - void plotTextArrow(double index, const QString& text, const QString& graph, const QColor& color, QCheckBox *checkBox = NULL); + void plotTextArrow(double index, const QString& text, const QString& graph, const QColor& color, QCheckBox *checkBox = nullptr); /** * @brief This method hides or shows the text arrows of type @@ -150,7 +150,7 @@ private slots: QList itemList; QMap messageMap; - Graph() : isManualRange(false), isInGroup(false), axisIndex(0), axis(NULL), graph(NULL){} + Graph() : isManualRange(false), isInGroup(false), axisIndex(0), axis(nullptr), graph(nullptr){} }; QMap m_graphClassMap; diff --git a/src/ui/ApmToolBar.cc b/src/ui/ApmToolBar.cc index e4d2e0fd63..d6e2eb5b08 100644 --- a/src/ui/ApmToolBar.cc +++ b/src/ui/ApmToolBar.cc @@ -40,7 +40,7 @@ This file is part of the APM_PLANNER project #include APMToolBar::APMToolBar(QWindow *parent): - QQuickView(parent), m_uas(NULL), m_disableOverride(false), m_currentLinkId(0) + QQuickView(parent), m_uas(nullptr), m_disableOverride(false), m_currentLinkId(0) { // Configure our QML object QLOG_DEBUG() << "qmlBaseDir" << QGC::shareDirectory(); diff --git a/src/ui/AutoUpdateCheck.cc b/src/ui/AutoUpdateCheck.cc index e155253bb6..922afd2d18 100644 --- a/src/ui/AutoUpdateCheck.cc +++ b/src/ui/AutoUpdateCheck.cc @@ -38,7 +38,7 @@ static const QString VersionCompareRegEx = "(\\d*\\.\\d+\\.?\\d+)-?(rc\\d)?"; AutoUpdateCheck::AutoUpdateCheck(QObject *parent) : QObject(parent), - m_networkReply(NULL), + m_networkReply(nullptr), m_httpRequestAborted(false), m_suppressNoUpdateSignal(false) { @@ -64,9 +64,9 @@ void AutoUpdateCheck::autoUpdateCheck(const QUrl &url) m_url = QUrl(url); - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(m_url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpFinished())); @@ -86,7 +86,7 @@ void AutoUpdateCheck::httpFinished() QLOG_DEBUG() << "AutoUpdateCheck::httpFinished()"; if (m_httpRequestAborted) { reply->deleteLater(); - reply = NULL; + reply = nullptr; return; } @@ -96,7 +96,7 @@ void AutoUpdateCheck::httpFinished() if (reply->error()) { // [TODO] cleanup download failed #ifdef QT_DEBUG - QMessageBox::information(NULL, tr("HTTP"), + QMessageBox::information(nullptr, tr("HTTP"), tr("Download failed: %1.") .arg(m_networkReply->errorString())); #endif @@ -117,7 +117,7 @@ void AutoUpdateCheck::httpFinished() } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; } void AutoUpdateCheck::processDownloadedVersionObject(const QByteArray& versionObject) diff --git a/src/ui/AutoUpdateDialog.cc b/src/ui/AutoUpdateDialog.cc index bc3e907e10..efdf73bf02 100644 --- a/src/ui/AutoUpdateDialog.cc +++ b/src/ui/AutoUpdateDialog.cc @@ -33,7 +33,7 @@ AutoUpdateDialog::AutoUpdateDialog(const QString &version, const QString &target ui(new Ui::AutoUpdateDialog), m_sourceUrl(url), m_targetFilename(targetFilename), - m_networkReply(NULL), + m_networkReply(nullptr), m_skipVersion(false), m_skipVersionString(version) { @@ -99,7 +99,7 @@ bool AutoUpdateDialog::startDownload(const QString& url, const QString& filename tr("Unable to save the file %1: %2.") .arg(filename).arg(m_targetFile->errorString())); delete m_targetFile; - m_targetFile = NULL; + m_targetFile = nullptr; return false; } @@ -119,9 +119,9 @@ void AutoUpdateDialog::startFileDownloadRequest(QUrl url) ui->questionLabel->setText(tr("")); ui->statusLabel->setText(tr("Downloading %1").arg(m_targetFilename)); m_httpRequestAborted = false; - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpFinished())); @@ -146,7 +146,7 @@ void AutoUpdateDialog::httpFinished() m_targetFile->close(); m_targetFile->remove(); delete m_targetFile; - m_targetFile = NULL; + m_targetFile = nullptr; } m_networkReply->deleteLater(); return; @@ -181,7 +181,7 @@ void AutoUpdateDialog::httpFinished() } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; if (!result){ ui->titleLabel->setText(tr("

Download Failed

")); @@ -202,7 +202,7 @@ void AutoUpdateDialog::httpFinished() this->raise(); delete m_targetFile; - m_targetFile = NULL; + m_targetFile = nullptr; } void AutoUpdateDialog::executeDownloadedFile() diff --git a/src/ui/CameraView.cc b/src/ui/CameraView.cc index 09559aa2ec..e1f1d68ad6 100644 --- a/src/ui/CameraView.cc +++ b/src/ui/CameraView.cc @@ -37,11 +37,11 @@ This file is part of the QGROUNDCONTROL project CameraView::CameraView(int width, int height, int depth, int channels, QWidget* parent) : QGLWidget(parent) { - rawImage = NULL; - rawBuffer1 = NULL; - rawBuffer2 = NULL; + rawImage = nullptr; + rawBuffer1 = nullptr; + rawBuffer2 = nullptr; rawLastIndex = 0; - image = NULL; + image = nullptr; imageStarted = false; // Init to black image //setImageSize(width, height, depth, channels); @@ -84,7 +84,7 @@ void CameraView::addUAS(UASInterface* uas) void CameraView::setImageSize(int width, int height, int depth, int channels) { // Allocate raw image in correct size - if (width != receivedWidth || height != receivedHeight || depth != receivedDepth || channels != receivedChannels || image == NULL) { + if (width != receivedWidth || height != receivedHeight || depth != receivedDepth || channels != receivedChannels || image == nullptr) { // Set new size if (width > 0) receivedWidth = width; if (height > 0) receivedHeight = height; @@ -94,9 +94,9 @@ void CameraView::setImageSize(int width, int height, int depth, int channels) rawExpectedBytes = (receivedWidth * receivedHeight * receivedDepth * receivedChannels) / 8; bytesPerLine = rawExpectedBytes / receivedHeight; // Delete old buffers if necessary - rawImage = NULL; - if (rawBuffer1 != NULL) delete rawBuffer1; - if (rawBuffer2 != NULL) delete rawBuffer2; + rawImage = nullptr; + if (rawBuffer1 != nullptr) delete rawBuffer1; + if (rawBuffer2 != nullptr) delete rawBuffer2; rawBuffer1 = (unsigned char*)malloc(rawExpectedBytes); rawBuffer2 = (unsigned char*)malloc(rawExpectedBytes); @@ -161,7 +161,7 @@ void CameraView::finishImage() void CameraView::commitRawDataToGL() { //QLOG_DEBUG() << __FILE__ << __LINE__ << "Copying raw data to GL buffer:" << rawImage << receivedWidth << receivedHeight << image->format(); - if (image != NULL) { + if (image != nullptr) { QImage::Format format = image->format(); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); if (format == QImage::Format_Indexed8) { diff --git a/src/ui/CameraView.h b/src/ui/CameraView.h index e8291944cf..1f4ddeae35 100644 --- a/src/ui/CameraView.h +++ b/src/ui/CameraView.h @@ -40,7 +40,7 @@ class CameraView : public QGLWidget { Q_OBJECT public: - CameraView(int width = 640, int height = 480, int depth = 8, int channels = 1, QWidget* parent = NULL); + CameraView(int width = 640, int height = 480, int depth = 8, int channels = 1, QWidget* parent = nullptr); ~CameraView(); void setImageSize(int width, int height, int depth, int channels); diff --git a/src/ui/CommConfigurationWindow.cc b/src/ui/CommConfigurationWindow.cc index 8dab4a87da..b30cbb9b84 100644 --- a/src/ui/CommConfigurationWindow.cc +++ b/src/ui/CommConfigurationWindow.cc @@ -224,7 +224,7 @@ void CommConfigurationWindow::setLinkName(QString name) void CommConfigurationWindow::remove() { if(action) delete action; //delete action first since it has a pointer to link - action=NULL; + action=nullptr; LinkManager::instance()->removeLink(m_linkid); //close & remove link from LinkManager list diff --git a/src/ui/EKFMonitor.cpp b/src/ui/EKFMonitor.cpp index e59e9cace6..2693e5c7f0 100644 --- a/src/ui/EKFMonitor.cpp +++ b/src/ui/EKFMonitor.cpp @@ -32,8 +32,8 @@ This file is part of the APM_PLANNER project EKFMonitor::EKFMonitor(QWidget *parent) : QWidget(parent), - m_declarativeView(NULL), - m_uasInterface(NULL) + m_declarativeView(nullptr), + m_uasInterface(nullptr) { QUrl url = QUrl::fromLocalFile(QGC::shareDirectory() + "/qml/EKFMonitor.qml"); QLOG_DEBUG() << url; diff --git a/src/ui/GoogleElevationData.cpp b/src/ui/GoogleElevationData.cpp index acf33760dd..1f9647cda0 100644 --- a/src/ui/GoogleElevationData.cpp +++ b/src/ui/GoogleElevationData.cpp @@ -31,7 +31,7 @@ This file is part of the APM_PLANNER project GoogleElevationData::GoogleElevationData(QObject *parent) : QObject(parent), - m_networkReply(NULL), + m_networkReply(nullptr), m_httpRequestAborted(false) { } @@ -52,14 +52,14 @@ void GoogleElevationData::httpFinished() QLOG_DEBUG() << "GoogleElevationData::httpFinished()"; if (m_httpRequestAborted) { m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; return; } // Finished donwloading the elevation information if (m_networkReply->error()) { // cleanup download failed - QMessageBox::information(NULL, tr("HTTP"), + QMessageBox::information(nullptr, tr("HTTP"), tr("Download failed: %1.") .arg(m_networkReply->errorString())); } else { @@ -68,7 +68,7 @@ void GoogleElevationData::httpFinished() } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; } void GoogleElevationData::httpReadyRead() @@ -119,9 +119,9 @@ void GoogleElevationData::requestElevationData(const QList &waypoint m_url.setQuery(q); QLOG_DEBUG() << "elevation query :" << m_url; - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(m_url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpFinished())); diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index 4ac9030dd4..fe8e2e2ec7 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -30,7 +30,7 @@ HDDisplay::HDDisplay(QStringList* plotList, QString title, QWidget *parent) : QGraphicsView(parent), - uas(NULL), + uas(nullptr), xCenterOffset(0.0f), yCenterOffset(0.0f), vwidth(80.0f), @@ -53,7 +53,7 @@ HDDisplay::HDDisplay(QStringList* plotList, QString title, QWidget *parent) : lastPaintTime(0), columns(3), valuesChanged(true), - m_ui(NULL) + m_ui(nullptr) { setWindowTitle(title); //m_ui->setupUi(this); @@ -484,7 +484,7 @@ void HDDisplay::setActiveUAS(UASInterface* uas) if (!uas) return; // Disconnect any previously connected active UAS - if (this->uas != NULL) { + if (this->uas != nullptr) { removeSource(this->uas); } diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index b4c5a5d69b..ae195fdbd3 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -47,7 +47,7 @@ This file is part of the QGROUNDCONTROL project #include HSIDisplay::HSIDisplay(QWidget *parent) : - HDDisplay(NULL, "HSI", parent), + HDDisplay(nullptr, "HSI", parent), dragStarted(false), leftDragStarted(false), mouseHasMoved(false), @@ -165,7 +165,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) : xCenterPos = vwidth/2.0f; yCenterPos = vheight/2.0f + topMargin - bottomMargin; - uas = NULL; + uas = nullptr; resetMAVState(); // Do first update @@ -859,7 +859,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) if (!uas) return; - if (this->uas != NULL) { + if (this->uas != nullptr) { disconnect(this->uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); disconnect(this->uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); disconnect(this->uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 8c0eed8103..061ac6a2c5 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -59,8 +59,8 @@ This file is part of the QGROUNDCONTROL project */ HUD::HUD(int width, int height, QWidget* parent) : QLabel(parent), - image(NULL), - uas(NULL), + image(nullptr), + uas(nullptr), yawInt(0.0f), mode(tr("UNKNOWN MODE")), state(tr("UNKNOWN STATE")), @@ -71,9 +71,9 @@ HUD::HUD(int width, int height, QWidget* parent) vheight(150.0f), vGaugeSpacing(65.0f), vPitchPerDeg(6.0f), ///< 4 mm y translation per degree) - rawBuffer1(NULL), - rawBuffer2(NULL), - rawImage(NULL), + rawBuffer1(nullptr), + rawBuffer2(nullptr), + rawImage(nullptr), rawLastIndex(0), rawExpectedBytes(0), bytesPerLine(1), @@ -172,7 +172,7 @@ HUD::HUD(int width, int height, QWidget* parent) createActions(); - if (UASManager::instance()->getActiveUAS() != NULL) setActiveUAS(UASManager::instance()->getActiveUAS()); + if (UASManager::instance()->getActiveUAS() != nullptr) setActiveUAS(UASManager::instance()->getActiveUAS()); } HUD::~HUD() @@ -248,7 +248,7 @@ void HUD::createActions() */ void HUD::setActiveUAS(UASInterface* uas) { - if (this->uas != NULL) { + if (this->uas != nullptr) { // Disconnect any previously connected active MAV disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*, double, double, double, quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,int, double, double, double, quint64)), this, SLOT(updateAttitude(UASInterface*,int,double, double, double, quint64))); @@ -1157,7 +1157,7 @@ void HUD::selectWaypoint(int uasId, int id) void HUD::setImageSize(int width, int height, int depth, int channels) { // Allocate raw image in correct size - if (width != receivedWidth || height != receivedHeight || depth != receivedDepth || channels != receivedChannels || image == NULL) { + if (width != receivedWidth || height != receivedHeight || depth != receivedDepth || channels != receivedChannels || image == nullptr) { // Set new size if (width > 0) receivedWidth = width; if (height > 0) receivedHeight = height; @@ -1167,9 +1167,9 @@ void HUD::setImageSize(int width, int height, int depth, int channels) rawExpectedBytes = (receivedWidth * receivedHeight * receivedDepth * receivedChannels) / 8; bytesPerLine = rawExpectedBytes / receivedHeight; // Delete old buffers if necessary - rawImage = NULL; - if (rawBuffer1 != NULL) delete rawBuffer1; - if (rawBuffer2 != NULL) delete rawBuffer2; + rawImage = nullptr; + if (rawBuffer1 != nullptr) delete rawBuffer1; + if (rawBuffer2 != nullptr) delete rawBuffer2; rawBuffer1 = (unsigned char*)malloc(rawExpectedBytes); rawBuffer2 = (unsigned char*)malloc(rawExpectedBytes); @@ -1235,7 +1235,7 @@ void HUD::finishImage() void HUD::commitRawDataToGL() { QLOG_DEBUG() << __FILE__ << __LINE__ << "Copying raw data to GL buffer:" << rawImage << receivedWidth << receivedHeight << image->format(); - if (image != NULL) { + if (image != nullptr) { QImage::Format format = image->format(); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); if (format == QImage::Format_Indexed8) { diff --git a/src/ui/HUD.h b/src/ui/HUD.h index 433006a171..3f6294f04b 100644 --- a/src/ui/HUD.h +++ b/src/ui/HUD.h @@ -52,7 +52,7 @@ class HUD : public QLabel { Q_OBJECT public: - HUD(int width = 640, int height = 480, QWidget* parent = NULL); + HUD(int width = 640, int height = 480, QWidget* parent = nullptr); ~HUD(); void setImageSize(int width, int height, int depth, int channels); diff --git a/src/ui/JoystickWidget.cc b/src/ui/JoystickWidget.cc index e360986985..ac3387f29a 100644 --- a/src/ui/JoystickWidget.cc +++ b/src/ui/JoystickWidget.cc @@ -95,7 +95,7 @@ void JoystickWidget::joystickSelected(const QString& name) { m_ui->joystickLabel->setText(name); m_ui->joystickButton->setEnabled(true); - joystick->setActiveUAS(NULL); + joystick->setActiveUAS(nullptr); updateMappings(); m_buttonList.clear(); @@ -117,7 +117,7 @@ void JoystickWidget::joystickEnabled(bool checked) { QLOG_INFO() << "Disabling joystick"; m_ui->joystickButton->setText("Activate"); - joystick->setActiveUAS(NULL); + joystick->setActiveUAS(nullptr); } } diff --git a/src/ui/MAVLinkSettingsWidget.cc b/src/ui/MAVLinkSettingsWidget.cc index ca3c7e4db3..7b12acaba1 100644 --- a/src/ui/MAVLinkSettingsWidget.cc +++ b/src/ui/MAVLinkSettingsWidget.cc @@ -190,7 +190,7 @@ void MAVLinkSettingsWidget::enableDroneOS(bool enable) //QString host = hostString.split(":").first(); // Delete from all lists first - UDPLink* firstUdp = NULL; + UDPLink* firstUdp = nullptr; /*QList links = LinkManager::instance()->getLinksForProtocol(protocol); foreach (LinkInterface* link, links) { diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 791558ffae..98172ffb84 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -180,7 +180,7 @@ MainWindow::MainWindow(QWidget *parent): centerStackActionGroup(new QActionGroup(this)), styleFileName(QCoreApplication::applicationDirPath() + "/style-outdoor.css"), m_heartbeatEnabled(true), - m_terminalDialog(NULL) + m_terminalDialog(nullptr) { QLOG_DEBUG() << "Creating MainWindow"; this->setAttribute(Qt::WA_DeleteOnClose); @@ -419,14 +419,14 @@ MainWindow::~MainWindow() QLOG_DEBUG() << "Delete JoystickWidget"; delete joystickWidget; - joystickWidget = NULL; + joystickWidget = nullptr; } if (joystick) { joystick->shutdown(); joystick->wait(5000); delete joystick; - joystick = NULL; + joystick = nullptr; } // Get and delete all dockwidgets and contained @@ -445,14 +445,14 @@ MainWindow::~MainWindow() // delete dockWidget->widget(); QLOG_DEBUG() << "Delete DockWidget " << dockWidget; delete dockWidget; - dockWidget = NULL; + dockWidget = nullptr; } else if (dynamic_cast(*i)) // [ToDo] Stability { QWidget* widget = dynamic_cast(*i); QLOG_DEBUG() << "Delete Widget " << widget; delete widget; - *i = NULL; + *i = nullptr; } } // Delete all UAS objects @@ -640,7 +640,7 @@ void MainWindow::buildCommonWidgets() connect(ui.actionAdvanced_Mode, SIGNAL(toggled(bool)), apsw, SLOT(advModeChanged(bool))); } - AP2DataPlot2D *plot = NULL; + AP2DataPlot2D *plot = nullptr; if (!engineeringView) { engineeringView = new SubMainWindow(this); @@ -2450,7 +2450,7 @@ void MainWindow::showAbout() dialog->exec(); dialog->hide(); delete dialog; - dialog = NULL; + dialog = nullptr; } void MainWindow::showAutoUpdateDownloadDialog(QString version, QString releaseType, QString url, QString name) @@ -2469,7 +2469,7 @@ void MainWindow::autoUpdateCancelled(QString version) m_autoUpdateCheck.setSkipVersion(version); delete m_dialog; - m_dialog = NULL; + m_dialog = nullptr; } void MainWindow::showNoUpdateAvailDialog() @@ -2491,8 +2491,8 @@ void MainWindow::enableHeartbeat(bool enabled) void MainWindow::showTerminalConsole() { - if(m_terminalDialog == NULL){ - m_terminalDialog = new QDialog(NULL); + if(m_terminalDialog == nullptr){ + m_terminalDialog = new QDialog(nullptr); TerminalConsole *terminalConsole = new TerminalConsole(this); QVBoxLayout* vLayout = new QVBoxLayout(m_terminalDialog); vLayout->setMargin(0); @@ -2512,6 +2512,6 @@ void MainWindow::closeTerminalConsole() if (m_terminalDialog){ m_terminalDialog->close(); m_terminalDialog->deleteLater(); - m_terminalDialog = NULL; + m_terminalDialog = nullptr; } } diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index c5fceed5ed..898c66972d 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -28,11 +28,11 @@ MapWidget::MapWidget(QWidget *parent) : QWidget(parent), - mc(NULL), + mc(nullptr), zoomLevel(0), uasIcons(), uasTrails(), - mav(NULL), + mav(nullptr), lastUpdate(0), initialized(false), m_ui(new Ui::MapWidget) @@ -499,7 +499,7 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp, bool updateView) // Update pen wpIcons.at(wpindex)->setPen(mavPens.value(uas)); // Then waypoint line coordinate - Point* linesegment = NULL; + Point* linesegment = nullptr; // If the line segment already exists, just update it // else create a new one if (waypointPath->points().size() > wpindex) { @@ -800,7 +800,7 @@ void MapWidget::updateAttitude(UASInterface* uas, double roll, double pitch, dou if (mc) { if (uas) { - MAV2DIcon* icon = dynamic_cast(uasIcons.value(uas->getUASID(), NULL)); + MAV2DIcon* icon = dynamic_cast(uasIcons.value(uas->getUASID(), nullptr)); if (icon) { icon->setYaw(yaw); } diff --git a/src/ui/MissionElevationDisplay.cpp b/src/ui/MissionElevationDisplay.cpp index cd2b8df0da..8505168ee8 100644 --- a/src/ui/MissionElevationDisplay.cpp +++ b/src/ui/MissionElevationDisplay.cpp @@ -43,10 +43,10 @@ static const int ElevationGraphElevationId = 1; //m MissionElevationDisplay::MissionElevationDisplay(QWidget *parent) : QWidget(parent), ui(new Ui::MissionElevationDisplay), - m_uasInterface(NULL), - m_uasWaypointMgr(NULL), + m_uasInterface(nullptr), + m_uasWaypointMgr(nullptr), m_totalDistance(0), - m_elevationData(NULL), + m_elevationData(nullptr), m_useHomeAltOffset(false), m_homeAltOffset(0.0), m_elevationShown(false) @@ -110,7 +110,7 @@ void MissionElevationDisplay::activeUASSet(UASInterface *uas) disconnect(ui->sampleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(sampleValueChanged())); } - m_uasWaypointMgr = NULL; + m_uasWaypointMgr = nullptr; m_uasInterface = uas; if(m_uasInterface){ @@ -194,7 +194,7 @@ void MissionElevationDisplay::updateElevationGraph(QList waypointLis int MissionElevationDisplay::plotElevationGraph(QList waypointList, int graphId, double homeAltOffset) { - Waypoint* previousWp = NULL; + Waypoint* previousWp = nullptr; double totalDistance = 0.0; double homeAlt = 0.0; QCustomPlot* customplot = ui->customPlot; @@ -253,10 +253,10 @@ void MissionElevationDisplay::addWaypointLabels() customPlot->clearItems(); double totalDistance = 0.0; double distance = 0.0; - Waypoint* previousWp = NULL; + Waypoint* previousWp = nullptr; foreach(Waypoint* wp, m_waypointList){ - if(previousWp != NULL) { + if(previousWp != nullptr) { distance = distanceBetweenLatLng(previousWp->getLatitude(), previousWp->getLongitude(), wp->getLatitude(), wp->getLongitude()); } @@ -277,7 +277,7 @@ void MissionElevationDisplay::addWaypointLabels() void MissionElevationDisplay::updateElevationData() { - if(m_elevationData == NULL){ + if(m_elevationData == nullptr){ m_elevationData = new GoogleElevationData(); connect(m_elevationData, SIGNAL(elevationDataReady(QList,double)), this, SLOT(updateElevationGraph(QList,double))); diff --git a/src/ui/ObjectDetectionView.cc b/src/ui/ObjectDetectionView.cc index f6e0daa7b6..72b8be367a 100644 --- a/src/ui/ObjectDetectionView.cc +++ b/src/ui/ObjectDetectionView.cc @@ -45,7 +45,7 @@ ObjectDetectionView::ObjectDetectionView(QString folder, QWidget *parent) : patternList(), letterList(), letterTimer(), - uas(NULL), + uas(nullptr), patternFolder(folder), separator(" "), m_ui(new Ui::ObjectDetectionView) @@ -77,7 +77,7 @@ void ObjectDetectionView::changeEvent(QEvent *e) void ObjectDetectionView::setUAS(UASInterface* uas) { - if (this->uas != NULL) { + if (this->uas != nullptr) { disconnect(this->uas, SIGNAL(patternDetected(int, QString, float, bool)), this, SLOT(newPattern(int, QString, float, bool))); disconnect(this->uas, SIGNAL(letterDetected(int, QString, float, bool)), this, SLOT(newLetter(int, QString, float, bool))); } diff --git a/src/ui/OgreWidget.cc b/src/ui/OgreWidget.cc index 73998af834..dfe0d73fff 100644 --- a/src/ui/OgreWidget.cc +++ b/src/ui/OgreWidget.cc @@ -12,7 +12,7 @@ class OgreWidget : public QGLWidget public: OgreWidget( QWidget *parent=0 ): QGLWidget( parent ), - mOgreWindow(NULL) { + mOgreWindow(nullptr) { init( "../bin/plugins.cfg", "../bin/ogre.cfg", "../bin/ogre.log" ); } diff --git a/src/ui/PrimaryFlightDisplay.cc b/src/ui/PrimaryFlightDisplay.cc index 1a011ddba0..f35497c635 100644 --- a/src/ui/PrimaryFlightDisplay.cc +++ b/src/ui/PrimaryFlightDisplay.cc @@ -123,7 +123,7 @@ const QString PrimaryFlightDisplay::compassWindNames[] = { PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *parent) : QWidget(parent), - uas(NULL), + uas(nullptr), /* altimeterMode(GPS_MAIN), @@ -265,7 +265,7 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event) void PrimaryFlightDisplay::forgetUAS(UASInterface* uas) { - if (this->uas != NULL && this->uas == uas) { + if (this->uas != nullptr && this->uas == uas) { // Disconnect any previously connected active MAV disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); diff --git a/src/ui/PrimaryFlightDisplay.h b/src/ui/PrimaryFlightDisplay.h index d5d5223a8e..1f2cfd8ef4 100644 --- a/src/ui/PrimaryFlightDisplay.h +++ b/src/ui/PrimaryFlightDisplay.h @@ -9,7 +9,7 @@ class PrimaryFlightDisplay : public QWidget { Q_OBJECT public: - PrimaryFlightDisplay(int width = 640, int height = 480, QWidget* parent = NULL); + PrimaryFlightDisplay(int width = 640, int height = 480, QWidget* parent = nullptr); ~PrimaryFlightDisplay(); public slots: diff --git a/src/ui/PrimaryFlightDisplayQML.cpp b/src/ui/PrimaryFlightDisplayQML.cpp index b5de9ed405..0cbda5171a 100644 --- a/src/ui/PrimaryFlightDisplayQML.cpp +++ b/src/ui/PrimaryFlightDisplayQML.cpp @@ -34,8 +34,8 @@ This file is part of the APM_PLANNER project PrimaryFlightDisplayQML::PrimaryFlightDisplayQML(QWidget *parent) : QWidget(parent), - m_declarativeView(NULL), - m_uasInterface(NULL) + m_declarativeView(nullptr), + m_uasInterface(nullptr) { QUrl url = QUrl::fromLocalFile(QGC::shareDirectory() + "/qml/PrimaryFlightDisplayQML.qml"); QLOG_DEBUG() << url; diff --git a/src/ui/QGCHilConfiguration.h b/src/ui/QGCHilConfiguration.h index 025c913ae0..43d7390fb8 100644 --- a/src/ui/QGCHilConfiguration.h +++ b/src/ui/QGCHilConfiguration.h @@ -1,4 +1,4 @@ -#ifndef QGCHILCONFIGURATION_H + #ifndef QGCHILCONFIGURATION_H #define QGCHILCONFIGURATION_H #include diff --git a/src/ui/QGCMAVLinkInspector.cc b/src/ui/QGCMAVLinkInspector.cc index 5742d5c11a..2eb4fc6e7b 100644 --- a/src/ui/QGCMAVLinkInspector.cc +++ b/src/ui/QGCMAVLinkInspector.cc @@ -138,7 +138,7 @@ void QGCMAVLinkInspector::clearView() for(ite=uasMessageStorage.begin(); ite!=uasMessageStorage.end();++ite) { delete ite.value(); - ite.value() = NULL; + ite.value() = nullptr; } uasMessageStorage.clear(); @@ -160,7 +160,7 @@ void QGCMAVLinkInspector::clearView() for(iteTree=uasTreeWidgetItems.begin(); iteTree!=uasTreeWidgetItems.end();++iteTree) { delete iteTree.value(); - iteTree.value() = NULL; + iteTree.value() = nullptr; } uasTreeWidgetItems.clear(); @@ -170,7 +170,7 @@ void QGCMAVLinkInspector::clearView() iteHz.value()->clear(); delete iteHz.value(); - iteHz.value() = NULL; + iteHz.value() = nullptr; } uasMessageHz.clear(); @@ -179,7 +179,7 @@ void QGCMAVLinkInspector::clearView() { iteCount.value()->clear(); delete iteCount.value(); - iteCount.value() = NULL; + iteCount.value() = nullptr; } uasMessageCount.clear(); @@ -188,7 +188,7 @@ void QGCMAVLinkInspector::clearView() { iteLast.value()->clear(); delete iteLast.value(); - iteLast.value() = NULL; + iteLast.value() = nullptr; } uasLastMessageUpdate.clear(); @@ -214,7 +214,7 @@ void QGCMAVLinkInspector::refreshView() { mavlink_message_t* msg = ite.value(); - // Ignore NULL values + // Ignore nullptr values if (msg->msgid == 0xFF) continue; // Update the message frenquency diff --git a/src/ui/QGCMAVLinkLogPlayer.cc b/src/ui/QGCMAVLinkLogPlayer.cc index 76c26cc58d..37994c2e33 100644 --- a/src/ui/QGCMAVLinkLogPlayer.cc +++ b/src/ui/QGCMAVLinkLogPlayer.cc @@ -13,10 +13,10 @@ QGCMAVLinkLogPlayer::QGCMAVLinkLogPlayer(QWidget *parent): m_sliderDown(false), m_isPlaying(false), ui(new Ui::QGCMAVLinkLogPlayer), - m_logLink(NULL), + m_logLink(nullptr), m_logLoaded(false), - m_mavlinkDecoder(NULL), - m_mavlinkInspector(NULL) + m_mavlinkDecoder(nullptr), + m_mavlinkInspector(nullptr) { ui->setupUi(this); ui->horizontalLayout->setAlignment(Qt::AlignTop); diff --git a/src/ui/QGCParamWidget.cc b/src/ui/QGCParamWidget.cc index ceb249b53c..dcce59f6b8 100644 --- a/src/ui/QGCParamWidget.cc +++ b/src/ui/QGCParamWidget.cc @@ -703,7 +703,7 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName, initialParamTimer->stop(); } // Reference to item in tree - QTreeWidgetItem* parameterItem = NULL; + QTreeWidgetItem* parameterItem = nullptr; // Get component if (!components->contains(component)) @@ -882,7 +882,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) { if (current && column > 0) { QTreeWidgetItem* parent = current->parent(); - while (parent->parent() != NULL) { + while (parent->parent() != nullptr) { parent = parent->parent(); } // Parent is now top-level component @@ -890,7 +890,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) if (!changedValues.contains(key)) { changedValues.insert(key, new QMap()); } - QMap* map = changedValues.value(key, NULL); + QMap* map = changedValues.value(key, nullptr); if (map) { QString str = current->data(0, Qt::DisplayRole).toString(); QVariant value = current->data(1, Qt::DisplayRole); @@ -1018,7 +1018,7 @@ void QGCParamWidget::retransmissionGuardTick() // Iterate through the parameters of the component int component = i.key(); // Request n parameters from this component (at maximum) - QList * paramList = transmissionMissingPackets.value(component, NULL); + QList * paramList = transmissionMissingPackets.value(component, nullptr); if (paramList) { int count = 0; foreach (int id, *paramList) { @@ -1117,7 +1117,7 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant QMap* parameterList = parameters.value(component); - if (parameterList == NULL){ + if (parameterList == nullptr){ QLOG_ERROR() << " No parameter list for component: " << component; return; } diff --git a/src/ui/QGCRGBDView.cc b/src/ui/QGCRGBDView.cc index 110ade057d..7238c7ebd4 100644 --- a/src/ui/QGCRGBDView.cc +++ b/src/ui/QGCRGBDView.cc @@ -56,7 +56,7 @@ void QGCRGBDView::loadSettings() void QGCRGBDView::setActiveUAS(UASInterface* uas) { - if (this->uas != NULL) + if (this->uas != nullptr) { // Disconnect any previously connected active MAV disconnect(this->uas, SIGNAL(rgbdImageChanged(UASInterface*)), this, SLOT(updateData(UASInterface*))); diff --git a/src/ui/QGCSettingsWidget.cc b/src/ui/QGCSettingsWidget.cc index 69e1ec22fd..37bca4bef8 100644 --- a/src/ui/QGCSettingsWidget.cc +++ b/src/ui/QGCSettingsWidget.cc @@ -203,10 +203,10 @@ void QGCSettingsWidget::setMissionsDir() void QGCSettingsWidget::setActiveUAS(UASInterface *uas) { if (m_uas){ - m_uas = NULL; + m_uas = nullptr; } - if (uas != NULL){ + if (uas != nullptr){ m_uas = uas; } } @@ -272,7 +272,7 @@ void QGCSettingsWidget::ratesChanged() if (m_uas) { ArduPilotMegaMAV *mav = dynamic_cast(m_uas); - if (mav != NULL){ + if (mav != nullptr){ mav->RequestAllDataStreams(); } } diff --git a/src/ui/QGCStatusBar.cc b/src/ui/QGCStatusBar.cc index eec4b55e56..6aba8e42ff 100644 --- a/src/ui/QGCStatusBar.cc +++ b/src/ui/QGCStatusBar.cc @@ -31,11 +31,11 @@ This file is part of the QGROUNDCONTROL project QGCStatusBar::QGCStatusBar(QWidget *parent) : QStatusBar(parent), - toggleLoggingButton(NULL), - player(NULL), + toggleLoggingButton(nullptr), + player(nullptr), changed(true), lastLogDirectory(QGC::MAVLinkLogDirectory()), - m_uas(NULL) + m_uas(nullptr) { setObjectName("QGC_STATUSBAR"); diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 6195865140..cada38a7f6 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -31,16 +31,16 @@ This file is part of the QGROUNDCONTROL project QGCToolBar::QGCToolBar(QWidget *parent) : QToolBar(parent), - mav(NULL), - player(NULL), + mav(nullptr), + player(nullptr), changed(true), batteryPercent(0), batteryVoltage(0), wpId(0), wpDistance(0), systemArmed(false), - currentLink(NULL), - firstAction(NULL) + currentLink(nullptr), + firstAction(nullptr) { setObjectName("QGC_TOOLBAR"); @@ -302,8 +302,8 @@ void QGCToolBar::advancedActivityTriggered(QAction* action) void QGCToolBar::setActiveUAS(UASInterface* active) { - // Do nothing if system is the same or NULL - if ((active == NULL) || mav == active) return; + // Do nothing if system is the same or nullptr + if ((active == nullptr) || mav == active) return; if (mav) { @@ -555,7 +555,7 @@ void QGCToolBar::addLink(LinkInterface* link) void QGCToolBar::removeLink(LinkInterface* link) { if (link == currentLink) { - currentLink = NULL; + currentLink = nullptr; //portComboBox->setEnabled(false); //portComboBox->clear(); // XXX magic number diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index fc0192c497..0ba62e88bd 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -22,7 +22,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : QWidget(parent), - mav(NULL), + mav(nullptr), chanCount(0), rcRoll(0.0f), rcPitch(0.0f), @@ -787,8 +787,8 @@ void QGCVehicleConfig::loadConfig() void QGCVehicleConfig::setActiveUAS(UASInterface* active) { - // Do nothing if system is the same or NULL - if ((active == NULL) || mav == active) return; + // Do nothing if system is the same or nullptr + if ((active == nullptr) || mav == active) return; if (mav) { diff --git a/src/ui/QGCWaypointListMulti.cc b/src/ui/QGCWaypointListMulti.cc index 136a10a5bc..dc78cb47a8 100644 --- a/src/ui/QGCWaypointListMulti.cc +++ b/src/ui/QGCWaypointListMulti.cc @@ -29,7 +29,7 @@ void QGCWaypointListMulti::systemDeleted(QObject* uas) if (mav) { int id = mav->getUASID(); - WaypointList* list = lists.value(id, NULL); + WaypointList* list = lists.value(id, nullptr); if (list) { delete list; @@ -49,7 +49,7 @@ void QGCWaypointListMulti::systemCreated(UASInterface* uas) void QGCWaypointListMulti::systemSetActive(int uas) { - WaypointList* list = lists.value(uas, NULL); + WaypointList* list = lists.value(uas, nullptr); if (list) { ui->stackedWidget->setCurrentWidget(list); } diff --git a/src/ui/SlugsDataSensorView.cc b/src/ui/SlugsDataSensorView.cc index 15ff46d393..12fd275755 100644 --- a/src/ui/SlugsDataSensorView.cc +++ b/src/ui/SlugsDataSensorView.cc @@ -11,7 +11,7 @@ SlugsDataSensorView::SlugsDataSensorView(QWidget *parent) : { ui->setupUi(this); - activeUAS = NULL; + activeUAS = nullptr; this->setVisible(false); @@ -29,7 +29,7 @@ void SlugsDataSensorView::addUAS(UASInterface* uas) { SlugsMAV* slugsMav = qobject_cast(uas); - if (slugsMav != NULL) { + if (slugsMav != nullptr) { connect(slugsMav, SIGNAL(slugsRawImu(int, const mavlink_raw_imu_t&)), this, SLOT(slugRawDataChanged(int, const mavlink_raw_imu_t&))); diff --git a/src/ui/SlugsHilSim.cc b/src/ui/SlugsHilSim.cc index b4b51c0d80..e979b6640d 100644 --- a/src/ui/SlugsHilSim.cc +++ b/src/ui/SlugsHilSim.cc @@ -42,7 +42,7 @@ SlugsHilSim::SlugsHilSim(QWidget *parent) : rxSocket = new QUdpSocket(this); txSocket = new QUdpSocket(this); - hilLink = NULL; + hilLink = nullptr; //connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addToCombo(LinkInterface*))); connect(LinkManager::instance(),SIGNAL(newLink(LinkInterface*)),this,SLOT(addToCombo(LinkInterface*))); @@ -78,7 +78,7 @@ void SlugsHilSim::addToCombo(LinkInterface* theLink) linksAvailable.insert(ui->cb_mavlinkLinks->count(),theLink); ui->cb_mavlinkLinks->addItem(theLink->getName()); - if (hilLink == NULL) { + if (hilLink == nullptr) { hilLink = theLink; } @@ -156,7 +156,7 @@ void SlugsHilSim::readDatagram(void) void SlugsHilSim::activeUasSet(UASInterface* uas) { - if (uas != NULL) { + if (uas != nullptr) { activeUas = static_cast (uas); } } @@ -332,7 +332,7 @@ void SlugsHilSim::commandDatagramToSimulink() //mavlink_pwm_commands_t* pwdC; -// if(pwdC != NULL){ +// if(pwdC != nullptr){ // } QByteArray data; diff --git a/src/ui/VibrationMonitor.cpp b/src/ui/VibrationMonitor.cpp index df6eb4fb86..1a7ec8906f 100644 --- a/src/ui/VibrationMonitor.cpp +++ b/src/ui/VibrationMonitor.cpp @@ -32,8 +32,8 @@ This file is part of the APM_PLANNER project VibrationMonitor::VibrationMonitor(QWidget *parent) : QWidget(parent), - m_declarativeView(NULL), - m_uasInterface(NULL) + m_declarativeView(nullptr), + m_uasInterface(nullptr) { QUrl url = QUrl::fromLocalFile(QGC::shareDirectory() + "/qml/VibrationMonitor.qml"); QLOG_DEBUG() << url; diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index 59290a6183..c0f7989a4f 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -75,7 +75,7 @@ This file is part of the QGROUNDCONTROL project WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : QWidget(parent), viewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_DEFAULT), - m_missionWidget(NULL), + m_missionWidget(nullptr), m_ui(new Ui::WaypointEditableView) { m_ui->setupUi(this); @@ -254,10 +254,10 @@ void WaypointEditableView::updateActionView(int actionID) if (m_missionWidget && (m_currentAction != actionID)){ delete m_missionWidget; - m_missionWidget = NULL; + m_missionWidget = nullptr; } - if (m_missionWidget == NULL){ + if (m_missionWidget == nullptr){ m_missionWidget = createActionWidget(actionID); m_ui->customActionWidget->layout()->addWidget(m_missionWidget); m_currentAction = actionID; diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 1c3c44c08b..0dbb244de0 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -44,7 +44,7 @@ This file is part of the PIXHAWK project WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) : QWidget(parent), - m_uas(NULL), + m_uas(nullptr), WPM(wpm), mavX(0.0), mavY(0.0), @@ -172,7 +172,7 @@ void WaypointList::updateAttitude(UASInterface* uas, double roll, double pitch, void WaypointList::setUAS(UASInterface* uas) { - if (m_uas != NULL) + if (m_uas != nullptr) { // Clear current list on_clearWPListButton_clicked(); diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h index 0e53fb632e..95d58ae260 100644 --- a/src/ui/WaypointList.h +++ b/src/ui/WaypointList.h @@ -56,7 +56,7 @@ class WaypointList : public QWidget Q_OBJECT Q_DISABLE_COPY(WaypointList) public: - WaypointList(QWidget* parent = NULL, UASWaypointManager* wpm = NULL); + WaypointList(QWidget* parent = nullptr, UASWaypointManager* wpm = nullptr); virtual ~WaypointList(); public slots: diff --git a/src/ui/XbeeConfigurationWindow.cpp b/src/ui/XbeeConfigurationWindow.cpp index b66e18eb9f..6d38968787 100644 --- a/src/ui/XbeeConfigurationWindow.cpp +++ b/src/ui/XbeeConfigurationWindow.cpp @@ -82,8 +82,8 @@ static kern_return_t FindModems(io_iterator_t *matchingServices) // Serial devices are instances of class IOSerialBSDClient classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue); - if (classesToMatch == NULL) { - printf("IOServiceMatching returned a NULL dictionary.\n"); + if (classesToMatch == nullptr) { + printf("IOServiceMatching returned a nullptr dictionary.\n"); } else { /*! @function CFDictionarySetValue From 000b5dbf42c9375d1f62b7a2d229d7da1873e760 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:13:51 +0900 Subject: [PATCH 09/23] configuration: Change from NULL to nullptr --- src/ui/configuration/AdvParameterList.cc | 12 ++++---- src/ui/configuration/ApmHardwareConfig.cc | 2 +- src/ui/configuration/ApmSoftwareConfig.cc | 4 +-- src/ui/configuration/CompassConfig.cc | 6 ++-- .../CompassMotorCalibrationDialog.cpp | 2 +- .../DownloadRemoteParamsDialog.cc | 28 +++++++++---------- src/ui/configuration/FrameTypeConfig.cc | 4 +-- src/ui/configuration/ParamCompareDialog.cpp | 6 ++-- src/ui/configuration/Radio3DRConfig.cc | 10 +++---- src/ui/configuration/RadioFlashWizard.cpp | 4 +-- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/ui/configuration/AdvParameterList.cc b/src/ui/configuration/AdvParameterList.cc index 31688f50b6..ba8fcca036 100644 --- a/src/ui/configuration/AdvParameterList.cc +++ b/src/ui/configuration/AdvParameterList.cc @@ -46,7 +46,7 @@ AdvParameterList::AdvParameterList(QWidget *parent) : AP2ConfigWidget(parent), m_writingParams(false), m_paramsWritten(0), m_paramsToWrite(0), - m_fileDialog(NULL) + m_fileDialog(nullptr) { ui.setupUi(this); connect(ui.refreshPushButton, SIGNAL(clicked()),this, SLOT(refreshButtonClicked())); @@ -172,7 +172,7 @@ void AdvParameterList::writeButtonClicked() AdvParameterList::~AdvParameterList() { delete m_fileDialog; - m_fileDialog = NULL; + m_fileDialog = nullptr; } void AdvParameterList::refreshButtonClicked() @@ -270,7 +270,7 @@ void AdvParameterList::dialogRejected() QLOG_DEBUG() << "Dialog Rejected:" << dialog; if (dialog){ dialog->deleteLater(); - dialog = NULL; + dialog = nullptr; } } @@ -340,7 +340,7 @@ void AdvParameterList::saveDialogAccepted() file.close(); dialog->deleteLater(); // cleanup dialog instance - dialog = NULL; + dialog = nullptr; } void AdvParameterList::parameterChanged(int /*uas*/, int /*component*/, QString parameterName, QVariant value) @@ -503,7 +503,7 @@ void AdvParameterList::downloadRemoteFiles() QTimer::singleShot(300, this, SLOT(compareButtonClicked())); } dialog->deleteLater(); - dialog = NULL; + dialog = nullptr; } void AdvParameterList::updateTableWidgetElements(QMap ¶meterList) @@ -536,7 +536,7 @@ void AdvParameterList::compareButtonClicked() } m_paramFileToCompare = ""; // clear any previous filenames dialog->deleteLater(); - dialog = NULL; + dialog = nullptr; } void AdvParameterList::findStringInTable(const QString &searchString) diff --git a/src/ui/configuration/ApmHardwareConfig.cc b/src/ui/configuration/ApmHardwareConfig.cc index 3b96d27f59..f5a36c8ac1 100644 --- a/src/ui/configuration/ApmHardwareConfig.cc +++ b/src/ui/configuration/ApmHardwareConfig.cc @@ -31,7 +31,7 @@ This file is part of the APM_PLANNER project #include "ApmHardwareConfig.h" ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : AP2ConfigWidget(parent), - m_uas(NULL), + m_uas(nullptr), m_paramDownloadState(none), m_paramDownloadCount(0), m_mandatory(false) diff --git a/src/ui/configuration/ApmSoftwareConfig.cc b/src/ui/configuration/ApmSoftwareConfig.cc index 469b1100c6..a137a99b64 100644 --- a/src/ui/configuration/ApmSoftwareConfig.cc +++ b/src/ui/configuration/ApmSoftwareConfig.cc @@ -178,7 +178,7 @@ void ApmSoftwareConfig::apmParamNetworkReplyFinished() } m_url = newUrl; m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; m_networkReply = m_networkAccessManager.get(QNetworkRequest(m_url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(apmParamNetworkReplyFinished())); return; @@ -208,7 +208,7 @@ void ApmSoftwareConfig::apmParamNetworkReplyFinished() file.close(); } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; if (!pdef_urls.isEmpty()) { QPair next = pdef_urls.takeFirst(); diff --git a/src/ui/configuration/CompassConfig.cc b/src/ui/configuration/CompassConfig.cc index e3a56bdaa6..807bfbec4e 100644 --- a/src/ui/configuration/CompassConfig.cc +++ b/src/ui/configuration/CompassConfig.cc @@ -27,8 +27,8 @@ This file is part of the APM_PLANNER project #include "QGCCore.h" CompassConfig::CompassConfig(QWidget *parent) : AP2ConfigWidget(parent), - m_progressDialog(NULL), - m_timer(NULL), + m_progressDialog(nullptr), + m_timer(nullptr), m_calibratingCompass(false), m_compatibilityMode(false), m_haveSecondCompass(false), @@ -352,7 +352,7 @@ void CompassConfig::liveCalibrationClicked() void CompassConfig::startDataCollection() { - if (m_uas == NULL){ + if (m_uas == nullptr){ return; } QGCUASParamManager* pm = m_uas->getParamManager(); diff --git a/src/ui/configuration/CompassMotorCalibrationDialog.cpp b/src/ui/configuration/CompassMotorCalibrationDialog.cpp index 152b996b07..ffb01c2a92 100644 --- a/src/ui/configuration/CompassMotorCalibrationDialog.cpp +++ b/src/ui/configuration/CompassMotorCalibrationDialog.cpp @@ -20,7 +20,7 @@ static const QColor GRAPH_COLOR_CURRENT_FILL = QColor(0, 255, 0, 20); // Red CompassMotorCalibrationDialog::CompassMotorCalibrationDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CompassMotorCalibrationDialog), - m_uasInterface(NULL) + m_uasInterface(nullptr) { ui->setupUi(this); diff --git a/src/ui/configuration/DownloadRemoteParamsDialog.cc b/src/ui/configuration/DownloadRemoteParamsDialog.cc index 4e0ee2bfda..8747d95d00 100644 --- a/src/ui/configuration/DownloadRemoteParamsDialog.cc +++ b/src/ui/configuration/DownloadRemoteParamsDialog.cc @@ -38,7 +38,7 @@ DownloadRemoteParamsDialog::DownloadRemoteParamsDialog(QWidget *parent, bool ove m_locationOfFrameParams("https://raw.github.com/diydrones/ardupilot/master/Tools/Frame_params/"), m_extension(".param"), m_version("?ref=master"), - m_networkReply(NULL), + m_networkReply(nullptr), m_httpRequestAborted(false), m_overwriteFile(overwriteFile) { @@ -128,9 +128,9 @@ void DownloadRemoteParamsDialog::refreshParamList() m_url = QUrl("https://api.github.com/repos/diydrones/ardupilot/contents/Tools/Frame_params"); - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(m_url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpParamListFinished())); @@ -141,9 +141,9 @@ void DownloadRemoteParamsDialog::refreshParamList() void DownloadRemoteParamsDialog::startFileDownloadRequest(QUrl url) { m_httpRequestAborted = false; - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpFinished())); @@ -155,9 +155,9 @@ void DownloadRemoteParamsDialog::startFileDownloadRequest(QUrl url) void DownloadRemoteParamsDialog::startParamListDownloadRequest(QUrl url) { m_httpRequestAborted = false; - if (m_networkReply != NULL){ + if (m_networkReply != nullptr){ delete m_networkReply; - m_networkReply = NULL; + m_networkReply = nullptr; } m_networkReply = m_networkAccessManager.get(QNetworkRequest(url)); connect(m_networkReply, SIGNAL(finished()), this, SLOT(httpParamListFinished())); @@ -204,7 +204,7 @@ bool DownloadRemoteParamsDialog::downloadParamFile() tr("Unable to save the file %1: %2.") .arg(fileName).arg(m_downloadedParamFile->errorString())); delete m_downloadedParamFile; - m_downloadedParamFile = NULL; + m_downloadedParamFile = nullptr; return false; } return true; @@ -226,7 +226,7 @@ void DownloadRemoteParamsDialog::httpFinished() m_downloadedParamFile->close(); m_downloadedParamFile->remove(); delete m_downloadedParamFile; - m_downloadedParamFile = NULL; + m_downloadedParamFile = nullptr; } m_networkReply->deleteLater(); return; @@ -261,9 +261,9 @@ void DownloadRemoteParamsDialog::httpFinished() } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; delete m_downloadedParamFile; - m_downloadedParamFile = NULL; + m_downloadedParamFile = nullptr; if (result){ this->accept(); @@ -295,7 +295,7 @@ void DownloadRemoteParamsDialog::httpParamListFinished() QLOG_DEBUG() << "DownloadRemoteParamsDialog::httpParamListFinished()"; if (m_httpRequestAborted) { m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; return; } @@ -303,7 +303,7 @@ void DownloadRemoteParamsDialog::httpParamListFinished() if (m_networkReply->error()) { // [TODO] cleanup download failed #ifdef QT_DEBUG - QMessageBox::information(NULL, tr("HTTP"), + QMessageBox::information(nullptr, tr("HTTP"), tr("Download failed: %1.") .arg(m_networkReply->errorString())); #endif @@ -313,7 +313,7 @@ void DownloadRemoteParamsDialog::httpParamListFinished() } m_networkReply->deleteLater(); - m_networkReply = NULL; + m_networkReply = nullptr; } void DownloadRemoteParamsDialog::processDownloadedVersionObject(const QByteArray& data) diff --git a/src/ui/configuration/FrameTypeConfig.cc b/src/ui/configuration/FrameTypeConfig.cc index b90149db11..84f0537083 100644 --- a/src/ui/configuration/FrameTypeConfig.cc +++ b/src/ui/configuration/FrameTypeConfig.cc @@ -139,7 +139,7 @@ void FrameTypeConfig::paramButtonClicked() QTimer::singleShot(300, this, SLOT(activateCompareDialog())); } delete dialog; - dialog = NULL; + dialog = nullptr; } void FrameTypeConfig::activateCompareDialog() @@ -159,7 +159,7 @@ void FrameTypeConfig::activateCompareDialog() } } delete dialog; - dialog = NULL; + dialog = nullptr; } diff --git a/src/ui/configuration/ParamCompareDialog.cpp b/src/ui/configuration/ParamCompareDialog.cpp index 7bc4550403..65741346c8 100644 --- a/src/ui/configuration/ParamCompareDialog.cpp +++ b/src/ui/configuration/ParamCompareDialog.cpp @@ -92,7 +92,7 @@ void ParamCompareDialog::dialogRejected() QLOG_DEBUG() << "Dialog Rejected:" << dialog; if (dialog){ dialog->deleteLater(); - dialog = NULL; + dialog = nullptr; } } @@ -155,7 +155,7 @@ void ParamCompareDialog::loadParameterFile(const QString &filename) } void ParamCompareDialog::populateParamListFromString(QString paramString, QMap* list, - QWidget* widget = NULL) + QWidget* widget = nullptr) { QStringList paramSplit = paramString.split(QGC::paramLineSplitRegExp()); bool summaryComplete = false; @@ -210,7 +210,7 @@ void ParamCompareDialog::compareLists() UASParameter* currentParam = m_currentList->value(keys[count]); - if (currentParam != NULL){ + if (currentParam != nullptr){ UASParameter* newParam = m_newList->value(keys[count]); if ( !paramCompareEqual(currentParam->value(), newParam->value()) ){ diff --git a/src/ui/configuration/Radio3DRConfig.cc b/src/ui/configuration/Radio3DRConfig.cc index bee2f8aee3..edef6f07dc 100644 --- a/src/ui/configuration/Radio3DRConfig.cc +++ b/src/ui/configuration/Radio3DRConfig.cc @@ -36,7 +36,7 @@ This file is part of the APM_PLANNER project #include Radio3DRConfig::Radio3DRConfig(QWidget *parent) : QWidget(parent), - m_radioSettings(NULL), + m_radioSettings(nullptr), m_state(none) { ui.setupUi(this); @@ -264,7 +264,7 @@ void Radio3DRConfig::readRadioSettings() { QLOG_INFO() << "read 3DR Radio Settings"; - if (m_radioSettings == NULL) { + if (m_radioSettings == nullptr) { m_radioSettings = new Radio3DRSettings(this); connect(m_radioSettings, SIGNAL(localReadComplete(Radio3DREeprom&, bool)), this, SLOT(localReadComplete(Radio3DREeprom&, bool))); @@ -478,7 +478,7 @@ void Radio3DRConfig::writeLocalRadioSettings() { QLOG_INFO() << "save 3DR Local Radio Settings"; - if(m_radioSettings == NULL){ + if(m_radioSettings == nullptr){ QMessageBox::critical(this, tr("Radio Config"), tr("Please Load Settings before attempting to change them")); return; } @@ -509,7 +509,7 @@ void Radio3DRConfig::writeRemoteRadioSettings() { QLOG_INFO() << "save 3DR Remote Radio Settings"; - if(m_radioSettings == NULL){ + if(m_radioSettings == nullptr){ QMessageBox::critical(this, tr("Radio Config"), tr("Please Load Settings before attempting to change them")); return; } @@ -545,7 +545,7 @@ void Radio3DRConfig::writeRemoteRadioSettings() void Radio3DRConfig::copyLocalSettingsToRemote() { QLOG_INFO() << "Copy 3DR Local Radio Settings to remote"; - if(m_radioSettings == NULL){ + if(m_radioSettings == nullptr){ QMessageBox::critical(this, tr("Radio Config"), tr("Please Load Settings before attempting to change them")); return; } diff --git a/src/ui/configuration/RadioFlashWizard.cpp b/src/ui/configuration/RadioFlashWizard.cpp index 7934a633be..1d2ee004b3 100644 --- a/src/ui/configuration/RadioFlashWizard.cpp +++ b/src/ui/configuration/RadioFlashWizard.cpp @@ -62,7 +62,7 @@ RadioFlashWizard::RadioFlashWizard(QWidget *parent) : RadioFlashWizard::~RadioFlashWizard() { delete m_updateProcess; - m_updateProcess = NULL; + m_updateProcess = nullptr; delete ui; } @@ -165,7 +165,7 @@ void RadioFlashWizard::processFinished(int exitCode) ui->plainTextEdit->insertPlainText(QString("\nComplete %1").arg(exitCode)); m_timer.stop(); m_updateProcess->deleteLater(); - m_updateProcess = NULL; + m_updateProcess = nullptr; } QString RadioFlashWizard::getFirmwareImageName(int index) From 12c4de81f1f5e3d76d1460d31f26184ba26f2e8a Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:14:11 +0900 Subject: [PATCH 10/23] designer: Change from NULL to nullptr --- src/ui/designer/QGCComboBox.cc | 2 +- src/ui/designer/QGCCommandButton.cc | 2 +- src/ui/designer/QGCParamSlider.cc | 2 +- src/ui/designer/QGCToolWidget.cc | 20 ++++++++++---------- src/ui/designer/QGCToolWidgetItem.cc | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ui/designer/QGCComboBox.cc b/src/ui/designer/QGCComboBox.cc index edcae7c772..a50dea80fd 100644 --- a/src/ui/designer/QGCComboBox.cc +++ b/src/ui/designer/QGCComboBox.cc @@ -21,7 +21,7 @@ QGCComboBox::QGCComboBox(QWidget *parent) : ui(new Ui::QGCComboBox) { ui->setupUi(this); - uas = NULL; + uas = nullptr; ui->editInfoCheckBox->hide(); diff --git a/src/ui/designer/QGCCommandButton.cc b/src/ui/designer/QGCCommandButton.cc index 63b5faee12..4faf8857ad 100644 --- a/src/ui/designer/QGCCommandButton.cc +++ b/src/ui/designer/QGCCommandButton.cc @@ -8,7 +8,7 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) : QGCToolWidgetItem("Command Button", parent), ui(new Ui::QGCCommandButton), - uas(NULL) + uas(nullptr) { ui->setupUi(this); diff --git a/src/ui/designer/QGCParamSlider.cc b/src/ui/designer/QGCParamSlider.cc index 6a5230e3e9..dcf25e2c5e 100644 --- a/src/ui/designer/QGCParamSlider.cc +++ b/src/ui/designer/QGCParamSlider.cc @@ -29,7 +29,7 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) : ui->intValueSpinBox->hide(); ui->valueSlider->setEnabled(false); ui->doubleValueSpinBox->setEnabled(false); - uas = NULL; + uas = nullptr; scaledInt = ui->valueSlider->maximum() - ui->valueSlider->minimum(); diff --git a/src/ui/designer/QGCToolWidget.cc b/src/ui/designer/QGCToolWidget.cc index 3b171bd035..e6ec9e1bf5 100644 --- a/src/ui/designer/QGCToolWidget.cc +++ b/src/ui/designer/QGCToolWidget.cc @@ -18,8 +18,8 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent, QSettings* settings) : QWidget(parent), - mav(NULL), - mainMenuAction(NULL), + mav(nullptr), + mainMenuAction(nullptr), widgetTitle(title), ui(new Ui::QGCToolWidget) { @@ -232,7 +232,7 @@ void QGCToolWidget::setParameterValue(int uas, int component, QString parameterN for (int j = 0; j < size; j++) { QString type = settingsMap.value(widgetName + "\\" + QString::number(j) + "\\" + "TYPE", "UNKNOWN").toString(); - QGCToolWidgetItem* item = NULL; + QGCToolWidgetItem* item = nullptr; if (type == "COMMANDBUTTON") { //This shouldn't happen, but I'm not sure... so lets test for it. @@ -281,7 +281,7 @@ void QGCToolWidget::loadSettings(QVariantMap& settings) QString type = settings.value(widgetName + "\\" + QString::number(j) + "\\" + "TYPE", "UNKNOWN").toString(); if (type != "UNKNOWN") { - QGCToolWidgetItem* item = NULL; + QGCToolWidgetItem* item = nullptr; if (type == "COMMANDBUTTON") { item = new QGCCommandButton(this); @@ -333,7 +333,7 @@ void QGCToolWidget::loadSettings(QSettings& settings) QString type = settings.value("TYPE", "UNKNOWN").toString(); if (type != "UNKNOWN") { - QGCToolWidgetItem* item = NULL; + QGCToolWidgetItem* item = nullptr; if (type == "COMMANDBUTTON") { QGCCommandButton *button = new QGCCommandButton(this); @@ -477,7 +477,7 @@ void QGCToolWidget::addUAS(UASInterface* uas) if (newMav) { // FIXME Convert to list - if (mav == NULL) mav = newMav; + if (mav == nullptr) mav = newMav; } } @@ -559,7 +559,7 @@ void QGCToolWidget::addParam(int uas,int component,QString paramname,QVariant va if (ui->hintLabel) { ui->hintLabel->deleteLater(); - ui->hintLabel = NULL; + ui->hintLabel = nullptr; } toolLayout->addWidget(slider); slider->setActiveUAS(mav); @@ -575,7 +575,7 @@ void QGCToolWidget::addParam() if (ui->hintLabel) { ui->hintLabel->deleteLater(); - ui->hintLabel = NULL; + ui->hintLabel = nullptr; } toolLayout->addWidget(slider); slider->startEditMode(); @@ -588,7 +588,7 @@ void QGCToolWidget::addCommand() if (ui->hintLabel) { ui->hintLabel->deleteLater(); - ui->hintLabel = NULL; + ui->hintLabel = nullptr; } toolLayout->addWidget(button); button->startEditMode(); @@ -599,7 +599,7 @@ void QGCToolWidget::addToolWidget(QGCToolWidgetItem* widget) if (ui->hintLabel) { ui->hintLabel->deleteLater(); - ui->hintLabel = NULL; + ui->hintLabel = nullptr; } connect(widget, SIGNAL(destroyed()), this, SLOT(storeSettings())); toolLayout->addWidget(widget); diff --git a/src/ui/designer/QGCToolWidgetItem.cc b/src/ui/designer/QGCToolWidgetItem.cc index 0d7f95e5cd..5c833b0a16 100644 --- a/src/ui/designer/QGCToolWidgetItem.cc +++ b/src/ui/designer/QGCToolWidgetItem.cc @@ -10,7 +10,7 @@ QGCToolWidgetItem::QGCToolWidgetItem(const QString& name, QWidget *parent) : QWidget(parent), isInEditMode(false), qgcToolWidgetItemName(name), - uas(NULL), + uas(nullptr), _component(-1) { startEditAction = new QAction(tr("Edit %1").arg(qgcToolWidgetItemName), this); From a8deec337f2bf994b82f814fe69d555f52363853 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:14:29 +0900 Subject: [PATCH 11/23] linechart: Change from NULL to nullptr --- src/ui/linechart/IncrementalPlot.cc | 8 ++++---- src/ui/linechart/IncrementalPlot.h | 2 +- src/ui/linechart/LinechartPlot.cc | 16 ++++++++-------- src/ui/linechart/LinechartPlot.h | 2 +- src/ui/linechart/LinechartWidget.cc | 16 ++++++++-------- src/ui/linechart/Linecharts.cc | 2 +- src/ui/linechart/ScrollZoomer.cc | 18 +++++++++--------- src/ui/linechart/Scrollbar.h | 6 +++--- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index 0fbf5da63c..f3ddb4b60c 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -118,7 +118,7 @@ IncrementalPlot::IncrementalPlot(QWidget *parent): zoomer->setRubberBandPen(QPen(Qt::red, 1.5f, Qt::DotLine)); zoomer->setTrackerPen(QPen(Qt::red)); //zoomer->setZoomBase(QwtDoubleRect()); - legend = NULL; + legend = nullptr; colors = QList(); nextColor = 0; @@ -174,7 +174,7 @@ void IncrementalPlot::handleLegendClick(QwtPlotItem* item, bool on) void IncrementalPlot::showLegend(bool show) { if (show) { - if (legend == NULL) { + if (legend == nullptr) { legend = new QwtLegend; legend->setFrameStyle(QFrame::Box); legend->setItemMode(QwtLegend::CheckableItem); @@ -182,7 +182,7 @@ void IncrementalPlot::showLegend(bool show) insertLegend(legend, QwtPlot::RightLegend); } else { delete legend; - legend = NULL; + legend = nullptr; } updateScale(); // Updates the scaling at replots } @@ -269,7 +269,7 @@ void IncrementalPlot::updateScale() // Get the aspect ratio of the plot float xSize = width(); - if (legend != NULL) xSize -= legend->width(); + if (legend != nullptr) xSize -= legend->width(); float ySize = height(); float aspectRatio = xSize / ySize; diff --git a/src/ui/linechart/IncrementalPlot.h b/src/ui/linechart/IncrementalPlot.h index ea656a9fa1..2d1590a9aa 100644 --- a/src/ui/linechart/IncrementalPlot.h +++ b/src/ui/linechart/IncrementalPlot.h @@ -78,7 +78,7 @@ class IncrementalPlot : public QwtPlot Q_OBJECT public: /** @brief Create a new, empty incremental plot */ - IncrementalPlot(QWidget *parent = NULL); + IncrementalPlot(QWidget *parent = nullptr); virtual ~IncrementalPlot(); /** @brief Get color map of this plot */ diff --git a/src/ui/linechart/LinechartPlot.cc b/src/ui/linechart/LinechartPlot.cc index fc31ebedff..0fe93c4369 100644 --- a/src/ui/linechart/LinechartPlot.cc +++ b/src/ui/linechart/LinechartPlot.cc @@ -41,8 +41,8 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt automaticScrollActive(false), m_active(false), m_groundTime(true), - d_data(NULL), - d_curve(NULL) + d_data(nullptr), + d_curve(nullptr) { this->plotid = plotid; this->plotInterval = interval; @@ -141,7 +141,7 @@ LinechartPlot::~LinechartPlot() // // Delete the object // delete curve; // // Set the pointer null -// curve = NULL; +// curve = nullptr; // } // // Delete data @@ -152,7 +152,7 @@ LinechartPlot::~LinechartPlot() // // Delete the object // delete d; // // Set the pointer null -// d = NULL; +// d = nullptr; // } // datalock.unlock(); } @@ -239,7 +239,7 @@ void LinechartPlot::removeTimedOutCurves() // Delete the object delete curve; // Set the pointer null - curve = NULL; + curve = nullptr; // Notify connected components about the removal emit curveRemoved(key); @@ -249,7 +249,7 @@ void LinechartPlot::removeTimedOutCurves() // Delete the object delete d; // Set the pointer null - d = NULL; + d = nullptr; emit curveRemoved(key); } } @@ -779,7 +779,7 @@ void LinechartPlot::removeAllData() // Delete the object delete curve; // Set the pointer null - curve = NULL; + curve = nullptr; // Notify connected components about the removal emit curveRemoved(i.key()); @@ -794,7 +794,7 @@ void LinechartPlot::removeAllData() // Delete the object delete d; // Set the pointer null - d = NULL; + d = nullptr; } datalock.unlock(); replot(); diff --git a/src/ui/linechart/LinechartPlot.h b/src/ui/linechart/LinechartPlot.h index 77c0a7c20b..1ea6e23c99 100644 --- a/src/ui/linechart/LinechartPlot.h +++ b/src/ui/linechart/LinechartPlot.h @@ -185,7 +185,7 @@ class LinechartPlot : public QwtPlot { Q_OBJECT public: - LinechartPlot(QWidget *parent = NULL, int plotid=0, quint64 interval = LinechartPlot::DEFAULT_PLOT_INTERVAL); + LinechartPlot(QWidget *parent = nullptr, int plotid=0, quint64 interval = LinechartPlot::DEFAULT_PLOT_INTERVAL); virtual ~LinechartPlot(); void setZeroValue(QString id, double zeroValue); diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index 73b67a9d22..086b029447 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -57,7 +57,7 @@ This file is part of the PIXHAWK project LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent), sysid(systemid), - activePlot(NULL), + activePlot(nullptr), curvesLock(new QReadWriteLock()), plotWindowLock(), curveListIndex(0), @@ -154,9 +154,9 @@ LinechartWidget::~LinechartWidget() writeSettings(); stopLogging(); if (activePlot) delete activePlot; - activePlot = NULL; + activePlot = nullptr; delete listedCurves; - listedCurves = NULL; + listedCurves = nullptr; } void LinechartWidget::selectActiveSystem(int mav) @@ -340,7 +340,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& // Order matters here, first append to plot, then update curve list activePlot->appendData(curve+unit, usec, value); // Store data - QLabel* label = curveLabels->value(curve+unit, NULL); + QLabel* label = curveLabels->value(curve+unit, nullptr); // Make sure the curve will be created if it does not yet exist if(!label) { @@ -386,7 +386,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& // Order matters here, first append to plot, then update curve list activePlot->appendData(curve+unit, usec, value); // Store data - QLabel* label = curveLabels->value(curve+unit, NULL); + QLabel* label = curveLabels->value(curve+unit, nullptr); // Make sure the curve will be created if it does not yet exist if(!label) { @@ -433,7 +433,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& // Order matters here, first append to plot, then update curve list activePlot->appendData(curve+unit, usec, value); // Store data - QLabel* label = curveLabels->value(curve+unit, NULL); + QLabel* label = curveLabels->value(curve+unit, nullptr); // Make sure the curve will be created if it does not yet exist if(!label) { @@ -767,7 +767,7 @@ void LinechartWidget::removeCurve(QString curve) { Q_UNUSED(curve) - QWidget* widget = NULL; + QWidget* widget = nullptr; widget = curveLabels->take(curve); curvesWidgetLayout->removeWidget(widget); widget->deleteLater(); @@ -1002,7 +1002,7 @@ void LinechartWidget::takeButtonClick(bool checked) QCheckBox* button = qobject_cast(QObject::sender()); - if(button != NULL) + if(button != nullptr) { activePlot->setVisible(button->objectName(), checked); diff --git a/src/ui/linechart/Linecharts.cc b/src/ui/linechart/Linecharts.cc index 783157d1b9..1130b16412 100644 --- a/src/ui/linechart/Linecharts.cc +++ b/src/ui/linechart/Linecharts.cc @@ -74,7 +74,7 @@ void Linecharts::selectSystem(int systemid) // chart->setActiveSystem(systemid); // } // } -// QWidget* widget = plots.value(systemid, NULL); +// QWidget* widget = plots.value(systemid, nullptr); // if (widget) // { // setCurrentWidget(widget); diff --git a/src/ui/linechart/ScrollZoomer.cc b/src/ui/linechart/ScrollZoomer.cc index e497cfc3e0..427acd2ea6 100644 --- a/src/ui/linechart/ScrollZoomer.cc +++ b/src/ui/linechart/ScrollZoomer.cc @@ -10,7 +10,7 @@ class ScrollData { public: ScrollData(): - scrollBar(NULL), + scrollBar(nullptr), position(ScrollZoomer::OppositeToScale), #if QT_VERSION < 0x040000 mode(QScrollView::Auto) @@ -35,9 +35,9 @@ class ScrollData ScrollZoomer::ScrollZoomer(QwtPlotCanvas *canvas): QwtPlotZoomer(canvas), - d_cornerWidget(NULL), - d_hScrollData(NULL), - d_vScrollData(NULL), + d_cornerWidget(nullptr), + d_hScrollData(nullptr), + d_vScrollData(nullptr), d_inZoom(false) { if ( !canvas ) @@ -96,7 +96,7 @@ ScrollBar *ScrollZoomer::scrollBar(Qt::Orientation o) ScrollBar *&sb = (o == Qt::Vertical) ? d_vScrollData->scrollBar : d_hScrollData->scrollBar; - if ( sb == NULL ) { + if ( sb == nullptr ) { sb = new ScrollBar(o, canvas()); sb->hide(); connect(sb, @@ -226,11 +226,11 @@ bool ScrollZoomer::eventFilter(QObject *o, QEvent *e) case QEvent::ChildRemoved: { const QObject *child = ((QChildEvent *)e)->child(); if ( child == d_cornerWidget ) - d_cornerWidget = NULL; + d_cornerWidget = nullptr; else if ( child == d_hScrollData->scrollBar ) - d_hScrollData->scrollBar = NULL; + d_hScrollData->scrollBar = nullptr; else if ( child == d_vScrollData->scrollBar ) - d_vScrollData->scrollBar = NULL; + d_vScrollData->scrollBar = nullptr; break; } default: @@ -358,7 +358,7 @@ void ScrollZoomer::updateScrollBars() } if ( showHScrollBar && showVScrollBar ) { - if ( d_cornerWidget == NULL ) { + if ( d_cornerWidget == nullptr ) { d_cornerWidget = new QWidget(canvas()); #if QT_VERSION >= 0x040100 d_cornerWidget->setAutoFillBackground(true); diff --git a/src/ui/linechart/Scrollbar.h b/src/ui/linechart/Scrollbar.h index 0587dd0fcc..273fbad009 100644 --- a/src/ui/linechart/Scrollbar.h +++ b/src/ui/linechart/Scrollbar.h @@ -8,10 +8,10 @@ class ScrollBar: public QScrollBar Q_OBJECT public: - ScrollBar(QWidget *parent = NULL); - ScrollBar(Qt::Orientation, QWidget *parent = NULL); + ScrollBar(QWidget *parent = nullptr); + ScrollBar(Qt::Orientation, QWidget *parent = nullptr); ScrollBar(double minBase, double maxBase, - Qt::Orientation o, QWidget *parent = NULL); + Qt::Orientation o, QWidget *parent = nullptr); void setInverted(bool); bool isInverted() const; From 6ccd6f03e0eea489a385eeb207369a18eb6ab92b Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:14:42 +0900 Subject: [PATCH 12/23] map3D: Change from NULL to nullptr --- src/ui/map3D/GCManipulator.cc | 2 +- src/ui/map3D/Pixhawk3DWidget.cc | 6 +++--- src/ui/map3D/QGCGoogleEarthView.cc | 16 ++++++++-------- src/ui/map3D/QGCGoogleEarthView.h | 2 +- src/ui/map3D/Texture.cc | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ui/map3D/GCManipulator.cc b/src/ui/map3D/GCManipulator.cc index a224bfe6c4..729cbb7ea5 100644 --- a/src/ui/map3D/GCManipulator.cc +++ b/src/ui/map3D/GCManipulator.cc @@ -209,7 +209,7 @@ GCManipulator::calcMovement(void) using namespace osgGA; // return if less then two events have been added. - if (_ga_t0.get() == NULL || _ga_t1.get() == NULL) { + if (_ga_t0.get() == nullptr || _ga_t1.get() == nullptr) { return false; } diff --git a/src/ui/map3D/Pixhawk3DWidget.cc b/src/ui/map3D/Pixhawk3DWidget.cc index b0c0b174b7..cfe870d845 100644 --- a/src/ui/map3D/Pixhawk3DWidget.cc +++ b/src/ui/map3D/Pixhawk3DWidget.cc @@ -53,7 +53,7 @@ Pixhawk3DWidget::Pixhawk3DWidget(QWidget* parent) , mMode(DEFAULT_MODE) , mSelectedWpIndex(-1) , mActiveSystemId(-1) - , mActiveUAS(NULL) + , mActiveUAS(nullptr) , mGlobalViewParams(new GlobalViewParams) , mFollowCameraId(-1) , mInitCameraPos(false) @@ -779,7 +779,7 @@ Pixhawk3DWidget::insertWaypoint(void) return; } - Waypoint* wp = NULL; + Waypoint* wp = nullptr; if (mGlobalViewParams->frame() == MAV_FRAME_GLOBAL) { double latitude = mActiveUAS->getLatitude(); @@ -2078,7 +2078,7 @@ Pixhawk3DWidget::resizeHUD(int width, int height) int bottomHUDHeight = 25; osg::Vec3Array* vertices = static_cast(mHudBackgroundGeometry->getVertexArray()); - if (vertices == NULL || vertices->size() != 8) + if (vertices == nullptr || vertices->size() != 8) { osg::ref_ptr newVertices = new osg::Vec3Array(8); mHudBackgroundGeometry->setVertexArray(newVertices); diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc index 6cdc0c3676..027562d965 100644 --- a/src/ui/map3D/QGCGoogleEarthView.cc +++ b/src/ui/map3D/QGCGoogleEarthView.cc @@ -34,7 +34,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : QWidget(parent), updateTimer(new QTimer(this)), refreshRateMs(100), - mav(NULL), + mav(nullptr), followCamera(true), trailEnabled(true), webViewInitialized(false), @@ -46,7 +46,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : #endif #ifdef _MSC_VER webViewWin(new QGCWebAxWidget(this)), - documentWin(NULL), + documentWin(nullptr), #endif ui(new Ui::QGCGoogleEarthView) { @@ -474,7 +474,7 @@ QVariant QGCGoogleEarthView::documentElement(QString name) IHTMLDocument3* doc; documentWin->queryInterface( IID_IHTMLDocument3, (void**)&doc); params.append(name); - IHTMLElement* element = NULL; + IHTMLElement* element = nullptr; // Append alias name.prepend("JScript_"); HRESULT res = doc->getElementById(QStringToBSTR(name), &element); @@ -484,7 +484,7 @@ QVariant QGCGoogleEarthView::documentElement(QString name) VARIANT var; var.vt = VT_BSTR; HRESULT res = element->getAttribute(L"value", 0, &var); - if (SUCCEEDED(res) && (var.vt != VT_NULL)) { + if (SUCCEEDED(res) && (var.vt != VT_nullptr)) { QByteArray typeName; QVariant qtValue = VARIANTToQVariant(var,typeName); return qtValue; @@ -509,16 +509,16 @@ void QGCGoogleEarthView::initializeGoogleEarth() #ifdef _MSC_VER QAxObject* doc = webViewWin->querySubObject("Document()"); //IDispatch* Disp; - IDispatch* winDoc = NULL; - IHTMLDocument2* document = NULL; + IDispatch* winDoc = nullptr; + IHTMLDocument2* document = nullptr; //332C4425-26CB-11D0-B483-00C04FD90119 IHTMLDocument2 //25336920-03F9-11CF-8FD0-00AA00686F13 HTMLDocument doc->queryInterface(QUuid("{332C4425-26CB-11D0-B483-00C04FD90119}"), (void**)(&winDoc)); if (winDoc) { - document = NULL; + document = nullptr; winDoc->QueryInterface( IID_IHTMLDocument2, (void**)&document ); - IHTMLWindow2 *window = NULL; + IHTMLWindow2 *window = nullptr; document->get_parentWindow( &window ); documentWin = new QAxObject(document, webViewWin); jScriptWin = new QAxObject(window, webViewWin); diff --git a/src/ui/map3D/QGCGoogleEarthView.h b/src/ui/map3D/QGCGoogleEarthView.h index 117239aa4f..00263b2fe0 100644 --- a/src/ui/map3D/QGCGoogleEarthView.h +++ b/src/ui/map3D/QGCGoogleEarthView.h @@ -20,7 +20,7 @@ class QGCWebAxWidget : public QAxWidget //Q_OBJECT QGCWebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0) : QAxWidget(parent, f)/*, - _document(NULL)*/ + _document(nullptr)*/ { // Set web browser control setControl("{8856F961-340A-11D0-A96B-00C04FD705A2}"); diff --git a/src/ui/map3D/Texture.cc b/src/ui/map3D/Texture.cc index e7dc3c741b..a4ee303e03 100644 --- a/src/ui/map3D/Texture.cc +++ b/src/ui/map3D/Texture.cc @@ -102,7 +102,7 @@ Texture::sync(const WebImagePtr& image) { image->setSyncFlag(false); - if (mTexture2D->getImage() != NULL) + if (mTexture2D->getImage() != nullptr) { mTexture2D->getImage()->setImage(image->getWidth(), image->getHeight(), From bf83fafee4582c72ec9761fbbe708631e86ebdca Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:15:02 +0900 Subject: [PATCH 13/23] uas: Change from NULL to nullptr --- src/ui/uas/PreFlightCalibrationDialog.cpp | 6 +++--- src/ui/uas/QGCMessageView.cc | 2 +- src/ui/uas/UASActionsWidget.cpp | 12 ++++++------ src/ui/uas/UASInfoWidget.cc | 4 ++-- src/ui/uas/UASListWidget.cc | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ui/uas/PreFlightCalibrationDialog.cpp b/src/ui/uas/PreFlightCalibrationDialog.cpp index b49836a00d..816c05316d 100644 --- a/src/ui/uas/PreFlightCalibrationDialog.cpp +++ b/src/ui/uas/PreFlightCalibrationDialog.cpp @@ -23,7 +23,7 @@ PreFlightCalibrationDialog::PreFlightCalibrationDialog(QWidget *parent) : for (int count = 0; count < 7; count++){ m_param.append(0.0f); - m_widgets.append(NULL); + m_widgets.append(nullptr); } connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*))); @@ -119,7 +119,7 @@ void PreFlightCalibrationDialog::addParamCheckBoxes(const QString& vehicleName, for(int count = 0; count < parameterList.length(); count++) { QString parameterName = parameterList[count]; - QAbstractButton *paramBox = NULL; + QAbstractButton *paramBox = nullptr; if (exclusive){ paramBox = new QRadioButton(parameterName); } else { @@ -199,7 +199,7 @@ float PreFlightCalibrationDialog::getCheckValue(QWidget* widget) return 0.0f; // No } } else { - float result = qobject_cast(widget) == NULL ? + float result = qobject_cast(widget) == nullptr ? 0.0f : qobject_cast(widget)->value(); return result; } diff --git a/src/ui/uas/QGCMessageView.cc b/src/ui/uas/QGCMessageView.cc index 08349d2520..dd58c361c4 100644 --- a/src/ui/uas/QGCMessageView.cc +++ b/src/ui/uas/QGCMessageView.cc @@ -7,7 +7,7 @@ QGCMessageView::QGCMessageView(QWidget *parent) : QWidget(parent), - activeUAS(NULL), + activeUAS(nullptr), clearAction(new QAction(tr("Clear Text"), this)), ui(new Ui::QGCMessageView) { diff --git a/src/ui/uas/UASActionsWidget.cpp b/src/ui/uas/UASActionsWidget.cpp index 3f90dbad50..54f410dcb3 100644 --- a/src/ui/uas/UASActionsWidget.cpp +++ b/src/ui/uas/UASActionsWidget.cpp @@ -89,7 +89,7 @@ void UASActionsWidget::setupApmRoverModes() UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent) { QLOG_INFO() << "UASActionsWidget creating " << this; - m_uas = NULL; + m_uas = nullptr; ui.setupUi(this); connect(ui.changeAltitudeButton,SIGNAL(clicked()),this,SLOT(changeAltitudeClicked())); connect(ui.changeSpeedButton,SIGNAL(clicked()),this,SLOT(changeSpeedClicked())); @@ -132,8 +132,8 @@ UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent) void UASActionsWidget::activeUASSet(UASInterface *uas) { QLOG_INFO() << "UASActionWidget::activeUASSet"; - if (uas == NULL) { - QLOG_ERROR() << "uas object NULL"; + if (uas == nullptr) { + QLOG_ERROR() << "uas object nullptr"; return; } @@ -839,7 +839,7 @@ void UASActionsWidget::setRTLMode() bool UASActionsWidget::activeUas() { - if (m_uas == NULL) { + if (m_uas == nullptr) { QLOG_ERROR() << "UASActionsWidget: Error: No Active UAS, please connnect"; return false; } @@ -876,7 +876,7 @@ void UASActionsWidget::contextMenuEvent(QContextMenuEvent *event) QLOG_DEBUG() << "contextMenuEvent"; - if(m_uas == NULL) + if(m_uas == nullptr) return; APMShortcutModesDialog* dialog = new APMShortcutModesDialog(); @@ -899,7 +899,7 @@ void UASActionsWidget::contextMenuEvent(QContextMenuEvent *event) } else { // Do nothing. delete dialog; - dialog = NULL; + dialog = nullptr; return; } diff --git a/src/ui/uas/UASInfoWidget.cc b/src/ui/uas/UASInfoWidget.cc index 655f0ae64a..52e2dda8b3 100644 --- a/src/ui/uas/UASInfoWidget.cc +++ b/src/ui/uas/UASInfoWidget.cc @@ -45,7 +45,7 @@ UASInfoWidget::UASInfoWidget(QWidget *parent, QString name) : QWidget(parent) { ui.setupUi(this); this->name = name; - activeUAS = NULL; + activeUAS = nullptr; connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); setActiveUAS(UASManager::instance()->getActiveUAS()); @@ -95,7 +95,7 @@ void UASInfoWidget::hideEvent(QHideEvent* event) void UASInfoWidget::addUAS(UASInterface* uas) { - if (uas != NULL) { + if (uas != nullptr) { connect(uas, SIGNAL(batteryChanged(UASInterface*, double, double, double, int)), this, SLOT(updateBattery(UASInterface*, double, double, double, int))); connect(uas, SIGNAL(dropRateChanged(int,float)), this, SLOT(updateReceiveLoss(int,float))); connect(uas, SIGNAL(loadChanged(UASInterface*, double)), this, SLOT(updateCPULoad(UASInterface*,double))); diff --git a/src/ui/uas/UASListWidget.cc b/src/ui/uas/UASListWidget.cc index 44b14b8a91..89bc1d825f 100644 --- a/src/ui/uas/UASListWidget.cc +++ b/src/ui/uas/UASListWidget.cc @@ -46,7 +46,7 @@ This file is part of the PIXHAWK project #include "LinkManager.h" UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), - uWidget(NULL), + uWidget(nullptr), m_ui(new Ui::UASList) { m_ui->setupUi(this); @@ -117,7 +117,7 @@ void UASListWidget::addUAS(UASInterface* uas) { listLayout->removeWidget(uWidget); delete uWidget; - uWidget = NULL; + uWidget = nullptr; } } @@ -131,7 +131,7 @@ void UASListWidget::addUAS(UASInterface* uas) void UASListWidget::activeUAS(UASInterface* uas) { - UASView* view = uasViews.value(uas, NULL); + UASView* view = uasViews.value(uas, nullptr); if (view) { view->setUASasActive(true); } From dd33f81b6e70fc71d5bf012fbff84885ee3a3e26 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:15:14 +0900 Subject: [PATCH 14/23] map: Change from NULL to nullptr --- src/ui/map/QGCMapTool.cc | 8 ++++---- src/ui/map/QGCMapToolBar.cc | 2 +- src/ui/map/QGCMapWidget.cc | 18 +++++++++--------- src/ui/map/Waypoint2DIcon.cc | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ui/map/QGCMapTool.cc b/src/ui/map/QGCMapTool.cc index 0ba70a65ab..8d41e12967 100644 --- a/src/ui/map/QGCMapTool.cc +++ b/src/ui/map/QGCMapTool.cc @@ -13,7 +13,7 @@ const static int MapToolZoomFactor = 10; // This may need to be different for wi QGCMapTool::QGCMapTool(QWidget *parent) : QWidget(parent), ui(new Ui::QGCMapTool), - m_uasInterface(NULL) + m_uasInterface(nullptr) { ui->setupUi(this); @@ -66,11 +66,11 @@ QGCMapTool::~QGCMapTool() void QGCMapTool::activeUASSet(UASInterface *uasInterface) { QLOG_INFO() << "QGCMapTool::activeUASSet"; - if (uasInterface == NULL) { - QLOG_ERROR() << "uas object NULL"; + if (uasInterface == nullptr) { + QLOG_ERROR() << "uas object nullptr"; return; } - UAS* uas = NULL; + UAS* uas = nullptr; if (m_uasInterface){ uas = qobject_cast(m_uasInterface); disconnect(m_uasInterface, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), diff --git a/src/ui/map/QGCMapToolBar.cc b/src/ui/map/QGCMapToolBar.cc index f96d18ea7e..54a3e33383 100644 --- a/src/ui/map/QGCMapToolBar.cc +++ b/src/ui/map/QGCMapToolBar.cc @@ -7,7 +7,7 @@ QGCMapToolBar::QGCMapToolBar(QWidget *parent) : QWidget(parent), ui(new Ui::QGCMapToolBar), - map(NULL), + map(nullptr), optionsMenu(this), trailPlotMenu(this), updateTimesMenu(this), diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index 6df0080e7c..6ece577354 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -12,7 +12,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) : mapcontrol::OPMapWidget(parent), - firingWaypointChange(NULL), + firingWaypointChange(nullptr), maxUpdateInterval(2.1f), // 2 seconds followUAVEnabled(false), trailType(mapcontrol::UAVTrailType::ByTimeElapsed), @@ -20,7 +20,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) : followUAVID(0), mapInitialized(false), homeAltitude(0), - uas(NULL) + uas(nullptr) { // Set the map cache directory configuration->SetCacheLocation(QGC::appDataDirectory() + "/mapscache/"); @@ -355,7 +355,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) wp->setLatitude(pos.Lat()); wp->setLongitude(pos.Lng()); currWPManager->blockSignals(false); - currWPManager->notifyOfChangeEditable(NULL); // yes: NULL to fire waypointEditableListChanged + currWPManager->notifyOfChangeEditable(nullptr); // yes: nullptr to fire waypointEditableListChanged } OPMapWidget::mouseDoubleClickEvent(event); @@ -442,7 +442,7 @@ void QGCMapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lo // Get reference to graphic UAV item mapcontrol::UAVItem* uav = GetUAV(uas->getUASID()); // Check if reference is valid, else create a new one - if (uav == NULL) + if (uav == nullptr) { MAV2DIcon* newUAV = new MAV2DIcon(map, this, uas); newUAV->setParentItem(map); @@ -500,7 +500,7 @@ void QGCMapWidget::updateGlobalPosition() // Get reference to graphic UAV item mapcontrol::UAVItem* uav = GetUAV(system->getUASID()); // Check if reference is valid, else create a new one - if (uav == NULL) + if (uav == nullptr) { MAV2DIcon* newUAV = new MAV2DIcon(map, this, system); AddUAV(system->getUASID(), newUAV); @@ -530,7 +530,7 @@ void QGCMapWidget::updateLocalPosition() // Get reference to graphic UAV item mapcontrol::UAVItem* uav = GetUAV(system->getUASID()); // Check if reference is valid, else create a new one - if (uav == NULL) + if (uav == nullptr) { MAV2DIcon* newUAV = new MAV2DIcon(map, this, system); AddUAV(system->getUASID(), newUAV); @@ -706,7 +706,7 @@ void QGCMapWidget::shiftOtherSelectedWaypoints(mapcontrol::WayPointItem* selecte void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) { // Block circle updates - Waypoint* wp = iconsToWaypoints.value(waypoint, NULL); + Waypoint* wp = iconsToWaypoints.value(waypoint, nullptr); // Delete UI element if wp doesn't exist if (!wp) @@ -730,7 +730,7 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) wp->setLongitude(pos.Lng()); wp->blockSignals(false); - firingWaypointChange = NULL; + firingWaypointChange = nullptr; emit waypointChanged(wp); @@ -818,7 +818,7 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) redrawWaypointLines(uas); - firingWaypointChange = NULL; + firingWaypointChange = nullptr; } else { diff --git a/src/ui/map/Waypoint2DIcon.cc b/src/ui/map/Waypoint2DIcon.cc index a88b8692e9..96f5082cca 100644 --- a/src/ui/map/Waypoint2DIcon.cc +++ b/src/ui/map/Waypoint2DIcon.cc @@ -7,7 +7,7 @@ Waypoint2DIcon::Waypoint2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMapWidget* parent, qreal latitude, qreal longitude, qreal altitude, int listindex, QString name, QString description, int radius) : mapcontrol::WayPointItem(internals::PointLatLng(latitude, longitude), altitude, map, parent, description), parent(parent), - waypoint(NULL), + waypoint(nullptr), radius(radius), showAcceptanceRadius(true), showOrbit(false), @@ -181,7 +181,7 @@ void Waypoint2DIcon::drawIcon() painter.drawLine(p.x(), p.y(), p.x()+sin(Heading()/180.0f*M_PI) * rad, p.y()-cos(Heading()/180.0f*M_PI) * rad); } - if ((waypoint != NULL) && (waypoint->getAction() == (int)MAV_CMD_NAV_TAKEOFF)) + if ((waypoint != nullptr) && (waypoint->getAction() == (int)MAV_CMD_NAV_TAKEOFF)) { // Takeoff waypoint int width = picture.width()-penWidth; @@ -197,7 +197,7 @@ void Waypoint2DIcon::drawIcon() painter.setPen(pen2); painter.drawRect(width*0.3, height*0.3f, width*0.6f, height*0.6f); } - else if ((waypoint != NULL) && (waypoint->getAction() == (int)MAV_CMD_NAV_LAND)) + else if ((waypoint != nullptr) && (waypoint->getAction() == (int)MAV_CMD_NAV_LAND)) { // Landing waypoint int width = (picture.width())/2-penWidth; @@ -209,7 +209,7 @@ void Waypoint2DIcon::drawIcon() painter.drawEllipse(p, width, height); painter.drawLine(p.x()-width/2, p.y()-height/2, 2*width, 2*height); } - else if ((waypoint != NULL) && ((waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TO_ALT) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_UNLIM) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TIME) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TURNS))) + else if ((waypoint != nullptr) && ((waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TO_ALT) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_UNLIM) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TIME) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TURNS))) { // Loiter waypoint int width = (picture.width()-penWidth)/2; @@ -221,7 +221,7 @@ void Waypoint2DIcon::drawIcon() painter.drawEllipse(p, width, height); painter.drawPoint(p); } - else if ((waypoint != NULL) && (waypoint->getAction() == (int)MAV_CMD_DO_SET_ROI)) + else if ((waypoint != nullptr) && (waypoint->getAction() == (int)MAV_CMD_DO_SET_ROI)) { // Region of Interest int width = (picture.width()-penWidth)/2; @@ -235,7 +235,7 @@ void Waypoint2DIcon::drawIcon() painter.drawEllipse(p, height, height); painter.drawPoint(p); } - else if ((waypoint != NULL) && (waypoint->getAction() == (int)MAV_CMD_NAV_RETURN_TO_LAUNCH)) + else if ((waypoint != nullptr) && (waypoint->getAction() == (int)MAV_CMD_NAV_RETURN_TO_LAUNCH)) { // Return to launch waypoint int width = picture.width()-penWidth; From bce9d7207b4a2609b253fb8d1e66a63436c5a9a3 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:15:30 +0900 Subject: [PATCH 15/23] audio: Change from NULL to nullptr --- src/audio/AlsaAudio.cc | 32 ++++++++++++++++---------------- src/audio/AlsaAudio.h | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/audio/AlsaAudio.cc b/src/audio/AlsaAudio.cc index 9a16ebd5a6..b370f5e898 100644 --- a/src/audio/AlsaAudio.cc +++ b/src/audio/AlsaAudio.cc @@ -193,7 +193,7 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if ((err = snd_pcm_open (&alsa_dev, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { QLOG_INFO() << "cannot open audio device " << device << snd_strerror(err); - return NULL; + return nullptr; } snd_pcm_nonblock (alsa_dev, 0); @@ -201,56 +201,56 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) { QLOG_INFO() << "cannot allocate hardware parameter structure "<< snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_any (alsa_dev, hw_params)) < 0) { QLOG_INFO() << "cannot initialize hardware parameter structure " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_access (alsa_dev, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) { QLOG_INFO() << "cannot set access type ", snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_format (alsa_dev, hw_params, SND_PCM_FORMAT_FLOAT)) < 0) { QLOG_INFO() << "cannot set sample format " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_rate_near (alsa_dev, hw_params, (uint*)&samplerate, 0)) < 0) { QLOG_INFO() << "cannot set sample rate " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_channels (alsa_dev, hw_params, channels)) < 0) { QLOG_INFO() << "cannot set channel count " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_buffer_size_near (alsa_dev, hw_params, &alsa_buffer_frames)) < 0) { QLOG_INFO() << "cannot set buffer size " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params_set_period_size_near (alsa_dev, hw_params, &alsa_period_size, 0)) < 0) { QLOG_INFO() << "cannot set period size " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_hw_params (alsa_dev, hw_params)) < 0) { QLOG_INFO() << "cannot set parameters " << snd_strerror (err); - return NULL; + return nullptr; } /* extra check: if we have only one period, this code won't work */ @@ -259,7 +259,7 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if (alsa_period_size == buffer_size) { QLOG_INFO() << "Can't use period equal to buffer size " << alsa_period_size << buffer_size; - return NULL; + return nullptr; } snd_pcm_hw_params_free (hw_params); @@ -267,13 +267,13 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if ((err = snd_pcm_sw_params_malloc (&sw_params)) != 0) { QLOG_INFO() << "%s: snd_pcm_sw_params_malloc: " << __func__<< snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_sw_params_current (alsa_dev, sw_params)) != 0) { QLOG_INFO() << "%s: snd_pcm_sw_params_current: " << __func__ << snd_strerror (err); - return NULL; + return nullptr; } /* note: set start threshold to delay start until the ring buffer is full */ @@ -281,7 +281,7 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if ((err = snd_pcm_sw_params_get_xfer_align (sw_params, &xfer_align)) < 0) { QLOG_INFO() << "cannot get xfer align " << snd_strerror (err); - return NULL; + return nullptr; } /* round up to closest transfer boundary */ @@ -291,13 +291,13 @@ snd_pcm_t * AlsaAudio::alsa_open (int channels, int samplerate) if ((err = snd_pcm_sw_params_set_start_threshold (alsa_dev, sw_params, start_threshold)) < 0) { QLOG_INFO() << "cannot set start threshold " << snd_strerror (err); - return NULL; + return nullptr; } if ((err = snd_pcm_sw_params (alsa_dev, sw_params)) != 0) { QLOG_INFO() << "%s: snd_pcm_sw_params: " << __func__ << snd_strerror (err); - return NULL; + return nullptr; } snd_pcm_sw_params_free (sw_params); diff --git a/src/audio/AlsaAudio.h b/src/audio/AlsaAudio.h index def7d895cf..e3b1768964 100644 --- a/src/audio/AlsaAudio.h +++ b/src/audio/AlsaAudio.h @@ -47,7 +47,7 @@ class AlsaAudio : public QThread { // Q_OBJECT public: - AlsaAudio(QObject *parent=NULL); + AlsaAudio(QObject *parent=nullptr); /** @brief Get the singleton instance */ static AlsaAudio* instance(QObject *par); From 5e95dc869eef9da7841ab3ce605da1b1018dffb8 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:15:40 +0900 Subject: [PATCH 16/23] input: Change from NULL to nullptr --- src/input/Freenect.cc | 8 ++++---- src/input/JoystickInput.cc | 6 +++--- src/input/Mouse6dofInput.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/input/Freenect.cc b/src/input/Freenect.cc index 5c18972de8..7297498640 100644 --- a/src/input/Freenect.cc +++ b/src/input/Freenect.cc @@ -46,8 +46,8 @@ const freenect_frame_mode FREENECT_DEPTH_11_BIT_MEDIUM = supported_depth_modes[0 Freenect::Freenect() - : context(NULL) - , device(NULL) + : context(nullptr) + , device(nullptr) , tiltAngle(0) , rgbData(new QByteArray) , rawDepthData(new QByteArray) @@ -60,7 +60,7 @@ Freenect::Freenect() Freenect::~Freenect() { - if (device != NULL) { + if (device != nullptr) { freenect_stop_depth(device); freenect_stop_video(device); } @@ -100,7 +100,7 @@ Freenect::init(int userDeviceNumber) } } - if (freenect_init(&context, NULL) < 0) { + if (freenect_init(&context, nullptr) < 0) { return false; } diff --git a/src/input/JoystickInput.cc b/src/input/JoystickInput.cc index b46ef7fc2b..29d0f76404 100644 --- a/src/input/JoystickInput.cc +++ b/src/input/JoystickInput.cc @@ -33,9 +33,9 @@ * @image html http://pixhawk.ethz.ch/wiki/_media/standards/body-frame.png Aeronautical frame */ JoystickInput::JoystickInput() : - joystick(NULL), + joystick(nullptr), joystickName(""), - uas(NULL), + uas(nullptr), done(0), thrustAxis(2), xAxis(0), @@ -333,7 +333,7 @@ bool JoystickInput::sdlJoystickUpdate(unsigned timeout) void JoystickInput::run() { init(); - if (joystick == NULL) + if (joystick == nullptr) { exit(); return; diff --git a/src/input/Mouse6dofInput.cpp b/src/input/Mouse6dofInput.cpp index dcf379fae1..a3983c3541 100644 --- a/src/input/Mouse6dofInput.cpp +++ b/src/input/Mouse6dofInput.cpp @@ -26,7 +26,7 @@ extern "C" #ifdef MOUSE_ENABLED_WIN Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) : mouse3DMax(0.075), // TODO: check maximum value fot plugged device - uas(NULL), + uas(nullptr), done(false), mouseActive(false), translationActive(true), @@ -50,7 +50,7 @@ Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) : #ifdef MOUSE_ENABLED_LINUX Mouse6dofInput::Mouse6dofInput(QWidget* parent) : mouse3DMax(350.0), // TODO: check maximum value fot plugged device - uas(NULL), + uas(nullptr), done(false), mouseActive(false), translationActive(true), From b79983966e3eeaff47c84be9986da6d15b2ec900 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:15:57 +0900 Subject: [PATCH 17/23] qgcvideo --- src/apps/qgcvideo/QGCVideoWidget.cc | 12 ++++++------ src/apps/qgcvideo/QGCVideoWidget.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/qgcvideo/QGCVideoWidget.cc b/src/apps/qgcvideo/QGCVideoWidget.cc index 8fc9b85ad8..a4298308cc 100644 --- a/src/apps/qgcvideo/QGCVideoWidget.cc +++ b/src/apps/qgcvideo/QGCVideoWidget.cc @@ -82,9 +82,9 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent) vheight(150.0f), vGaugeSpacing(50.0f), vPitchPerDeg(6.0f), ///< 4 mm y translation per degree) - rawBuffer1(NULL), - rawBuffer2(NULL), - rawImage(NULL), + rawBuffer1(nullptr), + rawBuffer2(nullptr), + rawImage(nullptr), rawLastIndex(0), rawExpectedBytes(0), bytesPerLine(1), @@ -135,8 +135,8 @@ QGCVideoWidget::QGCVideoWidget(QWidget* parent) xImageFactor(1.0), yImageFactor(1.0), imageRequested(false), - flowFieldX(NULL), - flowFieldY(NULL), + flowFieldX(nullptr), + flowFieldY(nullptr), flowWidth(0), flowHeight(0) { @@ -1131,7 +1131,7 @@ void QGCVideoWidget::resizeGL(int w, int h) void QGCVideoWidget::commitRawDataToGL() { qDebug() << __FILE__ << __LINE__ << "Copying raw data to GL buffer:" << rawImage << receivedWidth << receivedHeight << image->format(); - if (image != NULL) { + if (image != nullptr) { QImage::Format format = image->format(); QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); if (format == QImage::Format_Indexed8) { diff --git a/src/apps/qgcvideo/QGCVideoWidget.h b/src/apps/qgcvideo/QGCVideoWidget.h index 93a44bf694..f4c9cfe56d 100644 --- a/src/apps/qgcvideo/QGCVideoWidget.h +++ b/src/apps/qgcvideo/QGCVideoWidget.h @@ -18,7 +18,7 @@ class QGCVideoWidget : public QGLWidget { Q_OBJECT public: - QGCVideoWidget(QWidget* parent = NULL); + QGCVideoWidget(QWidget* parent = nullptr); ~QGCVideoWidget(); void resizeGL(int w, int h); From b27eeb4e81710449c7463a2f1092396cff59a405 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:16:18 +0900 Subject: [PATCH 18/23] utils: Change from NULL to nullptr --- libs/utils/consoleprocess_win.cpp | 10 +++++----- libs/utils/filesearch.cpp | 2 +- libs/utils/winutils.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/utils/consoleprocess_win.cpp b/libs/utils/consoleprocess_win.cpp index 15eec83619..0df4192d81 100644 --- a/libs/utils/consoleprocess_win.cpp +++ b/libs/utils/consoleprocess_win.cpp @@ -48,7 +48,7 @@ ConsoleProcess::ConsoleProcess(QObject *parent) : m_stubSocket(0), m_tempFile(0), m_pid(0), - m_hInferior(NULL), + m_hInferior(nullptr), inferiorFinishedNotifier(0), processFinishedNotifier(0) { @@ -133,7 +133,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) void ConsoleProcess::stop() { - if (m_hInferior != NULL) { + if (m_hInferior != nullptr) { TerminateProcess(m_hInferior, (unsigned)-1); cleanupInferior(); } @@ -190,7 +190,7 @@ void ConsoleProcess::readStubOutput() m_hInferior = OpenProcess( SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE, FALSE, m_appPid); - if (m_hInferior == NULL) { + if (m_hInferior == nullptr) { emit processError(tr("Cannot obtain a handle to the inferior: %1") .arg(winErrorMessage(GetLastError()))); // Uhm, and now what? @@ -212,7 +212,7 @@ void ConsoleProcess::cleanupInferior() delete inferiorFinishedNotifier; inferiorFinishedNotifier = 0; CloseHandle(m_hInferior); - m_hInferior = NULL; + m_hInferior = nullptr; m_appPid = 0; } @@ -248,7 +248,7 @@ void ConsoleProcess::stubExited() if (m_stubSocket && m_stubSocket->state() == QLocalSocket::ConnectedState) m_stubSocket->waitForDisconnected(); cleanupStub(); - if (m_hInferior != NULL) { + if (m_hInferior != nullptr) { TerminateProcess(m_hInferior, (unsigned)-1); cleanupInferior(); m_appStatus = QProcess::CrashExit; diff --git a/libs/utils/filesearch.cpp b/libs/utils/filesearch.cpp index 54c6083142..4c336771f0 100644 --- a/libs/utils/filesearch.cpp +++ b/libs/utils/filesearch.cpp @@ -112,7 +112,7 @@ void runFileSearch(QFutureInterface &future, if (!device->open(QIODevice::ReadOnly)) continue; int lineNr = 1; - const char *startOfLastLine = NULL; + const char *startOfLastLine = nullptr; bool firstChunk = true; while (!device->atEnd()) { diff --git a/libs/utils/winutils.cpp b/libs/utils/winutils.cpp index ae80f26efc..3dcedb8fd0 100644 --- a/libs/utils/winutils.cpp +++ b/libs/utils/winutils.cpp @@ -44,7 +44,7 @@ QTCREATOR_UTILS_EXPORT QString winErrorMessage(unsigned long error) const int len = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL); + nullptr, error, 0, (LPTSTR)&lpMsgBuf, 0, nullptr); if (len) { rc = QString::fromUtf16(lpMsgBuf, len); LocalFree(lpMsgBuf); From 8c2dd571b417bdcabaf73e5d79b7b82c48059960 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:16:33 +0900 Subject: [PATCH 19/23] src: Change from NULL to nullptr --- src/AudioOutput.cc | 8 ++++---- src/GAudioOutput.cc | 26 +++++++++++++------------- src/GAudioOutput.h | 2 +- src/PX4FirmwareUpgradeWorker.cc | 4 ++-- src/QGCGeo.cc | 2 +- src/configuration.h | 2 +- src/globalobject.cc | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/AudioOutput.cc b/src/AudioOutput.cc index 1f76355ba5..d464b49f06 100644 --- a/src/AudioOutput.cc +++ b/src/AudioOutput.cc @@ -27,7 +27,7 @@ extern "C" { AudioOutput::AudioOutput(QString voice, QObject* parent) : QObject(parent), - voice(NULL), + voice(nullptr), voiceIndex(0) { #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) @@ -113,14 +113,14 @@ bool AudioOutput::stopEmergency() void AudioOutput::selectFemaleVoice() { #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) - this->voice = register_cmu_us_slt(NULL); + this->voice = register_cmu_us_slt(nullptr); #endif } void AudioOutput::selectMaleVoice() { #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) - this->voice = register_cmu_us_rms(NULL); + this->voice = register_cmu_us_rms(nullptr); #endif } @@ -128,7 +128,7 @@ void AudioOutput::selectMaleVoice() void AudioOutput::selectNeutralVoice() { #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) - this->voice = register_cmu_us_awb(NULL); + this->voice = register_cmu_us_awb(nullptr); #endif } diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 30a625e67f..7ec1a6fbf1 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -124,31 +124,31 @@ GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent), #ifdef Q_OS_MAC m_speech_channel = new SpeechChannel; - OSErr theErr = NewSpeechChannel(NULL, m_speech_channel); + OSErr theErr = NewSpeechChannel(nullptr, m_speech_channel); if (theErr != noErr) { QLOG_WARN() << "Creating speech channel failed!"; delete m_speech_channel; - m_speech_channel = NULL; + m_speech_channel = nullptr; } #endif #if _MSC_VER2 - ISpVoice * pVoice = NULL; - if (FAILED(::CoInitialize(NULL))) + ISpVoice * pVoice = nullptr; + if (FAILED(::CoInitialize(nullptr))) { QLOG_WARN() << "Creating COM object for audio output failed!"; } else { - HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice;); + HRESULT hr = CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice;); if( SUCCEEDED( hr ) ) { - hr = pVoice->Speak(L"Hello world", 0, NULL); + hr = pVoice->Speak(L"Hello world", 0, nullptr); pVoice->Release(); - pVoice = NULL; + pVoice = nullptr; } } #endif @@ -181,7 +181,7 @@ GAudioOutput::~GAudioOutput() DisposeSpeechChannel(*m_speech_channel); }; delete m_speech_channel; - m_speech_channel = NULL; + m_speech_channel = nullptr; #endif //#ifdef _MSC_VER2 // ::CoUninitialize(); @@ -239,7 +239,7 @@ bool GAudioOutput::say(QString text, int severity) if (file.open(QIODevice::ReadWrite)) { QLOG_INFO() << file.fileName() << " file not exist, create a new one"; - cst_voice *v = register_cmu_us_kal(NULL); + cst_voice *v = register_cmu_us_kal(nullptr); cst_wave *wav = flite_text_to_wave(text.toStdString().c_str(), v); cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); file.close(); @@ -261,7 +261,7 @@ bool GAudioOutput::say(QString text, int severity) #ifdef Q_OS_MAC if(m_speech_channel) { - SpeakCFString(*m_speech_channel, text.toCFString(), NULL); + SpeakCFString(*m_speech_channel, text.toCFString(), nullptr); } res = true; #endif @@ -369,14 +369,14 @@ void GAudioOutput::beep() void GAudioOutput::selectFemaleVoice() { #ifdef Q_OS_LINUX - //this->voice = register_cmu_us_slt(NULL); + //this->voice = register_cmu_us_slt(nullptr); #endif } void GAudioOutput::selectMaleVoice() { #ifdef Q_OS_LINUX - //this->voice = register_cmu_us_rms(NULL); + //this->voice = register_cmu_us_rms(nullptr); #endif } @@ -384,7 +384,7 @@ void GAudioOutput::selectMaleVoice() void GAudioOutput::selectNeutralVoice() { #ifdef Q_OS_LINUX - this->voice = register_cmu_us_awb(NULL); + this->voice = register_cmu_us_awb(nullptr); #endif }*/ diff --git a/src/GAudioOutput.h b/src/GAudioOutput.h index 76ae414ef0..c74f284eba 100644 --- a/src/GAudioOutput.h +++ b/src/GAudioOutput.h @@ -113,7 +113,7 @@ public slots: QTimer* emergencyTimer; bool muted; private: - GAudioOutput(QObject* parent=NULL); + GAudioOutput(QObject* parent=nullptr); ~GAudioOutput(); }; diff --git a/src/PX4FirmwareUpgradeWorker.cc b/src/PX4FirmwareUpgradeWorker.cc index 5abd7d1a40..75dd23d34c 100644 --- a/src/PX4FirmwareUpgradeWorker.cc +++ b/src/PX4FirmwareUpgradeWorker.cc @@ -18,7 +18,7 @@ PX4FirmwareUpgradeWorker::PX4FirmwareUpgradeWorker(QObject *parent) : QObject(parent), - link(NULL) + link(nullptr) { } @@ -127,7 +127,7 @@ void PX4FirmwareUpgradeWorker::loadFirmware(const QString &filename) PX4_Uploader uploader; const char* filenames[2]; filenames[0] = filename.toStdString().c_str(); - filenames[1] = NULL; + filenames[1] = nullptr; uploader.upload(filenames, "/dev/tty.usbmodem1"); // QFile f(filename); diff --git a/src/QGCGeo.cc b/src/QGCGeo.cc index f5cf51ca4a..2d10770d44 100644 --- a/src/QGCGeo.cc +++ b/src/QGCGeo.cc @@ -134,7 +134,7 @@ bool Vector3d::setToLeastSquaresSphericalCenter(const QVector &pointsO alglib::minlmsetcond(state, epsg, epsf, epsx, maxits); // optimize it! - alglib::minlmoptimize(state, &sphereError, NULL, (void *)&pointsOnSphere); + alglib::minlmoptimize(state, &sphereError, nullptr, (void *)&pointsOnSphere); // retrieve output report alglib::minlmreport rep; diff --git a/src/configuration.h b/src/configuration.h index febf4bb186..1c7288a1f5 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -65,7 +65,7 @@ const int APPLICATIONVERSION = 2027; // 2.0.27 [TODO] we should deprecate this v inline void close(){ GlobalObject* global = GlobalObject::sharedInstance(); delete global; - global = NULL; + global = nullptr; } inline void loadSettings(){ diff --git a/src/globalobject.cc b/src/globalobject.cc index 76d4f9e700..5b15d0ea9b 100644 --- a/src/globalobject.cc +++ b/src/globalobject.cc @@ -8,7 +8,7 @@ GlobalObject* GlobalObject::sharedInstance() { - static GlobalObject* _globalInstance = NULL; + static GlobalObject* _globalInstance = nullptr; if (_globalInstance) { return _globalInstance; } From 95c32789b5e81d66684f2d009b89dfe56aac0640 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:16:50 +0900 Subject: [PATCH 20/23] watchdog: Change from NULL to nullptr --- src/ui/watchdog/WatchdogControl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/watchdog/WatchdogControl.cc b/src/ui/watchdog/WatchdogControl.cc index e91f77349a..49422764b0 100644 --- a/src/ui/watchdog/WatchdogControl.cc +++ b/src/ui/watchdog/WatchdogControl.cc @@ -38,7 +38,7 @@ This file is part of the QGROUNDCONTROL project WatchdogControl::WatchdogControl(QWidget *parent) : QWidget(parent), - mav(NULL), + mav(nullptr), updateInterval(2000000), ui(new Ui::WatchdogControl) { From f9cea9859bebf445a817ec691b277da181642208 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:17:05 +0900 Subject: [PATCH 21/23] qgcunittest: Change from NULL to nullptr --- src/qgcunittest/UASUnitTest.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qgcunittest/UASUnitTest.cc b/src/qgcunittest/UASUnitTest.cc index 11b95ccd74..d27a1c2c30 100644 --- a/src/qgcunittest/UASUnitTest.cc +++ b/src/qgcunittest/UASUnitTest.cc @@ -15,10 +15,10 @@ void UASUnitTest::init() void UASUnitTest::cleanup() { delete uas; - uas = NULL; + uas = nullptr; delete mav; - mav = NULL; + mav = nullptr; } void UASUnitTest::getUASID_test() @@ -270,7 +270,7 @@ void UASUnitTest::signalWayPoint_test() QCOMPARE( spyDestroyed.count(), 0 ); delete uas;// delete(destroyed) uas for validating - uas = NULL; + uas = nullptr; QCOMPARE(spyDestroyed.count(), 1);// count destroyed uas should are 1 uas = new UAS(mav,UASID); QSignalSpy spy2(uas->getWaypointManager(), SIGNAL(waypointEditableListChanged())); @@ -284,7 +284,7 @@ void UASUnitTest::signalWayPoint_test() QVector wpList = uas->getWaypointManager()->getWaypointEditableList(); QCOMPARE(wpList.count(), 1); delete uas; - uas = NULL; + uas = nullptr; delete wp2; } @@ -317,7 +317,7 @@ void UASUnitTest::signalUASLink_test() qDebug()<< link->getName(); qDebug()<< QString::number(link->getId()); qDebug()<< QString::number(link->getNominalDataRate()); - QVERIFY(link != NULL); + QVERIFY(link != nullptr); uas->addLink(link); } From 77bf1b49cfb0bac430e63c3000f4c8e36038ded5 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:17:19 +0900 Subject: [PATCH 22/23] xsys: Change from NULL to nullptr --- libs/thirdParty/libxbee/xsys/win32.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/thirdParty/libxbee/xsys/win32.h b/libs/thirdParty/libxbee/xsys/win32.h index 65f19f805c..7611a29a5a 100644 --- a/libs/thirdParty/libxbee/xsys/win32.h +++ b/libs/thirdParty/libxbee/xsys/win32.h @@ -37,23 +37,23 @@ #define Win32Message() MessageBox(0,"Run xbee_setup() first!...","libxbee",MB_OK); -HMODULE glob_hModule = NULL; +HMODULE glob_hModule = nullptr; /* this uses miliseconds not microseconds... */ #define usleep(a) Sleep((a)/1000) -#define xbee_thread_create(a,b,c) (((a) = CreateThread(NULL,0,(void *)(b),(void *)(c),0,NULL)) == NULL) +#define xbee_thread_create(a,b,c) (((a) = CreateThread(nullptr,0,(void *)(b),(void *)(c),0,nullptr)) == nullptr) #define xbee_thread_cancel(a,b) TerminateThread((a),(b)) #define xbee_thread_join(a) WaitForSingleObject((a),INFINITE) #define xbee_thread_tryjoin(a) WaitForSingleObject((a),0) -#define xbee_mutex_init(a) (((a) = CreateEvent(NULL,FALSE,TRUE,NULL)) == NULL) +#define xbee_mutex_init(a) (((a) = CreateEvent(nullptr,FALSE,TRUE,nullptr)) == nullptr) #define xbee_mutex_destroy(a) CloseHandle((a)) #define xbee_mutex_lock(a) WaitForSingleObject((a),INFINITE) #define xbee_mutex_trylock(a) WaitForSingleObject((a),0) #define xbee_mutex_unlock(a) SetEvent((a)) -#define xbee_sem_init(a) (((a) = CreateEvent(NULL,FALSE,FALSE,NULL)) == NULL) +#define xbee_sem_init(a) (((a) = CreateEvent(nullptr,FALSE,FALSE,nullptr)) == nullptr) #define xbee_sem_destroy(a) CloseHandle((a)) #define xbee_sem_wait(a) WaitForSingleObject((a),INFINITE) #define xbee_sem_wait1sec(a) WaitForSingleObject((a),1000) From c83ce6526e35965fae773b1b8293a449d3bdd591 Mon Sep 17 00:00:00 2001 From: murata Date: Sun, 21 Jul 2019 19:17:39 +0900 Subject: [PATCH 23/23] 3DMouse: Change from NULL to nullptr --- libs/thirdParty/3DMouse/win/Mouse3DInput.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/thirdParty/3DMouse/win/Mouse3DInput.cpp b/libs/thirdParty/3DMouse/win/Mouse3DInput.cpp index c2db60965c..70f8868df8 100644 --- a/libs/thirdParty/3DMouse/win/Mouse3DInput.cpp +++ b/libs/thirdParty/3DMouse/win/Mouse3DInput.cpp @@ -234,7 +234,7 @@ bool Mouse3DInput::Is3dmouseAttached() unsigned int nDevices = 0; - if (::GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { + if (::GetRawInputDeviceList(nullptr, &nDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { return false; } @@ -318,7 +318,7 @@ UINT Mouse3DInput::GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSize #else BOOL bIsWow64 = FALSE; ::IsWow64Process(GetCurrentProcess(), &bIsWow64); - if (!bIsWow64 || pData==NULL) { + if (!bIsWow64 || pData==nullptr) { return ::GetRawInputBuffer(pData, pcbSize, cbSizeHeader); } else { HWND hwndTarget = fWindow; //fParent->winId(); @@ -365,7 +365,7 @@ UINT Mouse3DInput::GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSize void Mouse3DInput::On3dmouseInput() { // Don't do any data processing in background - bool bIsForeground = (::GetActiveWindow() != NULL); + bool bIsForeground = (::GetActiveWindow() != nullptr); if (!bIsForeground) { // set all cached data to zero so that a zero event is seen and the cached data deleted for (std::map::iterator it = fDevice2Data.begin(); it != fDevice2Data.end(); it++) { @@ -550,7 +550,7 @@ bool Mouse3DInput::TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput) #if _TRACE_RIDI_DEVICENAME UINT dwSize=0; - if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, NULL, &dwSize) == 0) { + if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, nullptr, &dwSize) == 0) { std::vector szDeviceName(dwSize+1); if (::GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICENAME, &szDeviceName[0], &dwSize) >0) { QLOG_TRACE() << "Device Name = %s\nDevice handle = 0x%x\n", &szDeviceName[0], pRawInput->header.hDevice;