summaryrefslogtreecommitdiff
path: root/contrib/pcl3/eprn
Commit message (Collapse)AuthorAgeFilesLines
* Fix compiler warnings in contrib devicesChris Liddell2023-01-041-1/+1
| | | | Function protoype mismatch warnings.
* Runtime safety of non threadsafe devices and rework globals.Robin Watts2021-11-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices within Ghostscript (currently the x11 devices, uniprint and opvp/oprp) use non const static variables, so cannot be run in multiple instances at a time. We now maintain a core "count" of how many non-threadsafe devices are being used at any time. This value can be atomically adjusted by calls to gs_lib_ctx_nts_adjust. Non threadsafe devices now call gx_init_non_threadsafe_device either as or as part of their initialise_device proc. This function attempts to increment the non-threadsafe count and fails to init if there is already a non-threadsafe device running. On success, the device finalize method is modified so that it will decrement the count at the end. The known non-threadsafe devices are updated to call this. In order to have somewhere safe to store this count, we introduce a gs_globals structure, shared between instances. Setting this up without race conditions requires some new gp_ functions that can make use of platform specific threading primitives. We have these implemented for both windows and pthread based platforms. On other platforms, we drop back to the old unsafe mechanism for counting instances. While we do this work, we take the opportunity to push the gs_memory_t pointer used for non-threadsafe debug printing into thread local storage. This enables us to remove the remaining GS_THREADSAFE guarded compilation from the source code. What is left is broadly down to allowing debugging collection for statistics, and these are now controlled by specific COLLECT_STATS_XXX defines. It is assumed that anyone wanting to collect such stats is smart enough to not try to do so while using Ghostscript in a multi-instance environment.
* Tweak eprn and pcl3 devices to remove non const statics.Robin Watts2021-10-274-16/+33
| | | | This should make the devices threadsafe.
* Move devices away from static init of procs.Robin Watts2021-04-201-79/+0
|
* Rename finish_copydevice to initialize, and remove second param.Robin Watts2021-04-201-1/+1
| | | | | | | | | | | It used to be that finish_copydevice(dev, const old_dev) would be used to copy stuff from a prototype to a new instance of a device. Now, no copying is ever done. Also, it's a confusing name. Rename it to be 'initialize', which is clearer. Also, it should become even more appropriate in future, if we have this function be the one that is responsible for filling out the procs.
* Bug 703294: Fix Ghostscript build for AndroidPeter Cherepanov2021-02-151-0/+1
| | | | | | | Header files shifted around so that the redefinition of printf happens after cdefs. Also removes redundant CONTDEVH definition from contrib/contrib.mak
* Coverity 121439: use gx_color_index instead of uint, to avoid overflow when ↵Julian Smith2020-01-091-1/+1
| | | | shifting.
* Coverity 95007: propogate error from eprn_check_colour_info().Julian Smith2020-01-082-5/+8
|
* Coverity 121439: avoid overflow when shifting.Julian Smith2020-01-081-1/+1
|
* Fix warnings when building contrib on windows.Robin Watts2019-10-312-5/+5
| | | | | | MSVC is much more sensitive to casting types than gcc is, it seems. Accordingly avoid making doubles when we want floats, and make all casts down to int (or byte) explicit.
* Fix up some coverity issues, and other warningsChris Liddell2019-06-181-4/+4
| | | | | | | | CIDs: 341120, 341119, 341118, 341117, 341116, 341115, 341114, 341113, 341112, 341111, 341110, 341109, 341108, 341107, 341106, 341105, 341104, 341103, 341102, 341101. Mostly examples of gp_fseek and sscanf ignoring return values.
* Move FILE * operations behind new gp_file * API.Robin Watts2019-05-294-52/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (squash of commits from filesec branch) Most of this commit is donkeywork conversions of calls from FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every device is touched, along with the clist and parsing code. The more interesting changes are within gp.h (where the actual new API is defined), gpmisc.c (where the basic implementations live), and the platform specific levels (gp_mswin.c, gp_unifs.c etc where the platform specific implementations have been tweaked/renamed). File opening path validation All file opening routines now call a central routine for path validation. This then consults new entries in gs_lib_ctx to see if validation is enabled or not. If so, it validates the paths by seeing if they match. Simple C level functions for adding/removing/clearing paths, exposed through the gsapi level. Add 2 postscript operators for path control. <name> <string> .addcontrolpath - Add the given <string> (path) to the list of paths for controlset <name>, where <name> can be: /PermitFileReading /PermitFileWriting /PermitFileControl (Anything else -> rangecheck) - .activatepathcontrol - Enable path control. At this point PS cannot make any more changes, and all file access is checked.
* Make gs_imager_state == gs_state.Chris Liddell2016-06-063-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change how gstate initialisation is done: Previously we relied on the imager state being a subset of the gstate (thus assigning an imager state to a graphics state over wrote to the entries common to both, and didn't overwrite any already set graphics state specific entries). Making the imager and graphics states the same means that approach doesn't work, so this changes it to initialise the entries individually. Renames gsistate.c->gsgstate.c and gxistate.h->gxgstate.h Cleanup and fix the gs_state gc stuff. Uses different check for pre/post clist pdf14 device Previously, the code used "is_gstate" in the imager/graphics state object to determine if the code was being called pre or post clist (post clist would only ever have had an imager_state so is_gstate = false). With no imager state any more, that test would no longer work (and I am dubious about whether it was really safe, anyway). Other places check for the presence of a clist reader device in the pdf14 device structure - so use that here too. Adds initial (NULL) value for show_gstate pointer in gs_state. Removes the now pointless macro for the contents of the graphics state Changes function names that had "imager" to use "gstate" Removes the redundant 'is_state' flag Cleans up gs_(g)state_putdeviceparams(): Previously we had to similar routines: one took a graphics state, and used the device from the graphics state, the other took an imager state and the device as an explicit parameter. With the removal of the imager state, "merge" those two functions Replaces gs_state with gs_gstate It makes for less confusion as it really is a g(raphics)state
* Silence some more warnings.Robin Watts2016-01-062-28/+1
|
* Squash miscellaneous warnings.Robin Watts2016-01-059-45/+0
| | | | | Remove some redundant variables, and tweak code to avoid compiler warnings.
* Squash warnings: Contrib devicesRobin Watts2016-01-041-3/+3
| | | | | | | Workaround as many warnings as possible in the contrib devices. Removing dead code, checking return values etc, fixing type casts (char to unsigned char etc).
* Squash warnings: Add explicit bracketing.Robin Watts2016-01-045-33/+34
| | | | | | | | | && binds more tightly than || in C (similarly & and |). Expressions such as "A && B || C" are therefore well defined, but often error prone and confusing to read, so the compiler warns about them. We add explicit parentheses to shut this up (and to clarify the code).
* Commit of build_consolidation branchChris Liddell2015-07-209-0/+6170
Squashed into one commit (see branch for details of the evolution of the branch). This brings gpcl6 and gxps into the Ghostscript build system, and a shared set of graphics library object files for all the interpreters. Also, brings the same configuration options to the pcl and xps products as we have for Ghostscript.