[gs-cvs] rev 8663 - branches/mtrender/src

ray at ghostscript.com ray at ghostscript.com
Fri Apr 25 12:24:17 PDT 2008


Author: ray
Date: 2008-04-25 12:24:16 -0700 (Fri, 25 Apr 2008)
New Revision: 8663

Modified:
   branches/mtrender/src/gsmchunk.c
   branches/mtrender/src/gxclmem.c
   branches/mtrender/src/gxclthrd.h
   branches/mtrender/src/gxclthrd1.c
Log:
Clean up gcc warnings.


Modified: branches/mtrender/src/gsmchunk.c
===================================================================
--- branches/mtrender/src/gsmchunk.c	2008-04-24 19:30:33 UTC (rev 8662)
+++ branches/mtrender/src/gsmchunk.c	2008-04-25 19:24:16 UTC (rev 8663)
@@ -107,7 +107,6 @@
 gs_memory_chunk_wrap( gs_memory_t **wrapped,	/* chunk allocator init */
 		      gs_memory_t * target )	/* base allocator */
 {
-    int code;
     gs_memory_chunk_t *cmem = (gs_memory_chunk_t *)
         gs_alloc_bytes_immovable(target, sizeof(gs_memory_chunk_t),
                                  "gs_malloc_wrap(chunk)");
@@ -212,7 +211,7 @@
 
 
 /* return -1 on error, 0 on success */
-int 
+static int 
 chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, chunk_mem_node_t **newchunk)
 {
     chunk_mem_node_t *node, *prev_node;
@@ -466,7 +465,7 @@
 	void (*finalize)(void *ptr) = obj->type->finalize;
 	gs_memory_chunk_t * const cmem = (gs_memory_chunk_t *)mem;
 	chunk_mem_node_t *current;
-	chunk_obj_node_t *free_obj, *prev_free, *new_free;
+	chunk_obj_node_t *free_obj, *prev_free;
 	chunk_obj_node_t *scan_obj, *prev_obj;
 	/* space we will free */
 	uint freed_size = round_up_to_align(obj->size + sizeof(chunk_obj_node_t));
@@ -481,7 +480,7 @@
 	}
 	if (current == NULL) {
 	    /* Object not found in any chunk */
-	    dprintf1("chunk_free_obj failed, object %0x not in any chunk\n", obj);
+	    dprintf1("chunk_free_obj failed, object %0x not in any chunk\n", ((unsigned int)obj));
 	    return;
 	}
 
@@ -494,7 +493,8 @@
 	}
 	if (scan_obj == NULL) {
 	    /* Object not found in expected chunk */
-	    dprintf3("chunk_free_obj failed, object %0x not in chunk at %0x, size = %0x\n", obj, current, current->size);
+	    dprintf3("chunk_free_obj failed, object %0x not in chunk at %0x, size = %0x\n",
+			    ((unsigned int)obj), ((unsigned int)current), current->size);
 	    return;
 	}
 	/* link around the object being freed */

Modified: branches/mtrender/src/gxclmem.c
===================================================================
--- branches/mtrender/src/gxclmem.c	2008-04-24 19:30:33 UTC (rev 8662)
+++ branches/mtrender/src/gxclmem.c	2008-04-25 19:24:16 UTC (rev 8663)
@@ -233,13 +233,15 @@
 
     /* fname[0] == 0 if this is not reopening */
     /* memfile file names begin with a flag byte == 0xff */
-    if (fname[0] == 0xff || fmode[0] == 'r') {
+    if (fname[0] == '\377' || fmode[0] == 'r') {
 	MEMFILE *base_f = NULL;
 
 	/* reopening an existing file. */
 	code = sscanf(fname+1, "0x%x", &base_f);
-	if (code != 1)
+	if (code != 1) {
 	    gs_note_error(gs_error_ioerror);
+	    goto finish;
+	}
 
 	/* We need to 'clone' this memfile so that each reader instance	*/
 	/* will be able to maintain it's own 'state'			*/
@@ -410,7 +412,7 @@
 		if (prev_f->openlist == f)
 		    break;
 	    if (prev_f == NULL) {
-		eprintf1("Could not find 0x%x on memfile openlist\n", f);
+		eprintf1("Could not find 0x%x on memfile openlist\n", ((unsigned int)f));
 		return_error(gs_error_invalidfileaccess);
 	    }
 	    prev_f->openlist = f->openlist;	/* link around the one being fclosed */
@@ -431,7 +433,7 @@
     /* future accesses will return errors rather than causing SEGV  */
     if (f->openlist) {
         /* TODO: do the cleanup rather than just giving an error */
-    	eprintf1("Attempt to delete a memfile still open for read: 0x%0x\n", f);
+    	eprintf1("Attempt to delete a memfile still open for read: 0x%0x\n", ((unsigned int)f));
         return_error(gs_error_invalidfileaccess);
     }
     memfile_free_mem(f);
@@ -469,7 +471,7 @@
     MEMFILE *f;
 
     /* memfile file names begin with a flag byte == 0xff */
-    if (fname[0] == 0xff && (code = sscanf(fname+1, "0x%x", &f) == 1)) {
+    if (fname[0] == '\377' && (code = sscanf(fname+1, "0x%x", &f) == 1)) {
 	return memfile_fclose((clist_file_ptr)f, fname, true);
     } else
         return_error(gs_error_invalidfileaccess);
@@ -788,8 +790,10 @@
 	else
 	    f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
     } else {
+
 	/* data was compressed                                            */
 	if (f->raw_head == NULL) {
+	    code = 0;
 	    /* need to allocate the raw buffer pool                        */
 	    num_raw_buffers = GET_NUM_RAW_BUFFERS(f);
 	    if (f->reservePhysBlockCount) {
@@ -802,8 +806,6 @@
 		f->reservePhysBlockChain = f->reservePhysBlockChain->link;
 		--f->reservePhysBlockCount;
 	    } else {
-		int code;
-
 		f->raw_head =
 		    allocateWithReserve(f, sizeof(*f->raw_head), &code,
 					"memfile raw buffer",

Modified: branches/mtrender/src/gxclthrd.h
===================================================================
--- branches/mtrender/src/gxclthrd.h	2008-04-24 19:30:33 UTC (rev 8662)
+++ branches/mtrender/src/gxclthrd.h	2008-04-25 19:24:16 UTC (rev 8663)
@@ -29,7 +29,7 @@
 typedef struct clist_render_thread_control_s clist_render_thread_control_t;
 #endif
 
-typedef struct clist_render_thread_control_s {
+struct clist_render_thread_control_s {
     int status;	/* 0: not started, 1: done, 2: busy, < 0: error */ 
 		/* values allow waiting until status < 2 */
     gs_memory_t *memory;	/* thread's 'chunk' memory allocator */

Modified: branches/mtrender/src/gxclthrd1.c
===================================================================
--- branches/mtrender/src/gxclthrd1.c	2008-04-24 19:30:33 UTC (rev 8662)
+++ branches/mtrender/src/gxclthrd1.c	2008-04-25 19:24:16 UTC (rev 8663)
@@ -105,7 +105,6 @@
 	gx_device_clist *ncldev;
 	gx_device_clist_common *ncdev;
 	clist_render_thread_control_t *thread = &(crdev->render_threads[i]);
-	gs_memory_t *tmem;	/* per thread allocator (wrapper) */
 
 	/* Every thread will have a 'chunk allocator' to reduce the interaction
 	 * with the 'base' allocator which has 'mutex' (locking) protection. 
@@ -279,7 +278,6 @@
 {
     gx_device_clist *cldev = (gx_device_clist *)dev;
     gx_device_clist_reader *crdev = &cldev->reader;
-    gx_device_clist_common *cdev = (gx_device_clist_common *)dev;
     int code;
 
     crdev->render_threads[thread_index].band = band;
@@ -539,7 +537,6 @@
 int 
 clist_enable_multi_thread_render(gx_device *dev)
 {   
-    gx_device_clist_common *cdev = (gx_device_clist_common *)dev;
     int code = -1;
 
     /* We need to test gp_create_thread since we may be on a platform */



More information about the gs-cvs mailing list