提交 e3296f21 编写于 作者: L linghuazaii

Change int64_t to long int and delete exclude stdint.h

上级 861c4a85
......@@ -390,7 +390,7 @@ const char * iniparser_getstring(const dictionary * d, const char * key, const c
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an int
@brief Get the string associated to a key, convert to an long int
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
......@@ -411,22 +411,21 @@ const char * iniparser_getstring(const dictionary * d, const char * key, const c
Warning: the conversion may overflow in various ways. Conversion is
totally outsourced to strtol(), see the associated man page for overflow
handling.
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int iniparser_getint(const dictionary * d, const char * key, int notfound)
long int iniparser_getlongint(const dictionary * d, const char * key, long int notfound)
{
const char * str ;
str = iniparser_getstring(d, key, INI_INVALID_KEY);
if (str==INI_INVALID_KEY) return notfound ;
return (int)strtol(str, NULL, 0);
return strtol(str, NULL, 0);
}
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an int64_t
@brief Get the string associated to a key, convert to an int
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
......@@ -447,15 +446,13 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound)
Warning: the conversion may overflow in various ways. Conversion is
totally outsourced to strtol(), see the associated man page for overflow
handling.
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int64_t iniparser_getlongint(const dictionary * d, const char * key, int64_t notfound)
int iniparser_getint(const dictionary * d, const char * key, int notfound)
{
const char * str ;
str = iniparser_getstring(d, key, INI_INVALID_KEY);
if (str==INI_INVALID_KEY) return notfound ;
return strtol(str, NULL, 0);
return (int)iniparser_getlongint(d, key, notfound);
}
/*-------------------------------------------------------------------------*/
......
......@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
/*
* The following #include is necessary on many Unixes but not Linux.
......@@ -193,7 +192,7 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound);
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an int64_t
@brief Get the string associated to a key, convert to an long int
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
......@@ -216,7 +215,7 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound);
handling.
*/
/*--------------------------------------------------------------------------*/
int64_t iniparser_getlongint(const dictionary * d, const char * key, int64_t notfound);
long int iniparser_getlongint(const dictionary * d, const char * key, long int notfound);
/*-------------------------------------------------------------------------*/
......
......@@ -212,7 +212,7 @@ void CuAssertIntEquals_LineMsg(CuTest* tc, const char* file, int line, const cha
}
void CuAssertLongIntEquals_LineMsg(CuTest *tc, const char *file, int line, const char *message,
int64_t expected, int64_t actual)
long int expected, long int actual)
{
char buf[STRING_MAX];
if (expected == actual) return;
......
......@@ -3,7 +3,6 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#define CUTEST_VERSION "CuTest 1.5"
......@@ -67,7 +66,7 @@ void CuAssertIntEquals_LineMsg(CuTest* tc,
int expected, int actual);
void CuAssertLongIntEquals_LineMsg(CuTest *tc,
const char *file, int line, const char *message,
int64_t expected, int64_t actual);
long int expected, long int actual);
void CuAssertDblEquals_LineMsg(CuTest* tc,
const char* file, int line, const char* message,
double expected, double actual, double delta);
......
......@@ -343,7 +343,7 @@ void Test_iniparser_getlongint(CuTest *tc)
unsigned i;
char key_name[64];
dictionary *dic;
const struct { int64_t num; const char *value; } good_val[] = {
const struct { long int num; const char *value; } good_val[] = {
{ 0, "0" },
{ 1, "1" },
{ -1, "-1" },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册