]> git.imager.perl.org - imager.git/blobdiff - imageri.h
extend some variable types to avoid overflows for mediancut
[imager.git] / imageri.h
index 34817ed10628f6599f203b1e682f370369684c7a..14d1d23ced965f2454afca679ecd36698c1a456c 100644 (file)
--- a/imageri.h
+++ b/imageri.h
@@ -6,6 +6,7 @@
 #define IMAGEI_H_
 
 #include "imager.h"
+#include <stddef.h>
 
 /* wrapper functions that implement the floating point sample version of a 
    function in terms of the 8-bit sample version
@@ -117,11 +118,31 @@ typedef struct im_context_tag {
   size_t error_alloc[IM_ERROR_COUNT];
   i_errmsg error_stack[IM_ERROR_COUNT];
 #ifdef IMAGER_LOG
-  int log_level;
+  /* the log file and level for this context */
   FILE *lg_file;
+  int log_level;
+
+  /* whether we own the lg_file, false for stderr and for cloned contexts */
+  int own_log;
+
+  /* values supplied by lhead */
   const char *filename;
   int line;
 #endif
+
+  /* file size limits */
+  i_img_dim max_width, max_height;
+  size_t max_bytes;
+
+  /* per context storage */
+  size_t slot_alloc;
+  void **slots;
+
+  ptrdiff_t refcount;
 } im_context_struct;
 
+#define DEF_BYTES_LIMIT 0x40000000
+
+#define im_size_t_max (~(size_t)0)
+
 #endif