mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
changed copying files to patching
This commit is contained in:
parent
28089de353
commit
490bc569ed
2
oss-internship-2020/openjpeg/.gitignore
vendored
2
oss-internship-2020/openjpeg/.gitignore
vendored
|
@ -1,3 +1 @@
|
|||
build/
|
||||
examples/convert_lib.cc
|
||||
examples/convert_lib.h
|
||||
|
|
|
@ -12,27 +12,26 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_custom_target(patching_reverse_before
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch -R --no-backup-if-mismatch -r /dev/null convert.c < ${PROJECT_SOURCE_DIR}/examples/convert.patch > /dev/null || (exit 0)
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch -R --no-backup-if-mismatch -r /dev/null convert.h < ${PROJECT_SOURCE_DIR}/examples/convert_h.patch > /dev/null || (exit 0)
|
||||
)
|
||||
# we need to use modified versions of some of the library tools
|
||||
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/gen_files")
|
||||
file(COPY "${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/convert.c" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
|
||||
file(COPY "${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/convert.h" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
|
||||
file(COPY "${PROJECT_SOURCE_DIR}/examples/convert.patch" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
|
||||
file(COPY "${PROJECT_SOURCE_DIR}/examples/convert_h.patch" DESTINATION "${PROJECT_BINARY_DIR}/gen_files/")
|
||||
|
||||
add_custom_command(
|
||||
DEPENDS opj_decompress opj_compress opj_dump
|
||||
OUTPUT ${PROJECT_SOURCE_DIR}/examples/convert_lib.cc ${PROJECT_SOURCE_DIR}/examples/convert_lib.h
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch convert.c < ${PROJECT_SOURCE_DIR}/examples/convert.patch > /dev/null && cp convert.c ${PROJECT_SOURCE_DIR}/examples/convert_lib.cc
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch convert.h < ${PROJECT_SOURCE_DIR}/examples/convert_h.patch > /dev/null && cp convert.h ${PROJECT_SOURCE_DIR}/examples/convert_lib.h
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/gen_files/convert.cc ${PROJECT_BINARY_DIR}/gen_files/convert.h
|
||||
COMMAND cd ${PROJECT_BINARY_DIR}/gen_files && patch < ${PROJECT_SOURCE_DIR}/examples/convert.patch > /dev/null
|
||||
COMMAND cd ${PROJECT_BINARY_DIR}/gen_files && patch < ${PROJECT_SOURCE_DIR}/examples/convert_h.patch > /dev/null
|
||||
COMMAND mv ${PROJECT_BINARY_DIR}/gen_files/convert.c ${PROJECT_BINARY_DIR}/gen_files/convert.cc
|
||||
)
|
||||
|
||||
add_library(convert_helper STATIC
|
||||
${PROJECT_SOURCE_DIR}/examples/convert_lib.cc
|
||||
${PROJECT_SOURCE_DIR}/examples/convert_lib.h
|
||||
${PROJECT_BINARY_DIR}/gen_files/convert.cc
|
||||
${PROJECT_BINARY_DIR}/gen_files/convert.h
|
||||
)
|
||||
|
||||
add_dependencies(opj_decompress patching_reverse_before)
|
||||
add_dependencies(opj_compress patching_reverse_before)
|
||||
add_dependencies(opj_dump patching_reverse_before)
|
||||
|
||||
add_executable(decompress_sandboxed
|
||||
decompress_example.cc
|
||||
)
|
||||
|
@ -47,10 +46,3 @@ target_link_libraries(convert_helper PRIVATE
|
|||
openjp2_sapi
|
||||
sapi::sapi
|
||||
)
|
||||
|
||||
add_custom_target(patching_reverse ALL
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch -R convert.c < ${PROJECT_SOURCE_DIR}/examples/convert.patch > /dev/null
|
||||
COMMAND cd ${PROJECT_SOURCE_DIR}/openjpeg/src/bin/jp2/ && patch -R convert.h < ${PROJECT_SOURCE_DIR}/examples/convert_h.patch > /dev/null
|
||||
)
|
||||
|
||||
add_dependencies(patching_reverse decompress_sandboxed)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- convert.c 2020-08-27 15:46:32.911584344 +0000
|
||||
+++ ../../../../examples/convert_helper.cc 2020-08-27 15:10:52.695231032 +0000
|
||||
+++ convert_helper.cc 2020-08-27 15:10:52.695231032 +0000
|
||||
@@ -35,2605 +35,311 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
|
@ -62,7 +62,7 @@
|
|||
- }
|
||||
- component->prec = precision;
|
||||
-}
|
||||
+// copies of a few library tools
|
||||
+// patched versions of a few library tools
|
||||
|
||||
-/* Component precision scaling */
|
||||
-static void scale_component_up(opj_image_comp_t* component,
|
||||
|
@ -181,7 +181,7 @@
|
|||
-{
|
||||
- OPJ_SIZE_T i;
|
||||
- const OPJ_INT32* pSrc0 = pSrc[0];
|
||||
+#include "convert_lib.h"
|
||||
+#include "convert.h"
|
||||
|
||||
- for (i = 0; i < length; i++) {
|
||||
- pDst[i] = pSrc0[i] + adjust;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- convert.h 2020-08-27 15:46:45.028628305 +0000
|
||||
+++ ../../../../examples/convert_helper.h 2020-08-27 14:26:02.155455250 +0000
|
||||
+++ convert_helper.h 2020-08-27 14:26:02.155455250 +0000
|
||||
@@ -1,126 +1,8 @@
|
||||
-/*
|
||||
- * The copyright in this software is being made available under the 2-clauses
|
||||
|
@ -39,8 +39,8 @@
|
|||
- */
|
||||
-#ifndef __J2K_CONVERT_H
|
||||
-#define __J2K_CONVERT_H
|
||||
+// imagetopnm and the two functions it calls internaly are copied from the
|
||||
+// library's tools; from openjpeg/src/bin/jp2/convert.c
|
||||
+// imagetopnm and the two functions it calls internaly are patched
|
||||
+// versions of the library's tools; from openjpeg/src/bin/jp2/convert.c
|
||||
|
||||
-/**@name RAW component encoding parameters */
|
||||
-/*@{*/
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "convert_lib.h"
|
||||
#include "gen_files/convert.h"
|
||||
#include "openjp2_sapi.sapi.h"
|
||||
|
||||
class Openjp2SapiSandbox : public Openjp2Sandbox {
|
||||
|
|
Loading…
Reference in New Issue
Block a user