diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_comms.h ZoneMinder-1.24.2-patch/src/zm_comms.h
--- ZoneMinder-1.24.2/src/zm_comms.h	2009-03-20 13:07:00.000000000 +0100
+++ ZoneMinder-1.24.2-patch/src/zm_comms.h	2009-07-04 16:10:53.000000000 +0200
@@ -320,7 +320,7 @@
 	{
 		ssize_t nBytes = ::send( mSd, msg.data(), msg.size(), 0 );
         if ( nBytes < 0 )
-            Debug( 1, "Send of string '%s' (%d bytes) on sd %d failed: %s", msg.c_str(), msg.size(), mSd, strerror(errno) );
+            Debug( 1, "Send of string '%s' (%zd bytes) on sd %d failed: %s", msg.c_str(), msg.size(), mSd, strerror(errno) );
 		return( nBytes );
 	}
 	virtual int recv( std::string &msg ) const
@@ -329,7 +329,11 @@
         int nBytes = 0;
 		if ( (nBytes = ::recv( mSd, buffer, sizeof(buffer), 0 )) < 0 )
         {
+#ifdef __x86_64__
+            Debug( 1, "Recv of %lu bytes max to string on sd %d failed: %s", sizeof(buffer), mSd, strerror(errno) );
+#else
             Debug( 1, "Recv of %d bytes max to string on sd %d failed: %s", sizeof(buffer), mSd, strerror(errno) );
+#endif
             return( nBytes );
         }
         buffer[nBytes] = '\0';
@@ -342,7 +346,7 @@
         int nBytes = 0;
 		if ( (nBytes = ::recv( mSd, buffer, sizeof(buffer), 0 )) < 0 )
         {
-            Debug( 1, "Recv of %d bytes max to string on sd %d failed: %s", maxLen, mSd, strerror(errno) );
+            Debug( 1, "Recv of %zd bytes max to string on sd %d failed: %s", maxLen, mSd, strerror(errno) );
             return( nBytes );
         }
         buffer[nBytes] = '\0';
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_event.cpp ZoneMinder-1.24.2-patch/src/zm_event.cpp
--- ZoneMinder-1.24.2/src/zm_event.cpp	2009-05-08 15:47:19.000000000 +0200
+++ ZoneMinder-1.24.2-patch/src/zm_event.cpp	2009-07-04 16:11:25.000000000 +0200
@@ -315,7 +315,7 @@
         }
         else
         {
-            Error( "Incomplete frame write: %d of %d bytes written", writev_result, writev_size );
+            Error( "Incomplete frame write: %zd of %zd bytes written", writev_result, writev_size );
             close( sd );
             sd = -1;
         }
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_image.cpp ZoneMinder-1.24.2-patch/src/zm_image.cpp
--- ZoneMinder-1.24.2/src/zm_image.cpp	2009-05-25 20:04:00.000000000 +0200
+++ ZoneMinder-1.24.2-patch/src/zm_image.cpp	2009-07-04 16:31:45.000000000 +0200
@@ -776,7 +776,8 @@
 
 		while( pdest < (buffer+size) )
 		{
-			*pdest++ = (*blend_ptr)[*pdest][*psrc++];
+			*pdest = (*blend_ptr)[*pdest][*psrc++];
+			pdest++;
 		}
 	}
 	else
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_jpeg.c ZoneMinder-1.24.2-patch/src/zm_jpeg.c
--- ZoneMinder-1.24.2/src/zm_jpeg.c	2009-03-20 13:07:00.000000000 +0100
+++ ZoneMinder-1.24.2-patch/src/zm_jpeg.c	2009-07-04 16:37:11.000000000 +0200
@@ -18,6 +18,7 @@
 */ 
 
 #include <unistd.h>
+#include <stdlib.h>
 
 #include "zm_jpeg.h"
 #include "zm_debug.h"
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_rtp_ctrl.cpp ZoneMinder-1.24.2-patch/src/zm_rtp_ctrl.cpp
--- ZoneMinder-1.24.2/src/zm_rtp_ctrl.cpp	2009-05-28 10:47:59.000000000 +0200
+++ ZoneMinder-1.24.2-patch/src/zm_rtp_ctrl.cpp	2009-07-04 16:45:47.000000000 +0200
@@ -91,7 +91,7 @@
             ssize_t contentLen = packetLen - sizeof(rtcpPacket->header);
             while ( contentLen )
             {
-                Debug( 5, "RTCP CL: %d", contentLen );
+                Debug( 5, "RTCP CL: %zd", contentLen );
                 U32 ssrc = ntohl(rtcpPacket->body.sdes.srcN);
 
                 Debug( 5, "RTCP Got SDES (%lx), %d items", ssrc, count );
@@ -307,7 +307,7 @@
             if ( UdpInetSocket *socket = dynamic_cast<UdpInetSocket *>(*iter) )
             {
                 ssize_t nBytes = socket->recv( buffer, sizeof(buffer) );
-                Debug( 4, "Read %d bytes on sd %d", nBytes, socket->getReadDesc() );
+                Debug( 4, "Read %zd bytes on sd %d", nBytes, socket->getReadDesc() );
 
                 if ( nBytes )
                 {
@@ -318,7 +318,11 @@
                         unsigned char *bufferPtr = buffer;
                         bufferPtr += generateRr( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) );
                         bufferPtr += generateSdes( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) );
+#ifdef __x86_64__
+                        Debug( 4, "Sending %lu bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() );
+#else
                         Debug( 4, "Sending %d bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() );
+#endif
                         if ( (nBytes = rtpCtrlServer.send( buffer, bufferPtr-buffer )) < 0 )
                             Error( "Unable to send: %s", strerror( errno ) );
                         //Debug( 4, "Sent %d bytes on sd %d", nBytes, rtpCtrlServer.getWriteDesc() );
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_rtsp.cpp ZoneMinder-1.24.2-patch/src/zm_rtsp.cpp
--- ZoneMinder-1.24.2/src/zm_rtsp.cpp	2009-05-28 10:47:59.000000000 +0200
+++ ZoneMinder-1.24.2-patch/src/zm_rtsp.cpp	2009-07-04 16:55:39.000000000 +0200
@@ -69,7 +69,7 @@
 {
     if ( mRtspSocket.recv( response ) < 0 )
         Error( "Recv failed; %s", strerror(errno) );
-    Debug( 2, "Received RTSP response: %s (%d bytes)", response.c_str(), response.size() );
+    Debug( 2, "Received RTSP response: %s (%zd bytes)", response.c_str(), response.size() );
     float respVer = 0;
     int respCode = -1;
     char respText[BUFSIZ];
@@ -81,7 +81,7 @@
         }
         else
         {
-            Error( "Response parse failure, %d bytes follow", response.size() );
+            Error( "Response parse failure, %zd bytes follow", response.size() );
             if ( response.size() )
                 Hexdump( ZM_DBG_ERR, response.data(), min(response.size(),16) );
         }
@@ -243,7 +243,7 @@
             return( -1 );
         }
 
-        Debug( 2, "Received HTTP response: %s (%d bytes)", response.c_str(), response.size() );
+        Debug( 2, "Received HTTP response: %s (%zd bytes)", response.c_str(), response.size() );
         float respVer = 0;
         int respCode = -1;
         char respText[256];
@@ -255,7 +255,7 @@
             }
             else
             {
-                Error( "Response parse failure, %d bytes follow", response.size() );
+                Error( "Response parse failure, %zd bytes follow", response.size() );
                 if ( response.size() )
                     Hexdump( ZM_DBG_ERR, response.data(), min(response.size(),16) );
             }
@@ -566,7 +566,7 @@
                 static char tempBuffer[10*BUFSIZ];
                 ssize_t nBytes = mRtspSocket.recv( tempBuffer, sizeof(tempBuffer) );
                 buffer.append( tempBuffer, nBytes );
-                Debug( 4, "Read %d bytes on sd %d, %d total", nBytes, mRtspSocket.getReadDesc(), buffer.size() );
+                Debug( 4, "Read %zd bytes on sd %d, %d total", nBytes, mRtspSocket.getReadDesc(), buffer.size() );
 
                 while( buffer.size() > 0 )
                 {
@@ -578,7 +578,11 @@
                         Debug( 4, "Got %d bytes left, expecting %d byte packet on channel %d", buffer.size(), len, channel );
                         if ( buffer.size() < (len+4) )
                         {
+#ifdef __x86_64__
+                            Debug( 4, "Missing %ld bytes, rereading", (len+4)-nBytes );
+#else
                             Debug( 4, "Missing %d bytes, rereading", (len+4)-nBytes );
+#endif
                             break;
                         }
                         if ( channel == remoteChannels[0] )
@@ -591,7 +595,7 @@
                         else if ( channel == remoteChannels[1] )
                         {
                             len = ntohs( *((unsigned short *)(buffer+2)) );
-                            Debug( 4, "Got %d bytes on control channel %d", nBytes, channel );
+                            Debug( 4, "Got %zd bytes on control channel %d", nBytes, channel );
                             rtpCtrlThread.recvPackets( buffer+4, len );
                         }
                         else
diff -U 3 -H -d -r -N -- ZoneMinder-1.24.2/src/zm_signal.cpp ZoneMinder-1.24.2-patch/src/zm_signal.cpp
--- ZoneMinder-1.24.2/src/zm_signal.cpp	2009-05-28 10:45:50.000000000 +0200
+++ ZoneMinder-1.24.2-patch/src/zm_signal.cpp	2009-07-04 16:53:14.000000000 +0200
@@ -87,7 +87,7 @@
 	// overwrite sigaction with caller's address
 	trace[1] = (void *)context.eip;
 #elif HAVE_STRUCT_SIGCONTEXT
-	Error( "Signal address is %p, no eip", context.cr2 );
+	Error( "Signal address is %ld, no eip", context.cr2 );
 
 	trace_size = backtrace( trace, TRACE_SIZE );
 #else // HAVE_STRUCT_SIGCONTEXT
