mirror of git://gcc.gnu.org/git/gcc.git
cobol: Eliminate cppcheck warnings for libgcobol [PR119323]
I configured and ran cppcheck-2.17.0 with this config file:
<?xml version="1.0"?>
<def format="2">
<define name="HOST_SIZE_T_PRINT_UNSIGNED" value=""%ld""/>
<define name="GCC_PRISZ" value=""z""/>
<define name="YYLTYPE" value="struct {int first_line; int first_column; int last_line; int last_column;}"/>
<define name="__FLT128_MANT_DIG__" value="113"/>
<define name="__FLT128_MIN_EXP__" value="-16381"/>
</def>
and this command line
cppcheck --inline-suppr --enable=all --force --language=c++ --library=$CFG \
--check-level=exhaustive \
--disable=unusedFunction \
--disable=missingInclude \
$(cat $FILES) > $RESULT 2>&1
$FILES was all of the .cc files in libgcobol.
The result was many hundreds of warnings. The vast bulk of them were
recommendations for declaring variables as const, recommendations for
changing C-style casts to C++ casts, cheery notes about shadowed
variables, and complaints that malloc() results weren't being checked
for errors.
Two and a half days of applied OCD on my part has reduced the number of
warnings down to zero.
libgcobol/ChangeLog:
PR cobol/119323
* charmaps.cc (__gg__raw_to_ascii): Eliminate cppcheck warnings.
(__gg__raw_to_ebcdic): Likewise.
(__gg__ebcdic_to_console): Likewise.
(__gg__console_to_ascii): Likewise.
(__gg__console_to_ebcdic): Likewise.
* common-defs.h (struct cbl_declarative_t): Likewise.
* gfileio.cc (get_filename): Likewise.
(max_value): Likewise.
(relative_file_delete_varying): Likewise.
(relative_file_delete): Likewise.
(read_an_indexed_record): Likewise.
(position_state_restore): Likewise.
(indexed_file_delete): Likewise.
(indexed_file_start): Likewise.
(sequential_file_rewrite): Likewise.
(relative_file_write_varying): Likewise.
(relative_file_write): Likewise.
(sequential_file_write): Likewise.
(indexed_file_write): Likewise.
(__io__file_write): Likewise.
(line_sequential_file_read): Likewise.
(indexed_file_read): Likewise.
(file_indexed_open): Likewise.
(__gg__file_reopen): Likewise.
* gmath.cc (conditional_stash): Likewise.
(__gg__pow): Likewise.
(multiply_int256_by_int64): Likewise.
(add_int256_to_int256): Likewise.
(divide_int256_by_int64): Likewise.
(squeeze_int256): Likewise.
(get_int256_from_qualified_field): Likewise.
(__gg__add_fixed_phase1): Likewise.
(__gg__addf1_fixed_phase2): Likewise.
(__gg__fixed_phase2_assign_to_c): Likewise.
(__gg__add_float_phase1): Likewise.
(__gg__addf1_float_phase2): Likewise.
(__gg__float_phase2_assign_to_c): Likewise.
(__gg__addf3): Likewise.
(__gg__subtractf1_fixed_phase2): Likewise.
(__gg__subtractf2_fixed_phase1): Likewise.
(__gg__subtractf1_float_phase2): Likewise.
(__gg__subtractf2_float_phase1): Likewise.
(__gg__subtractf3): Likewise.
(__gg__multiplyf1_phase1): Likewise.
(multiply_int128_by_int128): Likewise.
(__gg__multiplyf1_phase2): Likewise.
(__gg__multiplyf2): Likewise.
(shift_in_place128): Likewise.
(divide_int128_by_int128): Likewise.
(__gg__dividef1_phase2): Likewise.
(__gg__dividef23): Likewise.
(__gg__dividef45): Likewise.
* intrinsic.cc (struct input_state): Likewise.
(get_value_as_double_from_qualified_field): Likewise.
(kahan_summation): Likewise.
(variance): Likewise.
(get_all_time): Likewise.
(populate_ctm_from_date): Likewise.
(populate_ctm_from_time): Likewise.
(ftime_replace): Likewise.
(__gg__abs): Likewise.
(__gg__acos): Likewise.
(__gg__annuity): Likewise.
(__gg__asin): Likewise.
(__gg__atan): Likewise.
(__gg__byte_length): Likewise.
(__gg__char): Likewise.
(__gg__combined_datetime): Likewise.
(__gg__cos): Likewise.
(__gg__date_of_integer): Likewise.
(__gg__date_to_yyyymmdd): Likewise.
(__gg__day_of_integer): Likewise.
(__gg__day_to_yyyyddd): Likewise.
(__gg__exp): Likewise.
(__gg__exp10): Likewise.
(__gg__factorial): Likewise.
(__gg__formatted_current_date): Likewise.
(__gg__formatted_date): Likewise.
(__gg__formatted_datetime): Likewise.
(__gg__formatted_time): Likewise.
(__gg__integer): Likewise.
(__gg__integer_of_date): Likewise.
(__gg__integer_of_day): Likewise.
(__gg__integer_part): Likewise.
(__gg__fraction_part): Likewise.
(__gg__log): Likewise.
(__gg__log10): Likewise.
(__gg__max): Likewise.
(__gg__lower_case): Likewise.
(__gg__median): Likewise.
(__gg__min): Likewise.
(numval): Likewise.
(numval_c): Likewise.
(__gg__numval): Likewise.
(__gg__test_numval): Likewise.
(__gg__numval_c): Likewise.
(__gg__test_numval_c): Likewise.
(__gg__ord): Likewise.
(__gg__rem): Likewise.
(__gg__trim): Likewise.
(__gg__random): Likewise.
(__gg__reverse): Likewise.
(__gg__sign): Likewise.
(__gg__sin): Likewise.
(__gg__sqrt): Likewise.
(__gg__tan): Likewise.
(__gg__test_date_yyyymmdd): Likewise.
(__gg__test_day_yyyyddd): Likewise.
(__gg__upper_case): Likewise.
(__gg__year_to_yyyy): Likewise.
(gets_int): Likewise.
(gets_year): Likewise.
(gets_month): Likewise.
(gets_day): Likewise.
(gets_day_of_week): Likewise.
(gets_day_of_year): Likewise.
(gets_week): Likewise.
(gets_hours): Likewise.
(gets_minutes): Likewise.
(gets_seconds): Likewise.
(gets_nanoseconds): Likewise.
(fill_cobol_tm): Likewise.
(__gg__test_formatted_datetime): Likewise.
(__gg__integer_of_formatted_date): Likewise.
(__gg__seconds_from_formatted_time): Likewise.
(__gg__hex_of): Likewise.
(__gg__highest_algebraic): Likewise.
(__gg__lowest_algebraic): Likewise.
(floating_format_tester): Likewise.
(__gg__numval_f): Likewise.
(__gg__test_numval_f): Likewise.
(ismatch): Likewise.
(iscasematch): Likewise.
(strstr): Likewise.
(strcasestr): Likewise.
(strlaststr): Likewise.
(strcaselaststr): Likewise.
(__gg__substitute): Likewise.
(__gg__locale_compare): Likewise.
(__gg__locale_date): Likewise.
(__gg__locale_time): Likewise.
(__gg__locale_time_from_seconds): Likewise.
* libgcobol.cc (class ec_status_t): Likewise.
(__gg__set_truncation_mode): Likewise.
(malloc): Likewise.
(__gg__mabort): Likewise.
(__gg__resize_int_p): Likewise.
(__gg__resize_treeplet): Likewise.
(var_is_refmod): Likewise.
(value_is_too_big): Likewise.
(__gg__string_to_alpha_edited_ascii): Likewise.
(int128_to_field): Likewise.
(edited_to_binary): Likewise.
(get_binary_value_local): Likewise.
(__gg__get_date_yymmdd): Likewise.
(__gg__get_date_yyyymmdd): Likewise.
(__gg__get_date_yyddd): Likewise.
(__gg__get_yyyyddd): Likewise.
(__gg__get_date_dow): Likewise.
(get_scaled_rdigits): Likewise.
(format_for_display_internal): Likewise.
(compare_88): Likewise.
(get_float128): Likewise.
(compare_field_class): Likewise.
(compare_strings): Likewise.
(__gg__compare_2): Likewise.
(__gg__sort_table): Likewise.
(init_var_both): Likewise.
(alpha_to_alpha_move_from_location): Likewise.
(alpha_to_alpha_move): Likewise.
(__gg__move): Likewise.
(__gg__move_literala): Likewise.
(__gg__sort_workfile): Likewise.
(__gg__merge_files): Likewise.
(normalize_id): Likewise.
(inspect_backward_format_1): Likewise.
(__gg__inspect_format_1): Likewise.
(inspect_backward_format_2): Likewise.
(__gg__inspect_format_2): Likewise.
(__gg__inspect_format_4): Likewise.
(move_string): Likewise.
(__gg__string): Likewise.
(display_both): Likewise.
(__gg__display_string): Likewise.
(__gg__accept): Likewise.
(__gg__binary_value_from_qualified_field): Likewise.
(__gg__float128_from_qualified_field): Likewise.
(float128_to_int128): Likewise.
(float128_to_location): Likewise.
(__gg__set_initial_switch_value): Likewise.
(is_numeric_display_numeric): Likewise.
(is_packed_numeric): Likewise.
(is_alpha_a_number): Likewise.
(__gg__classify): Likewise.
(__gg__accept_envar): Likewise.
(__gg__set_envar): Likewise.
(command_line_plan_b): Likewise.
(__gg__get_command_line): Likewise.
(__gg__set_pointer): Likewise.
(__gg__ascii_to_internal_field): Likewise.
(__gg__internal_to_console_in_place): Likewise.
(__gg__routine_to_call): Likewise.
(__gg__fetch_call_by_value_value): Likewise.
(__gg__assign_value_from_stack): Likewise.
(__gg__literaln_alpha_compare): Likewise.
(string_in): Likewise.
(__gg__unstring): Likewise.
(local_ec_type_of): Likewise.
(struct exception_descr_t): Likewise.
(struct cbl_exception_t): Likewise.
(cbl_enabled_exception_t: Likewise.: Likewise.dump): Likewise.
(__gg__match_exception): Likewise.
(__gg__float128_from_location): Likewise.
(__gg__integer_from_float128): Likewise.
(__gg__set_exception_file): Likewise.
(__gg__func_exception_file): Likewise.
(__gg__set_exception_code): Likewise.
(__gg__is_float_infinite): Likewise.
(__gg__float32_from_128): Likewise.
(__gg__float32_from_64): Likewise.
(__gg__float64_from_128): Likewise.
(__gg__copy_as_big_endian): Likewise.
(__gg__get_figconst_data): Likewise.
(find_in_dirs): Likewise.
(__gg__function_handle_from_cobpath): Likewise.
(__gg__just_mangle_name): Likewise.
(__gg__function_handle_from_literal): Likewise.
(__gg__function_handle_from_name): Likewise.
(__gg__mirror_range): Likewise.
(__gg__deallocate): Likewise.
(__gg__allocate): Likewise.
(__gg__module_name): Likewise.
(__gg__set_env_name): Likewise.
(__gg__set_env_value): Likewise.
* libgcobol.h (__gg__mabort): Likewise.
(massert): Likewise.
(PTRCAST): Likewise.
(__gg__float128_from_location): Likewise.
(__gg__set_exception_file): Likewise.
(__gg__binary_value_from_qualified_field): Likewise.
(__gg__float128_from_qualified_field): Likewise.
* valconv.cc (__gg__realloc_if_necessary): Likewise.
(__gg__alphabet_create): Likewise.
(__gg__string_to_numeric_edited): Likewise.
(__gg__string_to_alpha_edited): Likewise.
* valconv.h: Likewise.
(cherry picked from commit 54e4f75b7d)
This commit is contained in:
parent
c48cce8872
commit
ddf7357af4
|
|
@ -435,7 +435,7 @@ __gg__raw_to_ascii(char **dest, size_t *dest_size, const char *in, size_t length
|
|||
|
||||
size_t code_point;
|
||||
// Pull the next code_point from the UTF-8 stream
|
||||
long unicode_point = extract_next_code_point((const unsigned char *)in,
|
||||
long unicode_point = extract_next_code_point(reinterpret_cast<const unsigned char *>(in),
|
||||
length,
|
||||
position );
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ __gg__raw_to_ebcdic(char **dest, size_t *dest_size, const char *in, size_t lengt
|
|||
}
|
||||
|
||||
// Pull the next code_point from the UTF-8 stream
|
||||
long unicode_point = extract_next_code_point( (const unsigned char *)in,
|
||||
long unicode_point = extract_next_code_point( reinterpret_cast<const unsigned char *>(in),
|
||||
length,
|
||||
position );
|
||||
// Check for that unicode code point in the subset of characters we
|
||||
|
|
@ -722,7 +722,8 @@ char *__gg__ebcdic_to_console(char **dest,
|
|||
const size_t length)
|
||||
{
|
||||
static size_t ebcdic_size = MINIMUM_ALLOCATION_SIZE;
|
||||
static char *ebcdic = (char *)malloc(ebcdic_size);
|
||||
static char *ebcdic = static_cast<char *>(malloc(ebcdic_size));
|
||||
if(!ebcdic)abort();
|
||||
__gg__realloc_if_necessary(&ebcdic, &ebcdic_size, length);
|
||||
|
||||
memcpy(ebcdic, str, length);
|
||||
|
|
@ -757,7 +758,7 @@ void __gg__console_to_ascii(char * const str, size_t length)
|
|||
size_t code_point;
|
||||
// Pull the next code_point from the UTF-8 stream
|
||||
long unicode_point
|
||||
= extract_next_code_point( (const unsigned char *)str,
|
||||
= extract_next_code_point( reinterpret_cast<const unsigned char *>(str),
|
||||
length,
|
||||
position );
|
||||
if( unicode_point == -1 )
|
||||
|
|
@ -797,7 +798,7 @@ __gg__console_to_ebcdic(char * const str, size_t length)
|
|||
size_t code_point;
|
||||
// Pull the next code_point from the UTF-8 stream
|
||||
long unicode_point
|
||||
= extract_next_code_point( (const unsigned char *)str,
|
||||
= extract_next_code_point( reinterpret_cast<const unsigned char *>(str),
|
||||
length,
|
||||
position );
|
||||
if( unicode_point == -1 )
|
||||
|
|
|
|||
|
|
@ -464,16 +464,20 @@ struct cbl_declarative_t {
|
|||
uint32_t nfile, files[files_max];
|
||||
cbl_file_mode_t mode;
|
||||
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
cbl_declarative_t( cbl_file_mode_t mode = file_mode_none_e )
|
||||
: section(0), global(false)
|
||||
: section(0)
|
||||
, global(false)
|
||||
, type(ec_none_e)
|
||||
, nfile(0)
|
||||
, mode(mode)
|
||||
{
|
||||
std::fill(files, files + COUNT_OF(files), 0);
|
||||
}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
cbl_declarative_t( ec_type_t type )
|
||||
: section(0), global(false)
|
||||
: section(0)
|
||||
, global(false)
|
||||
, type(type)
|
||||
, nfile(0)
|
||||
, mode(file_mode_none_e)
|
||||
|
|
@ -533,9 +537,9 @@ struct cbl_declarative_t {
|
|||
return section < that.section;
|
||||
}
|
||||
|
||||
// TRUE if there are no files to match, or the provided file is in the list.
|
||||
bool match_file( size_t file ) const {
|
||||
static const auto pend = files + nfile;
|
||||
// TRUE if there are no files to match, or the provided file is in the list.
|
||||
bool match_file( size_t file ) const {
|
||||
static const auto pend = files + nfile; // cppcheck-suppress constVariablePointer
|
||||
|
||||
return nfile == 0 || pend != std::find(files, files + nfile, file);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// cppcheck-suppress-file postfixOperator
|
||||
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -105,6 +107,11 @@
|
|||
|
||||
*/
|
||||
|
||||
/* cppcheck has its opinions about ++iterator being superior to iterator++.
|
||||
however, can't abide by the prefix notation; it just looks dumb to me.
|
||||
And I have to believe that in the year of our Lord 2025 that the
|
||||
optimizing algorithms in modern compilers have sorted this out by now. */
|
||||
|
||||
extern "C"
|
||||
void
|
||||
__gg__handle_error(const char *function, const char *msg)
|
||||
|
|
@ -191,11 +198,12 @@ handle_errno(cblc_file_t *file, const char *function, const char *msg)
|
|||
|
||||
static
|
||||
char *
|
||||
get_filename( cblc_file_t *file,
|
||||
get_filename( const cblc_file_t *file,
|
||||
int is_quoted)
|
||||
{
|
||||
static size_t fname_size = MINIMUM_ALLOCATION_SIZE;
|
||||
static char *fname = (char *)malloc(MINIMUM_ALLOCATION_SIZE);
|
||||
static char *fname = static_cast<char *>(malloc(MINIMUM_ALLOCATION_SIZE));
|
||||
massert(fname);
|
||||
fname = internal_to_console(&fname,
|
||||
&fname_size,
|
||||
file->filename,
|
||||
|
|
@ -205,14 +213,15 @@ get_filename( cblc_file_t *file,
|
|||
{
|
||||
// We have been given something that might be the name of an
|
||||
// environment variable that contains the filename:
|
||||
char *p_from_environment = getenv(fname);
|
||||
const char *p_from_environment = getenv(fname);
|
||||
if( p_from_environment )
|
||||
{
|
||||
if( strlen(p_from_environment)+1 > fname_size )
|
||||
{
|
||||
fname_size = strlen(p_from_environment)+1;
|
||||
free(fname);
|
||||
fname = (char *)malloc(fname_size);
|
||||
fname = static_cast<char *>(malloc(fname_size));
|
||||
massert(fname);
|
||||
}
|
||||
strcpy(fname, p_from_environment);
|
||||
}
|
||||
|
|
@ -272,7 +281,7 @@ __gg__set_user_status(cblc_field_t *ustatus, cblc_file_t *file)
|
|||
}
|
||||
|
||||
static long
|
||||
max_value(cblc_field_t *key)
|
||||
max_value(const cblc_field_t *key)
|
||||
{
|
||||
long retval;
|
||||
if( key->digits )
|
||||
|
|
@ -537,7 +546,8 @@ relative_file_delete_varying(cblc_file_t *file, bool is_random)
|
|||
|
||||
size_t payload_length;
|
||||
|
||||
unsigned char *stash = (unsigned char *)malloc(file->default_record->capacity);
|
||||
unsigned char *stash = static_cast<unsigned char *>(malloc(file->default_record->capacity));
|
||||
massert(stash);
|
||||
memcpy(stash, file->default_record->data, file->default_record->capacity);
|
||||
long starting_pos = ftell(file->file_pointer);
|
||||
|
||||
|
|
@ -654,7 +664,8 @@ relative_file_delete(cblc_file_t *file, bool is_random)
|
|||
|
||||
char record_marker;
|
||||
|
||||
unsigned char *stash = (unsigned char *)malloc(file->default_record->capacity);
|
||||
unsigned char *stash = static_cast<unsigned char *>(malloc(file->default_record->capacity));
|
||||
massert(stash);
|
||||
memcpy(stash, file->default_record->data, file->default_record->capacity);
|
||||
|
||||
long starting_pos = ftell(file->file_pointer);
|
||||
|
|
@ -829,7 +840,7 @@ read_an_indexed_record( cblc_file_t *file,
|
|||
goto done;
|
||||
}
|
||||
|
||||
record_length = ach[0]<<8;
|
||||
record_length = static_cast<long>(ach[0])<<8;
|
||||
record_length += ach[1];
|
||||
if(ach[2] != 0)
|
||||
{
|
||||
|
|
@ -906,7 +917,7 @@ position_state_preserve(cblc_file_t *file, position_state_t &state)
|
|||
}
|
||||
|
||||
static void
|
||||
position_state_restore(cblc_file_t *file, position_state_t &state)
|
||||
position_state_restore(cblc_file_t *file, const position_state_t &state)
|
||||
{
|
||||
file->recent_key = state.recent_key;
|
||||
fseek(file->file_pointer, state.starting_position, SEEK_SET);
|
||||
|
|
@ -973,7 +984,8 @@ indexed_file_delete(cblc_file_t *file, bool is_random)
|
|||
// and the record area itself are unchanged by the delete operation.
|
||||
|
||||
// So, we save the current record area:
|
||||
stash = (unsigned char *)malloc(file->record_area_max);
|
||||
stash = static_cast<unsigned char *>(malloc(file->record_area_max));
|
||||
massert(stash);
|
||||
memcpy(stash, file->default_record->data, file->record_area_max);
|
||||
|
||||
// And the position state of our file
|
||||
|
|
@ -1051,8 +1063,6 @@ indexed_file_delete(cblc_file_t *file, bool is_random)
|
|||
// we find one, we check to see if the keys match. If the keys don't
|
||||
// match, then we have to remove the existing one from the index.
|
||||
|
||||
std::vector<unsigned char> the_key
|
||||
= file_indexed_make_key(file, key_number);
|
||||
bool deleting = true;
|
||||
while(deleting)
|
||||
{
|
||||
|
|
@ -1069,6 +1079,7 @@ indexed_file_delete(cblc_file_t *file, bool is_random)
|
|||
deleting = true;
|
||||
break;
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1234,7 +1245,7 @@ indexed_file_start( cblc_file_t *file,
|
|||
file->io_status = FsErrno;
|
||||
}
|
||||
}
|
||||
else if( result < 0 )
|
||||
else // if( result < 0 )
|
||||
{
|
||||
// The index is less than the key.
|
||||
if( relop == lt_op
|
||||
|
|
@ -1656,7 +1667,7 @@ sequential_file_rewrite( cblc_file_t *file, size_t length )
|
|||
|
||||
if( file->record_area_min != file->record_area_max )
|
||||
{
|
||||
unsigned char preamble[4] =
|
||||
const unsigned char preamble[4] =
|
||||
{
|
||||
(unsigned char)(bytes_to_write>>8),
|
||||
(unsigned char)(bytes_to_write),
|
||||
|
|
@ -1688,7 +1699,6 @@ done:
|
|||
fseek(file->file_pointer, starting_position, SEEK_SET);
|
||||
handle_ferror(file, __func__, "fseek() error");
|
||||
file->prior_op = file_op_rewrite;
|
||||
file->prior_op = file_op_rewrite;
|
||||
establish_status(file, starting_position);
|
||||
}
|
||||
|
||||
|
|
@ -2210,7 +2220,7 @@ __io__file_rewrite(cblc_file_t *file, size_t length, bool is_random)
|
|||
|
||||
static void
|
||||
relative_file_write_varying(cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
bool is_random)
|
||||
{
|
||||
|
|
@ -2359,7 +2369,7 @@ done:
|
|||
|
||||
static void
|
||||
relative_file_write(cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
bool is_random)
|
||||
{
|
||||
|
|
@ -2374,7 +2384,7 @@ relative_file_write(cblc_file_t *file,
|
|||
file->io_status = FsErrno;
|
||||
|
||||
long necessary_file_size;
|
||||
unsigned char achPostamble[] = {internal_cr, internal_newline};
|
||||
const unsigned char achPostamble[] = {internal_cr, internal_newline};
|
||||
|
||||
relative_file_parameters rfp;
|
||||
|
||||
|
|
@ -2493,7 +2503,7 @@ done:
|
|||
|
||||
static void
|
||||
sequential_file_write(cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
int after,
|
||||
int lines)
|
||||
|
|
@ -2609,7 +2619,7 @@ sequential_file_write(cblc_file_t *file,
|
|||
{
|
||||
// Because of the min/max mismatch, we require a preamble:
|
||||
// The first two bytes are the big-endian character count
|
||||
unsigned char preamble[4] =
|
||||
const unsigned char preamble[4] =
|
||||
{
|
||||
(unsigned char)(characters_to_write>>8),
|
||||
(unsigned char)(characters_to_write),
|
||||
|
|
@ -2681,7 +2691,7 @@ done:
|
|||
|
||||
static void
|
||||
indexed_file_write( cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
bool is_random)
|
||||
{
|
||||
|
|
@ -2752,13 +2762,13 @@ indexed_file_write( cblc_file_t *file,
|
|||
// We are allowed to do the write, but only if there will be no key
|
||||
// violations as a result:
|
||||
|
||||
for(size_t key_number=1;
|
||||
key_number<file->supplemental->indexes.size();
|
||||
key_number++)
|
||||
for(size_t keynum=1;
|
||||
keynum<file->supplemental->indexes.size();
|
||||
keynum++)
|
||||
{
|
||||
if( file->supplemental->uniques[key_number] )
|
||||
if( file->supplemental->uniques[keynum] )
|
||||
{
|
||||
long record_position = file_indexed_first_position(file, key_number);
|
||||
long record_position = file_indexed_first_position(file, keynum);
|
||||
if( record_position != -1 )
|
||||
{
|
||||
// No can do, because we already have a unique key with that value
|
||||
|
|
@ -2849,7 +2859,7 @@ done:
|
|||
|
||||
static void
|
||||
__io__file_write( cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
int after,
|
||||
int lines,
|
||||
|
|
@ -2983,7 +2993,7 @@ line_sequential_file_read( cblc_file_t *file)
|
|||
{
|
||||
break;
|
||||
}
|
||||
if( ch == file->delimiter || ch == EOF )
|
||||
if( ch == EOF )
|
||||
{
|
||||
hit_eof = true;
|
||||
clearerr(file->file_pointer);
|
||||
|
|
@ -3647,6 +3657,7 @@ indexed_file_read( cblc_file_t *file,
|
|||
goto done;
|
||||
}
|
||||
|
||||
// cppcheck-suppress derefInvalidIteratorRedundantCheck
|
||||
fpos = file_index->current_iterator->second;
|
||||
|
||||
if( file_index->current_iterator == file_index->key_to_position.end() )
|
||||
|
|
@ -3728,6 +3739,7 @@ indexed_file_read( cblc_file_t *file,
|
|||
|
||||
// We are ready to proceed
|
||||
|
||||
// cppcheck-suppress derefInvalidIteratorRedundantCheck
|
||||
fpos = file_index->current_iterator->second;
|
||||
if( file_index->current_iterator == file_index->key_to_position.end() )
|
||||
{
|
||||
|
|
@ -3922,7 +3934,6 @@ file_indexed_open(cblc_file_t *file)
|
|||
{
|
||||
if( file->key_numbers[index] != current_key_number )
|
||||
{
|
||||
file_index_t file_index;
|
||||
file->supplemental->indexes.push_back(file_index);
|
||||
current_key_number = file->key_numbers[index];
|
||||
file->supplemental->uniques.push_back(file->uniques[index]);
|
||||
|
|
@ -3952,7 +3963,8 @@ file_indexed_open(cblc_file_t *file)
|
|||
// We need to open the file for reading, and build the
|
||||
// maps for each index:
|
||||
static size_t fname_size = MINIMUM_ALLOCATION_SIZE;
|
||||
static char *fname = (char *)malloc(fname_size);
|
||||
static char *fname = static_cast<char *>(malloc(fname_size));
|
||||
massert(fname);
|
||||
|
||||
internal_to_console(&fname,
|
||||
&fname_size,
|
||||
|
|
@ -3969,7 +3981,8 @@ file_indexed_open(cblc_file_t *file)
|
|||
}
|
||||
|
||||
// Stash the existing record area:
|
||||
stash = (unsigned char *)malloc(file->record_area_max);
|
||||
stash = static_cast<unsigned char *>(malloc(file->record_area_max));
|
||||
massert(stash);
|
||||
memcpy( stash,
|
||||
file->default_record->data,
|
||||
file->record_area_max);
|
||||
|
|
@ -4111,7 +4124,8 @@ __gg__file_reopen(cblc_file_t *file, int mode_char)
|
|||
}
|
||||
|
||||
static size_t fname_size = MINIMUM_ALLOCATION_SIZE;
|
||||
static char *fname = (char *)malloc(fname_size);
|
||||
static char *fname = static_cast<char *>(malloc(fname_size));
|
||||
massert(fname)
|
||||
internal_to_console(&fname,
|
||||
&fname_size,
|
||||
file->filename,
|
||||
|
|
@ -4465,7 +4479,7 @@ public:
|
|||
typedef void (read_t)( cblc_file_t *file,
|
||||
int where );
|
||||
typedef void (write_t)( cblc_file_t *file,
|
||||
unsigned char *location,
|
||||
const unsigned char *location,
|
||||
size_t length,
|
||||
int after,
|
||||
int lines,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ conditional_stash( cblc_field_t *destination,
|
|||
// This is slightly more complex, because in the event of a
|
||||
// SIZE ERROR. we need to leave the original value untouched
|
||||
|
||||
unsigned char *stash = (unsigned char *)malloc(destination_s);
|
||||
unsigned char *stash = static_cast<unsigned char *>(malloc(destination_s));
|
||||
massert(stash);
|
||||
memcpy(stash, destination->data+destination_o, destination_s);
|
||||
|
||||
__gg__int128_to_qualified_field(destination,
|
||||
|
|
@ -132,7 +133,9 @@ conditional_stash( cblc_field_t *destination,
|
|||
{
|
||||
// This is slightly more complex, because in the event of a
|
||||
// SIZE ERROR. we need to leave the original value untouched
|
||||
unsigned char *stash = (unsigned char *)malloc(destination_s);
|
||||
assert(destination_s);
|
||||
unsigned char *stash = static_cast<unsigned char *>(malloc(destination_s));
|
||||
massert(stash);
|
||||
memcpy(stash, destination->data+destination_o, destination_s);
|
||||
__gg__float128_to_qualified_field(destination,
|
||||
destination_o,
|
||||
|
|
@ -256,20 +259,20 @@ __gg__pow( cbl_arith_format_t,
|
|||
size_t,
|
||||
size_t,
|
||||
size_t,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
GCOB_FP128 avalue = __gg__float128_from_qualified_field(A[0], A_o[0], A_s[0]);
|
||||
GCOB_FP128 bvalue = __gg__float128_from_qualified_field(B[0], B_o[0], B_s[0]);
|
||||
|
|
@ -368,8 +371,8 @@ multiply_int256_by_int64(int256 &product, const uint64_t multiplier)
|
|||
for(int i=0; i<4; i++)
|
||||
{
|
||||
uint128 temp = (uint128)product.i64[i] * multiplier;
|
||||
product.i64[i] = *(uint64_t *)(&temp);
|
||||
overflows[i+1] = *(uint64_t *)((uint8_t *)(&temp) + 8);
|
||||
product.i64[i] = *PTRCAST(uint64_t, &temp);
|
||||
overflows[i+1] = *PTRCAST(uint64_t, PTRCAST(uint8_t, &temp) + 8);
|
||||
}
|
||||
|
||||
for(int i=1; i<4; i++)
|
||||
|
|
@ -386,7 +389,7 @@ multiply_int256_by_int64(int256 &product, const uint64_t multiplier)
|
|||
}
|
||||
|
||||
static int
|
||||
add_int256_to_int256(int256 &sum, const int256 addend)
|
||||
add_int256_to_int256(int256 &sum, const int256 &addend)
|
||||
{
|
||||
uint128 overflows[3] = {};
|
||||
for(int i=0; i<2; i++)
|
||||
|
|
@ -451,10 +454,11 @@ divide_int256_by_int64(int256 &val, uint64_t divisor)
|
|||
for( int i=3; i>=0; i-- )
|
||||
{
|
||||
// Left shift temp 64 bits:
|
||||
*(uint64_t *)(((uint8_t *)&temp)+8) = *(uint64_t *)(((uint8_t *)&temp)+0);
|
||||
*PTRCAST(uint64_t, ((PTRCAST(uint8_t, &temp))+8))
|
||||
= *PTRCAST(uint64_t, ((PTRCAST(uint8_t, &temp))+0));
|
||||
|
||||
// Put the high digit of val into the bottom of temp
|
||||
*(uint64_t *)(((uint8_t *)&temp)+0) = val.i64[i];
|
||||
*PTRCAST(uint64_t, ((PTRCAST(uint8_t, &temp))+0)) = val.i64[i];
|
||||
|
||||
// Divide that combinary by divisor to get the new digits
|
||||
val.i64[i] = temp / divisor;
|
||||
|
|
@ -469,7 +473,8 @@ squeeze_int256(int256 &val, int &rdigits)
|
|||
{
|
||||
int overflow = 0;
|
||||
// It has been decreed that at this juncture the result must fit into
|
||||
// MAX_FIXED_POINT_DIGITS. If the result does not, we have an OVERFLOW error.
|
||||
// MAX_FIXED_POINT_DIGITS. If the result does not, we have an OVERFLOW
|
||||
// error.
|
||||
|
||||
int is_negative = val.data[31] & 0x80;
|
||||
if( is_negative )
|
||||
|
|
@ -477,9 +482,9 @@ squeeze_int256(int256 &val, int &rdigits)
|
|||
negate_int256(val);
|
||||
}
|
||||
|
||||
// As long as there are some decimal places left, we hold our nose and right-
|
||||
// shift a too-large value rightward by decimal digits. In other words, we
|
||||
// truncate the fractional part to make room for the integer part:
|
||||
// As long as there are some decimal places left, we hold our nose and
|
||||
// right-shift a too-large value rightward by decimal digits. In other
|
||||
// words, we truncate the fractional part to make room for the integer part:
|
||||
while(rdigits > 0 && val.i128[1] )
|
||||
{
|
||||
divide_int256_by_int64(val, 10UL);
|
||||
|
|
@ -504,7 +509,7 @@ squeeze_int256(int256 &val, int &rdigits)
|
|||
// These sixteen bytes comprise the binary value of 10^38
|
||||
static const uint8_t C1038[] = {0x00, 0x00, 0x00, 0x00, 0x40, 0x22, 0x8a, 0x09,
|
||||
0x7a, 0xc4, 0x86, 0x5a, 0xa8, 0x4c, 0x3b, 0x4b};
|
||||
static const uint128 biggest = *(uint128 *)C1038;
|
||||
static const uint128 biggest = *reinterpret_cast<const uint128 *>(C1038);
|
||||
|
||||
// If we still have some rdigits to throw away, we can keep shrinking
|
||||
// the value:
|
||||
|
|
@ -540,7 +545,7 @@ squeeze_int256(int256 &val, int &rdigits)
|
|||
static void
|
||||
get_int256_from_qualified_field(int256 &var,
|
||||
int &rdigits,
|
||||
cblc_field_t *field,
|
||||
const cblc_field_t *field,
|
||||
size_t field_o,
|
||||
size_t field_s)
|
||||
{
|
||||
|
|
@ -571,7 +576,7 @@ __gg__add_fixed_phase1( cbl_arith_format_t ,
|
|||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *,
|
||||
const cbl_round_t *,
|
||||
int ,
|
||||
int *compute_error
|
||||
)
|
||||
|
|
@ -580,9 +585,9 @@ __gg__add_fixed_phase1( cbl_arith_format_t ,
|
|||
|
||||
// The result goes into the temporary phase1_result.
|
||||
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
|
||||
// Let us prime the pump with the first value of A[]
|
||||
get_int256_from_qualified_field(phase1_result, phase1_rdigits, A[0], A_o[0], A_s[0]);
|
||||
|
|
@ -600,7 +605,6 @@ __gg__add_fixed_phase1( cbl_arith_format_t ,
|
|||
if( phase1_rdigits > temp_rdigits )
|
||||
{
|
||||
scale_int256_by_digits(temp, phase1_rdigits - temp_rdigits);
|
||||
temp_rdigits = phase1_rdigits;
|
||||
}
|
||||
else if( phase1_rdigits < temp_rdigits )
|
||||
{
|
||||
|
|
@ -628,14 +632,14 @@ __gg__addf1_fixed_phase2( cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
// This is the assignment phase of an ADD Format 1
|
||||
|
||||
|
|
@ -680,7 +684,6 @@ __gg__addf1_fixed_phase2( cbl_arith_format_t ,
|
|||
if( rdigits_a > rdigits_b )
|
||||
{
|
||||
scale_int256_by_digits(value_b, rdigits_a - rdigits_b);
|
||||
rdigits_b = rdigits_a;
|
||||
}
|
||||
else if( rdigits_a < rdigits_b )
|
||||
{
|
||||
|
|
@ -713,16 +716,16 @@ __gg__fixed_phase2_assign_to_c( cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
// This is the assignment phase of an ADD Format 2
|
||||
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
|
||||
// We take phase1_result and put it into C
|
||||
|
|
@ -771,7 +774,7 @@ __gg__add_float_phase1( cbl_arith_format_t ,
|
|||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *,
|
||||
const cbl_round_t *,
|
||||
int ,
|
||||
int *compute_error
|
||||
)
|
||||
|
|
@ -780,9 +783,9 @@ __gg__add_float_phase1( cbl_arith_format_t ,
|
|||
|
||||
// The result goes into the temporary phase1_result_ffloat.
|
||||
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
|
||||
// Let us prime the pump with the first value of A[]
|
||||
phase1_result_float = __gg__float128_from_qualified_field(A[0], A_o[0], A_s[0]);
|
||||
|
|
@ -804,14 +807,14 @@ __gg__addf1_float_phase2( cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
// This is the assignment phase of an ADD Format 2
|
||||
|
|
@ -831,14 +834,14 @@ __gg__float_phase2_assign_to_c( cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
// This is the assignment phase of an ADD Format 2
|
||||
|
|
@ -856,7 +859,7 @@ __gg__addf3(cbl_arith_format_t ,
|
|||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
|
|
@ -864,13 +867,13 @@ __gg__addf3(cbl_arith_format_t ,
|
|||
// This is an ADD Format 3. Each A[i] gets accumulated into each C[i]. When
|
||||
// both are fixed, we do fixed arithmetic. When either is a FldFloat, we
|
||||
// do floating-point arithmetic.
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
|
||||
|
|
@ -906,7 +909,6 @@ __gg__addf3(cbl_arith_format_t ,
|
|||
if( rdigits_a > rdigits_b )
|
||||
{
|
||||
scale_int256_by_digits(value_b, rdigits_a - rdigits_b);
|
||||
rdigits_b = rdigits_a;
|
||||
}
|
||||
else if( rdigits_a < rdigits_b )
|
||||
{
|
||||
|
|
@ -940,14 +942,14 @@ __gg__subtractf1_fixed_phase2(cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
// This is the assignment phase of an ADD Format 1
|
||||
|
||||
|
|
@ -997,7 +999,6 @@ __gg__subtractf1_fixed_phase2(cbl_arith_format_t ,
|
|||
else if( rdigits_a < rdigits_b )
|
||||
{
|
||||
scale_int256_by_digits(value_a, rdigits_b - rdigits_a);
|
||||
rdigits_a = rdigits_b;
|
||||
}
|
||||
|
||||
// The two numbers have the same number of rdigits. It's now safe to add
|
||||
|
|
@ -1025,16 +1026,16 @@ __gg__subtractf2_fixed_phase1(cbl_arith_format_t ,
|
|||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
// This is the calculation phase of a fixed-point SUBTRACT Format 2
|
||||
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
|
||||
// Add up all the A values
|
||||
__gg__add_fixed_phase1( not_expected_e ,
|
||||
|
|
@ -1065,7 +1066,6 @@ __gg__subtractf2_fixed_phase1(cbl_arith_format_t ,
|
|||
else if( rdigits_a < rdigits_b )
|
||||
{
|
||||
scale_int256_by_digits(value_a, rdigits_b - rdigits_a);
|
||||
rdigits_a = rdigits_b;
|
||||
}
|
||||
|
||||
// The two numbers have the same number of rdigits. It's now safe to add
|
||||
|
|
@ -1081,21 +1081,20 @@ __gg__subtractf2_fixed_phase1(cbl_arith_format_t ,
|
|||
phase1_rdigits = rdigits_b;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
void
|
||||
__gg__subtractf1_float_phase2(cbl_arith_format_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
// This is the assignment phase of an ADD Format 2
|
||||
|
|
@ -1109,23 +1108,22 @@ __gg__subtractf1_float_phase2(cbl_arith_format_t ,
|
|||
*rounded++);
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
void
|
||||
__gg__subtractf2_float_phase1(cbl_arith_format_t ,
|
||||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
// This is the calculation phase of a fixed-point SUBTRACT Format 2
|
||||
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
|
||||
// Add up all the A values
|
||||
__gg__add_float_phase1( not_expected_e ,
|
||||
|
|
@ -1151,7 +1149,7 @@ __gg__subtractf3( cbl_arith_format_t ,
|
|||
size_t nA,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
|
|
@ -1159,12 +1157,12 @@ __gg__subtractf3( cbl_arith_format_t ,
|
|||
// This is an ADD Format 3. Each A[i] gets accumulated into each C[i]. Each
|
||||
// SUBTRACTION is treated separately.
|
||||
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
|
||||
|
|
@ -1205,7 +1203,6 @@ __gg__subtractf3( cbl_arith_format_t ,
|
|||
else if( rdigits_a < rdigits_b )
|
||||
{
|
||||
scale_int256_by_digits(value_a, rdigits_b - rdigits_a);
|
||||
rdigits_a = rdigits_b;
|
||||
}
|
||||
|
||||
// The two numbers have the same number of rdigits. It's now safe to add
|
||||
|
|
@ -1240,16 +1237,16 @@ __gg__multiplyf1_phase1(cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *,
|
||||
const cbl_round_t *,
|
||||
int ,
|
||||
int *)
|
||||
{
|
||||
// We are getting just the one value, which we are converting to the necessary
|
||||
// intermediate form
|
||||
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
|
||||
if( A[0]->type == FldFloat )
|
||||
{
|
||||
|
|
@ -1274,7 +1271,8 @@ void multiply_int128_by_int128(int256 &ABCD,
|
|||
__int128 ab_value,
|
||||
__int128 cd_value)
|
||||
{
|
||||
int is_negative = ( ((uint8_t *)(&ab_value))[15]^((uint8_t *)(&cd_value))[15]) & 0x80;
|
||||
int is_negative = ( (PTRCAST(uint8_t, (&ab_value)))[15]
|
||||
^(PTRCAST(uint8_t, (&cd_value)))[15]) & 0x80;
|
||||
if( ab_value < 0 )
|
||||
{
|
||||
ab_value = -ab_value;
|
||||
|
|
@ -1290,10 +1288,10 @@ void multiply_int128_by_int128(int256 &ABCD,
|
|||
uint128 BD;
|
||||
|
||||
// Let's extract the digits.
|
||||
uint64_t a = *(uint64_t *)((unsigned char *)(&ab_value)+8);
|
||||
uint64_t b = *(uint64_t *)((unsigned char *)(&ab_value)+0);
|
||||
uint64_t c = *(uint64_t *)((unsigned char *)(&cd_value)+8);
|
||||
uint64_t d = *(uint64_t *)((unsigned char *)(&cd_value)+0);
|
||||
uint64_t a = *PTRCAST(uint64_t, (PTRCAST(unsigned char, (&ab_value))+8));
|
||||
uint64_t b = *PTRCAST(uint64_t, (PTRCAST(unsigned char, (&ab_value))+0));
|
||||
uint64_t c = *PTRCAST(uint64_t, (PTRCAST(unsigned char, (&cd_value))+8));
|
||||
uint64_t d = *PTRCAST(uint64_t, (PTRCAST(unsigned char, (&cd_value))+0));
|
||||
|
||||
// multiply (a0 + b) * (c0 + d)
|
||||
|
||||
|
|
@ -1334,14 +1332,14 @@ __gg__multiplyf1_phase2(cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
int error_this_time=0;
|
||||
|
|
@ -1415,14 +1413,13 @@ __gg__multiplyf1_phase2(cbl_arith_format_t ,
|
|||
if( error_this_time && on_size_error)
|
||||
{
|
||||
*compute_error |= error_this_time;
|
||||
rounded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*compute_error |= conditional_stash(C[0], C_o[0], C_s[0],
|
||||
on_size_error,
|
||||
a_value,
|
||||
*rounded++);
|
||||
*rounded);
|
||||
}
|
||||
done:
|
||||
return;
|
||||
|
|
@ -1434,20 +1431,20 @@ __gg__multiplyf2( cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t nC,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
|
||||
|
|
@ -1517,7 +1514,7 @@ shift_in_place128(uint8_t *buf, int size, int bits)
|
|||
uint128 temp;
|
||||
uint128 overflow = 0;
|
||||
|
||||
uint128 *as128 = (uint128 *)buf;
|
||||
uint128 *as128 = PTRCAST(uint128, buf);
|
||||
|
||||
for( size_t i=0; i<places; i++ )
|
||||
{
|
||||
|
|
@ -1598,7 +1595,7 @@ divide_int128_by_int128(int256 "ient,
|
|||
}
|
||||
|
||||
// We are going to be referencing the 64-bit pices of the 128-bit divisor:
|
||||
uint64_t *divisor64 = (uint64_t *)&divisor;
|
||||
uint64_t *divisor64 = PTRCAST(uint64_t, &divisor);
|
||||
|
||||
quotient.i128[1] = 0;
|
||||
quotient.i128[0] = dividend;
|
||||
|
|
@ -1667,12 +1664,11 @@ divide_int128_by_int128(int256 "ient,
|
|||
|
||||
int bits_to_shift = 0;
|
||||
int i=15;
|
||||
while( ((uint8_t *)(&divisor))[i] == 0 )
|
||||
while( (PTRCAST(uint8_t, &divisor))[i] == 0 )
|
||||
{
|
||||
i -= 1;
|
||||
bits_to_shift += 8;
|
||||
}
|
||||
uint8_t tail = ((uint8_t *)(&divisor))[i];
|
||||
} uint8_t tail = ( PTRCAST(uint8_t, &divisor) )[i];
|
||||
while( !(tail & 0x80) )
|
||||
{
|
||||
bits_to_shift += 1;
|
||||
|
|
@ -1681,9 +1677,8 @@ divide_int128_by_int128(int256 "ient,
|
|||
|
||||
// Shift both the numerator and the divisor that number of bits
|
||||
|
||||
shift_in_place128((uint8_t *)&numerator, sizeof(numerator), bits_to_shift);
|
||||
shift_in_place128((uint8_t *)&divisor, sizeof(divisor), bits_to_shift);
|
||||
|
||||
shift_in_place128( PTRCAST(uint8_t, &numerator), sizeof(numerator), bits_to_shift);
|
||||
shift_in_place128( PTRCAST(uint8_t, &divisor), sizeof(divisor), bits_to_shift);
|
||||
|
||||
// We are now ready to do the guess-multiply-subtract loop. We know that
|
||||
// the result will have two places, so we know we are going to go through
|
||||
|
|
@ -1700,7 +1695,7 @@ divide_int128_by_int128(int256 "ient,
|
|||
// We develop our guess for a quotient by dividing the top two places of
|
||||
// the numerator area by C
|
||||
uint128 temp;
|
||||
uint64_t *temp64 = (uint64_t *)&temp;
|
||||
uint64_t *temp64 = PTRCAST(uint64_t, &temp);
|
||||
|
||||
temp64[1] = numerator.i64[q_place+2];
|
||||
temp64[0] = numerator.i64[q_place+1];
|
||||
|
|
@ -1714,10 +1709,10 @@ divide_int128_by_int128(int256 "ient,
|
|||
subber[2] = 0;
|
||||
|
||||
// Start with the bottom 128 bits of the "subber"
|
||||
*(uint128 *)subber = (uint128) divisor64[0] * quotient.i64[q_place];
|
||||
*PTRCAST(uint128, subber) = (uint128) divisor64[0] * quotient.i64[q_place];
|
||||
|
||||
// Get the next 128 bits of subber
|
||||
temp = (uint128) divisor64[1] * quotient.i64[q_place];
|
||||
temp = (uint128) divisor64[1] * quotient.i64[q_place];
|
||||
|
||||
// Add the top of the first product to the bottom of the second:
|
||||
subber[1] += temp64[0];
|
||||
|
|
@ -1738,20 +1733,20 @@ divide_int128_by_int128(int256 "ient,
|
|||
// the numerator:
|
||||
|
||||
uint64_t borrow = 0;
|
||||
for(size_t i=0; i<3; i++)
|
||||
for(size_t j=0; j<3; j++)
|
||||
{
|
||||
if( numerator.i64[q_place + i] == 0 && borrow )
|
||||
if( numerator.i64[q_place + j] == 0 && borrow )
|
||||
{
|
||||
// We are subtracting from zero and we have a borrow. Leave the
|
||||
// borrow on and just do the subtraction:
|
||||
numerator.i64[q_place + i] -= subber[i];
|
||||
numerator.i64[q_place + j] -= subber[j];
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t stash = numerator.i64[q_place + i];
|
||||
numerator.i64[q_place + i] -= borrow;
|
||||
numerator.i64[q_place + i] -= subber[i];
|
||||
if( numerator.i64[q_place + i] > stash )
|
||||
uint64_t stash = numerator.i64[q_place + j];
|
||||
numerator.i64[q_place + j] -= borrow;
|
||||
numerator.i64[q_place + j] -= subber[j];
|
||||
if( numerator.i64[q_place + j] > stash )
|
||||
{
|
||||
// After subtracting, the value got bigger, which means we have
|
||||
// to borrow from the next value to the left
|
||||
|
|
@ -1775,21 +1770,21 @@ divide_int128_by_int128(int256 "ient,
|
|||
{
|
||||
// We need to add subber back into the numerator area
|
||||
uint64_t carry = 0;
|
||||
for(size_t i=0; i<3; i++)
|
||||
for(size_t ii=0; ii<3; ii++)
|
||||
{
|
||||
if( numerator.i64[q_place + i] == 0xFFFFFFFFFFFFFFFFUL && carry )
|
||||
if( numerator.i64[q_place + ii] == 0xFFFFFFFFFFFFFFFFUL && carry )
|
||||
{
|
||||
// We are at the top and have a carry. Just leave the carry on
|
||||
// and do the addition:
|
||||
numerator.i64[q_place + i] += subber[i];
|
||||
numerator.i64[q_place + ii] += subber[ii];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are not at the top.
|
||||
uint64_t stash = numerator.i64[q_place + i];
|
||||
numerator.i64[q_place + i] += carry;
|
||||
numerator.i64[q_place + i] += subber[i];
|
||||
if( numerator.i64[q_place + i] < stash )
|
||||
uint64_t stash = numerator.i64[q_place + ii];
|
||||
numerator.i64[q_place + ii] += carry;
|
||||
numerator.i64[q_place + ii] += subber[ii];
|
||||
if( numerator.i64[q_place + ii] < stash )
|
||||
{
|
||||
// The addition caused the result to get smaller, meaning that
|
||||
// we wrapped around:
|
||||
|
|
@ -1817,14 +1812,14 @@ __gg__dividef1_phase2(cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t ,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
int error_this_time=0;
|
||||
|
|
@ -1904,14 +1899,13 @@ __gg__dividef1_phase2(cbl_arith_format_t ,
|
|||
|
||||
if( error_this_time && on_size_error)
|
||||
{
|
||||
rounded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*compute_error |= conditional_stash(C[0], C_o[0], C_s[0],
|
||||
on_size_error,
|
||||
b_value,
|
||||
*rounded++);
|
||||
*rounded);
|
||||
}
|
||||
done:
|
||||
return;
|
||||
|
|
@ -1923,20 +1917,20 @@ __gg__dividef23(cbl_arith_format_t ,
|
|||
size_t ,
|
||||
size_t ,
|
||||
size_t nC,
|
||||
cbl_round_t *rounded,
|
||||
const cbl_round_t *rounded,
|
||||
int on_error_flag,
|
||||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **A = __gg__treeplet_1f;
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f;
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f;
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
int error_this_time=0;
|
||||
|
|
@ -2009,15 +2003,15 @@ __gg__dividef45(cbl_arith_format_t ,
|
|||
int *compute_error
|
||||
)
|
||||
{
|
||||
cblc_field_t **A = __gg__treeplet_1f; // Numerator
|
||||
size_t *A_o = __gg__treeplet_1o;
|
||||
size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f; // Denominator
|
||||
size_t *B_o = __gg__treeplet_2o;
|
||||
size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f; // Has remainder, then quotient
|
||||
size_t *C_o = __gg__treeplet_3o;
|
||||
size_t *C_s = __gg__treeplet_3s;
|
||||
cblc_field_t **A = __gg__treeplet_1f; // Numerator
|
||||
const size_t *A_o = __gg__treeplet_1o;
|
||||
const size_t *A_s = __gg__treeplet_1s;
|
||||
cblc_field_t **B = __gg__treeplet_2f; // Denominator
|
||||
const size_t *B_o = __gg__treeplet_2o;
|
||||
const size_t *B_s = __gg__treeplet_2s;
|
||||
cblc_field_t **C = __gg__treeplet_3f; // Has remainder, then quotient
|
||||
const size_t *C_o = __gg__treeplet_3o;
|
||||
const size_t *C_s = __gg__treeplet_3s;
|
||||
|
||||
bool on_size_error = !!(on_error_flag & ON_SIZE_ERROR);
|
||||
int error_this_time=0;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -39,6 +39,21 @@
|
|||
Some are also called between source code modules in libgcobol, hence the
|
||||
need here for declarations. */
|
||||
|
||||
extern void __gg__mabort();
|
||||
|
||||
|
||||
// The unnecessary abort() that follows is necessary to make cppcheck be
|
||||
// aware that massert() actually terminates processing after a failed
|
||||
// malloc().
|
||||
#define massert(p) if(!p){__gg__mabort();abort();}
|
||||
|
||||
// This was part of an exercise to make cppcheck shut up about invalid
|
||||
// pointer type conversions.
|
||||
// It was also to avoid having reinterpret_cast<> all over the place.
|
||||
// So, instead of reinterpret_cast<char *>(VALUE)
|
||||
// I sometimes use PTRCAST(char, VALUE)
|
||||
#define PTRCAST(TYPE, VALUE) static_cast<TYPE *>(static_cast<void *>(VALUE))
|
||||
|
||||
extern "C" __int128 __gg__power_of_ten(int n);
|
||||
|
||||
extern "C" __int128 __gg__dirty_to_binary_source( const char *dirty,
|
||||
|
|
@ -91,20 +106,21 @@ extern "C" char * __gg__get_default_currency_string();
|
|||
|
||||
extern "C" void __gg__clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
|
||||
extern "C" GCOB_FP128 __gg__float128_from_location(cblc_field_t *var,
|
||||
unsigned char *location);
|
||||
extern "C" GCOB_FP128 __gg__float128_from_location(
|
||||
const cblc_field_t *var,
|
||||
const unsigned char *location);
|
||||
extern "C" void __gg__adjust_dest_size(cblc_field_t *dest, size_t ncount);
|
||||
|
||||
extern "C" void __gg__realloc_if_necessary( char **dest,
|
||||
size_t *dest_size,
|
||||
size_t new_size);
|
||||
extern "C" void __gg__set_exception_file(cblc_file_t *file);
|
||||
extern "C" void __gg__set_exception_file(const cblc_file_t *file);
|
||||
extern "C" void __gg__internal_to_console_in_place(char *loc, size_t length);
|
||||
extern "C" __int128 __gg__binary_value_from_qualified_field(int *rdigits,
|
||||
cblc_field_t *var,
|
||||
extern "C" __int128 __gg__binary_value_from_qualified_field(int *rdigits,
|
||||
const cblc_field_t *var,
|
||||
size_t offset,
|
||||
size_t size);
|
||||
extern "C" GCOB_FP128 __gg__float128_from_qualified_field(cblc_field_t *field,
|
||||
extern "C" GCOB_FP128 __gg__float128_from_qualified_field(const cblc_field_t *field,
|
||||
size_t offset,
|
||||
size_t size);
|
||||
extern "C" __int128 __gg__integer_from_qualified_field(cblc_field_t *var,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ __gg__realloc_if_necessary(char **dest, size_t *dest_size, size_t new_size)
|
|||
new_size |= new_size>>16;
|
||||
new_size |= (new_size>>16)>>16;
|
||||
*dest_size = new_size + 1;
|
||||
*dest = (char *)realloc(*dest, *dest_size);
|
||||
*dest = static_cast<char *>(realloc(*dest, *dest_size));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ extern "C"
|
|||
void
|
||||
__gg__alphabet_create( cbl_encoding_t encoding,
|
||||
size_t alphabet_index,
|
||||
unsigned char *alphabet,
|
||||
const unsigned char *alphabet,
|
||||
int low_char,
|
||||
int high_char )
|
||||
{
|
||||
|
|
@ -222,7 +222,7 @@ Rindex(const char *dest, int length, char ch)
|
|||
extern "C"
|
||||
bool
|
||||
__gg__string_to_numeric_edited( char * const dest,
|
||||
char *source, // In source characters
|
||||
const char *source, // In source characters
|
||||
int rdigits,
|
||||
int is_negative,
|
||||
const char *picture)
|
||||
|
|
@ -1222,9 +1222,9 @@ got_float:
|
|||
extern "C"
|
||||
void
|
||||
__gg__string_to_alpha_edited( char *dest,
|
||||
char *source,
|
||||
const char *source,
|
||||
int slength,
|
||||
char *picture)
|
||||
const char *picture)
|
||||
{
|
||||
// Put the PICTURE into the data area. If the caller didn't leave enough
|
||||
// room, well, poo on them. Said another way; if they specify disaster,
|
||||
|
|
|
|||
|
|
@ -60,18 +60,18 @@ extern "C"
|
|||
void __gg__realloc_if_necessary(char **dest, size_t *dest_size, size_t new_size);
|
||||
void __gg__alphabet_create(cbl_encoding_t encoding,
|
||||
size_t alphabet_index,
|
||||
unsigned char *alphabet,
|
||||
const unsigned char *alphabet,
|
||||
int low_char,
|
||||
int high_char );
|
||||
bool __gg__string_to_numeric_edited(char * const dest,
|
||||
char *source, // ASCII
|
||||
const char *source, // ASCII
|
||||
int rdigits,
|
||||
int is_negative,
|
||||
const char *picture);
|
||||
void __gg__string_to_alpha_edited(char *dest,
|
||||
char *source,
|
||||
const char *source,
|
||||
int slength,
|
||||
char *picture);
|
||||
const char *picture);
|
||||
void __gg__currency_sign_init();
|
||||
void __gg__currency_sign(int symbol, const char *sign);
|
||||
void __gg__remove_trailing_zeroes(char *p);
|
||||
|
|
|
|||
Loading…
Reference in New Issue