Skip to content

Commit ecf832b

Browse files
author
Christopher Dawes
committed
Fix issue with incorrect clone causing seg fault
1 parent 1729e9c commit ecf832b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/json/value.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace detail {
3636
#define ALIGNAS(byte_alignment)
3737
#endif
3838
static const unsigned char ALIGNAS(8) kNull[2048] = { 0 }; //FIXME no sizeof(Value) exists
39-
const unsigned char& kNullRef = kNull[0];
39+
static const unsigned char& kNullRef = kNull[0];
4040
template <typename T, typename U>
4141
const Value<T, U>& Value<T, U>::null = reinterpret_cast<const Value<T, U>&>(kNullRef);
4242
template <typename T, typename U>
@@ -128,7 +128,7 @@ static inline typename _Value::StringDataPtr duplicateAndPrefixStringValue(
128128
"length too big for prefixing");
129129

130130
try {
131-
typename _Value::StringDataPtr newString(new typename _Value::StringData(value, value + length));
131+
typename _Value::StringDataPtr newString(new typename _Value::StringData());
132132
for (unsigned int i=0; i<sizeof(unsigned); i++)
133133
newString->push_back(reinterpret_cast<char*>(&length)[i]);
134134
newString->insert(newString->end(), value, value+length);
@@ -157,7 +157,7 @@ inline static void decodePrefixedString(
157157
/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue().
158158
*/
159159
template<class _Value>
160-
static inline void releaseStringValue(char* value) { /* Unused */ } //FIXME Remove!
160+
static inline void releaseStringValue(char* value) { (void)(value);/* Unused */ } //FIXME Remove!
161161

162162
} // namespace detail
163163
} // namespace Json

0 commit comments

Comments
 (0)