/src/opusfile/src/internal.c
Line | Count | Source |
1 | | /******************************************************************** |
2 | | * * |
3 | | * THIS FILE IS PART OF THE libopusfile SOFTWARE CODEC SOURCE CODE. * |
4 | | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
5 | | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
6 | | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
7 | | * * |
8 | | * THE libopusfile SOURCE CODE IS (C) COPYRIGHT 2012-2020 * |
9 | | * by the Xiph.Org Foundation and contributors https://xiph.org/ * |
10 | | * * |
11 | | ********************************************************************/ |
12 | | #ifdef HAVE_CONFIG_H |
13 | | #include "config.h" |
14 | | #endif |
15 | | |
16 | | #include "internal.h" |
17 | | |
18 | | #if defined(OP_ENABLE_ASSERTIONS) |
19 | 0 | void op_fatal_impl(const char *_str,const char *_file,int _line){ |
20 | 0 | fprintf(stderr,"Fatal (internal) error in %s, line %i: %s\n", |
21 | 0 | _file,_line,_str); |
22 | 0 | abort(); |
23 | 0 | } |
24 | | #endif |
25 | | |
26 | | /*A version of strncasecmp() that is guaranteed to only ignore the case of |
27 | | ASCII characters.*/ |
28 | 5.87k | int op_strncasecmp(const char *_a,const char *_b,int _n){ |
29 | 5.87k | int i; |
30 | 6.69k | for(i=0;i<_n;i++){ |
31 | 6.69k | int a; |
32 | 6.69k | int b; |
33 | 6.69k | int d; |
34 | 6.69k | a=_a[i]; |
35 | 6.69k | b=_b[i]; |
36 | 6.69k | if(a>='a'&&a<='z')a-='a'-'A'; |
37 | 6.69k | if(b>='a'&&b<='z')b-='a'-'A'; |
38 | 6.69k | d=a-b; |
39 | 6.69k | if(d)return d; |
40 | 6.69k | } |
41 | 0 | return 0; |
42 | 5.87k | } |