Fixed strreplace() in case the search string is empty

This commit is contained in:
Klaus Schmidinger
2025-06-18 08:44:47 +02:00
parent 7d60fb5fda
commit f305e7df37
3 changed files with 5 additions and 3 deletions

View File

@@ -3388,6 +3388,7 @@ Stefan Hofmann <stefan.hofmann@t-online.de>
for reporting missing setting the file name of the info file after renaming a recording for reporting missing setting the file name of the info file after renaming a recording
for adding '~' to the list of delimiters in cTextWrapper for adding '~' to the list of delimiters in cTextWrapper
for suggesting to delete old recording info before reading modified info file for suggesting to delete old recording info before reading modified info file
for fixing strreplace() in case the search string is empty
Stefan Blochberger <Stefan.Blochberger@gmx.de> Stefan Blochberger <Stefan.Blochberger@gmx.de>
for suggesting to automatically display the progress display whenever replay of a for suggesting to automatically display the progress display whenever replay of a

View File

@@ -10119,7 +10119,7 @@ Video Disk Recorder Revision History
- Now deleting old recording info before reading modified info file (suggested by - Now deleting old recording info before reading modified info file (suggested by
Stefan Hofmann). Stefan Hofmann).
2025-06-17: 2025-06-18:
- Fixed some misplaced 'override' keywords in the 'hello' and 'skincurses' plugins. - Fixed some misplaced 'override' keywords in the 'hello' and 'skincurses' plugins.
- cRecording now fetches priority, lifetime and framesPerSecond from cRecordingInfo. - cRecording now fetches priority, lifetime and framesPerSecond from cRecordingInfo.
@@ -10129,3 +10129,4 @@ Video Disk Recorder Revision History
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- Enabled manually turning subtitles on/off in 'after rewind' mode. - Enabled manually turning subtitles on/off in 'after rewind' mode.
- Limiting timeouts to a minimum of 3ms to avoid problems with polls and waits if timeout is 0. - Limiting timeouts to a minimum of 3ms to avoid problems with polls and waits if timeout is 0.
- Fixed strreplace() in case the search string is empty (thanks to Stefan Hofmann).

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 5.16 2025/06/17 20:32:06 kls Exp $ * $Id: tools.c 5.17 2025/06/18 08:44:47 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@@ -154,7 +154,7 @@ char *strreplace(char *s, char c1, char c2)
char *strreplace(char *s, const char *s1, const char *s2) char *strreplace(char *s, const char *s1, const char *s2)
{ {
if (!s || !s1 || !s2 || strcmp(s1, s2) == 0) if (!s || !s1 || !*s1 || !s2 || strcmp(s1, s2) == 0)
return s; return s;
char *q = s; char *q = s;
if (char *p = strstr(s, s1)) { if (char *p = strstr(s, s1)) {