summaryrefslogtreecommitdiff
path: root/Build/source/utils/songs/songs-2.17-PATCHES/patch-02-const
blob: 632dcf2f7c48eb8dfaec63cb8951845588fcb1b5 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
diff -ur songs-2.17.orig/src/songidx/authidx.c songs-2.17/src/songidx/authidx.c
--- songs-2.17.orig/src/songidx/authidx.c	2013-01-02 21:05:12.000000000 +0100
+++ songs-2.17/src/songidx/authidx.c	2013-12-20 13:18:55.000000000 +0100
@@ -55,9 +55,12 @@
 }
 WORDLIST;
 
-WORDLIST wl_and = { NULL, ws_lit("and") };
-WORDLIST wl_by = { NULL, ws_lit("by") };
-WORDLIST wl_unknown = { NULL, ws_lit("unknown") };
+WCHAR ws_and[] = ws_lit("and");
+WCHAR ws_by[] = ws_lit("by");
+WCHAR ws_unknown[] = ws_lit("unknown");
+WORDLIST wl_and = { NULL, ws_and };
+WORDLIST wl_by = { NULL, ws_by };
+WORDLIST wl_unknown = { NULL, ws_unknown };
 
 /* wl_insert(<wordlist>,<word>)
  *  Insert a word onto the head of a wordlist. */
@@ -333,10 +336,10 @@
   int arraysize, numauthors, i;
   WORDLIST *seplist=&wl_and, *afterlist=&wl_by, *ignorelist=&wl_unknown;
   SONGENTRY **authors;
-  WCHAR authorbuf[MAXLINELEN], *bp;
+  WCHAR authorbuf[MAXLINELEN];
   WCHAR songnumbuf[MAXLINELEN], linknamebuf[MAXLINELEN];
   WCHAR *thisnum, *thislink;
-  const WCHAR *auth;
+  const WCHAR *auth, *bp;
 
   fprintf(stderr, "songidx: Parsing author index data file %s...\n",
           fs->filename);
@@ -395,7 +398,7 @@
     ws_strcpy(thislink, linknamebuf);
 
     for (bp=authorbuf;
-         (auth=grabauthor((const WCHAR **) &bp, seplist, afterlist,
+         (auth=grabauthor(&bp, seplist, afterlist,
                           ignorelist)) != NULL;
          ++numauthors)
     {
diff -ur songs-2.17.orig/src/songidx/songsort.c songs-2.17/src/songidx/songsort.c
--- songs-2.17.orig/src/songidx/songsort.c	2013-04-24 07:19:20.000000000 +0200
+++ songs-2.17/src/songidx/songsort.c	2013-12-19 15:10:08.000000000 +0100
@@ -96,8 +96,8 @@
 {
   static WCHAR buf1[MAXLINELEN+1], *bp1;
   static WCHAR buf2[MAXLINELEN+1], *bp2;
-  const WCHAR *t1 = (*((const SONGENTRY **) s1))->title;
-  const WCHAR *t2 = (*((const SONGENTRY **) s2))->title;
+  const WCHAR *t1 = (*((SONGENTRY * const *) s1))->title;
+  const WCHAR *t2 = (*((SONGENTRY * const *) s2))->title;
   int diff;
 
   for (;;)
@@ -151,14 +151,14 @@
 
   /* If each corresponding word/number is identical, then sort alternate-
    * form entries (e.g., lyrics) after normal entries (e.g., titles). */
-  if (((*((const SONGENTRY **) s1))->title[0] == wc_asterisk)
-      && ((*((const SONGENTRY **) s2))->title[0] != wc_asterisk))
+  if (((*((SONGENTRY * const *) s1))->title[0] == wc_asterisk)
+      && ((*((SONGENTRY * const *) s2))->title[0] != wc_asterisk))
     return 1;
-  if (((*((const SONGENTRY **) s1))->title[0] != wc_asterisk)
-      && ((*((const SONGENTRY **) s2))->title[0] == wc_asterisk))
+  if (((*((SONGENTRY * const *) s1))->title[0] != wc_asterisk)
+      && ((*((SONGENTRY * const *) s2))->title[0] == wc_asterisk))
     return -1;
 
   /* If everything is the same, sort by the right-hand sides of the index
    * entries (e.g., the song or page numbers). */
-  return (*((const SONGENTRY **) s1))->idx - (*((const SONGENTRY **) s2))->idx;
+  return (*((SONGENTRY * const *) s1))->idx - (*((SONGENTRY * const *) s2))->idx;
 }
diff -ur songs-2.17.orig/src/songidx/titleidx.c songs-2.17/src/songidx/titleidx.c
--- songs-2.17.orig/src/songidx/titleidx.c	2013-01-02 21:06:28.000000000 +0100
+++ songs-2.17/src/songidx/titleidx.c	2013-12-20 13:22:35.000000000 +0100
@@ -49,8 +49,10 @@
 }
 PREFIX;
 
-PREFIX pre_A = { NULL, ws_lit("A") };
-PREFIX pre_defaults = { &pre_A, ws_lit("The") };
+WCHAR ws_A[] = ws_lit("A");
+WCHAR ws_The[] = ws_lit("The");
+PREFIX pre_A = { NULL, ws_A };
+PREFIX pre_defaults = { &pre_A, ws_The };
 
 /* freeprefixes(<list>)
  *   Free prefix list <list>. */