Abzac / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Fix data types that are too small for string lengths #170

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From Bryan Jones via maillist on 2010/11/04:

A couple of minor nitpicks:

In string.py, lines 199-200:
    uint8_t pc1len;
    uint8_t pc2len;
should be
    uint16_t pc1len;
    uint16_t pc2len;
since the length of a string is a uint16_t.

Also, in img.c line 116:
        retval = img_findInPath(((pPmString_t)pname)->val,
                                ((pPmString_t)pname)->length,
                                *r_memspace, r_imgaddr);
Note that the string length is a uint16_t, but img_findInPath takes a uint8_t 
(see line 38):
img_findInPath(uint8_t *cname, uint8_t cnamelen, PmMemSpace_t memspace,
               uint8_t const **paddr)

I'm not sure which place to change on this one.

Original issue reported on code.google.com by dwhall...@gmail.com on 5 Nov 2010 at 2:52

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 5 Nov 2010 at 2:57

GoogleCodeExporter commented 9 years ago
r9d15d0d9d487
- Made src/lib/string.py's find() use proper 16-bit lengths.
- Added system test t370 which performs find() on a string of length > 256.
- Corrected img_findInPath() and mem_cmpn()'s cnamelen arg to use proper 16-bit 
length.

Original comment by dwhall...@gmail.com on 16 Nov 2010 at 3:55