asterisk/main
Kevin Harwell 51375686f7 core/conversions: Added string to unsigned integer and long conversions
Added functions that convert a string to an unsigned integer or unsigned long.
A couple of unit test were also created to test the routines. The reasons for
adding these conversion utilities (and hopefully eventually more) are as
follows:

  * Conversion routines are functionally contained with consistent and
    better error checking
  * The function names offer a better description of what is happening
  * It encourages code reuse for easier bug fixing at a single source
  * It's simpler to use
  * It's unit testable

For instance, currently in a lot of places when converting to an integer or
similar the "sscanf" function is used. When using "sscanf" it may not be
immediately clear what's happening as it lacks semantic naming. Limited error
checking is usually done as well. For example, most of the time a check is done
to make sure the value converted, but does not check for overflows or negative
valued conversions when converting unsigned numbers.

Why use/wrap "strtoul" and not "sscanf" then? Primarily, it lacks some of the
built in error handling that "strtoul" has. For instance "strtoul" contains
overflow checks. Less so, but can still factor as reasons, "sscanf" is slightly
more complex in its use. And maybe a bit controversial, but it may be ("big if")
potentially slower than "strtoul" in some cases.

Change-Id: If7eaca4a48f8c7b89cc8b5a1f4bed2852fca82bb
2017-05-17 17:41:11 -05:00
..
editline BuildSystem: Avoid 'ar cru' and use 'ar cr' instead. 2016-06-07 09:32:11 +02:00
stdtime Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
.gitignore build-system: Allow building with static pjproject 2016-03-01 09:30:43 -07:00
abstract_jb.c abstract/fixed/adpative jitter buffer: disallow frame re-inserts 2017-01-17 17:08:53 -06:00
acl.c acl.c: Improve ast_ouraddrfor() diagnostic messages. 2016-12-22 12:25:15 -06:00
adsi.c Allow Asterisk to compile under GCC 4.10 2014-05-09 22:49:26 +00:00
alaw.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
alertpipe.c core: Use eventfd for alert pipes on Linux when possible 2017-04-24 11:50:09 -05:00
aoc.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
app.c main/app.c: Memory corruption from early format destruction. 2017-01-24 14:05:05 -06:00
ast_expr2.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ast_expr2.fl Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ast_expr2.h Allow the REALTIME() function to report errors back to the caller. 2012-07-11 17:16:50 +00:00
ast_expr2.y Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ast_expr2f.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
asterisk.c modules: change module LOAD_FAILUREs to LOAD_DECLINES 2017-04-12 15:57:21 -06:00
asterisk.dynamics Fix error loading res_monitor. 2014-04-23 15:02:39 +00:00
asterisk.exports.in pjproject_bundled: Various fixes discovered during testing of OSes 2016-05-03 07:56:18 -05:00
astfd.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
astmm.c cli: Fix various CLI documentation and completion issues 2017-02-13 11:33:15 -05:00
astobj2.c astobj2: Prevent potential deadlocks with ao2_global_obj_release 2017-03-30 13:59:11 -04:00
astobj2_container.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
astobj2_container_private.h Astobj2: Allow reference debugging to be enabled/disabled by config. 2015-04-27 18:37:26 -04:00
astobj2_hash.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
astobj2_private.h Astobj2: Allow reference debugging to be enabled/disabled by config. 2015-04-27 18:37:26 -04:00
astobj2_rbtree.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
audiohook.c frame: Better handle interpolated frames. 2017-04-26 11:34:59 -05:00
autochan.c autochan/mixmonitor/chanspy: Fix unsafe channel locking and references. 2017-03-15 17:18:55 -06:00
autoservice.c Frame deferral: Revert API refactoring. 2017-02-02 13:02:03 -06:00
backtrace.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
bridge.c bridge_simple: Added support for streams 2017-05-03 16:36:22 -05:00
bridge_after.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
bridge_basic.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
bridge_channel.c bridge_simple: Added support for streams 2017-05-03 16:36:22 -05:00
bridge_roles.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
bucket.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
buildinfo.c fix a few small things found by using sparse 2008-10-30 16:49:02 +00:00
callerid.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ccss.c cli: Fix various CLI documentation and completion issues 2017-02-13 11:33:15 -05:00
cdr.c CDR: Protect from data overflow in ast_cdr_setuserfield. 2017-04-04 10:14:26 +00:00
cel.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
channel.c bridge: Fix returning to dialplan when executing Bridge() from AMI. 2017-05-04 16:40:04 -05:00
channel_internal_api.c bridge_simple: Added support for streams 2017-05-03 16:36:22 -05:00
chanvars.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
cli.c core: Show streams in "core show channel". 2017-02-22 14:32:23 +00:00
codec.c SDP: Ensure SDPs "merge" properly. 2017-04-25 13:03:33 -05:00
codec_builtin.c sdp: Add support for T.38 2017-04-25 13:03:33 -05:00
config.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
config_options.c app_confbridge: Fix reference to cfg in menu_template_handler 2017-05-04 20:13:55 -05:00
conversions.c core/conversions: Added string to unsigned integer and long conversions 2017-05-17 17:41:11 -05:00
core_local.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
core_unreal.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
crypt.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
cygload.c Kill off red blobs in most of main/* 2012-03-22 19:51:16 +00:00
data.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
datastore.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
db.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
devicestate.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dial.c channel: Remove old epoll support and fixed max number of file descriptors. 2017-03-27 19:54:44 +00:00
dns.c Add support for older name resolving version libraries like openBSD 2016-11-20 09:19:18 +11:00
dns_core.c Add support for older name resolving version libraries like openBSD 2016-11-20 09:19:18 +11:00
dns_naptr.c Add support for older name resolving version libraries like openBSD 2016-11-20 09:19:18 +11:00
dns_query_set.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dns_recurring.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dns_srv.c Add support for older name resolving version libraries like openBSD 2016-11-20 09:19:18 +11:00
dns_system_resolver.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dns_test.c dns: Fix build when TEST_FRAMEWORK is not defined. 2015-04-10 13:32:24 +00:00
dns_tlsa.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dnsmgr.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
dsp.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ecdisa.h Kill off red blobs in most of main/* 2012-03-22 19:51:16 +00:00
endpoints.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
enum.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
event.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
features.c bridge: Fix returning to dialplan when executing Bridge() from AMI. 2017-05-04 16:40:04 -05:00
features_config.c Fix issue with CLI not returning to prompt after running "features show" 2016-10-20 09:53:24 +11:00
file.c file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type 2016-11-15 21:21:59 -05:00
fixedjitterbuf.c abstract/fixed/adpative jitter buffer: disallow frame re-inserts 2017-01-17 17:08:53 -06:00
fixedjitterbuf.h abstract/fixed/adpative jitter buffer: disallow frame re-inserts 2017-01-17 17:08:53 -06:00
format.c ast_format: Adds an identifier for interleaved audio formats to the ast_format 2016-11-06 15:56:58 +01:00
format_cache.c sdp: Add support for T.38 2017-04-25 13:03:33 -05:00
format_cap.c stream: Add media stream topology definition and API 2017-02-13 07:49:25 -07:00
format_compatibility.c T.140: Fix format ref and memory leaks. 2017-01-25 13:46:41 -06:00
frame.c channel: Add ast_read_stream function for reading frames from all streams. 2017-02-24 10:20:33 -06:00
framehook.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
fskmodem.c Multiple revisions 369001-369002 2012-06-15 16:20:16 +00:00
fskmodem_float.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
fskmodem_int.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
global_datastores.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
hashtab.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
heap.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
http.c thread safety: Don't use getprotobyname() 2017-03-20 08:55:05 -04:00
image.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
indications.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
io.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
iostream.c tcptls: Improve error messages for TLS connections. 2017-05-09 16:12:04 +00:00
jitterbuf.c abstract/fixed/adpative jitter buffer: disallow frame re-inserts 2017-01-17 17:08:53 -06:00
json.c res_ari: Add support for channel variables in ARI events. 2016-11-14 13:51:56 -05:00
libasteriskpj.c PJPROJECT logging: Fix detection of max supported log level. 2017-01-24 11:25:19 -06:00
libasteriskssl.c libasteriskssl: do nothing with OpenSSL >= 1.1 2017-02-03 10:28:14 +02:00
libasteriskssl.exports.in Address OpenSSL initialization issues when using third-party libraries. 2012-01-30 21:21:16 +00:00
loader.c modules: change module LOAD_FAILUREs to LOAD_DECLINES 2017-04-12 15:57:21 -06:00
lock.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
logger.c logger: Added logger_queue_limit to the configuration options. 2017-05-08 16:49:13 -05:00
Makefile build: Fix deb build issues with fakeroot 2017-03-30 17:10:32 -05:00
manager.c Prevent Undefined Capath Crash 2017-05-09 09:22:00 -05:00
manager_bridges.c res/ari/resource_bridges: Add the ability to manipulate the video source 2016-11-14 17:03:09 -05:00
manager_channels.c manager: Add documentation for NewConnectedLine event. 2016-10-31 14:46:54 -04:00
manager_endpoints.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
manager_mwi.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
manager_system.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
max_forwards.c Detect potential forwarding loops based on count. 2015-04-17 15:58:07 -05:00
md5.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
media_cache.c media_cache: Prefer ast_file_is_readable() over access() 2017-03-08 17:26:41 -06:00
media_index.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
message.c res_pjsip_messaging: Check URI type before dereferencing 2017-03-21 08:45:37 -06:00
mixmonitor.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
named_acl.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
named_locks.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
netsock.c netsock.c: fix includes for HURD 2016-11-01 11:48:06 +02:00
netsock2.c netsock2.c: Made get/set addr port avoid potential uninitialized memory. 2017-05-05 18:49:19 -05:00
optional_api.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
parking.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx.c pbx: Use same thread if AST_OUTGOING_WAIT_COMPLETE specified 2017-04-19 16:43:55 -05:00
pbx_app.c cli: Fix various CLI documentation and completion issues 2017-02-13 11:33:15 -05:00
pbx_builtins.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_functions.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_hangup_handler.c cli: Fix various CLI documentation and completion issues 2017-02-13 11:33:15 -05:00
pbx_ignorepat.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_include.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_private.h pbx: Create pbx_sw.c for management of 'struct ast_sw'. 2016-07-21 13:58:26 -04:00
pbx_sw.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_switch.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_timing.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pbx_variables.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
pickup.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
plc.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
poll.c Merged revisions 285268 via svnmerge from 2010-09-07 19:09:08 +00:00
presencestate.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
privacy.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
rtp_engine.c SDP API: Add SSRC-level attributes 2017-04-27 15:03:51 -05:00
say.c Saynumber is trying to get "and" from "digits/" subfolder 2017-03-06 15:59:49 -06:00
sched.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
sdp.c SDP: Make process possible multiple fmtp attributes per rtpmap. 2017-05-09 12:57:57 -05:00
sdp_options.c SDP: Add interface_address to specify our address to use. 2017-05-09 12:57:57 -05:00
sdp_private.h SDP: Add interface_address to specify our address to use. 2017-05-09 12:57:57 -05:00
sdp_srtp.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
sdp_state.c SDP: Remove sdp_state.remote_capabilities 2017-05-09 12:57:57 -05:00
sdp_translator.c SDP: Make SDP translation to/from internal representation more const. 2017-04-27 19:08:05 -05:00
security_events.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
sem.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
sha1.c Doxygen Updates - janitor work 2012-09-21 17:14:59 +00:00
sip_api.c Don't make chan_sip export global symbols. 2012-10-11 15:49:02 +00:00
slinfactory.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
smoother.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
sorcery.c sorcery.c: Speed up ast_sorcery_retrieve_by_id() 2017-04-11 12:58:35 -05:00
sounds_index.c Replace most uses of ast_register_atexit with ast_register_cleanup. 2015-03-26 22:24:26 +00:00
srv.c srv: Fix crash when ast_srv_lookup is used and 0 records are returned. 2017-02-07 12:13:23 -06:00
stasis.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
stasis_bridges.c res/ari/resource_bridges: Add the ability to manipulate the video source 2016-11-14 17:03:09 -05:00
stasis_cache.c main/stasis_cache: Demote the ERROR message when removing a nonexistent item 2017-03-14 08:40:54 -06:00
stasis_cache_pattern.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
stasis_channels.c res_ari: fix memory leak for channelvars 2017-02-03 16:42:52 -05:00
stasis_endpoints.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
stasis_message.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
stasis_message_router.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
stasis_system.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
strcompat.c Add builtin roundf() for systems lacking it. 2013-01-19 20:54:07 +00:00
stream.c stream: ast_stream_clone() cannot copy the opaque user data. 2017-05-05 18:49:19 -05:00
stringfields.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
strings.c ari: Implement 'debug all' and request/response logging 2017-01-23 10:25:58 -07:00
stun.c stun.c: Fix ast_stun_request() erratic timeout. 2017-04-11 12:58:35 -05:00
syslog.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
taskprocessor.c taskprocessor.c: Change when high water warning logged. 2017-01-13 21:36:54 -06:00
tcptls.c tcptls.c: Cleanup TCP/TLS listener thread on abnormal exit. 2017-04-11 11:13:39 -05:00
tdd.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
term.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
test.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
threadpool.c threadpool: Fix leak in ast_threadpool_serializer_group error path. 2016-07-13 11:47:56 -05:00
threadstorage.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
timing.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
translate.c frame: Better handle interpolated frames. 2017-04-26 11:34:59 -05:00
udptl.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
ulaw.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
uri.c uri: Quiet warning about type qualifiers ignored on function return type 2014-08-21 14:42:12 +00:00
utils.c core: Use eventfd for alert pipes on Linux when possible 2017-04-24 11:50:09 -05:00
uuid.c Fix printf problems with high ascii characters after r413586 (1.8). 2014-12-17 10:23:32 +00:00
xml.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00
xmldoc.c Remove ASTERISK_REGISTER_FILE. 2016-10-27 09:53:55 -04:00