-/* $Id: drv_LCD2USB.c,v 1.1 2006/01/26 19:26:27 harbaum Exp $
+/* $Id: drv_LCD2USB.c,v 1.2 2006/01/28 15:36:17 harbaum Exp $
*
* driver for USB2LCD display interface
* see http://www.harbaum.org/till/lcd2usb for schematics
*
*
* $Log: drv_LCD2USB.c,v $
+ * Revision 1.2 2006/01/28 15:36:17 harbaum
+ * Fix: string termination bug in eval()
+ *
* Revision 1.1 2006/01/26 19:26:27 harbaum
* Added LCD2USB support
*
}
/* to increase performance, a little buffer is being used to */
-/* collect command bytes of the same type before transmissing them */
+/* collect command bytes of the same type before transmitting them */
#define BUFFER_MAX_CMD 4 /* current protocol supports up to 4 bytes */
int buffer_current_type = -1; /* nothing in buffer yet */
int buffer_current_fill = 0; /* -"- */
{
int pos;
+// printf("write %d/%d %s(%d)\n", row, col, data, len);
+
/* 16x4 Displays use a slightly different layout */
if (DCOLS == 16 && DROWS == 4) {
pos = (row % 2) * 64 + (row / 2) * 16 + col;
-/* $Id: evaluator.c,v 1.26 2006/01/21 09:40:20 reinelt Exp $
+/* $Id: evaluator.c,v 1.27 2006/01/28 15:36:18 harbaum Exp $
*
* expression evaluation
*
*
*
* $Log: evaluator.c,v $
+ * Revision 1.27 2006/01/28 15:36:18 harbaum
+ * Fix: string termination bug in eval()
+ *
* Revision 1.26 2006/01/21 09:40:20 reinelt
* Big Memory Leak in Evaluator fixed (thanks to Oliver Gehrke)
*
result->length = Tree->Result->length;
if (result->length >= 0) {
result->string = malloc(result->length+1);
- if (Tree->Result->string != NULL)
+ if (Tree->Result->string != NULL) {
strncpy(result->string, Tree->Result->string, result->length);
- else
+ result->string[result->length] = 0;
+ } else
result->string[0] = '\0';
} else {
result->string = NULL;