Print this page
10101 audio tools need smatch fixes

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/audio/audiorecord/audiorecord.c
          +++ new/usr/src/cmd/audio/audiorecord/audiorecord.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
       26 +/*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
       29 +
  26   30  /* Command-line audio record utility */
  27   31  
  28   32  #include <stdio.h>
  29   33  #include <libgen.h>
  30   34  #include <errno.h>
  31   35  #include <ctype.h>
  32   36  #include <math.h>
  33   37  #include <stdlib.h>
  34   38  #include <unistd.h>
  35   39  #include <string.h>
↓ open down ↓ 730 lines elided ↑ open up ↑
 766  770  
 767  771                  /*
 768  772                   * XXX bug alert: could have multiple "." in string
 769  773                   * and mess things up.
 770  774                   */
 771  775                  for (cp = s; *cp && (isdigit(*cp) || (*cp == '.')); cp++)
 772  776                          /* NOP */;
 773  777                  if (*cp != NULL) {
 774  778                          if ((*cp == 'k') || (*cp == 'K')) {
 775  779                                  drate *= 1000.0;
 776      -                        } else if ((*cp != 'h') || (*cp != 'H')) {
      780 +                        } else if ((*cp != 'h') && (*cp != 'H')) {
 777  781                                  /* bogus! */
 778  782                                  Error(stderr,
 779  783                                      MGET("invalid sample rate: %s\n"), s);
 780  784                                  return (1);
 781  785                          }
 782  786                  }
 783  787  
 784  788          }
 785  789  
 786  790          *rate = irint(drate);
 787  791          return (0);
 788  792  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX