Changeset 70 for trunk/module-monitor.c

05/12/09 05:25:27 (12 years ago)

csctapi/io_serial.c : fix the serial port read/write wait routine to use select instead of poll

This make them compatible with Mac OS X and now oscamd works on OS X. The same code off course
still works on linux and other unix platforms. I let that code ran for 24h before commiting this code.
If you have any issue let me know and I'llr evert to poll for non compatible machines.

all the others : fix all the warning due to sign difference (mostly uchar versus char). This make the code compile

with -Werror on the more strict version of gcc (which is the case on OS X). I also noticed that in a lot of places
the code use a buffer defined as an uchar * ... and use strings functions (strnXXXX) where some memcpy/memcmp .. function
would have been preferable as we're suposedly manipulation a binary buffer. Anyway I fixed all of them and it now compile
without any warning or error on linux and OS X (and also probably on all the other unices but we will have to try before
adding -Werror on the other platform).

1 edited


  • trunk/module-monitor.c

    r56 r70  
    6666  for (account=cfg->account; (account) && (!auth); account=account->next)
    6767    if ((account->monlvl) &&
    68        (crc==crc32(0L, MD5(account->usr, strlen(account->usr), NULL), 16)))
     68       (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), NULL), 16)))
    6969    {
    7070      memcpy(client[cs_idx].ucrc, ucrc, 4);
    71       aes_set_key(MD5(account->pwd, strlen(account->pwd), NULL));
     71      aes_set_key((char *)MD5((unsigned char *)account->pwd, strlen(account->pwd), NULL));
    7272      if (cs_auth_client(account, NULL))
    7373        cs_exit(0);
    9797  l=boundary(4, l+5)+5;
    9898  memcpy(buf+1, client[idx].ucrc, 4);
    99   strcpy(buf+10, txt);
     99  strcpy((char *)buf+10, txt);
    100100  memcpy(buf+5, i2b(4, crc32(0L, buf+10, l-10)), 4);
    101101  aes_encrypt_idx(idx, buf+5, l-5);
    167167    monitor_check_ip();
    168168    buf[n]='\0';
    169     if ((p=strchr(buf, 10)) && (bpos=n-(p-buf)-1))
     169    if ((p=(uchar *)strchr((char *)buf, 10)) && (bpos=n-(p-buf)-1))
    170170    {
    171171      memcpy(bbuf, p+1, bpos);
    175175  }
    176176  buf[n]='\0';
    177   if (n=strlen(trim(buf)))
     177  if (n=strlen(trim((char *)buf)))
    178178    client[cs_idx].last=time((time_t *) 0);
    179179  return(n);
    405405  char *p;
    406406  if ((r_idx=cs_idx2ridx(idx))>=0)
    407     for (p=reader[r_idx].init_history; *p; p+=strlen(p)+1)
     407    for (p=(char *)reader[r_idx].init_history; *p; p+=strlen(p)+1)
    408408      monitor_send_details(p, pid);
    409409  else
    537537  client[cs_idx].typ='m';
    538538  while (((n=process_input(mbuf, sizeof(mbuf), cfg->cmaxidle))>=0) &&
    539            monitor_process_request(mbuf));
     539           monitor_process_request((char *)mbuf));
    540540  cs_disconnect_client();
Note: See TracChangeset for help on using the changeset viewer.