[task][maybe] add optional limit parameter to getsz/putsz
Bug #1441507 reported by
Alexander Belchenko
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IntelHex |
Confirmed
|
Medium
|
Unassigned |
Bug Description
That's inspired by the idea about how to on serial number (as const char[]).
It would be nice to add optional limit parameter to getsz/putsz api, so users of such api can prevent themselves to shoot in the leg.
E.g.
def getsz(self, addr, limit=None):
if limit is not None and > 0 - read max of (limit-1) characters not including trailing zero. But expect it there. Maybe raise error if trailing zero not found within (limit) bytes.
def putsz(self, addr, s, limit=None):
if limit is not None and > 0 - write string only if it fits into limit bytes, including terminated zero character.
To post a comment you must log in.