From 5f7a7543d3cb9cf39d82d12a95566ab9c381dd53 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 14 Aug 2008 17:31:22 +0000 Subject: [PATCH] Make dbpr print DBF_NOACCESS pointer fields nicely (on little-endian CPUs). --- src/db/dbTest.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/db/dbTest.c b/src/db/dbTest.c index 1b909f4c5..759870020 100644 --- a/src/db/dbTest.c +++ b/src/db/dbTest.c @@ -1025,21 +1025,24 @@ static int dbpr_report( &paddr->precord->time); sprintf(pmsg, "%s: %s", pfield_name, time_buf); dbpr_msgOut(pMsgBuff, tab_size); - } else { /* just print field in hex */ - char * pchar = (char *)(pfield); - char temp_buf[42]; + } else if (pdbFldDes->size == sizeof(void *) && + strchr(pdbFldDes->extra, '*')) { + /* Special for pointers, needed on little-endian CPUs */ + sprintf(pmsg, "%s: %p", pfield_name, *(void **)pfield); + dbpr_msgOut(pMsgBuff, tab_size); + } else { /* just print field as hex bytes */ + unsigned char *pchar = (unsigned char *)pfield; + char temp_buf[61]; char *ptemp_buf = &temp_buf[0]; short n = pdbFldDes->size; short i; unsigned int value; - strcpy(ptemp_buf,"0x"); ptemp_buf+=2; - if(n>(sizeof(temp_buf)-2)/2) n = (sizeof(temp_buf)-2)/2; - for (i=0; i sizeof(temp_buf)/3) n = sizeof(temp_buf)/3; + for (i=0; i