Skip to content

Commit 3a84a2b

Browse files
committed
style: clarify macro name
1 parent c3442e4 commit 3a84a2b

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

includes/sjson/error.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
// #define SJSON_CPP_ASSERT(expression, format, ...) checkf(expression, ANSI_TO_TCHAR(format), #__VA_ARGS__)
5656
//
5757
// [Custom String Format Specifier]
58-
// Note that if you use a custom function, you may need to override the SJSON_STRING_FORMAT_SPECIFIER
58+
// Note that if you use a custom function, you may need to override the SJSON_ASSERT_STRING_FORMAT_SPECIFIER
5959
// to properly handle ANSI/Unicode support. The C++11 standard does not support a way to say that '%s'
6060
// always means an ANSI string (with 'const char*' as type). MSVC does support '%hs' but other compilers
6161
// do not.
@@ -66,8 +66,8 @@
6666
//////////////////////////////////////////////////////////////////////////
6767

6868
// See [Custom String Format Specifier] for details
69-
#if !defined(SJSON_STRING_FORMAT_SPECIFIER)
70-
#define SJSON_STRING_FORMAT_SPECIFIER "%s"
69+
#if !defined(SJSON_ASSERT_STRING_FORMAT_SPECIFIER)
70+
#define SJSON_ASSERT_STRING_FORMAT_SPECIFIER "%s"
7171
#endif
7272

7373
#if defined(SJSON_CPP_ON_ASSERT_ABORT)

includes/sjson/writer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ namespace sjson
268268

269269
char buffer[256];
270270
int length = snprintf(buffer, sizeof(buffer), "%s%s", value ? "true" : "false", k_line_terminator);
271-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_STRING_FORMAT_SPECIFIER " = " SJSON_STRING_FORMAT_SPECIFIER "]", key, value);
271+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_ASSERT_STRING_FORMAT_SPECIFIER " = " SJSON_ASSERT_STRING_FORMAT_SPECIFIER "]", key, value);
272272
m_stream_writer.write(buffer, static_cast<size_t>(length));
273273
}
274274

@@ -301,7 +301,7 @@ namespace sjson
301301
{
302302
char buffer[256];
303303
int length = snprintf(buffer, sizeof(buffer), "%.17g%s", value, k_line_terminator);
304-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_STRING_FORMAT_SPECIFIER " = %.17g]", key, value);
304+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_ASSERT_STRING_FORMAT_SPECIFIER " = %.17g]", key, value);
305305
m_stream_writer.write(buffer, static_cast<size_t>(length));
306306
}
307307
}
@@ -318,7 +318,7 @@ namespace sjson
318318

319319
char buffer[256];
320320
int length = snprintf(buffer, sizeof(buffer), "%" PRId64 "%s", value, k_line_terminator);
321-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_STRING_FORMAT_SPECIFIER " = %lld]", key, value);
321+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_ASSERT_STRING_FORMAT_SPECIFIER " = %lld]", key, value);
322322
m_stream_writer.write(buffer, static_cast<size_t>(length));
323323
}
324324

@@ -334,7 +334,7 @@ namespace sjson
334334

335335
char buffer[256];
336336
int length = snprintf(buffer, sizeof(buffer), "%" PRIu64 "%s", value, k_line_terminator);
337-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_STRING_FORMAT_SPECIFIER " = %llu]", key, value);
337+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to insert SJSON value: [" SJSON_ASSERT_STRING_FORMAT_SPECIFIER " = %llu]", key, value);
338338
m_stream_writer.write(buffer, static_cast<size_t>(length));
339339
}
340340

@@ -463,7 +463,7 @@ namespace sjson
463463

464464
char buffer[256];
465465
int length = snprintf(buffer, sizeof(buffer), "%s%s", value ? "true" : "false", k_line_terminator);
466-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to assign SJSON value: " SJSON_STRING_FORMAT_SPECIFIER, value);
466+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to assign SJSON value: " SJSON_ASSERT_STRING_FORMAT_SPECIFIER, value);
467467
m_object_writer->m_stream_writer.write(buffer, static_cast<size_t>(length));
468468
m_is_empty = false;
469469
}
@@ -615,7 +615,7 @@ namespace sjson
615615

616616
char buffer[256];
617617
int length = snprintf(buffer, sizeof(buffer), "%s", value ? "true" : "false");
618-
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to push SJSON value: " SJSON_STRING_FORMAT_SPECIFIER, value);
618+
SJSON_CPP_ASSERT(length > 0 && length < static_cast<int>(sizeof(buffer)), "Failed to push SJSON value: " SJSON_ASSERT_STRING_FORMAT_SPECIFIER, value);
619619
m_stream_writer.write(buffer, static_cast<size_t>(length));
620620
m_is_empty = false;
621621
m_is_newline = false;

0 commit comments

Comments
 (0)