From 42856a6041a74fd04615913937cce82bd8efabd6 Mon Sep 17 00:00:00 2001 From: a-ma72 Date: Thu, 24 Feb 2022 15:52:47 +0100 Subject: [PATCH] C99 issue --- python/src/rainflow.c | 18 +++++------ python/src/rfcnt.cpp | 74 +++++++++++++++++++++---------------------- src/rainflow.c | 18 +++++------ 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/python/src/rainflow.c b/python/src/rainflow.c index 4735294..039bad2 100644 --- a/python/src/rainflow.c +++ b/python/src/rainflow.c @@ -3893,7 +3893,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) class_shift = 0; rfc_value_t class_offset = rfc_ctx->class_offset; void *ptr; - + size_t i, j; if( pt->value < rfc_ctx->class_offset ) { @@ -3979,13 +3979,13 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) rfc_ctx->residue_cap = residue_cap; /* Residuum */ - for( size_t i = 0; i < rfc_ctx->residue_cnt; i++ ) + for( i = 0; i < rfc_ctx->residue_cnt; i++ ) { rfc_ctx->residue[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->residue[i].value ); } } - for( size_t i = 0; i < rfc_ctx->internal.residue_cap; i++ ) + for( i = 0; i < rfc_ctx->internal.residue_cap; i++ ) { rfc_ctx->internal.residue[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->internal.residue[i].value ); } @@ -4003,9 +4003,9 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t *rfm = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { - for( size_t j = 0; j < class_count_old; j++ ) + for( j = 0; j < class_count_old; j++ ) { rfm[ MAT_OFFS( i + class_shift, j + class_shift ) ] = rfc_ctx->rfm[ i * class_count_old + j ]; } @@ -4031,7 +4031,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t* lc = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { lc[i + class_shift] = rfc_ctx->lc[i]; } @@ -4052,7 +4052,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t* rp = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { rp[i] = rfc_ctx->rp[i]; } @@ -4065,7 +4065,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) #endif /*!RFC_MINIMAL*/ #if RFC_TP_SUPPORT - for( size_t i = 0; i < rfc_ctx->tp_cnt + ( rfc_ctx->state == RFC_STATE_BUSY_INTERIM ); i++ ) + for( i = 0; i < rfc_ctx->tp_cnt + ( rfc_ctx->state == RFC_STATE_BUSY_INTERIM ); i++ ) { #if RFC_USE_DELEGATES if( rfc_ctx->tp_get_fcn || rfc_ctx->tp_set_fcn ) @@ -4092,7 +4092,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) #endif /*RFC_GLOBAL_EXTREMA*/ #if RFC_HCM_SUPPORT - for( size_t i = 0; i < rfc_ctx->internal.hcm.stack_cap; i++ ) + for( i = 0; i < rfc_ctx->internal.hcm.stack_cap; i++ ) { rfc_ctx->internal.hcm.stack[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->internal.hcm.stack[i].value ); } diff --git a/python/src/rfcnt.cpp b/python/src/rfcnt.cpp index d32df7f..80791b4 100644 --- a/python/src/rfcnt.cpp +++ b/python/src/rfcnt.cpp @@ -42,7 +42,7 @@ int parse_rfc_kwargs( PyObject* kwargs, Py_ssize_t len, Rainflow *rf, Rainflow:: int use_hcm = 0; // false int use_astm = 0; // false int lc_method = 0; // Count rising slopes only - int flags = Rainflow::RFC_FLAGS_DEFAULT; + int flags = Rainflow::RFC_FLAGS_DEFAULT; int auto_resize = 0; // false int spread_damage = Rainflow::RFC_SD_TRANSIENT_23c; PyObject *wl = NULL; @@ -426,42 +426,42 @@ static PyObject* rfc( PyObject *self, PyObject *args, PyObject *kwargs ) Rainflow rf; Rainflow::rfc_res_method res_method; Py_ssize_t len; - bool ok = false; - - do - { - if( !parse_rfc_input_series( args, &arr_data, &data, &len ) ) - { - break; - } - - if( !parse_rfc_kwargs( kwargs, len, &rf, &res_method ) ) - { - break; - } - - if( !do_rainflow( &rf, data, len, res_method ) ) - { - break; - } - - if( !prepare_results( &rf, res_method, &ret ) ) - { - break; - } - - ok = true; - } - while(0); - - - if( !ok && ret ) - { - Py_DECREF( ret ); - ret = NULL; - } - - rf.deinit(); + bool ok = false; + + do + { + if( !parse_rfc_input_series( args, &arr_data, &data, &len ) ) + { + break; + } + + if( !parse_rfc_kwargs( kwargs, len, &rf, &res_method ) ) + { + break; + } + + if( !do_rainflow( &rf, data, len, res_method ) ) + { + break; + } + + if( !prepare_results( &rf, res_method, &ret ) ) + { + break; + } + + ok = true; + } + while(0); + + + if( !ok && ret ) + { + Py_DECREF( ret ); + ret = NULL; + } + + rf.deinit(); if( arr_data && data ) { diff --git a/src/rainflow.c b/src/rainflow.c index 4735294..039bad2 100644 --- a/src/rainflow.c +++ b/src/rainflow.c @@ -3893,7 +3893,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) class_shift = 0; rfc_value_t class_offset = rfc_ctx->class_offset; void *ptr; - + size_t i, j; if( pt->value < rfc_ctx->class_offset ) { @@ -3979,13 +3979,13 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) rfc_ctx->residue_cap = residue_cap; /* Residuum */ - for( size_t i = 0; i < rfc_ctx->residue_cnt; i++ ) + for( i = 0; i < rfc_ctx->residue_cnt; i++ ) { rfc_ctx->residue[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->residue[i].value ); } } - for( size_t i = 0; i < rfc_ctx->internal.residue_cap; i++ ) + for( i = 0; i < rfc_ctx->internal.residue_cap; i++ ) { rfc_ctx->internal.residue[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->internal.residue[i].value ); } @@ -4003,9 +4003,9 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t *rfm = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { - for( size_t j = 0; j < class_count_old; j++ ) + for( j = 0; j < class_count_old; j++ ) { rfm[ MAT_OFFS( i + class_shift, j + class_shift ) ] = rfc_ctx->rfm[ i * class_count_old + j ]; } @@ -4031,7 +4031,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t* lc = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { lc[i + class_shift] = rfc_ctx->lc[i]; } @@ -4052,7 +4052,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) { rfc_counts_t* rp = (rfc_counts_t*)ptr; - for( size_t i = 0; i < class_count_old; i++ ) + for( i = 0; i < class_count_old; i++ ) { rp[i] = rfc_ctx->rp[i]; } @@ -4065,7 +4065,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) #endif /*!RFC_MINIMAL*/ #if RFC_TP_SUPPORT - for( size_t i = 0; i < rfc_ctx->tp_cnt + ( rfc_ctx->state == RFC_STATE_BUSY_INTERIM ); i++ ) + for( i = 0; i < rfc_ctx->tp_cnt + ( rfc_ctx->state == RFC_STATE_BUSY_INTERIM ); i++ ) { #if RFC_USE_DELEGATES if( rfc_ctx->tp_get_fcn || rfc_ctx->tp_set_fcn ) @@ -4092,7 +4092,7 @@ bool autoresize( rfc_ctx_s *rfc_ctx, rfc_value_tuple_s* pt ) #endif /*RFC_GLOBAL_EXTREMA*/ #if RFC_HCM_SUPPORT - for( size_t i = 0; i < rfc_ctx->internal.hcm.stack_cap; i++ ) + for( i = 0; i < rfc_ctx->internal.hcm.stack_cap; i++ ) { rfc_ctx->internal.hcm.stack[i].cls = QUANTIZE( rfc_ctx, rfc_ctx->internal.hcm.stack[i].value ); }