aboutsummaryrefslogtreecommitdiff
path: root/src/tool_paramhlp.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-11-26 16:23:02 +0100
committerYang Tse <yangsita@gmail.com>2012-11-26 16:23:48 +0100
commit79954a1b07c6fc8ed4cf9d48c6383521b184c818 (patch)
tree3b910417595148ddb7174e7f30f734666af93c88 /src/tool_paramhlp.c
parentb33074d8931f2fd19f07ede99228abba393e2a4e (diff)
avoid mixing of enumerated type with another type
Diffstat (limited to 'src/tool_paramhlp.c')
-rw-r--r--src/tool_paramhlp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 85912a2ef..5d6f8bbc5 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -146,15 +146,15 @@ void cleanarg(char *str)
}
/*
- * Parse the string and write the long in the given address. Return non-zero
- * on failure, zero on success.
+ * Parse the string and write the long in the given address. Return PARAM_OK
+ * on success, otherwise a parameter specific error enum.
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
-int str2num(long *val, const char *str)
+ParameterError str2num(long *val, const char *str)
{
if(str) {
char *endptr;
@@ -168,15 +168,15 @@ int str2num(long *val, const char *str)
}
/*
- * Parse the string and write the long in the given address. Return non-zero
- * on failure, zero on success. ONLY ACCEPTS POSITIVE NUMBERS!
+ * Parse the string and write the long in the given address. Return PARAM_OK
+ * on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
-int str2unum(long *val, const char *str)
+ParameterError str2unum(long *val, const char *str)
{
if(str[0]=='-')
return PARAM_NEGATIVE_NUMERIC; /* badness */
@@ -295,9 +295,9 @@ long proto2num(struct Configurable *config, long *val, const char *str)
*
* @param val the offset to populate
* @param str the buffer containing the offset
- * @return zero if successful, non-zero if failure.
+ * @return PARAM_OK if successful, a parameter specific error enum if failure.
*/
-int str2offset(curl_off_t *val, const char *str)
+ParameterError str2offset(curl_off_t *val, const char *str)
{
char *endptr;
if(str[0] == '-')
@@ -314,7 +314,7 @@ int str2offset(curl_off_t *val, const char *str)
return PARAM_BAD_NUMERIC;
#endif
if((endptr != str) && (endptr == str + strlen(str)))
- return 0; /* Ok */
+ return PARAM_OK;
return PARAM_BAD_NUMERIC;
}