--- lib/database/src/sb/SbTime.c++.orig	2003-07-12 08:40:53.000000000 +1000
+++ lib/database/src/sb/SbTime.c++	2010-12-02 13:42:27.000000000 +1100
@@ -190,52 +190,52 @@ SbTime::format(const char *fmt) const
 
 	      case 'D':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", tday);
+		s += sprintf(s, "%d", tday);
 		break;
 
 	      case 'H':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", thour);
+		s += sprintf(s, "%d", thour);
 		break;
 
 	      case 'M':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", tmin);
+		s += sprintf(s, "%d", tmin);
 		break;
 
 	      case 'S':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", tsec);
+		s += sprintf(s, "%d", tsec);
 		break;
 
 	      case 'I':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", tmilli);
+		s += sprintf(s, "%d", tmilli);
 		break;
 
 	      case 'U':
 		if (negative) *s++ = '-';
-		s += sprintf(s, "%ld", tmicro);
+		s += sprintf(s, "%d", tmicro);
 		break;
 
 	      case 'h':
-		s += sprintf(s, "%.2ld", rhour);
+		s += sprintf(s, "%.2d", rhour);
 		break;
 
 	      case 'm':
-		s += sprintf(s, "%.2ld", rmin);
+		s += sprintf(s, "%.2d", rmin);
 		break;
 
 	      case 's':
-		s += sprintf(s, "%.2ld", rsec);
+		s += sprintf(s, "%.2d", rsec);
 		break;
 
 	      case 'i':
-		s += sprintf(s, "%.3ld", rmilli);
+		s += sprintf(s, "%.3d", rmilli);
 		break;
 
 	      case 'u':
-		s += sprintf(s, "%.6ld", rmicro);
+		s += sprintf(s, "%.6d", rmicro);
 		break;
 
 	      default:
--- lib/database/src/so/SoBase.c++.orig	2000-08-15 22:56:17.000000000 +1000
+++ lib/database/src/so/SoBase.c++	2010-12-02 13:58:54.000000000 +1100
@@ -994,7 +994,7 @@ SoBase::writeAnnotation(SoOutput *out) c
 	out->write(" #");
 	if (out->getAnnotation() & SoOutput::ADDRESSES) {
 	    char buf[100];
-	    sprintf(buf, " %#x", this);
+	    sprintf(buf, " %p", this);
 	    out->write(buf);
 	}
 	if (out->getAnnotation() & SoOutput::REF_COUNTS
--- lib/database/src/so/SoNotification.c++.orig	2000-08-15 22:56:17.000000000 +1000
+++ lib/database/src/so/SoNotification.c++	2010-12-02 14:01:28.000000000 +1100
@@ -98,7 +98,7 @@ SoNotRec::print(FILE *fp) const
     if (fp == NULL)
 	fp = stdout;
 
-    fprintf(fp, "\tSoNotRec @%#x: type %s, base %#x", this, typeName, base);
+    fprintf(fp, "\tSoNotRec @%p: type %s, base %p", this, typeName, base);
 
     if (base != NULL) {
 	const char *baseTypeName = base->getTypeId().getName().getString();
@@ -199,6 +199,6 @@ SoNotList::print(FILE *fp) const
 	rec = rec->getPrevious();
     } while (rec != NULL);
 
-    fprintf(fp, "\tfirstAtNode = %#x, lastField = %#x\n",
+    fprintf(fp, "\tfirstAtNode = %p, lastField = %p\n",
 	    firstAtNode, lastField);
 }
--- lib/database/src/so/SoType.c++.orig	2003-07-12 08:40:53.000000000 +1000
+++ lib/database/src/so/SoType.c++	2010-12-02 14:22:46.000000000 +1100
@@ -331,7 +331,7 @@ SoType::fromName(SbName name)
     if (b == NULL)
 	return SoType::badType();
 
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
     SoType result = typeData[(int) ((unsigned long) b)].type;
 #else
     SoType result = typeData[(int)b].type;
--- lib/database/src/so/SoOutput.c++.orig	2001-09-25 10:45:35.000000000 +1000
+++ lib/database/src/so/SoOutput.c++	2010-12-02 14:27:05.000000000 +1100
@@ -878,7 +878,7 @@ SoOutput::write(short s)
 ////////////////////////////////////////////////////////////////////////
 {
     int32_t l = (int32_t)s;
-    WRITE_NUM(l, "%ld", convertInt32, int32_t);
+    WRITE_NUM(l, "%d", convertInt32, int32_t);
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -894,7 +894,7 @@ SoOutput::write(unsigned short s)
 ////////////////////////////////////////////////////////////////////////
 {
     uint32_t l = (uint32_t)s;
-    WRITE_NUM(l, "%#lx", convertInt32, int32_t);
+    WRITE_NUM(l, "%#x", convertInt32, int32_t);
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -1462,7 +1462,7 @@ SoOutput::findReference(const SoBase *ba
 
     // Generates a CC warning. Ho hum.
     if (refDict->find((unsigned long) base, ref))
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
         referenceId = (int) ((unsigned long) ref);
 #else
 	referenceId = (int)ref;
--- lib/database/src/so/SoTranscribe.c++.orig	2000-08-15 22:56:17.000000000 +1000
+++ lib/database/src/so/SoTranscribe.c++	2010-12-02 14:29:37.000000000 +1100
@@ -270,7 +270,7 @@ SoTranSender::addNodeRef(const SoNode *n
     // Convert the node pointer to a string
     char	s[16];
 
-    sprintf(s, "%#x", node);
+    sprintf(s, "%p", node);
 
     out->write(s);
 
@@ -364,7 +364,7 @@ SoTranReceiver::SoTranReceiver(SoGroup *
 
     // Add root to dictionaries with name for NULL, since that is how
     // the root is referred to.
-    sprintf(s, "%#x", NULL);
+    sprintf(s, "%p", (void *)NULL);
     SbName	name(s);
     addEntry(rootNode, name);
 
--- lib/interaction/src/draggers/SoDragger.c++.orig	2001-09-25 10:45:44.000000000 +1000
+++ lib/interaction/src/draggers/SoDragger.c++	2010-12-02 14:36:44.000000000 +1100
@@ -686,7 +686,7 @@ SoDragger::isTempPathToThisOk()
 		int indexInPath = tempPathToThis->getIndex(numFmHead+1);
 
 		int numKidsNow    = children->getLength();
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
 		int numKidsBefore = (int) ((long) (*tempPathNumKidsHack)[numFmHead]);
 #else
 		int numKidsBefore = (int) (*tempPathNumKidsHack)[numFmHead];
--- lib/database/src/so/errors/SoError.c++.orig	2000-08-15 22:56:19.000000000 +1000
+++ lib/database/src/so/errors/SoError.c++	2010-12-02 14:39:51.000000000 +1100
@@ -264,7 +264,7 @@ SoError::getBaseString(const SoBase *bas
 	str += "\"";
     }
 
-    sprintf(addrBuf, "%#x", base);
+    sprintf(addrBuf, "%p", base);
     str += " at address ";
     str += addrBuf;
 
--- lib/database/src/so/fields/SoField.c++.orig	2000-08-23 16:07:30.000000000 +1000
+++ lib/database/src/so/fields/SoField.c++	2010-12-02 14:42:48.000000000 +1100
@@ -1626,7 +1626,7 @@ SoField::write(SoOutput *out, const SbNa
 	    // Annotate if necessary
 	    if (out->getAnnotation() & SoOutput::ADDRESSES) {
 		char buf[100];
-		sprintf(buf, " # %#x", this);
+		sprintf(buf, " # %p", this);
 		out->write(buf);
 	    }
 	    out->write(out->isCompact() ? ' ' : '\n');
@@ -1694,7 +1694,7 @@ SoField::writeConnection(SoOutput *out) 
 	out->write(CONNECTION_CHAR);
 	if (out->getAnnotation()&SoOutput::ADDRESSES) {
 	    char buf[100];
-	    sprintf(buf, " # %#x", this);
+	    sprintf(buf, " # %p", this);
 	    out->write(buf);
 	}
 	out->write('\n');
@@ -1731,7 +1731,7 @@ SoField::writeConnection(SoOutput *out) 
 	    getConnectedField(f);
 	    ptr = f;
 	}
-	sprintf(buf, " # %#x", ptr);
+	sprintf(buf, " # %p", ptr);
 	out->write(buf);
     }
 
--- lib/nodekits/src/nodekits/SoNkCatalog.c++.orig	2001-09-25 10:45:46.000000000 +1000
+++ lib/nodekits/src/nodekits/SoNkCatalog.c++	2010-12-02 14:56:15.000000000 +1100
@@ -251,7 +251,7 @@ SoNodekitCatalogEntry::printCheck() cons
     if ( listPart ) {
 	fprintf( stdout, "listItemTypes = " );
 	for ( int i = 0; i < listItemTypes.getLength(); i++ ) {
-	    fprintf( stdout,"  %d  ", listItemTypes[i].getName().getString() );
+	    fprintf( stdout,"  %ld  ", (long)listItemTypes[i].getName().getString() );
 	}
 	fprintf( stdout, "\n" );
     }
@@ -336,7 +336,7 @@ SoNodekitCatalog::getPartNumber( const S
     void *castPNum;
 
     if ( partNameDict.find( (unsigned long) theName.getString(), castPNum ) )
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
 	return ( (int) ((long) castPNum) );  // System long
 #else
 	return ( (int) castPNum );
--- lib/nodekits/src/upgraders/SoV1NkCatalog.c++.orig	2001-09-25 10:45:47.000000000 +1000
+++ lib/nodekits/src/upgraders/SoV1NkCatalog.c++	2010-12-02 15:02:24.000000000 +1100
@@ -119,8 +119,8 @@ SoV1NodekitCatalogEntry::printCheck() co
     if ( listPart ) {
 	fprintf( stdout, "listItemTypes = " );
 	for ( int i = 0; i < listItemTypes.getLength(); i++ ) {
-	    fprintf( stdout,"  %d  ", 
-		     ((SoType *) listItemTypes[i])->getName().getString() );
+	    fprintf( stdout,"  %ld  ", 
+		     (long)((SoType *) listItemTypes[i])->getName().getString() );
 	}
 	fprintf( stdout, "\n" );
     }
@@ -330,7 +330,7 @@ SoV1NodekitCatalog::getPartNumber( const
     void *castPNum;
 
     if ( partNameDict.find( (unsigned long) theName.getString(), castPNum ) )
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
 	return ( (int) ((long) castPNum) );  // System long
 #else
 	return ( (int) castPNum );
--- libSoXt/src/SoXtRsrc.c++.orig	2001-09-25 10:45:48.000000000 +1000
+++ libSoXt/src/SoXtRsrc.c++	2010-12-02 15:08:32.000000000 +1100
@@ -145,7 +145,7 @@ SoXtResource::SoXtResource(Widget widget
     classList = new XrmQuark[listSize];
     for (q = 0, s = len - 1;
     	 s >= 0; q++, s--) {
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (_MIPS_SZPTR == 64 || __ia64 || __LP64__)
 	 nameList[q]  = (XrmQuark) ((long) nameplist[s]);
 	 classList[q] = (XrmQuark) ((long) classplist[s]);
 #else
