Commits

Anonymous committed 0b1d443

size gymnastics to remove printf warnings

  • Participants
  • Parent commits 82e3d91
  • Tags CxxUtils-00-00-33

Comments (0)

Files changed (4)

+2009-08-05  Paolo Calafiura  <calaf@lxcalaf.cern.ch>
+	* src/PageAccessControl.cxx (protectPage): size gymnastics to remove
+	printf warnings 
+	* CxxUtils/page_access.h: size gymnastics to remove printf warnings 
+	* src/page_access.cxx: size gymnastics to remove printf warnings 
+	* tagging CxxUtils-00-00-32
+
 2009-04-15  Wim Lavrijsen  <WLavrijsen@lbl.gov>
 	* added addr2line functionality in stack trace as provided by Rolf Seuster
 	* added error handling, compiler warning and other fixes for the above patch

File CxxUtils/page_access.h

 #include <sys/mman.h> /* mprotect */
 #define DEBUG 1
 namespace athena {
-  const unsigned int PAGESIZE= 0x1000;  //sysconf(_SC_PAGE_SIZE)
+  const size_t PAGESIZE= 0x1000;  //sysconf(_SC_PAGE_SIZE)
 
   void* page_address(void* addr);
   void* next_page_address(void* addr);
   int rc=mprotect(pageAddr, lProtected, prot);
   if (rc) printf("page_protect WARNING: mprotect heap failed for address %p\n", (void*)addr);
 #ifdef DEBUG
-  else printf("page_protect DEBUG: set protection @%i for range @%x - @%x containing addr=%p\n",
-	      prot,(unsigned int)page_address(addr),(unsigned int)addr+sizeof(T), (void*)addr);
+  else printf("page_protect DEBUG: set protection @%i for range @%lx - @%lx containing addr=%p\n",
+	      prot,(long unsigned int)page_address(addr),(long unsigned int)addr+sizeof(T), (void*)addr);
 #endif
   return (rc == 0 ? lProtected : 0);
 }

File src/PageAccessControl.cxx

 	m_protected.push_back(Entry(pageAddr,lenProt, pageProt, 0));
 	m_protectedIsSorted=false; //FIXME we should use a mapvector
 #ifdef DEBUG
-	printf("PageAccessControl::protectPage DEBUG: set protection %i for page range %p - 0x%x containing address range=%p - 0x%x\n",
+	printf("PageAccessControl::protectPage DEBUG: set protection %i for page range %p - 0x%lx containing address range=%p - 0x%lx\n",
 	       prot,
 	       pageAddr, 
-	       nextUnprot - 1, 
+	       (long unsigned int)(nextUnprot - 1), 
 	       addr,
-	       nextProt -1 );
+	       (long unsigned int)(nextProt -1) );
 #endif
       }
     } else rc=0;

File src/page_access.cxx

     int rc=mprotect(page_address(addr), PAGESIZE, prot);
     if (rc) printf("page_protect WARNING: mprotect heap failed for void *address %p\n", addr);
 #ifdef DEBUG
-    else printf("page_protect DEBUG: set protection @%i for range @%x - @%x containing void* addr=%p\n",
-		prot,(size_t)page_address(addr), 
-		(size_t)page_address(addr) + PAGESIZE, addr);
+    else printf("page_protect DEBUG: set protection @%i for range @%lx - @%lx containing void* addr=%p\n",
+		prot,(long unsigned int)page_address(addr), 
+		(long unsigned int)page_address(addr) + PAGESIZE, addr);
 #endif
     return rc;
   }