Looks great. A few small things. On 08/05/2013 09:20 PM, Scott Talbert wrote: > /* > + * Special structures and methods for the Harmony Link > + */ > +void mh_get_value(char *buffer, const char *key, char *dest) > +{ > + char *start = NULL; > + char *end = NULL; > + int len; > + start = strstr(buffer, key); > + if (start) { > + start += strlen(key); > + end = strstr(start, "\n"); > + if (end) { > + len = end - start; > + if (len >= MH_STRING_LENGTH) > + start = NULL; > + } > + } > + if (start && end) > + strncpy(dest, start, len); > +}
OK, so I was going to ask if this was off-by-one because you don't account for the separating comma, but then I realized you always pass in 'key' WITH the comma. That's... not obvious. None of our other parsing functions work that way - nor do I think most parsing functions anywhere. web.cpp::GetTag expects just the name BeautifulSoup in python expects just tag names, etc. I would have this take the key, and then do: start += strlen(key) + 1; I would also add a comment to the top of this ... something to the effect of: /* * Given a buffer holding key-value pairs of the form * * key1,val1 * key2,val2 * * Will find the key passed in and copy the value on the other side of the * comma into dest. */ > + uint8_t pkts_to_send = wrlen / MH_MAX_DATA_SIZE; > + if ((wrlen % MH_MAX_DATA_SIZE) != 0) > + pkts_to_send++; > + pkts_to_send++; // count is always one more than the actual count That's odd. Any idea why we claim we're going to send one more than we do? -- Phil Dibowitz p...@ipom.com Open Source software and tech docs Insanity Palace of Metallica http://www.phildev.net/ http://www.ipom.com/ "Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind." - Dr. Seuss
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________ concordance-devel mailing list concordance-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/concordance-devel