1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Made all font and image data 'const'

This commit is contained in:
Klaus Schmidinger 2006-02-05 13:55:58 +01:00
parent 978462168c
commit 7b97eb6e97
57 changed files with 71 additions and 69 deletions

View File

@ -1431,6 +1431,7 @@ Darren Salt <linux@youmustbejoking.demon.co.uk>
for suggesting to write grabbed images to the SVDRP connection encoded in base64
for suggesting to open the file handle in the SVDRP GRAB command in a way that
it won't follow symbolic links, and to canonicalize the file name
for making all font and image data 'const'
Sean Carlos <seanc@libero.it>
for translating OSD texts to the Italian language

View File

@ -4311,3 +4311,4 @@ Video Disk Recorder Revision History
(thanks to Rolf Ahrenberg).
- Renamed the Makefile target 'plugins-clean' to 'clean-plugins' (suggested by
Sebastian Frei).
- Made all font and image data 'const' (thanks to Darren Salt).

11
font.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: font.c 1.11 2005/01/14 13:25:35 kls Exp $
* $Id: font.c 1.12 2006/02/05 13:49:10 kls Exp $
*/
#include "config.h"
@ -35,9 +35,10 @@
#include "fontfix-iso8859-15.c"
#include "fontosd-iso8859-15.c"
#include "fontsml-iso8859-15.c"
// --- cFont -----------------------------------------------------------------
static void *FontData[eDvbCodeSize][eDvbFontSize] = {
static const void *const FontData[eDvbCodeSize][eDvbFontSize] = {
{ FontOsd_iso8859_1, FontFix_iso8859_1, FontSml_iso8859_1 },
{ FontOsd_iso8859_2, FontFix_iso8859_2, FontSml_iso8859_2 },
{ FontOsd_iso8859_5, FontFix_iso8859_5, FontSml_iso8859_5 },
@ -58,12 +59,12 @@ static const char *FontCode[eDvbCodeSize] = {
eDvbCode cFont::code = code_iso8859_1;
cFont *cFont::fonts[eDvbFontSize] = { NULL };
cFont::cFont(void *Data)
cFont::cFont(const void *Data)
{
SetData(Data);
}
void cFont::SetData(void *Data)
void cFont::SetData(const void *Data)
{
if (Data) {
height = ((tCharData *)Data)->height;
@ -112,7 +113,7 @@ void cFont::SetCode(eDvbCode Code)
}
}
void cFont::SetFont(eDvbFont Font, void *Data)
void cFont::SetFont(eDvbFont Font, const void *Data)
{
delete fonts[Font];
fonts[Font] = new cFont(Data ? Data : FontData[code][Font]);

8
font.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: font.h 1.11 2005/03/19 15:51:19 kls Exp $
* $Id: font.h 1.12 2006/02/05 13:46:36 kls Exp $
*/
#ifndef __FONT_H
@ -43,9 +43,9 @@ private:
const tCharData *data[NUMCHARS];
int height;
public:
cFont(void *Data);
cFont(const void *Data);
virtual ~cFont() {}
void SetData(void *Data);
void SetData(const void *Data);
virtual int Width(unsigned char c) const { return data[c]->width; }
///< Returns the width of the given character.
virtual int Width(const char *s) const;
@ -59,7 +59,7 @@ public:
const tCharData *CharData(unsigned char c) const { return data[c]; }
static bool SetCode(const char *Code);
static void SetCode(eDvbCode Code);
static void SetFont(eDvbFont Font, void *Data = NULL);
static void SetFont(eDvbFont Font, const void *Data = NULL);
static const cFont *GetFont(eDvbFont Font);
};

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_1[][28] = {
static const cFont::tPixelData FontFix_iso8859_1[][28] = {
{ // 32
15, 26,
0x00000000, // ...............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_13[][28] = {
static const cFont::tPixelData FontFix_iso8859_13[][28] = {
{ // 32
15, 26,
0x00000000, // ...............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_15[][28] = {
static const cFont::tPixelData FontFix_iso8859_15[][28] = {
{ // 32
15, 26,
0x00000000, // ...............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_2[][28] = {
static const cFont::tPixelData FontFix_iso8859_2[][28] = {
{ // 32
15, 26,
0x00000000, // ...............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_5[][26] = {
static const cFont::tPixelData FontFix_iso8859_5[][26] = {
{ // 32
15, 24,
0x00000000, // ...............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontFix_iso8859_7[][26] = {
static const cFont::tPixelData FontFix_iso8859_7[][26] = {
{ // 32
11, 24,
0x00000000, // ...........

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontOsd_iso8859_1[][29] = {
static const cFont::tPixelData FontOsd_iso8859_1[][29] = {
{ // 32
6, 27,
0x00000000, // ......

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontOsd_iso8859_13[][29] = {
static const cFont::tPixelData FontOsd_iso8859_13[][29] = {
{ // 32
6, 27,
0x00000000, // ......

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontOsd_iso8859_15[][29] = {
static const cFont::tPixelData FontOsd_iso8859_15[][29] = {
{ // 32
6, 27,
0x00000000, // ......

View File

@ -1,4 +1,3 @@
/*
* iso8859-2 modified iso8859-1 (Drazen Dupor 23.05.2004).
*
@ -10,7 +9,7 @@
*
*/
cFont::tPixelData FontOsd_iso8859_2[][29] = {
static const cFont::tPixelData FontOsd_iso8859_2[][29] = {
{ // 32
6, 27,
0x00000000, // ......

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontOsd_iso8859_5[][24] = {
static const cFont::tPixelData FontOsd_iso8859_5[][24] = {
{ // 32
6, 22,
0x00000000, // ......

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontOsd_iso8859_7[][27] = {
static const cFont::tPixelData FontOsd_iso8859_7[][27] = {
{ // 32
12, 25,
0x00000000, // ............

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_1[][24] = {
static const cFont::tPixelData FontSml_iso8859_1[][24] = {
{ // 32
5, 22,
0x00000000, // .....

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_13[][24] = {
static const cFont::tPixelData FontSml_iso8859_13[][24] = {
{ // 32
5, 22,
0x00000000, // .....

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_15[][24] = {
static const cFont::tPixelData FontSml_iso8859_15[][24] = {
{ // 32
5, 22,
0x00000000, // .....

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_2[][25] = {
static const cFont::tPixelData FontSml_iso8859_2[][25] = {
{ // 32
5, 23,
0x00000000, // .....

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_5[][27] = {
static const cFont::tPixelData FontSml_iso8859_5[][27] = {
{ // 32
5, 25,
0x00000000, // .....

View File

@ -1,4 +1,4 @@
cFont::tPixelData FontSml_iso8859_7[][22] = {
static const cFont::tPixelData FontSml_iso8859_7[][22] = {
{ // 32
9, 20,
0x00000000, // .........

View File

@ -371,7 +371,7 @@ main(int argc, char *argv[])
exit(1);
}
printf("%s[][%d] = {\n", varname, fontinfo->max_ascent + fontinfo->max_descent + 2);
printf("static const %s[][%d] = {\n", varname, fontinfo->max_ascent + fontinfo->max_descent + 2);
for (c = 32; c < 256; c++) {
getMetric(fontinfo, c, &tgi);
printGlyph(fontinfo, c);

8
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 1.65 2005/12/30 15:42:04 kls Exp $
* $Id: osd.c 1.66 2006/02/05 13:46:37 kls Exp $
*/
#include "osd.h"
@ -112,7 +112,7 @@ cBitmap::cBitmap(const char *FileName)
LoadXpm(FileName);
}
cBitmap::cBitmap(char *Xpm[])
cBitmap::cBitmap(const char *const Xpm[])
{
bitmap = NULL;
x0 = 0;
@ -251,9 +251,9 @@ bool cBitmap::LoadXpm(const char *FileName)
return Result;
}
bool cBitmap::SetXpm(char *Xpm[], bool IgnoreNone)
bool cBitmap::SetXpm(const char *const Xpm[], bool IgnoreNone)
{
char **p = Xpm;
const char *const *p = Xpm;
int w, h, n, c;
if (4 != sscanf(*p, "%d %d %d %d", &w, &h, &n, &c)) {
esyslog("ERROR: faulty 'values' line in XPM: '%s'", *p);

6
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.50 2005/12/18 12:56:21 kls Exp $
* $Id: osd.h 1.51 2006/02/05 13:46:37 kls Exp $
*/
#ifndef __OSD_H
@ -112,7 +112,7 @@ public:
///< this offset (unless specified otherwise).
cBitmap(const char *FileName);
///< Creates a bitmap and loads an XPM image from the given file.
cBitmap(char *Xpm[]);
cBitmap(const char *const Xpm[]);
///< Creates a bitmap from the given XPM data.
virtual ~cBitmap();
int X0(void) const { return x0; }
@ -140,7 +140,7 @@ public:
bool LoadXpm(const char *FileName);
///< Calls SetXpm() with the data from the file FileName.
///< Returns true if the operation was successful.
bool SetXpm(char *Xpm[], bool IgnoreNone = false);
bool SetXpm(const char *const Xpm[], bool IgnoreNone = false);
///< Sets this bitmap to the given XPM data. Any previous bitmap or
///< palette data will be overwritten with the new data.
///< If IgnoreNone is true, a "none" color entry will be ignored.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinsttng.c 1.16 2006/01/01 14:38:14 kls Exp $
* $Id: skinsttng.c 1.17 2006/02/05 13:46:37 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -721,7 +721,7 @@ void cSkinSTTNGDisplayReplay::SetTitle(const char *Title)
osd->DrawText(x3 + 5, y0, Title, Theme.Color(clrReplayTitle), frameColor, cFont::GetFont(fontSml), x4 - x3 - 5);
}
static char **ReplaySymbols[2][2][5] = {
static const char *const *ReplaySymbols[2][2][5] = {
{ { pause_xpm, srew_xpm, srew1_xpm, srew2_xpm, srew3_xpm },
{ pause_xpm, sfwd_xpm, sfwd1_xpm, sfwd2_xpm, sfwd3_xpm }, },
{ { play_xpm, frew_xpm, frew1_xpm, frew2_xpm, frew3_xpm },

View File

@ -1,5 +1,5 @@
/* XPM */
static char * arrowdown_xpm[] = {
static const char *const arrowdown_xpm[] = {
"12 12 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * arrowup_xpm[] = {
static const char *const arrowup_xpm[] = {
"12 12 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * audio_xpm[] = {
static const char *const audio_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * audioleft_xpm[] = {
static const char *const audioleft_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * audioright_xpm[] = {
static const char *const audioright_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * audiostereo_xpm[] = {
static const char *const audiostereo_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * dolbydigital_xpm[] = {
static const char *const dolbydigital_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * encrypted_xpm[] = {
static const char *const encrypted_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * ffwd_xpm[] = {
static const char *const ffwd_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * ffwd1_xpm[] = {
static const char *const ffwd1_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * ffwd2_xpm[] = {
static const char *const ffwd2_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * ffwd3_xpm[] = {
static const char *const ffwd3_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * frew_xpm[] = {
static const char *const frew_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * frew1_xpm[] = {
static const char *const frew1_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * frew2_xpm[] = {
static const char *const frew2_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * frew3_xpm[] = {
static const char *const frew3_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * mute_xpm[] = {
static const char *const mute_xpm[] = {
"26 20 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * pause_xpm[] = {
static const char *const pause_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * play_xpm[] = {
static const char *const play_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * radio_xpm[] = {
static const char *const radio_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * recording_xpm[] = {
static const char *const recording_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * sfwd_xpm[] = {
static const char *const sfwd_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * sfwd1_xpm[] = {
static const char *const sfwd1_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * sfwd2_xpm[] = {
static const char *const sfwd2_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * sfwd3_xpm[] = {
static const char *const sfwd3_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * srew_xpm[] = {
static const char *const srew_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * srew1_xpm[] = {
static const char *const srew1_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * srew2_xpm[] = {
static const char *const srew2_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * srew3_xpm[] = {
static const char *const srew3_xpm[] = {
"28 26 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * teletext_xpm[] = {
static const char *const teletext_xpm[] = {
"27 18 2 1",
". c #FFFFFF",
"+ c #000000",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * volume_xpm[] = {
static const char *const volume_xpm[] = {
"28 14 2 1",
". c #FFFFFF",
"+ c #000000",