mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
cleaned up code
This commit is contained in:
parent
28d671efd7
commit
acbfec0cb5
|
@ -10,5 +10,5 @@ TODO
|
|||
- clear redundant includes
|
||||
- check if security policy can be stricter
|
||||
- ~~use addDirectoryAt instead of addDirectory~~
|
||||
- modify tests assertions
|
||||
- ~~modify tests assertions~~
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ void generate_one_step(SapiLodepngSandbox &sandbox, LodepngApi &api) {
|
|||
}
|
||||
|
||||
// encode the image
|
||||
sapi::v::Array<unsigned char> sapi_image(image.data(), img_len(width, height));
|
||||
sapi::v::Array<unsigned char> sapi_image(image.data(),
|
||||
img_len(width, height));
|
||||
sapi::v::UInt sapi_width(width), sapi_height(height);
|
||||
std::string filename = "/output/out_generated1.png";
|
||||
sapi::v::ConstCStr sapi_filename(filename.c_str());
|
||||
|
@ -116,7 +117,8 @@ void generate_two_steps(SapiLodepngSandbox &sandbox, LodepngApi &api) {
|
|||
}
|
||||
|
||||
// encode the image into memory first
|
||||
sapi::v::Array<unsigned char> sapi_image(image.data(), img_len(width, height));
|
||||
sapi::v::Array<unsigned char> sapi_image(image.data(),
|
||||
img_len(width, height));
|
||||
sapi::v::UInt sapi_width(width), sapi_height(height);
|
||||
std::string filename = "/output/out_generated2.png";
|
||||
sapi::v::ConstCStr sapi_filename(filename.c_str());
|
||||
|
@ -135,7 +137,6 @@ void generate_two_steps(SapiLodepngSandbox &sandbox, LodepngApi &api) {
|
|||
// the new array (pointed to by sapi_png_ptr) is allocated
|
||||
// inside the sandboxed process so we need to transfer it to this
|
||||
// process
|
||||
|
||||
sapi::v::RemotePtr sapi_remote_out_ptr(sapi_png_ptr.GetValue());
|
||||
sapi::v::Array<unsigned char> sapi_png_array(sapi_pngsize.GetValue());
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@ TEST(generate_image, encode_decode_compare_one_step) {
|
|||
sapi_height.GetValue()));
|
||||
|
||||
ASSERT_THAT(result, Eq(0));
|
||||
|
||||
// after the image has been encoded, decode it to check that the
|
||||
// pixel values are the same
|
||||
|
||||
sapi::v::UInt sapi_width2, sapi_height2;
|
||||
sapi::v::IntBase<unsigned char *> sapi_image_ptr(0);
|
||||
|
||||
|
@ -161,7 +161,6 @@ TEST(generate_image, encode_decode_compare_two_steps) {
|
|||
// the new array (pointed to by sapi_png_ptr) is allocated
|
||||
// inside the sandboxed process so we need to transfer it to this
|
||||
// process
|
||||
|
||||
sapi::v::RemotePtr sapi_remote_out_ptr(sapi_png_ptr.GetValue());
|
||||
sapi::v::Array<unsigned char> sapi_png_array(sapi_pngsize.GetValue());
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ class SapiLodepngSandbox : public LodepngSandbox {
|
|||
std::unique_ptr<sandbox2::Policy> ModifyPolicy(
|
||||
sandbox2::PolicyBuilder *) override {
|
||||
return sandbox2::PolicyBuilder()
|
||||
.AllowStaticStartup()
|
||||
.AllowRead()
|
||||
.AllowWrite()
|
||||
.AllowOpen()
|
||||
|
|
Loading…
Reference in New Issue
Block a user