plptools
Loading...
Searching...
No Matches
sislangrecord.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of plptools.
3
*
4
* Copyright (C) 2002 Daniel Brahneborg <basic.chello@se>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* along with this program; if not, see <https://www.gnu.org/licenses/>.
18
*/
19
#include "config.h"
20
21
#include "
sislangrecord.h
"
22
#include "
plpintl.h
"
23
24
#include <stdio.h>
25
26
SisRC
27
SISLangRecord::fillFrom
(uint8_t* buf,
int
* base, off_t len)
28
{
29
if
(*base + 2 > len)
30
return
SIS_TRUNCATED
;
31
m_lang
=
read16
(buf + *base);
32
if
(
m_lang
> 33)
// Thai, last language
33
return
SIS_CORRUPTED
;
34
if
(
logLevel
>= 2)
35
printf(
_
(
"Got language %d (%s)\n"
),
m_lang
,
langTable
[
m_lang
].m_name);
36
if
(
logLevel
>= 1)
37
printf(
_
(
"%d .. %d (%d bytes): Language record for %s\n"
),
38
*base, *base + 2, 2,
langTable
[
m_lang
].m_name);
39
*base += 2;
40
return
SIS_OK
;
41
}
SISLangRecord::fillFrom
SisRC fillFrom(uint8_t *buf, int *base, off_t len)
Populate the fields.
Definition:
sislangrecord.cpp:27
SISLangRecord::m_lang
uint16_t m_lang
The language number.
Definition:
sislangrecord.h:48
plpintl.h
_
#define _(String)
Definition:
plpintl.h:35
sislangrecord.h
langTable
LangTableEntry langTable[]
Definition:
sistypes.cpp:73
logLevel
int logLevel
Definition:
sistypes.cpp:25
read16
uint16_t read16(uint8_t *p)
Definition:
sistypes.cpp:57
SisRC
SisRC
Return Codes.
Definition:
sistypes.h:29
SIS_OK
@ SIS_OK
Definition:
sistypes.h:30
SIS_TRUNCATED
@ SIS_TRUNCATED
Definition:
sistypes.h:31
SIS_CORRUPTED
@ SIS_CORRUPTED
Definition:
sistypes.h:33
lib
sislangrecord.cpp
Generated by
1.9.5