[zaptel-commits] kpfleming: branch 1.4 r3662 - in /branches/1.4: adt_lec.c kb1ec.h mg2ec.h
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Fri Jan 11 14:22:28 CST 2008
Author: kpfleming
Date: Fri Jan 11 14:22:28 2008
New Revision: 3662
URL: http://svn.digium.com/view/zaptel?view=rev&rev=3662
Log:
apparently strcasecmp() is a fairly recent addition to the kernel, so use the older method of forcing the string to lowercase and using strcmp() instead for parameter parsing
Modified:
branches/1.4/adt_lec.c
branches/1.4/kb1ec.h
branches/1.4/mg2ec.h
Modified: branches/1.4/adt_lec.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/adt_lec.c?view=diff&rev=3662&r1=3661&r2=3662
==============================================================================
--- branches/1.4/adt_lec.c (original)
+++ branches/1.4/adt_lec.c Fri Jan 11 14:22:28 2008
@@ -25,6 +25,8 @@
#ifndef _ADT_LEC_C
#define _ADT_LEC_C
+#include <linux/ctype.h>
+
static inline void adt_lec_init_defaults(struct adt_lec_params *params, __u32 tap_length)
{
memset(params, 0, sizeof(*params));
@@ -34,9 +36,12 @@
static int adt_lec_parse_params(struct adt_lec_params *params, struct zt_echocanparams *ecp, struct zt_echocanparam *p)
{
unsigned int x;
+ char *c;
for (x = 0; x < ecp->param_count; x++) {
- if (!strcasecmp(p[x].name, "nlp_type")) {
+ for (c = p[x].name; *c; c++)
+ *c = tolower(*c);
+ if (!strcmp(p[x].name, "nlp_type")) {
switch (p[x].value) {
case ADT_LEC_NLP_OFF:
case ADT_LEC_NLP_MUTE:
@@ -48,9 +53,9 @@
default:
return -EINVAL;
}
- } else if (!strcasecmp(p[x].name, "nlp_thresh")) {
+ } else if (!strcmp(p[x].name, "nlp_thresh")) {
params->nlp_threshold = p[x].value;
- } else if (!strcasecmp(p[x].name, "nlp_suppress")) {
+ } else if (!strcmp(p[x].name, "nlp_suppress")) {
params->nlp_max_suppress = p[x].value;
} else {
return -EINVAL;
Modified: branches/1.4/kb1ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/kb1ec.h?view=diff&rev=3662&r1=3661&r2=3662
==============================================================================
--- branches/1.4/kb1ec.h (original)
+++ branches/1.4/kb1ec.h Fri Jan 11 14:22:28 2008
@@ -26,20 +26,12 @@
#ifndef _MARK2_ECHO_H
#define _MARK2_ECHO_H
-#ifdef __KERNEL__
#include <linux/kernel.h>
#include <linux/slab.h>
+#include <linux/ctype.h>
+
#define MALLOC(a) kmalloc((a), GFP_KERNEL)
#define FREE(a) kfree(a)
-#else
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <string.h>
-#include <math.h>
-#define MALLOC(a) malloc(a)
-#define FREE(a) free(a)
-#endif
/* Uncomment to provide summary statistics for overall echo can performance every 4000 samples */
/* #define MEC2_STATS 4000 */
@@ -536,6 +528,7 @@
int maxu;
size_t size;
unsigned int x;
+ char *c;
maxy = ecp->tap_length + DEFAULT_M;
maxu = DEFAULT_M;
@@ -565,7 +558,9 @@
#endif
for (x = 0; x < ecp->param_count; x++) {
- if (!strcasecmp(p[x].name, "aggressive")) {
+ for (c = p[x].name; *c; c++)
+ *c = tolower(*c);
+ if (!strcmp(p[x].name, "aggressive")) {
(*ec)->aggressive = p[x].value ? 1 : 0;
} else {
printk(KERN_WARNING "Unknown parameter supplied to KB1 echo canceler: '%s'\n", p[x].name);
Modified: branches/1.4/mg2ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mg2ec.h?view=diff&rev=3662&r1=3661&r2=3662
==============================================================================
--- branches/1.4/mg2ec.h (original)
+++ branches/1.4/mg2ec.h Fri Jan 11 14:22:28 2008
@@ -26,21 +26,12 @@
#ifndef _MG2_ECHO_H
#define _MG2_ECHO_H
-#ifdef __KERNEL__
#include <linux/kernel.h>
#include <linux/slab.h>
+#include <linux/ctype.h>
+
#define MALLOC(a) kmalloc((a), GFP_KERNEL)
#define FREE(a) kfree(a)
-#else
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <string.h>
-#include <math.h>
-#define MALLOC(a) malloc(a)
-#define FREE(a) free(a)
-#endif
-
#define ABS(a) abs(a!=-32768?a:-32767)
@@ -658,6 +649,7 @@
int maxu;
size_t size;
unsigned int x;
+ char *c;
maxy = ecp->tap_length + DEFAULT_M;
maxu = DEFAULT_M;
@@ -688,7 +680,9 @@
#endif
for (x = 0; x < ecp->param_count; x++) {
- if (!strcasecmp(p[x].name, "aggressive")) {
+ for (c = p[x].name; *c; c++)
+ *c = tolower(*c);
+ if (!strcmp(p[x].name, "aggressive")) {
(*ec)->aggressive = p[x].value ? 1 : 0;
} else {
printk(KERN_WARNING "Unknown parameter supplied to MG2 echo canceler: '%s'\n", p[x].name);
More information about the zaptel-commits
mailing list