mirror of
https://github.com/fachat/xa65.git
synced 2025-03-18 05:29:30 +00:00
fix sign problem when length of internal line presentation got over
128...
This commit is contained in:
parent
90e08089d0
commit
1399e1071c
@ -680,11 +680,11 @@ static int pass2(void)
|
||||
while((ner_max==0 || ner<ner_max) && afile->mn.tmpe<afile->mn.tmpz)
|
||||
{
|
||||
// get the length of the entry (now two byte - need to handle the sign)
|
||||
l = afile->mn.tmp[afile->mn.tmpe++];
|
||||
l = 255 & afile->mn.tmp[afile->mn.tmpe++];
|
||||
l |= afile->mn.tmp[afile->mn.tmpe++] << 8;
|
||||
ll=l;
|
||||
|
||||
// printf("%p: l=%d first=%02x\n", afile->mn.tmp+afile->mn.tmpe-1, l, 0xff & afile->mn.tmp[afile->mn.tmpe]);
|
||||
//printf("%p: l=%d first=%02x\n", afile->mn.tmp+afile->mn.tmpe-1, l, 0xff & afile->mn.tmp[afile->mn.tmpe]);
|
||||
|
||||
if(!l)
|
||||
{
|
||||
@ -712,7 +712,6 @@ static int pass2(void)
|
||||
|
||||
/* t_p2_l() includes the listing call to do_listing() */
|
||||
er=t_p2_l(afile->mn.tmp+afile->mn.tmpe,&ll,&al);
|
||||
|
||||
if(er==E_NOLINE)
|
||||
{
|
||||
} else
|
||||
|
@ -166,6 +166,12 @@ static formatter_t *formatp = &def_format;
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
void list_flush() {
|
||||
if (listfp != NULL) {
|
||||
fflush(listfp);
|
||||
}
|
||||
}
|
||||
|
||||
void list_start(const char *formatname) {
|
||||
formatp = &def_format;
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
void list_start(char *formatname); //either NULL or "html"
|
||||
void list_end();
|
||||
|
||||
void list_flush(); // debug helper
|
||||
|
||||
void list_setfile(FILE *fp);
|
||||
void list_line(int l); /* set line number for the coming listing output */
|
||||
void list_filename(char *fname);/* set file name for the coming listing output */
|
||||
|
@ -1013,7 +1013,7 @@ fprintf(stderr, "guessing instruction length is %d\n", bl);
|
||||
|
||||
/* adjust length by token listing buffer length */
|
||||
#ifdef DEBUG_CONV
|
||||
printf("converted: (er=%d, t=%p, ll=%d):",er, t, *ll);
|
||||
printf("converted: (er=%d, t=%p, ll=%d, tlen=%d):",er, t, *ll, tlen);
|
||||
for(i=0;i<*ll;i++)
|
||||
printf("%02x,",t[i] & 0xff);
|
||||
printf("\n");
|
||||
@ -1078,7 +1078,8 @@ int t_p2_l(signed char *t, int *ll, int *al)
|
||||
if (tlen > l)
|
||||
{
|
||||
// that is corrupt data and should not happen
|
||||
printf("t_p2_l (ll=%d, t=%p):", *ll, t);
|
||||
list_flush();
|
||||
printf("corrupt: t_p2_l (l=%d, tlen=%d, ll=%d, t=%p):", l, tlen, *ll, t);
|
||||
for(int i=0;i<l;i++)
|
||||
printf("%02x,",t[i] & 0xff);
|
||||
printf("\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user