-rw-r--r-- | core/multimedia/opieplayer/modplug/sndfile.cpp | 5 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/tremor/block.c | 6 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/tremor/info.c | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/modplug/sndfile.cpp b/core/multimedia/opieplayer/modplug/sndfile.cpp index 1d0d610..799555c 100644 --- a/core/multimedia/opieplayer/modplug/sndfile.cpp +++ b/core/multimedia/opieplayer/modplug/sndfile.cpp | |||
@@ -1718,49 +1718,52 @@ void CSoundFile::CheckCPUUsage(UINT nCPU) | |||
1718 | UINT i=MAX_CHANNELS; | 1718 | UINT i=MAX_CHANNELS; |
1719 | while (i >= 8) | 1719 | while (i >= 8) |
1720 | { | 1720 | { |
1721 | i--; | 1721 | i--; |
1722 | if (Chn[i].nLength) | 1722 | if (Chn[i].nLength) |
1723 | { | 1723 | { |
1724 | Chn[i].nLength = Chn[i].nPos = 0; | 1724 | Chn[i].nLength = Chn[i].nPos = 0; |
1725 | nCPU -= 2; | 1725 | nCPU -= 2; |
1726 | if (nCPU < 94) break; | 1726 | if (nCPU < 94) break; |
1727 | } | 1727 | } |
1728 | } | 1728 | } |
1729 | } else | 1729 | } else |
1730 | if (nCPU > 90) | 1730 | if (nCPU > 90) |
1731 | { | 1731 | { |
1732 | m_dwSongFlags |= SONG_CPUVERYHIGH; | 1732 | m_dwSongFlags |= SONG_CPUVERYHIGH; |
1733 | } | 1733 | } |
1734 | } | 1734 | } |
1735 | 1735 | ||
1736 | 1736 | ||
1737 | BOOL CSoundFile::SetPatternName(UINT nPat, LPCSTR lpszName) | 1737 | BOOL CSoundFile::SetPatternName(UINT nPat, LPCSTR lpszName) |
1738 | //--------------------------------------------------------- | 1738 | //--------------------------------------------------------- |
1739 | { | 1739 | { |
1740 | char szName[MAX_PATTERNNAME] = ""; // changed from CHAR | 1740 | char szName[MAX_PATTERNNAME] = ""; // changed from CHAR |
1741 | if (nPat >= MAX_PATTERNS) return FALSE; | 1741 | if (nPat >= MAX_PATTERNS) return FALSE; |
1742 | if (lpszName) lstrcpyn(szName, lpszName, MAX_PATTERNNAME); | 1742 | if (lpszName) |
1743 | lstrcpyn(szName, lpszName, MAX_PATTERNNAME); | ||
1744 | else | ||
1745 | return FALSE; | ||
1743 | szName[MAX_PATTERNNAME-1] = 0; | 1746 | szName[MAX_PATTERNNAME-1] = 0; |
1744 | if (!m_lpszPatternNames) m_nPatternNames = 0; | 1747 | if (!m_lpszPatternNames) m_nPatternNames = 0; |
1745 | if (nPat >= m_nPatternNames) | 1748 | if (nPat >= m_nPatternNames) |
1746 | { | 1749 | { |
1747 | if (!lpszName[0]) return TRUE; | 1750 | if (!lpszName[0]) return TRUE; |
1748 | UINT len = (nPat+1)*MAX_PATTERNNAME; | 1751 | UINT len = (nPat+1)*MAX_PATTERNNAME; |
1749 | char *p = new char[len]; // changed from CHAR | 1752 | char *p = new char[len]; // changed from CHAR |
1750 | if (!p) return FALSE; | 1753 | if (!p) return FALSE; |
1751 | memset(p, 0, len); | 1754 | memset(p, 0, len); |
1752 | if (m_lpszPatternNames) | 1755 | if (m_lpszPatternNames) |
1753 | { | 1756 | { |
1754 | memcpy(p, m_lpszPatternNames, m_nPatternNames * MAX_PATTERNNAME); | 1757 | memcpy(p, m_lpszPatternNames, m_nPatternNames * MAX_PATTERNNAME); |
1755 | delete m_lpszPatternNames; | 1758 | delete m_lpszPatternNames; |
1756 | m_lpszPatternNames = NULL; | 1759 | m_lpszPatternNames = NULL; |
1757 | } | 1760 | } |
1758 | m_lpszPatternNames = p; | 1761 | m_lpszPatternNames = p; |
1759 | m_nPatternNames = nPat + 1; | 1762 | m_nPatternNames = nPat + 1; |
1760 | } | 1763 | } |
1761 | memcpy(m_lpszPatternNames + nPat * MAX_PATTERNNAME, szName, MAX_PATTERNNAME); | 1764 | memcpy(m_lpszPatternNames + nPat * MAX_PATTERNNAME, szName, MAX_PATTERNNAME); |
1762 | return TRUE; | 1765 | return TRUE; |
1763 | } | 1766 | } |
1764 | 1767 | ||
1765 | 1768 | ||
1766 | BOOL CSoundFile::GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize) const | 1769 | BOOL CSoundFile::GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize) const |
diff --git a/core/multimedia/opieplayer/vorbis/tremor/block.c b/core/multimedia/opieplayer/vorbis/tremor/block.c index 8949253..7b5531b 100644 --- a/core/multimedia/opieplayer/vorbis/tremor/block.c +++ b/core/multimedia/opieplayer/vorbis/tremor/block.c | |||
@@ -205,50 +205,52 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){ | |||
205 | 205 | ||
206 | v->pcm_returned=-1; | 206 | v->pcm_returned=-1; |
207 | v->granulepos=-1; | 207 | v->granulepos=-1; |
208 | v->sequence=-1; | 208 | v->sequence=-1; |
209 | ((private_state *)(v->backend_state))->sample_count=-1; | 209 | ((private_state *)(v->backend_state))->sample_count=-1; |
210 | 210 | ||
211 | return(0); | 211 | return(0); |
212 | } | 212 | } |
213 | 213 | ||
214 | int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ | 214 | int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ |
215 | _vds_init(v,vi); | 215 | _vds_init(v,vi); |
216 | vorbis_synthesis_restart(v); | 216 | vorbis_synthesis_restart(v); |
217 | 217 | ||
218 | return(0); | 218 | return(0); |
219 | } | 219 | } |
220 | 220 | ||
221 | void vorbis_dsp_clear(vorbis_dsp_state *v){ | 221 | void vorbis_dsp_clear(vorbis_dsp_state *v){ |
222 | int i; | 222 | int i; |
223 | if(v){ | 223 | if(v){ |
224 | vorbis_info *vi=v->vi; | 224 | vorbis_info *vi=v->vi; |
225 | codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL); | 225 | codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL); |
226 | private_state *b=(private_state *)v->backend_state; | 226 | private_state *b=(private_state *)v->backend_state; |
227 | 227 | ||
228 | if(v->pcm){ | 228 | if(v->pcm){ |
229 | for(i=0;i<vi->channels;i++) | 229 | if (vi) { |
230 | if(v->pcm[i])_ogg_free(v->pcm[i]); | 230 | for(i=0;i<vi->channels;i++) |
231 | if(v->pcm[i])_ogg_free(v->pcm[i]); | ||
232 | } | ||
231 | _ogg_free(v->pcm); | 233 | _ogg_free(v->pcm); |
232 | if(v->pcmret)_ogg_free(v->pcmret); | 234 | if(v->pcmret)_ogg_free(v->pcmret); |
233 | } | 235 | } |
234 | 236 | ||
235 | /* free mode lookups; these are actually vorbis_look_mapping structs */ | 237 | /* free mode lookups; these are actually vorbis_look_mapping structs */ |
236 | if(ci){ | 238 | if(ci){ |
237 | for(i=0;i<ci->modes;i++){ | 239 | for(i=0;i<ci->modes;i++){ |
238 | int mapnum=ci->mode_param[i]->mapping; | 240 | int mapnum=ci->mode_param[i]->mapping; |
239 | int maptype=ci->map_type[mapnum]; | 241 | int maptype=ci->map_type[mapnum]; |
240 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); | 242 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); |
241 | } | 243 | } |
242 | } | 244 | } |
243 | 245 | ||
244 | if(b){ | 246 | if(b){ |
245 | if(b->mode)_ogg_free(b->mode); | 247 | if(b->mode)_ogg_free(b->mode); |
246 | _ogg_free(b); | 248 | _ogg_free(b); |
247 | } | 249 | } |
248 | 250 | ||
249 | memset(v,0,sizeof(*v)); | 251 | memset(v,0,sizeof(*v)); |
250 | } | 252 | } |
251 | } | 253 | } |
252 | 254 | ||
253 | /* Unlike in analysis, the window is only partially applied for each | 255 | /* Unlike in analysis, the window is only partially applied for each |
254 | block. The time domain envelope is not yet handled at the point of | 256 | block. The time domain envelope is not yet handled at the point of |
diff --git a/core/multimedia/opieplayer/vorbis/tremor/info.c b/core/multimedia/opieplayer/vorbis/tremor/info.c index 941695e..3499ae4 100644 --- a/core/multimedia/opieplayer/vorbis/tremor/info.c +++ b/core/multimedia/opieplayer/vorbis/tremor/info.c | |||
@@ -76,50 +76,50 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ | |||
76 | 76 | ||
77 | int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ | 77 | int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ |
78 | int i,count=0; | 78 | int i,count=0; |
79 | int taglen = strlen(tag)+1; /* +1 for the = we append */ | 79 | int taglen = strlen(tag)+1; /* +1 for the = we append */ |
80 | char *fulltag = (char *)alloca(taglen+1); | 80 | char *fulltag = (char *)alloca(taglen+1); |
81 | strcpy(fulltag,tag); | 81 | strcpy(fulltag,tag); |
82 | strcat(fulltag, "="); | 82 | strcat(fulltag, "="); |
83 | 83 | ||
84 | for(i=0;i<vc->comments;i++){ | 84 | for(i=0;i<vc->comments;i++){ |
85 | if(!tagcompare(vc->user_comments[i], fulltag, taglen)) | 85 | if(!tagcompare(vc->user_comments[i], fulltag, taglen)) |
86 | count++; | 86 | count++; |
87 | } | 87 | } |
88 | 88 | ||
89 | return count; | 89 | return count; |
90 | } | 90 | } |
91 | 91 | ||
92 | void vorbis_comment_clear(vorbis_comment *vc){ | 92 | void vorbis_comment_clear(vorbis_comment *vc){ |
93 | if(vc){ | 93 | if(vc){ |
94 | long i; | 94 | long i; |
95 | for(i=0;i<vc->comments;i++) | 95 | for(i=0;i<vc->comments;i++) |
96 | if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); | 96 | if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); |
97 | if(vc->user_comments)_ogg_free(vc->user_comments); | 97 | if(vc->user_comments)_ogg_free(vc->user_comments); |
98 | if(vc->comment_lengths)_ogg_free(vc->comment_lengths); | 98 | if(vc->comment_lengths)_ogg_free(vc->comment_lengths); |
99 | if(vc->vendor)_ogg_free(vc->vendor); | 99 | if(vc->vendor)_ogg_free(vc->vendor); |
100 | memset(vc,0,sizeof(*vc)); | ||
100 | } | 101 | } |
101 | memset(vc,0,sizeof(*vc)); | ||
102 | } | 102 | } |
103 | 103 | ||
104 | /* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. | 104 | /* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. |
105 | They may be equal, but short will never ge greater than long */ | 105 | They may be equal, but short will never ge greater than long */ |
106 | int vorbis_info_blocksize(vorbis_info *vi,int zo){ | 106 | int vorbis_info_blocksize(vorbis_info *vi,int zo){ |
107 | codec_setup_info *ci = (codec_setup_info *)vi->codec_setup; | 107 | codec_setup_info *ci = (codec_setup_info *)vi->codec_setup; |
108 | return ci ? ci->blocksizes[zo] : -1; | 108 | return ci ? ci->blocksizes[zo] : -1; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* used by synthesis, which has a full, alloced vi */ | 111 | /* used by synthesis, which has a full, alloced vi */ |
112 | void vorbis_info_init(vorbis_info *vi){ | 112 | void vorbis_info_init(vorbis_info *vi){ |
113 | memset(vi,0,sizeof(*vi)); | 113 | memset(vi,0,sizeof(*vi)); |
114 | vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info)); | 114 | vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info)); |
115 | } | 115 | } |
116 | 116 | ||
117 | void vorbis_info_clear(vorbis_info *vi){ | 117 | void vorbis_info_clear(vorbis_info *vi){ |
118 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | 118 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; |
119 | int i; | 119 | int i; |
120 | 120 | ||
121 | if(ci){ | 121 | if(ci){ |
122 | 122 | ||
123 | for(i=0;i<ci->modes;i++) | 123 | for(i=0;i<ci->modes;i++) |
124 | if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); | 124 | if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); |
125 | 125 | ||