This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Const valprint's print_* functions


FYI,

committed,
Andrew
2005-01-28  Andrew Cagney  <cagney@gnu.org>

	* valprint.h (print_octal_chars, print_char_chars)
	(print_hex_chars, print_decimal_chars, print_binary_chars): Make
	buffer a const bfd_byte.
	* valprint.c (print_binary_chars, print_octal_chars)
	(print_decimal_chars, print_hex_chars, print_char_chars): Make
	"valaddr"buffer a const bfd_byte, ditto for local variables
	referencing that buffer.

Index: valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.35
diff -p -u -r1.35 valprint.c
--- valprint.c	12 Sep 2004 16:13:04 -0000	1.35
+++ valprint.c	28 Jan 2005 16:19:18 -0000
@@ -344,13 +344,13 @@ print_floating (char *valaddr, struct ty
 }
 
 void
-print_binary_chars (struct ui_file *stream, unsigned char *valaddr,
+print_binary_chars (struct ui_file *stream, const bfd_byte *valaddr,
 		    unsigned len)
 {
 
 #define BITS_IN_BYTES 8
 
-  unsigned char *p;
+  const bfd_byte *p;
   unsigned int i;
   int b;
 
@@ -404,9 +404,10 @@ print_binary_chars (struct ui_file *stre
  * Print it in octal on stream or format it in buf.
  */
 void
-print_octal_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len)
+print_octal_chars (struct ui_file *stream, const bfd_byte *valaddr,
+		   unsigned len)
 {
-  unsigned char *p;
+  const bfd_byte *p;
   unsigned char octa1, octa2, octa3, carry;
   int cycle;
 
@@ -551,7 +552,7 @@ print_octal_chars (struct ui_file *strea
  * Print it in decimal on stream or format it in buf.
  */
 void
-print_decimal_chars (struct ui_file *stream, unsigned char *valaddr,
+print_decimal_chars (struct ui_file *stream, const bfd_byte *valaddr,
 		     unsigned len)
 {
 #define TEN             10
@@ -568,7 +569,7 @@ print_decimal_chars (struct ui_file *str
 #define LOW_NIBBLE(  x ) ( (x) & 0x00F)
 #define HIGH_NIBBLE( x ) (((x) & 0x0F0) >> 4)
 
-  unsigned char *p;
+  const bfd_byte *p;
   unsigned char *digits;
   int carry;
   int decimal_len;
@@ -686,9 +687,10 @@ print_decimal_chars (struct ui_file *str
 /* VALADDR points to an integer of LEN bytes.  Print it in hex on stream.  */
 
 void
-print_hex_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len)
+print_hex_chars (struct ui_file *stream, const bfd_byte *valaddr,
+		 unsigned len)
 {
-  unsigned char *p;
+  const bfd_byte *p;
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
@@ -717,9 +719,10 @@ print_hex_chars (struct ui_file *stream,
    Omit any leading zero chars.  */
 
 void
-print_char_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len)
+print_char_chars (struct ui_file *stream, const bfd_byte *valaddr,
+		  unsigned len)
 {
-  unsigned char *p;
+  const bfd_byte *p;
 
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
Index: valprint.h
===================================================================
RCS file: /cvs/src/src/gdb/valprint.h,v
retrieving revision 1.5
diff -p -u -r1.5 valprint.h
--- valprint.h	27 Feb 2004 00:01:14 -0000	1.5
+++ valprint.h	28 Jan 2005 16:19:18 -0000
@@ -55,18 +55,18 @@ extern void val_print_array_elements (st
 extern void val_print_type_code_int (struct type *, char *,
 				     struct ui_file *);
 
-extern void print_binary_chars (struct ui_file *, unsigned char *,
+extern void print_binary_chars (struct ui_file *, const bfd_byte *,
 				unsigned int);
 
-extern void print_octal_chars (struct ui_file *, unsigned char *,
+extern void print_octal_chars (struct ui_file *, const bfd_byte *,
 			       unsigned int);
 
-extern void print_decimal_chars (struct ui_file *, unsigned char *,
+extern void print_decimal_chars (struct ui_file *, const bfd_byte *,
 				 unsigned int);
 
-extern void print_hex_chars (struct ui_file *, unsigned char *,
+extern void print_hex_chars (struct ui_file *, const bfd_byte *,
 			     unsigned int);
 
-extern void print_char_chars (struct ui_file *, unsigned char *,
+extern void print_char_chars (struct ui_file *, const bfd_byte *,
 			      unsigned int);
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]