Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update json.hpp to v2.1.1
<https://webkit.org/b/172085>
<rdar://problem/32180980>

Reviewed by Alex Christensen.

* NetworkProcess/capture/NetworkCaptureEvent.cpp:
- Define JSON_NOEXCEPTION as 1 to disable exceptions in
  json.hpp.
(WebKit::NetworkCapture::JSONCoder<String>::encode):
(WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
- Build std::string passing in length to avoid the need for a
  custom basic_json() constructor, and for efficiency.

* NetworkProcess/capture/json.hpp:
- Update to v2.1.1 and remove customizations.


Canonical link: https://commits.webkit.org/189052@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ddkilzer committed May 15, 2017
1 parent 4156602 commit 3a74085
Show file tree
Hide file tree
Showing 3 changed files with 6,324 additions and 4,094 deletions.
19 changes: 19 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,22 @@
2017-05-15 David Kilzer <ddkilzer@apple.com>

Update json.hpp to v2.1.1
<https://webkit.org/b/172085>
<rdar://problem/32180980>

Reviewed by Alex Christensen.

* NetworkProcess/capture/NetworkCaptureEvent.cpp:
- Define JSON_NOEXCEPTION as 1 to disable exceptions in
json.hpp.
(WebKit::NetworkCapture::JSONCoder<String>::encode):
(WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
- Build std::string passing in length to avoid the need for a
custom basic_json() constructor, and for efficiency.

* NetworkProcess/capture/json.hpp:
- Update to v2.1.1 and remove customizations.

2017-05-15 Brent Fulgham <bfulgham@apple.com>

Unreviewed build fix.
Expand Down
6 changes: 4 additions & 2 deletions Source/WebKit2/NetworkProcess/capture/NetworkCaptureEvent.cpp
Expand Up @@ -28,6 +28,8 @@

#if ENABLE(NETWORK_CAPTURE)

#define JSON_NOEXCEPTION 1

#include "NetworkCaptureLogging.h"
#include "json.hpp"
#include <WebCore/ResourceError.h>
Expand Down Expand Up @@ -186,7 +188,7 @@ template<>
struct JSONCoder<String> {
static json encode(const String& val)
{
return json(static_cast<const char*>(val.utf8().data()));
return json(std::string(static_cast<const char*>(val.utf8().data()), val.length()));
}

static String decode(const json& jVal)
Expand Down Expand Up @@ -337,7 +339,7 @@ struct JSONCoder<WebCore::SharedBuffer> {
{
Vector<char> buffer;
base64Encode(data.data(), data.size(), buffer);
return json(&buffer[0], buffer.size());
return json(std::string(&buffer[0], buffer.size()));
}

static Ref<WebCore::SharedBuffer> decode(const json& jData)
Expand Down

0 comments on commit 3a74085

Please sign in to comment.