68
68
69
69
#if !defined(isnan)
70
70
// IEEE standard states that NaN values will not compare to themselves
71
- #define isnan (x ) (x != x )
71
+ #define isnan (x ) ((x) != (x) )
72
72
#endif
73
73
74
74
#if !defined(__APPLE__)
@@ -272,7 +272,7 @@ static void appendHex(String& result, unsigned ch) {
272
272
result.append (" \\ u" ).append (toHex16Bit (ch));
273
273
}
274
274
275
- static String valueToQuotedStringN (const char * value, unsigned length,
275
+ static String valueToQuotedStringN (const char * value, size_t length,
276
276
bool emitUTF8 = false ) {
277
277
if (value == nullptr )
278
278
return " " ;
@@ -350,7 +350,7 @@ static String valueToQuotedStringN(const char* value, unsigned length,
350
350
}
351
351
352
352
String valueToQuotedString (const char * value) {
353
- return valueToQuotedStringN (value, static_cast < unsigned int >( strlen (value) ));
353
+ return valueToQuotedStringN (value, strlen (value));
354
354
}
355
355
356
356
// Class Writer
@@ -399,7 +399,7 @@ void FastWriter::writeValue(const Value& value) {
399
399
char const * end;
400
400
bool ok = value.getString (&str, &end);
401
401
if (ok)
402
- document_ += valueToQuotedStringN (str, static_cast <unsigned >(end - str));
402
+ document_ += valueToQuotedStringN (str, static_cast <size_t >(end - str));
403
403
break ;
404
404
}
405
405
case booleanValue:
@@ -422,8 +422,7 @@ void FastWriter::writeValue(const Value& value) {
422
422
const String& name = *it;
423
423
if (it != members.begin ())
424
424
document_ += ' ,' ;
425
- document_ += valueToQuotedStringN (name.data (),
426
- static_cast <unsigned >(name.length ()));
425
+ document_ += valueToQuotedStringN (name.data (), name.length ());
427
426
document_ += yamlCompatibilityEnabled_ ? " : " : " :" ;
428
427
writeValue (value[name]);
429
428
}
@@ -468,7 +467,7 @@ void StyledWriter::writeValue(const Value& value) {
468
467
char const * end;
469
468
bool ok = value.getString (&str, &end);
470
469
if (ok)
471
- pushValue (valueToQuotedStringN (str, static_cast <unsigned >(end - str)));
470
+ pushValue (valueToQuotedStringN (str, static_cast <size_t >(end - str)));
472
471
else
473
472
pushValue (" " );
474
473
break ;
@@ -509,7 +508,7 @@ void StyledWriter::writeValue(const Value& value) {
509
508
}
510
509
511
510
void StyledWriter::writeArrayValue (const Value& value) {
512
- unsigned size = value.size ();
511
+ size_t size = value.size ();
513
512
if (size == 0 )
514
513
pushValue (" []" );
515
514
else {
@@ -518,7 +517,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
518
517
writeWithIndent (" [" );
519
518
indent ();
520
519
bool hasChildValue = !childValues_.empty ();
521
- unsigned index = 0 ;
520
+ ArrayIndex index = 0 ;
522
521
for (;;) {
523
522
const Value& childValue = value[index ];
524
523
writeCommentBeforeValue (childValue);
@@ -541,7 +540,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
541
540
{
542
541
assert (childValues_.size () == size);
543
542
document_ += " [ " ;
544
- for (unsigned index = 0 ; index < size; ++index ) {
543
+ for (size_t index = 0 ; index < size; ++index ) {
545
544
if (index > 0 )
546
545
document_ += " , " ;
547
546
document_ += childValues_[index ];
@@ -686,7 +685,7 @@ void StyledStreamWriter::writeValue(const Value& value) {
686
685
char const * end;
687
686
bool ok = value.getString (&str, &end);
688
687
if (ok)
689
- pushValue (valueToQuotedStringN (str, static_cast <unsigned >(end - str)));
688
+ pushValue (valueToQuotedStringN (str, static_cast <size_t >(end - str)));
690
689
else
691
690
pushValue (" " );
692
691
break ;
@@ -960,8 +959,8 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
960
959
char const * end;
961
960
bool ok = value.getString (&str, &end);
962
961
if (ok)
963
- pushValue (valueToQuotedStringN (str, static_cast < unsigned >(end - str),
964
- emitUTF8_));
962
+ pushValue (
963
+ valueToQuotedStringN (str, static_cast < size_t >(end - str), emitUTF8_));
965
964
else
966
965
pushValue (" " );
967
966
break ;
@@ -984,8 +983,8 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
984
983
String const & name = *it;
985
984
Value const & childValue = value[name];
986
985
writeCommentBeforeValue (childValue);
987
- writeWithIndent (valueToQuotedStringN (
988
- name.data (), static_cast < unsigned >( name.length () ), emitUTF8_));
986
+ writeWithIndent (
987
+ valueToQuotedStringN ( name.data (), name.length (), emitUTF8_));
989
988
*sout_ << colonSymbol_;
990
989
writeValue (childValue);
991
990
if (++it == members.end ()) {
0 commit comments