Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
d26d5009
Commit
d26d5009
authored
Jul 21, 2015
by
scheiber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing sign conversion warnings and loss of precision warnings
parent
ca8e3d5d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
25 deletions
+25
-25
encodedstream.h
include/rapidjson/encodedstream.h
+1
-1
biginteger.h
include/rapidjson/internal/biginteger.h
+1
-1
diyfp.h
include/rapidjson/internal/diyfp.h
+2
-2
dtoa.h
include/rapidjson/internal/dtoa.h
+4
-4
ieee754.h
include/rapidjson/internal/ieee754.h
+1
-1
strtod.h
include/rapidjson/internal/strtod.h
+11
-11
writer.h
include/rapidjson/writer.h
+5
-5
No files found.
include/rapidjson/encodedstream.h
View file @
d26d5009
...
...
@@ -146,7 +146,7 @@ private:
if
(
!
c
)
return
;
unsigned
bom
=
c
[
0
]
|
(
c
[
1
]
<<
8
)
|
(
c
[
2
]
<<
16
)
|
(
c
[
3
]
<<
24
);
unsigned
bom
=
static_cast
<
unsigned
>
(
c
[
0
]
|
(
c
[
1
]
<<
8
)
|
(
c
[
2
]
<<
16
)
|
(
c
[
3
]
<<
24
)
);
hasBOM_
=
false
;
if
(
bom
==
0xFFFE0000
)
{
type_
=
kUTF32BE
;
hasBOM_
=
true
;
is_
->
Take
();
is_
->
Take
();
is_
->
Take
();
is_
->
Take
();
}
else
if
(
bom
==
0x0000FEFF
)
{
type_
=
kUTF32LE
;
hasBOM_
=
true
;
is_
->
Take
();
is_
->
Take
();
is_
->
Take
();
is_
->
Take
();
}
...
...
include/rapidjson/internal/biginteger.h
View file @
d26d5009
...
...
@@ -230,7 +230,7 @@ private:
uint64_t
r
=
0
;
for
(
const
char
*
p
=
begin
;
p
!=
end
;
++
p
)
{
RAPIDJSON_ASSERT
(
*
p
>=
'0'
&&
*
p
<=
'9'
);
r
=
r
*
10
+
(
*
p
-
'0'
);
r
=
r
*
10
u
+
(
unsigned
)
(
*
p
-
'0'
);
}
return
r
;
}
...
...
include/rapidjson/internal/diyfp.h
View file @
d26d5009
...
...
@@ -232,8 +232,8 @@ inline DiyFp GetCachedPower(int e, int* K) {
}
inline
DiyFp
GetCachedPower10
(
int
exp
,
int
*
outExp
)
{
unsigned
index
=
(
exp
+
348
)
/
8
;
*
outExp
=
-
348
+
index
*
8
;
unsigned
index
=
(
static_cast
<
unsigned
>
(
exp
)
+
348u
)
/
8u
;
*
outExp
=
-
348
+
static_cast
<
int
>
(
index
)
*
8
;
return
GetCachedPowerByIndex
(
index
);
}
...
...
include/rapidjson/internal/dtoa.h
View file @
d26d5009
...
...
@@ -62,7 +62,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
const
DiyFp
wp_w
=
Mp
-
W
;
uint32_t
p1
=
static_cast
<
uint32_t
>
(
Mp
.
f
>>
-
one
.
e
);
uint64_t
p2
=
Mp
.
f
&
(
one
.
f
-
1
);
int
kappa
=
CountDecimalDigit32
(
p1
);
// kappa in [0, 9]
unsigned
kappa
=
CountDecimalDigit32
(
p1
);
// kappa in [0, 9]
*
len
=
0
;
while
(
kappa
>
0
)
{
...
...
@@ -158,14 +158,14 @@ inline char* Prettify(char* buffer, int length, int k) {
}
else
if
(
0
<
kk
&&
kk
<=
21
)
{
// 1234e-2 -> 12.34
std
::
memmove
(
&
buffer
[
kk
+
1
],
&
buffer
[
kk
],
length
-
kk
);
std
::
memmove
(
&
buffer
[
kk
+
1
],
&
buffer
[
kk
],
static_cast
<
size_t
>
(
length
-
kk
)
);
buffer
[
kk
]
=
'.'
;
return
&
buffer
[
length
+
1
];
}
else
if
(
-
6
<
kk
&&
kk
<=
0
)
{
// 1234e-6 -> 0.001234
const
int
offset
=
2
-
kk
;
std
::
memmove
(
&
buffer
[
offset
],
&
buffer
[
0
],
length
);
std
::
memmove
(
&
buffer
[
offset
],
&
buffer
[
0
],
static_cast
<
size_t
>
(
length
)
);
buffer
[
0
]
=
'0'
;
buffer
[
1
]
=
'.'
;
for
(
int
i
=
2
;
i
<
offset
;
i
++
)
...
...
@@ -179,7 +179,7 @@ inline char* Prettify(char* buffer, int length, int k) {
}
else
{
// 1234e30 -> 1.234e33
std
::
memmove
(
&
buffer
[
2
],
&
buffer
[
1
],
length
-
1
);
std
::
memmove
(
&
buffer
[
2
],
&
buffer
[
1
],
static_cast
<
size_t
>
(
length
-
1
)
);
buffer
[
1
]
=
'.'
;
buffer
[
length
+
1
]
=
'e'
;
return
WriteExponent
(
kk
-
1
,
&
buffer
[
0
+
length
+
2
]);
...
...
include/rapidjson/internal/ieee754.h
View file @
d26d5009
...
...
@@ -53,7 +53,7 @@ public:
else
if
(
order
<=
-
1074
)
return
0
;
else
return
order
+
1074
;
return
(
unsigned
)
order
+
1074
;
}
private
:
...
...
include/rapidjson/internal/strtod.h
View file @
d26d5009
...
...
@@ -95,13 +95,13 @@ inline int CheckWithinHalfULP(double b, const BigInteger& d, int dExp) {
hS_Exp2
-=
common_Exp2
;
BigInteger
dS
=
d
;
dS
.
MultiplyPow5
(
dS_Exp5
)
<<=
dS_Exp2
;
dS
.
MultiplyPow5
(
static_cast
<
unsigned
>
(
dS_Exp5
))
<<=
static_cast
<
unsigned
>
(
dS_Exp2
)
;
BigInteger
bS
(
bInt
);
bS
.
MultiplyPow5
(
bS_Exp5
)
<<=
bS_Exp2
;
bS
.
MultiplyPow5
(
static_cast
<
unsigned
>
(
bS_Exp5
))
<<=
static_cast
<
unsigned
>
(
bS_Exp2
)
;
BigInteger
hS
(
1
);
hS
.
MultiplyPow5
(
hS_Exp5
)
<<=
hS_Exp2
;
hS
.
MultiplyPow5
(
static_cast
<
unsigned
>
(
hS_Exp5
))
<<=
static_cast
<
unsigned
>
(
hS_Exp2
)
;
BigInteger
delta
(
0
);
dS
.
Difference
(
bS
,
&
delta
);
...
...
@@ -134,7 +134,7 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit
if
(
significand
>
RAPIDJSON_UINT64_C2
(
0x19999999
,
0x99999999
)
||
(
significand
==
RAPIDJSON_UINT64_C2
(
0x19999999
,
0x99999999
)
&&
decimals
[
i
]
>
'5'
))
break
;
significand
=
significand
*
10
+
(
decimals
[
i
]
-
'0'
);
significand
=
significand
*
10
u
+
static_cast
<
unsigned
>
(
decimals
[
i
]
-
'0'
);
}
if
(
i
<
length
&&
decimals
[
i
]
>=
'5'
)
// Rounding
...
...
@@ -163,10 +163,10 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit
DiyFp
(
RAPIDJSON_UINT64_C2
(
0xf4240000
,
00000000
),
-
44
),
// 10^6
DiyFp
(
RAPIDJSON_UINT64_C2
(
0x98968000
,
00000000
),
-
40
)
// 10^7
};
int
adjustment
=
dExp
-
actualExp
-
1
;
int
adjustment
=
dExp
-
actualExp
-
1
;
RAPIDJSON_ASSERT
(
adjustment
>=
0
&&
adjustment
<
7
);
v
=
v
*
kPow10
[
adjustment
];
if
(
length
+
adjustment
>
19
)
// has more digits than decimal digits in 64-bit
if
(
length
+
static_cast
<
unsigned
>
(
adjustment
)
>
19u
)
// has more digits than decimal digits in 64-bit
error
+=
kUlp
/
2
;
}
...
...
@@ -184,14 +184,14 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit
unsigned
scaleExp
=
(
precisionSize
+
kUlpShift
)
-
63
;
v
.
f
>>=
scaleExp
;
v
.
e
+=
scaleExp
;
error
=
(
error
>>
scaleExp
)
+
1
+
kUlp
;
error
=
(
error
>>
scaleExp
)
+
1
+
static_cast
<
int
>
(
kUlp
)
;
precisionSize
-=
scaleExp
;
}
DiyFp
rounded
(
v
.
f
>>
precisionSize
,
v
.
e
+
precisionSize
);
DiyFp
rounded
(
v
.
f
>>
precisionSize
,
v
.
e
+
static_cast
<
int
>
(
precisionSize
)
);
const
uint64_t
precisionBits
=
(
v
.
f
&
((
uint64_t
(
1
)
<<
precisionSize
)
-
1
))
*
kUlp
;
const
uint64_t
halfWay
=
(
uint64_t
(
1
)
<<
(
precisionSize
-
1
))
*
kUlp
;
if
(
precisionBits
>=
halfWay
+
error
)
{
if
(
precisionBits
>=
halfWay
+
static_cast
<
unsigned
>
(
error
)
)
{
rounded
.
f
++
;
if
(
rounded
.
f
&
(
DiyFp
::
kDpHiddenBit
<<
1
))
{
// rounding overflows mantissa (issue #340)
rounded
.
f
>>=
1
;
...
...
@@ -201,7 +201,7 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit
*
result
=
rounded
.
ToDouble
();
return
halfWay
-
error
>=
precisionBits
||
precisionBits
>=
halfWay
+
error
;
return
halfWay
-
static_cast
<
unsigned
>
(
error
)
>=
precisionBits
||
precisionBits
>=
halfWay
+
static_cast
<
unsigned
>
(
error
)
;
}
inline
double
StrtodBigInteger
(
double
approx
,
const
char
*
decimals
,
size_t
length
,
size_t
decimalPosition
,
int
exp
)
{
...
...
@@ -249,7 +249,7 @@ inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t
if
((
int
)
length
>
kMaxDecimalDigit
)
{
int
delta
=
(
int
(
length
)
-
kMaxDecimalDigit
);
exp
+=
delta
;
decimalPosition
-=
delta
;
decimalPosition
-=
static_cast
<
unsigned
>
(
delta
)
;
length
=
kMaxDecimalDigit
;
}
...
...
include/rapidjson/writer.h
View file @
d26d5009
...
...
@@ -350,7 +350,7 @@ template<>
inline
bool
Writer
<
StringBuffer
>::
WriteInt
(
int
i
)
{
char
*
buffer
=
os_
->
Push
(
11
);
const
char
*
end
=
internal
::
i32toa
(
i
,
buffer
);
os_
->
Pop
(
11
-
(
end
-
buffer
));
os_
->
Pop
(
static_cast
<
size_t
>
(
11
-
(
end
-
buffer
)
));
return
true
;
}
...
...
@@ -358,7 +358,7 @@ template<>
inline
bool
Writer
<
StringBuffer
>::
WriteUint
(
unsigned
u
)
{
char
*
buffer
=
os_
->
Push
(
10
);
const
char
*
end
=
internal
::
u32toa
(
u
,
buffer
);
os_
->
Pop
(
10
-
(
end
-
buffer
));
os_
->
Pop
(
static_cast
<
size_t
>
(
10
-
(
end
-
buffer
)
));
return
true
;
}
...
...
@@ -366,7 +366,7 @@ template<>
inline
bool
Writer
<
StringBuffer
>::
WriteInt64
(
int64_t
i64
)
{
char
*
buffer
=
os_
->
Push
(
21
);
const
char
*
end
=
internal
::
i64toa
(
i64
,
buffer
);
os_
->
Pop
(
21
-
(
end
-
buffer
));
os_
->
Pop
(
static_cast
<
size_t
>
(
21
-
(
end
-
buffer
)
));
return
true
;
}
...
...
@@ -374,7 +374,7 @@ template<>
inline
bool
Writer
<
StringBuffer
>::
WriteUint64
(
uint64_t
u
)
{
char
*
buffer
=
os_
->
Push
(
20
);
const
char
*
end
=
internal
::
u64toa
(
u
,
buffer
);
os_
->
Pop
(
20
-
(
end
-
buffer
));
os_
->
Pop
(
static_cast
<
size_t
>
(
20
-
(
end
-
buffer
)
));
return
true
;
}
...
...
@@ -382,7 +382,7 @@ template<>
inline
bool
Writer
<
StringBuffer
>::
WriteDouble
(
double
d
)
{
char
*
buffer
=
os_
->
Push
(
25
);
char
*
end
=
internal
::
dtoa
(
d
,
buffer
);
os_
->
Pop
(
25
-
(
end
-
buffer
));
os_
->
Pop
(
static_cast
<
size_t
>
(
25
-
(
end
-
buffer
)
));
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment