]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/jpeg6/jcomapi.cpp
more eol-style
[xonotic/netradiant.git] / libs / jpeg6 / jcomapi.cpp
index ebf2d7917d8e28c30bf5a34900992e49efb85e58..899a68f33a6e7ff364122fc6d28cc370ad8753c4 100644 (file)
-/*\r
-\r
- * jcomapi.c\r
-\r
- *\r
-\r
- * Copyright (C) 1994, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains application interface routines that are used for both\r
-\r
- * compression and decompression.\r
-\r
- */\r
-\r
-\r
-\r
-#define JPEG_INTERNALS\r
-\r
-#include "jinclude.h"\r
-\r
-#include "radiant_jpeglib.h"\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Abort processing of a JPEG compression or decompression operation,\r
-\r
- * but don't destroy the object itself.\r
-\r
- *\r
-\r
- * For this, we merely clean up all the nonpermanent memory pools.\r
-\r
- * Note that temp files (virtual arrays) are not allowed to belong to\r
-\r
- * the permanent pool, so we will be able to close all temp files here.\r
-\r
- * Closing a data source or destination, if necessary, is the application's\r
-\r
- * responsibility.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_abort (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  int pool;\r
-\r
-\r
-\r
-  /* Releasing pools in reverse order might help avoid fragmentation\r
-\r
-   * with some (brain-damaged) malloc libraries.\r
-\r
-   */\r
-\r
-  for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {\r
-\r
-    (*cinfo->mem->free_pool) (cinfo, pool);\r
-\r
-  }\r
-\r
-\r
-\r
-  /* Reset overall state for possible reuse of object */\r
-\r
-  cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START);\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Destruction of a JPEG object.\r
-\r
- *\r
-\r
- * Everything gets deallocated except the master jpeg_compress_struct itself\r
-\r
- * and the error manager struct.  Both of these are supplied by the application\r
-\r
- * and must be freed, if necessary, by the application.  (Often they are on\r
-\r
- * the stack and so don't need to be freed anyway.)\r
-\r
- * Closing a data source or destination, if necessary, is the application's\r
-\r
- * responsibility.\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL void\r
-\r
-jpeg_destroy (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  /* We need only tell the memory manager to release everything. */\r
-\r
-  /* NB: mem pointer is NULL if memory mgr failed to initialize. */\r
-\r
-  if (cinfo->mem != NULL)\r
-\r
-    (*cinfo->mem->self_destruct) (cinfo);\r
-\r
-  cinfo->mem = NULL;           /* be safe if jpeg_destroy is called twice */\r
-\r
-  cinfo->global_state = 0;     /* mark it destroyed */\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Convenience routines for allocating quantization and Huffman tables.\r
-\r
- * (Would jutils.c be a more reasonable place to put these?)\r
-\r
- */\r
-\r
-\r
-\r
-GLOBAL JQUANT_TBL *\r
-\r
-jpeg_alloc_quant_table (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  JQUANT_TBL *tbl;\r
-\r
-\r
-\r
-  tbl = (JQUANT_TBL *)\r
-\r
-    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));\r
-\r
-  tbl->sent_table = FALSE;     /* make sure this is false in any new table */\r
-\r
-  return tbl;\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-GLOBAL JHUFF_TBL *\r
-\r
-jpeg_alloc_huff_table (j_common_ptr cinfo)\r
-\r
-{\r
-\r
-  JHUFF_TBL *tbl;\r
-\r
-\r
-\r
-  tbl = (JHUFF_TBL *)\r
-\r
-    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));\r
-\r
-  tbl->sent_table = FALSE;     /* make sure this is false in any new table */\r
-\r
-  return tbl;\r
-\r
-}\r
-\r
+/*
+
+ * jcomapi.c
+
+ *
+
+ * Copyright (C) 1994, Thomas G. Lane.
+
+ * This file is part of the Independent JPEG Group's software.
+
+ * For conditions of distribution and use, see the accompanying README file.
+
+ *
+
+ * This file contains application interface routines that are used for both
+
+ * compression and decompression.
+
+ */
+
+
+
+#define JPEG_INTERNALS
+
+#include "jinclude.h"
+
+#include "radiant_jpeglib.h"
+
+
+
+
+
+/*
+
+ * Abort processing of a JPEG compression or decompression operation,
+
+ * but don't destroy the object itself.
+
+ *
+
+ * For this, we merely clean up all the nonpermanent memory pools.
+
+ * Note that temp files (virtual arrays) are not allowed to belong to
+
+ * the permanent pool, so we will be able to close all temp files here.
+
+ * Closing a data source or destination, if necessary, is the application's
+
+ * responsibility.
+
+ */
+
+
+
+GLOBAL void
+
+jpeg_abort (j_common_ptr cinfo)
+
+{
+
+  int pool;
+
+
+
+  /* Releasing pools in reverse order might help avoid fragmentation
+
+   * with some (brain-damaged) malloc libraries.
+
+   */
+
+  for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
+
+    (*cinfo->mem->free_pool) (cinfo, pool);
+
+  }
+
+
+
+  /* Reset overall state for possible reuse of object */
+
+  cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START);
+
+}
+
+
+
+
+
+/*
+
+ * Destruction of a JPEG object.
+
+ *
+
+ * Everything gets deallocated except the master jpeg_compress_struct itself
+
+ * and the error manager struct.  Both of these are supplied by the application
+
+ * and must be freed, if necessary, by the application.  (Often they are on
+
+ * the stack and so don't need to be freed anyway.)
+
+ * Closing a data source or destination, if necessary, is the application's
+
+ * responsibility.
+
+ */
+
+
+
+GLOBAL void
+
+jpeg_destroy (j_common_ptr cinfo)
+
+{
+
+  /* We need only tell the memory manager to release everything. */
+
+  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
+
+  if (cinfo->mem != NULL)
+
+    (*cinfo->mem->self_destruct) (cinfo);
+
+  cinfo->mem = NULL;           /* be safe if jpeg_destroy is called twice */
+
+  cinfo->global_state = 0;     /* mark it destroyed */
+
+}
+
+
+
+
+
+/*
+
+ * Convenience routines for allocating quantization and Huffman tables.
+
+ * (Would jutils.c be a more reasonable place to put these?)
+
+ */
+
+
+
+GLOBAL JQUANT_TBL *
+
+jpeg_alloc_quant_table (j_common_ptr cinfo)
+
+{
+
+  JQUANT_TBL *tbl;
+
+
+
+  tbl = (JQUANT_TBL *)
+
+    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));
+
+  tbl->sent_table = FALSE;     /* make sure this is false in any new table */
+
+  return tbl;
+
+}
+
+
+
+
+
+GLOBAL JHUFF_TBL *
+
+jpeg_alloc_huff_table (j_common_ptr cinfo)
+
+{
+
+  JHUFF_TBL *tbl;
+
+
+
+  tbl = (JHUFF_TBL *)
+
+    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));
+
+  tbl->sent_table = FALSE;     /* make sure this is false in any new table */
+
+  return tbl;
+
+}
+