Hi,
I just noticed that the Python bindings generally manage to return a
zero-sized reply instead of throwing an exception, when something goes
wrong.
It turns out that somebody used size_t for signed values. OUCH.
The result is still somewhat broken ..:
>>> s=ow.Sensor("/1F.BCC604000000/aux/1D.82EA09000000")
>>> s.counters_A
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ow/__init__.py", line 334, in __getattr__
attr = owfs_get( self._attrs[ name ] )
File "ow/__init__.py", line 146, in _get
raise exUnknownSensor(path)
... since the sensor does exist (it's just the counters_* read error),
but it's a whole lot better than scribbling somewhere into memory and
returning a zero-sized reply. :-(
--- owfs/module/swig/ow.i
+++ owfs/module/swig/ow.i
@@ -85,7 +85,7 @@ static void getdir( struct one_wire_query * owq ) {
*buffer will be returned as NULL on error
*/
static void getval( struct one_wire_query * owq ) {
- size_t s = FullFileLength(PN(owq)) ;
+ ssize_t s = FullFileLength(PN(owq)) ;
if ( s <= 0 ) return ;
if ( (OWQ_buffer(owq) = malloc(s+1))==NULL ) return ;
OWQ_size(owq) = s ;
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Chinese saying: "He who speak with forked tongue, not need chopsticks."
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers