rem: buffersize += c;
add: buffersize += (unsigned int)(unsigned char)c;
context: static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p){  char id[8];  char sw[2];  char hw[2];  char buf[10];  char type;  char c;  int dev_supported = 0;  no_show_func_info();  /*   * Send some ESC to activate butterfly bootloader.  This is not needed   * for plain avr109 bootloaders but does not harm there either.   */  fprintf(stderr, "Connecting to programmer: ");  do {    putc('.', stderr);    butterfly_send(pgm, "\033", 1);    butterfly_drain(pgm, 0);    butterfly_send(pgm, "S", 1);    butterfly_recv(pgm, &c, 1);    if (c != '?') {        putc('\n', stderr);        /*         * Got a useful response, continue getting the programmer         * identifier. Programmer returns exactly 7 chars _without_         * the null.         */      id[0] = c;      butterfly_recv(pgm, &id[1], sizeof(id)-2);      id[sizeof(id)-1] = '\0';    }  } while (c == '?');  /* Get the HW and SW versions to see if the programmer is present. */  butterfly_send(pgm, "V", 1);  butterfly_recv(pgm, sw, sizeof(sw));  butterfly_send(pgm, "v", 1);  butterfly_recv(pgm, hw, 1);	/* first, read only _one_ byte */  if (hw[0]!='?') {    butterfly_recv(pgm, &hw[1], 1);/* now, read second byte */  };  /* Get the programmer type (serial or parallel). Expect serial. */  butterfly_send(pgm, "p", 1);  butterfly_recv(pgm, &type, 1);  fprintf(stderr, "Found programmer: Id = \"%s\"; type = %c\n", id, type);  fprintf(stderr, "    Software Version = %c.%c; ", sw[0], sw[1]);  if (hw[0]=='?') {    fprintf(stderr, "No Hardware Version given.\n");  } else {    fprintf(stderr, "Hardware Version = %c.%c\n", hw[0], hw[1]);  };  /* See if programmer supports autoincrement of address. */  butterfly_send(pgm, "a", 1);  butterfly_recv(pgm, &has_auto_incr_addr, 1);  if (has_auto_incr_addr == 'Y')      fprintf(stderr, "Programmer supports auto addr increment.\n");  /* Check support for buffered memory access, abort if not available */  butterfly_send(pgm, "b", 1);  butterfly_recv(pgm, &c, 1);  if (c != 'Y') {    fprintf(stderr,            "%s: error: buffered memory access not supported. Maybe it isn't\n"\            "a butterfly/AVR109 but a AVR910 device?\n", progname);    exit(1);  };  butterfly_recv(pgm, &c, 1);  buffersize = c<<8;  butterfly_recv(pgm, &c, 1);  buffersize += c;  fprintf(stderr,    "Programmer supports buffered memory access with buffersize=%i bytes.\n",     buffersize);  /* Get list of devices that the programmer supports. */  butterfly_send(pgm, "t", 1);  fprintf(stderr, "\nProgrammer supports the following devices:\n");  while (1) {    butterfly_recv(pgm, &c, 1);    if (c == 0)      break;    fprintf(stderr, "    Device code: 0x%02x\n", (unsigned int)(unsigned char)c);    /* FIXME: Need to lookup devcode and report the device. */    if (p->avr910_devcode == (int)(unsigned char)c)      dev_supported = 1;  };  fprintf(stderr,"\n");  if (!dev_supported) {    /* FIXME: if nothing matched, we should rather compare the device       signatures. */    fprintf(stderr,            "%s: error: selected device is not supported by programmer: %s\n",            progname, p->id);  }  /* Tell the programmer which part we selected. */  buf[0] = 'T';  buf[1] = p->avr910_devcode;  butterfly_send(pgm, buf, 2);  butterfly_vfy_cmd_sent(pgm, "select device");  if (dev_supported)      butterfly_enter_prog_mode(pgm);  return dev_supported? 0: -1;}