diff options
author | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2011-03-13 12:46:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2011-03-19 19:02:09 +0100 |
commit | 5619c0602bc623adeddf3385ada8c742aaea9762 (patch) | |
tree | 189654d9da352bfe9bb47450d4446a5f0630ff20 /tools.c | |
parent | 58db02442b375f5669416e6e744a8325ed363f99 (diff) | |
download | vdr-patches-5619c0602bc623adeddf3385ada8c742aaea9762.tar.gz vdr-patches-5619c0602bc623adeddf3385ada8c742aaea9762.tar.bz2 |
Version 1.7.17
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
- Fixed following symbolic links in RemoveFileOrDir() (cont'd) (thanks to
Steffen Barszus).
- Changed the description of cDevice::GetSTC() to make it mandatory for devices
that can replay.
- Removed the check for positive STC values from cDvbSubtitleConverter::Action().
- Added cString::operator=(const char *String) (suggested by Antti Seppälä).
- Some spelling fixes (thanks to Ville Skyttä).
- Passing package name and version to xgettext (thanks to Ville Skyttä).
- Made 'dist' target dependent on up to date *.po (thanks to Ville Skyttä).
- Added Language and fixed Language-Team header of *.po (thanks to Ville Skyttä).
- Updated the Lithuanian OSD texts (thanks to Valdemaras Pipiras).
- Fixed detecting frames on channels that broadcast with 50 or 60 fps.
This avoids artifacts during fast forward/rewind when replaying recordings from such
channels. To fix the index of existing recordings from such channels, just delete the
'index' file of the recording and VDR will generate a new one the next time you play it.
You should also change the line "F 25" to "F 50" in the 'info' file of that recording.
- Added support for "registration descriptor" to 'libsi' and using it in pat.c (thanks
to Rolf Ahrenberg).
- Fixed unjustified log entries about changed channel pids (reported by Derek Kelly).
- Added an include of VDR's 'Make.global' to libsi's Makefile (thanks to Rolf
Ahrenberg).
- Removed displaying the "contents" information from the "Classic VDR" and
"ST:TNG Panels" skins, because it is often wrong and nothing but irritating.
- Added typecasts to avoid gcc 4.5 warnings in switch statements on eKeys
variables where additional 'k_...' flags are used.
- Fixed inclusion of <stdarg.h> (thanks to Henning Heinold).
- Changed "frame duration" to "frame rate" in vdr.5 (reported by Tobias Grimm).
- Removing a cRemote from the Remotes list in case its initialization failed (thanks
to Dominik Strasser).
- Added LDFLAGS to the linker calls in the Makefiles (thanks to Joerg Bornkessel and
Paul Menzel).
- Now updating the 'frames per second' data in the list of recordings when a new
recording is started that has a frame rate other than the default.
- The include path to the freetype2 header files is now retrieved via a call to
'pkg-config --cflags freetype2' (suggested by Andreas Oberritter).
- The OSD now has full TrueColor support. There can be several "pixmaps" that can
be overlayed with alpha blending. All existing skins should work out of the box
with the TrueColor OSD - the only exception being cOsd::GetBitmap(). Since the
TrueColor OSD doesn't use bitmaps, this function will return a dummy bitmap, which
may not be what the plugin expects. As long as this bitmap is only used for setting
the palette, there is no problem. However, any other operations on this bitmap will
have no effect. See the description of the cPixmap functions in osd.h for details
about the new functionalities.
The "ST:TNG Panels" skin has been enhanced to automatically use the TrueColor OSD
if available.
The "osddemo" plugin has been extended to show some of the possibilities of the
TrueColor OSD if it is run on a system that actually provides TrueColor support.
Thanks to Reinhard Nissl for some valuable input, help with debugging, and an
implementation of the AlphaBlend() function.
- Updated the Slovakian language texts (thanks to Milan Hrala).
- Added Serbian language texts (thanks to Milan Cvijanovic).
- Fixed reallocating memory in the "pictures" plugin (reported by Paul Menzel, with
input from Oliver Endriss).
- Fixed reallocating memory in cTsToPes::PutTs() (suggested by Oliver Endriss).
- Now checking the result of all realloc() calls.
- Fixed setting up the 'Recordings' menu in case there are several recordings
with exactly the same name (reported by Marcus Hilbrich).
- Setting the audio type of language descriptors to 0x00 in the PAT/PMT generator
(thanks to Anssi Hannula).
- Changed the compiler optimization flag to -O3, which gives quite a performance
boost in the AlphaBlend() function.
- While replaying, the editing marks are now updated every 10 seconds (based on a
patch from Manuel Reimer).
- Now reducing the thread and I/O priority cCuttingThread::Action() to make the
foreground process more responsive (suggested by Frank Neumann).
- Removed checking for minimum line length of 21 characters in the LIRC receiver code
(reported by Gerald Dachs).
- Updated the Romanian OSD texts (thanks to Lucian Muresan).
- Now storing the original display size when handling DVB subtitles (thanks to
Reinhard Nissl).
- The original display size of subtitles is now used to scale them properly when
displaying them on an HD OSD.
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 71 |
1 files changed, 53 insertions, 18 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 2.8 2010/08/29 15:03:08 kls Exp $ + * $Id: tools.c 2.12 2011/02/25 14:58:31 kls Exp $ */ #include "tools.h" @@ -18,7 +18,6 @@ extern "C" { #include <jpeglib.h> #undef boolean } -#include <stdarg.h> #include <stdlib.h> #include <sys/time.h> #include <sys/vfs.h> @@ -157,8 +156,14 @@ char *strreplace(char *s, const char *s1, const char *s2) int l = strlen(s); int l1 = strlen(s1); int l2 = strlen(s2); - if (l2 > l1) - s = (char *)realloc(s, l + l2 - l1 + 1); + if (l2 > l1) { + if (char *NewBuffer = (char *)realloc(s, l + l2 - l1 + 1)) + s = NewBuffer; + else { + esyslog("ERROR: out of memory"); + return s; + } + } char *sof = s + of; if (l2 != l1) memmove(sof + l2, sof + l1, l - of - l1 + 1); @@ -368,7 +373,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks) cString buffer = AddDirectory(FileName, e->d_name); if (FollowSymlinks) { struct stat st2; - if (stat(buffer, &st2) == 0) { + if (lstat(buffer, &st2) == 0) { if (S_ISLNK(st2.st_mode)) { int size = st2.st_size + 1; char *l = MALLOC(char, size); @@ -377,14 +382,12 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks) if (errno != EINVAL) LOG_ERROR_STR(*buffer); } - else if (n < size) { + else { l[n] = 0; dsyslog("removing %s", l); if (remove(l) < 0) LOG_ERROR_STR(l); } - else - esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size); free(l); } } @@ -822,8 +825,15 @@ const char *cCharSetConv::Convert(const char *From, char *To, size_t ToLength) size_t FromLength = strlen(From); char *ToPtr = To; if (!ToPtr) { - length = max(length, FromLength * 2); // some reserve to avoid later reallocations - result = (char *)realloc(result, length); + int NewLength = max(length, FromLength * 2); // some reserve to avoid later reallocations + if (char *NewBuffer = (char *)realloc(result, NewLength)) { + length = NewLength; + result = NewBuffer; + } + else { + esyslog("ERROR: out of memory"); + return From; + } ToPtr = result; ToLength = length; } @@ -839,8 +849,15 @@ const char *cCharSetConv::Convert(const char *From, char *To, size_t ToLength) // The result buffer is too small, so increase it: size_t d = ToPtr - result; size_t r = length / 2; - length += r; - Converted = result = (char *)realloc(result, length); + int NewLength = length + r; + if (char *NewBuffer = (char *)realloc(result, NewLength)) { + length = NewLength; + Converted = result = NewBuffer; + } + else { + esyslog("ERROR: out of memory"); + return From; + } ToLength += r; ToPtr = result + d; } @@ -887,6 +904,13 @@ cString &cString::operator=(const cString &String) return *this; } +cString &cString::operator=(const char *String) +{ + free(s); + s = String ? strdup(String) : NULL; + return *this; +} + cString &cString::Truncate(int Index) { int l = strlen(s); @@ -1025,15 +1049,22 @@ static boolean JpegCompressEmptyOutputBuffer(j_compress_ptr cinfo) tJpegCompressData *jcd = (tJpegCompressData *)cinfo->client_data; if (jcd) { int Used = jcd->size; - jcd->size += JPEGCOMPRESSMEM; - jcd->mem = (uchar *)realloc(jcd->mem, jcd->size); + int NewSize = jcd->size + JPEGCOMPRESSMEM; + if (uchar *NewBuffer = (uchar *)realloc(jcd->mem, NewSize)) { + jcd->size = NewSize; + jcd->mem = NewBuffer; + } + else { + esyslog("ERROR: out of memory"); + return false; + } if (jcd->mem) { cinfo->dest->next_output_byte = jcd->mem + Used; cinfo->dest->free_in_buffer = jcd->size - Used; - return TRUE; + return true; } } - return FALSE; + return false; } static void JpegCompressTermDestination(j_compress_ptr cinfo) @@ -1042,8 +1073,12 @@ static void JpegCompressTermDestination(j_compress_ptr cinfo) if (jcd) { int Used = cinfo->dest->next_output_byte - jcd->mem; if (Used < jcd->size) { - jcd->size = Used; - jcd->mem = (uchar *)realloc(jcd->mem, jcd->size); + if (uchar *NewBuffer = (uchar *)realloc(jcd->mem, Used)) { + jcd->size = Used; + jcd->mem = NewBuffer; + } + else + esyslog("ERROR: out of memory"); } } } |