16 Commits
Author SHA1 Message Date
Sebastian Huber 3f2e1bc22b cpukit: Add the remaining Doxygen file headers
Thirty-five files across the device drivers, the event recording, the
debugger interfaces, the flattened device tree support and several small
libraries had no Doxygen block.  Doxygen listed none of them.

Give each file a block with @file, @ingroup and @brief.  The brief names
what the file implements.

The score/cpu ports and the shell still lack their blocks.  Later
commits add them.

Updates #5717.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-09-01 20:17:20 +00:00
Sebastian Huber 6dca13d962 cpukit/libmisc: Remove the dead range checks
The string to integer template checked the range of the value in
every instantiation.  Six of the seven integer instantiations use a
conversion method whose type is not wider than the type of the value.
For those the two comparisons were constant and the code behind them
was dead.  Coverity reported this as CID 1700407 to CID 1700418.

Emit the range check only where the type of the conversion method is
wider than the type of the value.  Every instantiation which sets
STRING_TO_RESULT_TYPE gives the maximum of that type in
STRING_TO_RESULT_MAX.  The template compares the two maxima.  An
undefined macro drops the check without a diagnostic, so a missing
STRING_TO_RESULT_MAX is an error.

Behaviour is unchanged.  Where the two types have the same width, the
conversion method sets ERANGE.  The template already turns ERANGE into
RTEMS_INVALID_NUMBER.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-20 03:21:55 +02:00
Sebastian Huber a2103e0ece cpukit/libmisc: Fix the string to integer overflow
The conversion method returns a type which can be wider than the type
of the value.  The result was stored in the type of the value before
the range was checked, so the check saw a truncated value.  On a 64
bit target rtems_string_to_int() returned success for a value outside
the range of an int.

Keep the result in the type of the conversion method and check its
range before it is narrowed.  Report every range error of the method
and not only the one which saturates to the limit.

Update #5708.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-19 11:40:04 -05:00
Prashant Rahul 97e4174c62 cpukit/stringto: return RTEMS_INVALID_ADDRESS when null input string
libc's strto* functions' behaviour isn't defined when the passed string
is NULL. In glibc it causes a seg fault when I tested it. This could
cause inconsistency.
rtem's stringto* functions didnt previously checked for null before
passing to underlying strto* functions.

Added the check which returns `RTEMS_INVALID_ADDRESS` on failure.

Also added a test case for the same

Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
2026-02-06 17:47:28 +00:00
Gedare Bloom 6c47d4d000 cpukit/libmisc: relicense stringto
Fixes #5475
Updates #3053
2026-02-05 14:50:37 -06:00
Gedare Bloom 41df32a43c cpukit/libmisc: reformat stringto
Fixes #5472.
2026-02-05 14:50:37 -06:00
Prashant Rahul 9c2c1a6b03 cpukit/stringto: adapt stringto template for new api
This adapts stringto template file to adhere to the new api
Adds a special case for uchar conversion

Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
2026-02-04 23:34:44 +00:00
Prashant Rahul b0755abea6 cpukit/stringto: refactor: Revert to commit e8d59ca6af
Reverts back all stringto implementation files  to
e8d59ca6af

Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
2026-02-04 23:34:44 +00:00
Ralf Corsepius 5598bdd3f6 2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/Makefile.am: Remove stringto/stringto_template.h.
	* libmisc/stringto/stringto_template.h: Remove.
2011-02-01 02:39:21 +00:00
Joel Sherrill c0c5635164 2010-04-25 Joel Sherrill <joel.sherrilL@OARcorp.com>
* libmisc/stringto/stringto_template.h: Remove warning.
2010-04-26 00:50:15 +00:00
Ralf Corsepius d192aa3918 Reorder includes. 2010-03-28 15:20:04 +00:00
Joel Sherrill 2c6a3e7e2e 2009-12-01 Joel Sherrill <joel.sherrill@OARcorp.com>
* libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h:
	Tidy up as part of adding new test.
2009-12-01 22:16:10 +00:00
Ralf Corsepius 33c3b54d57 Whitespace removal. 2009-11-29 11:57:23 +00:00
Joel Sherrill 48751ab095 2009-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am, libmisc/shell/main_chmod.c,
	libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c,
	libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c,
	libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c,
	libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c,
	libmisc/shell/shell_script.c, libmisc/stringto/stringto.h,
	libmisc/stringto/stringto_template.h: Convert return type from bool
	to rtems_status_code and add rtems_string_to_pointer. Perform
	associated clean up and changes for return type change.
	* libmisc/stringto/stringtopointer.c: New file.
2009-07-23 14:32:34 +00:00
Joel Sherrill 35d09baa84 2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am, libmisc/shell/main_chmod.c,
	libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c,
	libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c,
	libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c,
	libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c,
	libmisc/shell/shell.h, libmisc/shell/shell_script.c,
	libmisc/stringto/stringto_template.h: Convert all shell code to use
	stringto.h mehods with better error checking.
	* libmisc/shell/str2int.c: Removed.
2009-07-22 15:17:37 +00:00
Joel Sherrill e8d59ca6af 2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, preinstall.am, libmisc/Makefile.am, wrapup/Makefile.am:
	Add the stringto family of string to number converters. These are
	error checking wrappers for the strtoXXX methods and do their best to
	return false if the conversion failed. The error checking required
	for this is tedious and error prone. Hence better to have in a family
	of helper routines.
	* libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h,
	libmisc/stringto/stringtodouble.c, libmisc/stringto/stringtofloat.c,
	libmisc/stringto/stringtoint.c, libmisc/stringto/stringtolong.c,
	libmisc/stringto/stringtolonglong.c,
	libmisc/stringto/stringtounsignedchar.c,
	libmisc/stringto/stringtounsignedint.c,
	libmisc/stringto/stringtounsignedlong.c,
	libmisc/stringto/stringtounsignedlonglong.c: New files.
2009-07-22 14:26:25 +00:00