mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
changed VLA to vectors
This commit is contained in:
parent
032053d55d
commit
ba88cd3499
|
@ -20,7 +20,6 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
#include "absl/algorithm/container.h"
|
#include "absl/algorithm/container.h"
|
||||||
#include "convert_helper.h"
|
#include "convert_helper.h"
|
||||||
|
@ -124,8 +123,8 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sapi::v::RemotePtr image_remote_pointer(image.GetRemote());
|
sapi::v::RemotePtr image_remote_pointer(image.GetRemote());
|
||||||
bool_status = api.opj_decode(&codec_pointer, &stream_pointer,
|
bool_status =
|
||||||
&image_remote_pointer);
|
api.opj_decode(&codec_pointer, &stream_pointer, &image_remote_pointer);
|
||||||
if (!bool_status.ok() || !bool_status.value()) {
|
if (!bool_status.ok() || !bool_status.value()) {
|
||||||
LOG(FATAL) << "decoding failed";
|
LOG(FATAL) << "decoding failed";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -152,7 +151,7 @@ int main(int argc, char* argv[]) {
|
||||||
int width = (int)image.data().comps[0].w;
|
int width = (int)image.data().comps[0].w;
|
||||||
int height = (int)image.data().comps[0].h;
|
int height = (int)image.data().comps[0].h;
|
||||||
|
|
||||||
OPJ_INT32 data[components][width * height];
|
std::vector<std::vector<OPJ_INT32>> data;
|
||||||
sapi::v::Array<OPJ_INT32> image_components_data(width * height);
|
sapi::v::Array<OPJ_INT32> image_components_data(width * height);
|
||||||
|
|
||||||
for (int i = 0; i < components; ++i) {
|
for (int i = 0; i < components; ++i) {
|
||||||
|
@ -161,10 +160,14 @@ int main(int argc, char* argv[]) {
|
||||||
LOG(FATAL) << "transfer from sandboxee failed";
|
LOG(FATAL) << "transfer from sandboxee failed";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < width * height; ++j) {
|
std::vector<OPJ_INT32> component_data(
|
||||||
data[i][j] = image_components_data[j];
|
image_components_data.GetData(),
|
||||||
}
|
image_components_data.GetData() + (width * height));
|
||||||
image_components[i].data = data[i];
|
data.push_back(component_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < components; ++i) {
|
||||||
|
image_components[i].data = &data[i][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the image to the desired format and save it to the file
|
// convert the image to the desired format and save it to the file
|
||||||
|
|
Loading…
Reference in New Issue
Block a user