summaryrefslogtreecommitdiff
path: root/prtype.c
diff options
context:
space:
mode:
Diffstat (limited to 'prtype.c')
-rw-r--r--prtype.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/prtype.c b/prtype.c
index 1fb917d..ef7889a 100644
--- a/prtype.c
+++ b/prtype.c
@@ -126,8 +126,6 @@ static short CurrentLevel = 0;
void
SetIndentLevel(short which)
{
- short i;
-
if (which > MaxIndent)
which = MaxIndent;
if (which < 0)
@@ -137,7 +135,7 @@ SetIndentLevel(short which)
/* set the indent level to <which> */
/* -> set the Print Leader to <which> tabs */
- for (i = 0; i < which; i++)
+ for (short i = 0; i < which; i++)
Leader[i] = '\t';
Leader[which] = '\0';
CurrentLevel = which;
@@ -281,12 +279,9 @@ int
PrintSTR(const unsigned char *buf)
{
/* STR have the length (1 byte) then a string of CHAR8 */
- short n;
+ short n = IByte(buf++);
- short i;
-
- n = IByte(buf++);
- for (i = 0; i < n; i++)
+ for (short i = 0; i < n; i++)
fprintf(stdout, "%s", printrep(buf[i]));
return (n + 1);
}
@@ -761,7 +756,6 @@ PrintList(const unsigned char *buf,
long number, short ListType, const char *name)
{
long n;
- long i;
long sum;
if (number == 0)
@@ -773,7 +767,7 @@ PrintList(const unsigned char *buf,
ModifyIndentLevel(1);
sum = 0;
- for (i = 0; i < number; i++) {
+ for (long i = 0; i < number; i++) {
switch (TD[ListType].Type) {
case BUILTIN:
n = (*TD[ListType].PrintProc) (buf);
@@ -807,7 +801,6 @@ long
PrintListSTR(const unsigned char *buf, long number, const char *name)
{
long n;
- long i;
long sum;
if (number == 0)
@@ -819,7 +812,7 @@ PrintListSTR(const unsigned char *buf, long number, const char *name)
ModifyIndentLevel(1);
sum = 0;
- for (i = 0; i < number; i++) {
+ for (long i = 0; i < number; i++) {
fprintf(stdout, "%s", Leader);
n = PrintSTR(buf);
buf = buf + n;
@@ -842,7 +835,6 @@ int
PrintBytes(const unsigned char *buf, long number, const char *name)
{
/* print a list of BYTE -- 8-bit character */
- long i;
short column;
if (number == 0)
@@ -850,7 +842,7 @@ PrintBytes(const unsigned char *buf, long number, const char *name)
fprintf(stdout, "%s%20s: ", Leader, name);
column = SizeofLeader() + 25;
- for (i = 0; i < number; i++) {
+ for (long i = 0; i < number; i++) {
if (column > 80) {
if (Verbose < 2)
break;
@@ -877,13 +869,11 @@ PrintBytes(const unsigned char *buf, long number, const char *name)
int
PrintString8(const unsigned char *buf, int number, const char *name)
{
- short i;
-
if (number == 0)
return (0);
fprintf(stdout, "%s%20s: \"", Leader, name);
- for (i = 0; i < number; i++)
+ for (short i = 0; i < number; i++)
fprintf(stdout, "%s", printrep(buf[i]));
fprintf(stdout, "\"\n");
@@ -895,15 +885,12 @@ PrintString8(const unsigned char *buf, int number, const char *name)
int
PrintString16(const unsigned char *buf, int number, const char *name)
{
- long i;
- unsigned short c;
-
if (number == 0)
return (0);
fprintf(stdout, "%s%20s: \"", Leader, name);
- for (i = 0; i < number * 2; i += 2) {
- c = IChar2B(&buf[i]);
+ for (long i = 0; i < number * 2; i += 2) {
+ unsigned short c = IChar2B(&buf[i]);
fprintf(stdout, "%s", printrep(c));
}
fprintf(stdout, "\"\n");
@@ -914,7 +901,6 @@ PrintString16(const unsigned char *buf, int number, const char *name)
void
PrintTString8(const unsigned char *buf, long number, const char *name)
{
- long i;
int off;
if (number == 0)
@@ -924,7 +910,7 @@ PrintTString8(const unsigned char *buf, long number, const char *name)
if (TranslateText)
off = 0x20;
fprintf(stdout, "%s%20s: \"", Leader, name);
- for (i = 0; i < number; i++)
+ for (long i = 0; i < number; i++)
fprintf(stdout, "%s", printrep(buf[i] + off));
fprintf(stdout, "\"\n");
}
@@ -933,8 +919,6 @@ PrintTString8(const unsigned char *buf, long number, const char *name)
void
PrintTString16(const unsigned char *buf, long number, const char *name)
{
- long i;
- unsigned short c;
int off;
if (number == 0)
@@ -944,8 +928,8 @@ PrintTString16(const unsigned char *buf, long number, const char *name)
if (TranslateText)
off = 0x20;
fprintf(stdout, "%s%20s: \"", Leader, name);
- for (i = 0; i < number * 2; i += 2) {
- c = IChar2B(&buf[i]);
+ for (long i = 0; i < number * 2; i += 2) {
+ unsigned short c = IChar2B(&buf[i]);
fprintf(stdout, "%s", printrep(c + off));
}
fprintf(stdout, "\"\n");
@@ -1066,12 +1050,11 @@ PrintTextList16(const unsigned char *buf, int length, const char *name)
void
DumpHexBuffer(const unsigned char *buf, long n)
{
- long i;
- short column;
- char h[6]; /* one hex or octal character */
+ short column = 27 + SizeofLeader();
+
+ for (long i = 0; i < n; i++) {
+ char h[6]; /* one hex or octal character */
- column = 27 + SizeofLeader();
- for (i = 0; i < n; i++) {
/* get the hex representations */
sprintf(h, "%02x", (0xff & buf[i]));