Revision: 1544 Author: bvwelch Date: Wed Dec 16 18:41:42 2009 Log: fill unused data locations with zero, for bulletproofing and debugging.
http://code.google.com/p/jallib/source/detail?r=1544 Modified: /trunk/include/protocol/can_ascii.jal ======================================= --- /trunk/include/protocol/can_ascii.jal Tue Sep 15 20:25:48 2009 +++ /trunk/include/protocol/can_ascii.jal Wed Dec 16 18:41:42 2009 @@ -1,6 +1,7 @@ -- Title: ASCII encapsulation of CAN messages -- Author: William Welch Copyright (c) 2009, all rights reserved. --- Compiler: 2.4l +-- Sponsored by: Fiwihex www.fiwihex.com +-- Compiler: 2.4m -- -- This file is part of jallib (http://jallib.googlecode.com) -- Released under the ZLIB license (http://www.opensource.org/licenses/zlib-license.html) @@ -105,12 +106,16 @@ end if i = i + 1 - for data_len using j loop - var byte v - v = _ascii2bin( ascii_buf[i] ) << 4 - v = v | _ascii2bin( ascii_buf[i+1] ) - can_data[j] = v - i = i + 2 + for 8 using j loop + if j < data_len then + var byte v + v = _ascii2bin( ascii_buf[i] ) << 4 + v = v | _ascii2bin( ascii_buf[i+1] ) + can_data[j] = v + i = i + 2 + else + can_data[j] = 0 + end if end loop return 1 -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
