This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


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

Re: RedBoot: load.c srecord input offset fix


On Thu, Apr 19, 2001 at 03:25:50PM -0500, Grant Edwards wrote:

> > The "offset" variable in load_srec_image() isn't incremented
> > properly (assuming its purpose is to keep track of the current
> > byte offset in the input stream).  My version of load.c has
> > diverged enough that I can't generate a usable patch, so I'll
> > summarize the changes:

Oops, the "discard rest of line" loop at the bottom of the main
while loop also needs to be fixed:


         default:
             printf("Invalid S-record at offset 0x%lx, type: %x\n", 
                    (unsigned long)offset, type);
             return;
         }
-        while ((c = (*getc)()) != '\n') offset++;
+        do {
+             c = (*getc)();
+             ++offset;
+        } while (c != '\n');
     }
 }

-- 
Grant Edwards
grante@visi.com


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