blob: 38737e2ebedb742fd978d0c13e8158a9b9575d72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#include <IceUtil/InputUtil.h>
#include <stdlib.h>
using namespace std;
using namespace IceUtil;
namespace IceUtilInternal
{
Int64
strToInt64(const char* s, char** endptr, int base)
{
#if defined(_WIN32) && defined(_MSC_VER)
return _strtoi64(s, endptr, base);
#elif defined(ICE_64) && !defined(_WIN32)
return strtol(s, endptr, base);
#else
return strtoll(s, endptr, base);
#endif
}
bool
stringToInt64(const string& s, Int64& result)
{
const char* start = s.c_str();
char* end = 0;
errno = 0;
result = strToInt64(start, &end, 0);
return (errno == 0 && start != end);
}
}
|