summaryrefslogtreecommitdiff
path: root/test/pdf-mime-data.c
Commit message (Collapse)AuthorAgeFilesLines
* test/pdf-mime-data.c: Check for pdfimagesUli Schlachter2021-03-081-0/+6
| | | | | | | | | | | | | | | | | | | | Currently, the pdf-mime-data check just fails for me with the following output: sh: 1: pdfimages: not found pdf-mime-data: FAIL pdf-mime-data.log contains: pdfimages failed with exit status 32512 Since I do not have pdfimages installed... yeah. This commit "fixes" that problem by skipping the test if pdfimages is not available. No idea if it would pass if it were available, but I do not feel like installing pdfimages just to test. Signed-off-by: Uli Schlachter <psychon@znc.in>
* pdf-mime-data: Fix for out-of-tree buildsUli Schlachter2021-03-081-1/+1
| | | | | | | | This makes the code use the existing helper for loading PNGs that also considers the $srcdir environment variable. This makes it find the file in out of tree builds. Signed-off-by: Uli Schlachter <psychon@znc.in>
* pdf-mime-data: Fix error checkingUli Schlachter2021-03-081-1/+1
| | | | | | | | I am not quite sure, but an if for "ignore this error if something failed" seems wrong. Either this should have compared against status2 or checked for success. This commit fixes the code for the latter. Signed-off-by: Uli Schlachter <psychon@znc.in>
* test: Fix use after freesBryce Harrington2015-12-091-1/+1
| | | | Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93152
* test: Free the memory, not the pointer to the memoryBryce Harrington2015-07-301-1/+1
| | | | | | | | | | | | | | | | | In read_file(), we see: *data = malloc (*len); ... if (fread(*data, *len, 1, fp) != 1) { free(data); ... The free call needs to be free(*data), to match the malloc call. Matthias Clasen found this via Coverity and proposed the fix. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91381
* test: Fix null pointer issue reported by cppcheck static analysis toolRavi Nanjundappa2014-08-271-11/+14
| | | | | | | | | | | | | | | | | | | cppcheck analysis tool reports the following issues when run on the latest Cairo source. $ grep "(error)" cppcheck_error_log.txt [test/pdf-mime-data.c:58]: (error) Possible null pointer dereference: file - otherwise it is redundant to check if file is null at line 53 [test/pdf-mime-data.c:75]: (error) Resource leak: fp $ The proposed changes fixes the above issues. And also it does some refactoring to print the appropriate error messages for each error condition in read_file() function and also to free the allocated data buffer. Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
* Fix some memory leaks found by scan-build, the LLVM/Clang static analyzerSylvestre Ledru2014-05-161-0/+2
| | | | | Signed-off-by: Bryce Harrington <b.harrington@samsung.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
* test: Ensure output dirs exist, falling back to current dir if neededBryce W. Harrington2013-09-091-1/+5
| | | | | | | | | | | | | | This change makes several tests behave more like ps-eps.c, et al by making them attempt to mkdir "output", and in case of trouble use "." instead. filenames are now allocated at runtime due to this change, so ensure the corresponding free()'s are in place as well. This should facilitate running the test suite with a relative path outside cairo's source tree, such as when employing the CAIRO_REF_DIR environment variable. Signed-off-by: Bryce Harrington <b.harrington@samsung.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
* test: Fix several tests to place output files in the output directoryBryce W. Harrington2013-09-091-4/+5
| | | | | | | | | | | | | | The standard location for test output is cairo/test/output. The harness itself was updated to write automatically generated images in this directory, however a number of tests generate their own local output files. This patch updates these tests to write their output into CAIRO_TEST_OUTPUT_DIR (which defaults to cairo/test/output) as well, in the interest of decluttering the test directory. Signed-off-by: Bryce Harrington <b.harrington@samsung.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
* [test/pdf-mime-data] Free data on error paths.Chris Wilson2009-01-021-0/+4
| | | | Cleanup the allocated buffers on error.
* [surface] Pass a separate closure for the mime-type destroy notifier.Chris Wilson2008-11-071-1/+3
| | | | | | | | A limitation of the current API was that the destroy notifier was called on the mime-data block. This prevents the user from passing in a pointer to a managed block, for example a mime-data block belonging to a ref-counted object. We can overcome this by allowing the user to specify the closure to be used with the destroy notifier.
* [test] Adapt pdf-mime-data for non-srcdir build.Chris Wilson2008-11-041-12/+32
| | | | Need to look for reference/input images from srcdir as well.
* Add pdf mime data testAdrian Johnson2008-11-041-0/+151
To test that images in PDF files correctly embedded the mime data.