Commit f240a33b1b38d1ba34f6e40b5b790edeee2a6762

Authored by Imanol-Mikel Barba Sabariego
1 parent 4902e75a

Fixed formats (not fault of inttypes, but wrong scanf formats)

Showing 1 changed file with 11 additions and 11 deletions
@@ -72,12 +72,12 @@ void query() @@ -72,12 +72,12 @@ void query()
72 { 72 {
73 //TODO discard stdin 73 //TODO discard stdin
74 uint8_t end = 0; 74 uint8_t end = 0;
75 - unsigned int bpoint;  
76 - unsigned int mempos; 75 + uint16_t bpoint;
  76 + uint16_t mempos;
77 char input[100] = {0}; 77 char input[100] = {0};
78 char filename[32]; 78 char filename[32];
79 - unsigned int reg;  
80 - unsigned int value; 79 + uint8_t reg;
  80 + uint16_t value;
81 while(!end) 81 while(!end)
82 { 82 {
83 printf("\n> "); 83 printf("\n> ");
@@ -96,14 +96,14 @@ void query() @@ -96,14 +96,14 @@ void query()
96 switch (command) 96 switch (command)
97 { 97 {
98 case 'b': 98 case 'b':
99 - sscanf(input,"b %d\n",&bpoint);  
100 - fprintf(stderr,"Set breakpoint %d to %d",nbpoints,bpoint); 99 + sscanf(input,"b %hu\n",&bpoint);
  100 + fprintf(stderr,"Set breakpoint %hu to %hu",nbpoints,bpoint);
101 breakpoints[nbpoints] = bpoint; 101 breakpoints[nbpoints] = bpoint;
102 nbpoints = nbpoints + 1 % 0xFF; 102 nbpoints = nbpoints + 1 % 0xFF;
103 break; 103 break;
104 case 'd': 104 case 'd':
105 - sscanf(input,"d %d\n",&bpoint);  
106 - fprintf(stderr,"Deleted breakpoint %d",bpoint); 105 + sscanf(input,"d %hu\n",&bpoint);
  106 + fprintf(stderr,"Deleted breakpoint %hu",bpoint);
107 breakpoints[bpoint] = 0; 107 breakpoints[bpoint] = 0;
108 break; 108 break;
109 case 'c': 109 case 'c':
@@ -117,7 +117,7 @@ void query() @@ -117,7 +117,7 @@ void query()
117 print_regs(); 117 print_regs();
118 break; 118 break;
119 case 'm': 119 case 'm':
120 - sscanf(input,"m %X\n",&mempos); 120 + sscanf(input,"m %hX\n",&mempos);
121 fprintf(stderr,"%02X: %02x\n",mempos,mem[mempos]); 121 fprintf(stderr,"%02X: %02x\n",mempos,mem[mempos]);
122 break; 122 break;
123 case 's': 123 case 's':
@@ -131,8 +131,8 @@ void query() @@ -131,8 +131,8 @@ void query()
131 fprintf(stderr,"Loaded state as %s",filename); 131 fprintf(stderr,"Loaded state as %s",filename);
132 break; 132 break;
133 case 'w': 133 case 'w':
134 - sscanf(input,"w r%d %d\n",&reg,&value);  
135 - fprintf(stderr,"Setting r%d = %02X",reg,value); 134 + sscanf(input,"w r%hhu %hu\n",&reg,&value);
  135 + fprintf(stderr,"Setting r%hhu = %02X",reg,value);
136 regs[reg] = value; 136 regs[reg] = value;
137 break; 137 break;
138 case 'q': 138 case 'q':