File: portsmf-string-const.patch

package info (click to toggle)
audacity 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 44,240 kB
  • sloc: cpp: 182,841; ansic: 120,375; sh: 26,421; lisp: 7,495; makefile: 1,606; python: 240; xml: 104; perl: 31
file content (44 lines) | stat: -rw-r--r-- 1,677 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: lib-src/portsmf/strparse.cpp
===================================================================
RCS file: /cvsroot/audacity/lib-src/portsmf/strparse.cpp,v
retrieving revision 1.3
diff -u -r1.3 strparse.cpp
--- lib-src/portsmf/strparse.cpp	6 Aug 2008 17:57:54 -0000	1.3
+++ lib-src/portsmf/strparse.cpp	3 Sep 2008 07:10:44 -0000
@@ -48,10 +48,10 @@
 }
 
 
-char *escape_chars[] = {"\\n", "\\t", "\\\\", "\\r", "\\\""};
+static const char *const escape_chars[] = {"\\n", "\\t", "\\\\", "\\r", "\\\""};
 
 
-void string_escape(string &result, char *str, char *quote)
+void string_escape(string &result, const char *str, const char *quote)
 {
     int length = (int) strlen(str);
     if (quote[0]) {
@@ -59,8 +59,8 @@
     }
     for (int i = 0; i < length; i++) {
         if (!isalnum((unsigned char) str[i])) {
-            char *chars = "\n\t\\\r\"";
-            char *special = strchr(chars, str[i]);
+            const char *const chars = "\n\t\\\r\"";
+            const char *const special = strchr(chars, str[i]);
             if (special) {
                 result.append(escape_chars[special - chars]);
             } else {
Index: lib-src/portsmf/strparse.h
===================================================================
RCS file: /cvsroot/audacity/lib-src/portsmf/strparse.h,v
retrieving revision 1.2
diff -u -r1.2 strparse.h
--- lib-src/portsmf/strparse.h	6 Aug 2008 17:57:54 -0000	1.2
+++ lib-src/portsmf/strparse.h	3 Sep 2008 07:10:53 -0000
@@ -15,4 +15,4 @@
     void get_remainder(std::string &field);
 };
 
-void string_escape(std::string &result, char *s, char *quote);
+void string_escape(std::string &result, const char *s, const char *quote);