Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
decompile.h File Reference

Go to the source code of this file.

Data Structures

struct  tagWBXML_NODE
 
struct  tagDTD_NODE_DATA
 
struct  tagWBXML_INFO
 
struct  tagWBXML_STRING_TABLE
 
struct  tagDTD_TYPE_LIST
 
struct  tagCODEPAGE_TAG_NAME_LIST
 
struct  tagCODEPAGE_ATTRSTART_NAME_LIST
 
struct  tagCODEPAGE_ATTRVALUE_NAME_LIST
 

Macros

#define TAG_SWITCH_PAGE   0x00
 
#define TAG_END   0x01
 
#define TAG_ENTITY   0x02
 
#define TAG_STR_I   0x03
 
#define TAG_LITERAL   0x04
 
#define TAG_EXT_I_0   0x40
 
#define TAG_EXT_I_1   0x41
 
#define TAG_EXT_I_2   0x42
 
#define TAG_PI   0x43
 
#define TAG_LITERAL_C   0x44
 
#define TAG_EXT_T_0   0x80
 
#define TAG_EXT_T_1   0x81
 
#define TAG_EXT_T_2   0x82
 
#define TAG_STR_T   0x83
 
#define TAG_LITERAL_A   0x84
 
#define TAG_EXT_0   0xc0
 
#define TAG_EXT_1   0xc1
 
#define TAG_EXT_2   0xc2
 
#define TAG_OPAQUE   0xc3
 
#define TAG_LITERAL_AC   0xc4
 
#define CODEPAGE_TAG_MASK   ((WBXML_TAG) 0x3f)
 
#define CODEPAGE_TAG_HAS_CONTENT   ((WBXML_TAG) 0x40)
 
#define CODEPAGE_TAG_HAS_ATTRS   ((WBXML_TAG) 0x80)
 
#define SWITCHPAGE_SIZE   2
 
#define FALSE   0
 
#define TRUE   1
 
#define MAX_MB_U_INT32_BYTES   4
 

Typedefs

typedef enum tagCP_TYPES CP_TAG_TYPE
 
typedef int BOOL
 
typedef unsigned char WBXML
 
typedef WBXMLP_WBXML
 
typedef P_WBXMLPP_WBXML
 
typedef unsigned char WBXML_TAG
 
typedef WBXML_TAGP_WBXML_TAG
 
typedef unsigned char WBXML_CODEPAGE
 
typedef unsigned long WBXML_LENGTH
 
typedef struct tagWBXML_NODE WBXML_NODE
 
typedef WBXML_NODEP_WBXML_NODE
 
typedef unsigned char WBXML_U_INT8
 
typedef WBXML_U_INT8P_WBXML_U_INT8
 
typedef unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
 
typedef WBXML_MB_U_INT32P_WBXML_MB_U_INT32
 
typedef WBXML_MB_U_INT32 WBXML_STRING_INDEX
 
typedef WBXML_STRING_INDEXP_WBXML_STRING_INDEX
 
typedef unsigned char * WBXML_BYTES
 
typedef WBXML_BYTESP_WBXML_BYTES
 
typedef WBXML_MB_U_INT32 WBXML_DTD_TYPE
 
typedef struct tagDTD_NODE_DATA DTD_NODE_DATA
 
typedef struct tagWBXML_INFO WBXML_INFO
 
typedef WBXML_INFOP_WBXML_INFO
 
typedef struct tagWBXML_STRING_TABLE WBXML_STRING_TABLE
 
typedef WBXML_STRING_TABLEP_WBXML_STRING_TABLE
 
typedef enum tagWBXML_PARSE_ERROR WBXML_PARSE_ERROR
 
typedef enum tagWBXML_PARSE_WARNING WBXML_PARSE_WARNING
 
typedef struct tagDTD_TYPE_LIST DTD_TYPE_LIST
 
typedef struct tagCODEPAGE_TAG_NAME_LIST CODEPAGE_TAG_NAME_LIST
 
typedef CODEPAGE_TAG_NAME_LISTP_CODEPAGE_TAG_NAME_LIST
 
typedef struct tagCODEPAGE_ATTRSTART_NAME_LIST CODEPAGE_ATTRSTART_NAME_LIST
 
typedef CODEPAGE_ATTRSTART_NAME_LISTP_CODEPAGE_ATTRSTART_NAME_LIST
 
typedef struct tagCODEPAGE_ATTRVALUE_NAME_LIST CODEPAGE_ATTRVALUE_NAME_LIST
 
typedef CODEPAGE_ATTRVALUE_NAME_LISTP_CODEPAGE_ATTRVALUE_NAME_LIST
 

Enumerations

enum  tagCP_TYPES { CP_TAG_TAG, CP_TAG_ATTRSTART, CP_TAG_ATTRVALUE }
 
enum  WBXML_NODE_TYPE {
  NODE_CODEPAGE_TAG, NODE_CODEPAGE_LITERAL_TAG, NODE_ATTRSTART, NODE_ATTRSTART_LITERAL,
  NODE_ATTRVALUE, NODE_ATTREND, NODE_STRING, NODE_DTD_TYPE,
  NODE_STRING_TABLE, NODE_VARIABLE_STRING, NODE_VARIABLE_INDEX
}
 
enum  WBXML_VARIABLE_TYPE { VAR_ESCAPED, VAR_UNESCAPED, VAR_UNCHANGED }
 
enum  tagWBXML_PARSE_ERROR {
  ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, ERR_TAG_NOT_FOUND, ERR_FILE_NOT_FOUND,
  ERR_FILE_NOT_READ, ERR_NOT_ENOUGH_MEMORY
}
 
enum  tagWBXML_PARSE_WARNING { WARN_FUTURE_EXPANSION_EXT_0, WARN_FUTURE_EXPANSION_EXT_1, WARN_FUTURE_EXPANSION_EXT_2 }
 

Functions

void Message (char *msg)
 
void ParseError (WBXML_PARSE_ERROR error)
 
void ParseWarning (WBXML_PARSE_WARNING warning)
 
WBXML_LENGTH BytesLeft (P_WBXML_INFO buffer)
 
BOOL IsTag (P_WBXML_INFO buffer, WBXML_TAG tag)
 
BOOL IsCodepageTag (P_WBXML_INFO buffer, CP_TAG_TYPE type)
 
BOOL Is_attrValue (P_WBXML_INFO buffer)
 
BOOL Is_extension (P_WBXML_INFO buffer)
 
BOOL Is_string (P_WBXML_INFO buffer)
 
BOOL Is_switchPage (P_WBXML_INFO buffer)
 
BOOL Is_inline (P_WBXML_INFO buffer)
 
BOOL Is_tableref (P_WBXML_INFO buffer)
 
BOOL Is_entity (P_WBXML_INFO buffer)
 
BOOL Is_pi (P_WBXML_INFO buffer)
 
BOOL Is_opaque (P_WBXML_INFO buffer)
 
BOOL Is_zero (P_WBXML_INFO buffer)
 
void Read_u_int8 (P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
 
void Read_mb_u_int32 (P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
 
void Read_bytes (P_WBXML_INFO buffer, WBXML_LENGTH length, P_WBXML_BYTES result)
 
void ReadFixedTag (P_WBXML_INFO buffer, WBXML_TAG tag)
 
WBXML_TAG ReadCodepageTag (P_WBXML_INFO buffer, CP_TAG_TYPE type)
 
long mb_u_int32_to_long (P_WBXML_MB_U_INT32 value)
 
void Read_start (P_WBXML_INFO buffer)
 
void Read_strtbl (P_WBXML_INFO buffer)
 
void Read_body (P_WBXML_INFO buffer)
 
void Read_element (P_WBXML_INFO buffer)
 
void Read_content (P_WBXML_INFO buffer)
 
WBXML_TAG Read_stag (P_WBXML_INFO buffer)
 
void Read_attribute (P_WBXML_INFO buffer)
 
void Read_attrStart (P_WBXML_INFO buffer)
 
void Read_attrValue (P_WBXML_INFO buffer)
 
void Read_extension (P_WBXML_INFO buffer)
 
void Read_string (P_WBXML_INFO buffer)
 
void Read_switchPage (P_WBXML_INFO buffer)
 
void Read_inline (P_WBXML_INFO buffer)
 
void Read_tableref (P_WBXML_INFO buffer)
 
void Read_entity (P_WBXML_INFO buffer)
 
void Read_entcode (P_WBXML_INFO buffer)
 
void Read_pi (P_WBXML_INFO buffer)
 
void Read_opaque (P_WBXML_INFO buffer)
 
void Read_version (P_WBXML_INFO buffer)
 
void Read_publicid (P_WBXML_INFO buffer)
 
void Read_charset (P_WBXML_INFO buffer)
 
void Read_termstr (P_WBXML_INFO buffer)
 
void Read_termstr_rtn (P_WBXML_INFO buffer, char **result)
 
void Read_index (P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
 
void Read_length (P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
 
void Read_zero (P_WBXML_INFO buffer)
 
void Read_pageindex (P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
 

Variables

const WBXML_MB_U_INT32 ZERO_WBXML_MB_U_INT32
 

Macro Definition Documentation

◆ CODEPAGE_TAG_HAS_ATTRS

#define CODEPAGE_TAG_HAS_ATTRS   ((WBXML_TAG) 0x80)

Definition at line 93 of file decompile.h.

Referenced by DumpNode(), and Read_element().

◆ CODEPAGE_TAG_HAS_CONTENT

#define CODEPAGE_TAG_HAS_CONTENT   ((WBXML_TAG) 0x40)

Definition at line 92 of file decompile.h.

Referenced by DumpNode(), and Read_element().

◆ CODEPAGE_TAG_MASK

#define CODEPAGE_TAG_MASK   ((WBXML_TAG) 0x3f)

Definition at line 91 of file decompile.h.

Referenced by CodepageTagName(), and DumpNode().

◆ FALSE

#define FALSE   0

Definition at line 109 of file decompile.h.

Referenced by DumpNode(), DumpNodes(), Is_zero(), IsCodepageTag(), IsTag(), and Read_termstr_rtn().

◆ MAX_MB_U_INT32_BYTES

#define MAX_MB_U_INT32_BYTES   4

Definition at line 164 of file decompile.h.

Referenced by mb_u_int32_to_long(), and Read_mb_u_int32().

◆ SWITCHPAGE_SIZE

#define SWITCHPAGE_SIZE   2

Definition at line 96 of file decompile.h.

Referenced by Is_attrValue(), and Is_extension().

◆ TAG_END

#define TAG_END   0x01

Definition at line 70 of file decompile.h.

Referenced by Read_element(), and Read_pi().

◆ TAG_ENTITY

#define TAG_ENTITY   0x02

Definition at line 71 of file decompile.h.

Referenced by Is_entity(), and Read_entity().

◆ TAG_EXT_0

#define TAG_EXT_0   0xc0

Definition at line 84 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_1

#define TAG_EXT_1   0xc1

Definition at line 85 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_2

#define TAG_EXT_2   0xc2

Definition at line 86 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_I_0

#define TAG_EXT_I_0   0x40

Definition at line 74 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_I_1

#define TAG_EXT_I_1   0x41

Definition at line 75 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_I_2

#define TAG_EXT_I_2   0x42

Definition at line 76 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_T_0

#define TAG_EXT_T_0   0x80

Definition at line 79 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_T_1

#define TAG_EXT_T_1   0x81

Definition at line 80 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_EXT_T_2

#define TAG_EXT_T_2   0x82

Definition at line 81 of file decompile.h.

Referenced by Is_extension(), and Read_extension().

◆ TAG_LITERAL

#define TAG_LITERAL   0x04

Definition at line 73 of file decompile.h.

Referenced by Read_attrStart(), and Read_stag().

◆ TAG_LITERAL_A

#define TAG_LITERAL_A   0x84

Definition at line 83 of file decompile.h.

◆ TAG_LITERAL_AC

#define TAG_LITERAL_AC   0xc4

Definition at line 88 of file decompile.h.

◆ TAG_LITERAL_C

#define TAG_LITERAL_C   0x44

Definition at line 78 of file decompile.h.

◆ TAG_OPAQUE

#define TAG_OPAQUE   0xc3

Definition at line 87 of file decompile.h.

Referenced by Is_opaque(), and Read_opaque().

◆ TAG_PI

#define TAG_PI   0x43

Definition at line 77 of file decompile.h.

Referenced by Is_pi(), and Read_pi().

◆ TAG_STR_I

#define TAG_STR_I   0x03

Definition at line 72 of file decompile.h.

Referenced by Is_inline(), and Read_inline().

◆ TAG_STR_T

#define TAG_STR_T   0x83

Definition at line 82 of file decompile.h.

Referenced by Is_tableref(), and Read_tableref().

◆ TAG_SWITCH_PAGE

#define TAG_SWITCH_PAGE   0x00

Definition at line 69 of file decompile.h.

Referenced by Is_switchPage(), and Read_switchPage().

◆ TRUE

#define TRUE   1

Definition at line 110 of file decompile.h.

Referenced by DumpNode(), IsCodepageTag(), and Read_termstr_rtn().

Typedef Documentation

◆ BOOL

typedef int BOOL

Definition at line 108 of file decompile.h.

◆ CODEPAGE_ATTRSTART_NAME_LIST

◆ CODEPAGE_ATTRVALUE_NAME_LIST

◆ CODEPAGE_TAG_NAME_LIST

◆ CP_TAG_TYPE

typedef enum tagCP_TYPES CP_TAG_TYPE

◆ DTD_NODE_DATA

◆ DTD_TYPE_LIST

◆ P_CODEPAGE_ATTRSTART_NAME_LIST

◆ P_CODEPAGE_ATTRVALUE_NAME_LIST

◆ P_CODEPAGE_TAG_NAME_LIST

Definition at line 243 of file decompile.h.

◆ P_WBXML

typedef WBXML* P_WBXML

Definition at line 113 of file decompile.h.

◆ P_WBXML_BYTES

Definition at line 175 of file decompile.h.

◆ P_WBXML_INFO

Definition at line 197 of file decompile.h.

◆ P_WBXML_MB_U_INT32

Definition at line 167 of file decompile.h.

◆ P_WBXML_NODE

Definition at line 151 of file decompile.h.

◆ P_WBXML_STRING_INDEX

Definition at line 172 of file decompile.h.

◆ P_WBXML_STRING_TABLE

Definition at line 206 of file decompile.h.

◆ P_WBXML_TAG

Definition at line 117 of file decompile.h.

◆ P_WBXML_U_INT8

Definition at line 162 of file decompile.h.

◆ PP_WBXML

typedef P_WBXML* PP_WBXML

Definition at line 114 of file decompile.h.

◆ WBXML

typedef unsigned char WBXML

Definition at line 112 of file decompile.h.

◆ WBXML_BYTES

typedef unsigned char* WBXML_BYTES

Definition at line 174 of file decompile.h.

◆ WBXML_CODEPAGE

typedef unsigned char WBXML_CODEPAGE

Definition at line 119 of file decompile.h.

◆ WBXML_DTD_TYPE

Definition at line 177 of file decompile.h.

◆ WBXML_INFO

typedef struct tagWBXML_INFO WBXML_INFO

◆ WBXML_LENGTH

typedef unsigned long WBXML_LENGTH

Definition at line 121 of file decompile.h.

◆ WBXML_MB_U_INT32

typedef unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]

Definition at line 166 of file decompile.h.

◆ WBXML_NODE

typedef struct tagWBXML_NODE WBXML_NODE

◆ WBXML_PARSE_ERROR

◆ WBXML_PARSE_WARNING

◆ WBXML_STRING_INDEX

Definition at line 171 of file decompile.h.

◆ WBXML_STRING_TABLE

◆ WBXML_TAG

typedef unsigned char WBXML_TAG

Definition at line 116 of file decompile.h.

◆ WBXML_U_INT8

typedef unsigned char WBXML_U_INT8

Definition at line 161 of file decompile.h.

Enumeration Type Documentation

◆ tagCP_TYPES

Enumerator
CP_TAG_TAG 
CP_TAG_ATTRSTART 
CP_TAG_ATTRVALUE 

Definition at line 99 of file decompile.h.

100 {
101  CP_TAG_TAG,
104 
105 } CP_TAG_TYPE;
enum tagCP_TYPES CP_TAG_TYPE

◆ tagWBXML_PARSE_ERROR

Enumerator
ERR_END_OF_DATA 
ERR_INTERNAL_BAD_PARAM 
ERR_TAG_NOT_FOUND 
ERR_FILE_NOT_FOUND 
ERR_FILE_NOT_READ 
ERR_NOT_ENOUGH_MEMORY 

Definition at line 208 of file decompile.h.

◆ tagWBXML_PARSE_WARNING

Enumerator
WARN_FUTURE_EXPANSION_EXT_0 
WARN_FUTURE_EXPANSION_EXT_1 
WARN_FUTURE_EXPANSION_EXT_2 

Definition at line 219 of file decompile.h.

◆ WBXML_NODE_TYPE

Enumerator
NODE_CODEPAGE_TAG 
NODE_CODEPAGE_LITERAL_TAG 
NODE_ATTRSTART 
NODE_ATTRSTART_LITERAL 
NODE_ATTRVALUE 
NODE_ATTREND 
NODE_STRING 
NODE_DTD_TYPE 
NODE_STRING_TABLE 
NODE_VARIABLE_STRING 
NODE_VARIABLE_INDEX 

Definition at line 123 of file decompile.h.

◆ WBXML_VARIABLE_TYPE

Enumerator
VAR_ESCAPED 
VAR_UNESCAPED 
VAR_UNCHANGED 

Definition at line 153 of file decompile.h.

154 {
155  VAR_ESCAPED,
158 
WBXML_VARIABLE_TYPE
Definition: decompile.h:153

Function Documentation

◆ BytesLeft()

WBXML_LENGTH BytesLeft ( P_WBXML_INFO  buffer)

Definition at line 548 of file decompile.c.

References ERR_INTERNAL_BAD_PARAM, tagWBXML_INFO::m_curpos, tagWBXML_INFO::m_length, tagWBXML_INFO::m_start, and ParseError().

Referenced by Is_zero(), IsTag(), Read_bytes(), Read_mb_u_int32(), Read_termstr_rtn(), Read_u_int8(), ReadCodepageTag(), and ReadFixedTag().

549 {
550  if (buffer)
551  {
552  WBXML_LENGTH bytesRead = (buffer->m_curpos - buffer->m_start);
553  if (bytesRead >= buffer->m_length)
554  {
555  return 0;
556  }
557  else
558  {
559  return (buffer->m_length - bytesRead);
560  }
561  }
562  else
563  {
565  }
566 
567  return 0;
568 }
P_WBXML m_curpos
Definition: decompile.h:189
unsigned long WBXML_LENGTH
Definition: decompile.h:121
WBXML_LENGTH m_length
Definition: decompile.h:190
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
P_WBXML m_start
Definition: decompile.h:188

◆ Is_attrValue()

BOOL Is_attrValue ( P_WBXML_INFO  buffer)

Definition at line 612 of file decompile.c.

References CP_TAG_ATTRVALUE, Is_entity(), Is_extension(), Is_opaque(), Is_pi(), Is_string(), Is_switchPage(), IsCodepageTag(), tagWBXML_INFO::m_curpos, and SWITCHPAGE_SIZE.

Referenced by Read_attribute(), and Read_pi().

613 {
614  WBXML_INFO tmpbuffer;
615  memcpy(&tmpbuffer, buffer, sizeof(WBXML_INFO));
616  tmpbuffer.m_curpos += SWITCHPAGE_SIZE;
617 
618  return ((Is_switchPage(buffer) && IsCodepageTag(&tmpbuffer, CP_TAG_ATTRVALUE)) ||
619  IsCodepageTag(buffer, CP_TAG_ATTRVALUE) ||
620  Is_string(buffer) ||
621  Is_extension(buffer) ||
622  Is_entity(buffer) ||
623  Is_pi(buffer) ||
624  Is_opaque(buffer));
625 }
BOOL IsCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:594
P_WBXML m_curpos
Definition: decompile.h:189
BOOL Is_extension(P_WBXML_INFO buffer)
Definition: decompile.c:627
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
BOOL Is_opaque(P_WBXML_INFO buffer)
Definition: decompile.c:685
#define SWITCHPAGE_SIZE
Definition: decompile.h:96
BOOL Is_pi(P_WBXML_INFO buffer)
Definition: decompile.c:680
BOOL Is_string(P_WBXML_INFO buffer)
Definition: decompile.c:654
BOOL Is_entity(P_WBXML_INFO buffer)
Definition: decompile.c:675

◆ Is_entity()

BOOL Is_entity ( P_WBXML_INFO  buffer)

Definition at line 675 of file decompile.c.

References IsTag(), and TAG_ENTITY.

Referenced by Is_attrValue(), Read_attrValue(), and Read_content().

676 {
677  return IsTag(buffer, TAG_ENTITY);
678 }
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
#define TAG_ENTITY
Definition: decompile.h:71

◆ Is_extension()

BOOL Is_extension ( P_WBXML_INFO  buffer)

Definition at line 627 of file decompile.c.

References Is_switchPage(), IsTag(), tagWBXML_INFO::m_curpos, SWITCHPAGE_SIZE, TAG_EXT_0, TAG_EXT_1, TAG_EXT_2, TAG_EXT_I_0, TAG_EXT_I_1, TAG_EXT_I_2, TAG_EXT_T_0, TAG_EXT_T_1, and TAG_EXT_T_2.

Referenced by Is_attrValue(), Read_attrValue(), and Read_content().

628 {
629  WBXML_INFO tmpbuffer;
630  memcpy(&tmpbuffer, buffer, sizeof(WBXML_INFO));
631  tmpbuffer.m_curpos += SWITCHPAGE_SIZE;
632 
633  return ((Is_switchPage(buffer) &&
634  (IsTag(&tmpbuffer, TAG_EXT_0) ||
635  IsTag(&tmpbuffer, TAG_EXT_1) ||
636  IsTag(&tmpbuffer, TAG_EXT_2) ||
637  IsTag(&tmpbuffer, TAG_EXT_T_0) ||
638  IsTag(&tmpbuffer, TAG_EXT_T_1) ||
639  IsTag(&tmpbuffer, TAG_EXT_T_2) ||
640  IsTag(&tmpbuffer, TAG_EXT_I_0) ||
641  IsTag(&tmpbuffer, TAG_EXT_I_1) ||
642  IsTag(&tmpbuffer, TAG_EXT_I_2))) ||
643  (IsTag(buffer, TAG_EXT_0) ||
644  IsTag(buffer, TAG_EXT_1) ||
645  IsTag(buffer, TAG_EXT_2) ||
646  IsTag(buffer, TAG_EXT_T_0) ||
647  IsTag(buffer, TAG_EXT_T_1) ||
648  IsTag(buffer, TAG_EXT_T_2) ||
649  IsTag(buffer, TAG_EXT_I_0) ||
650  IsTag(buffer, TAG_EXT_I_1) ||
651  IsTag(buffer, TAG_EXT_I_2)));
652 }
#define TAG_EXT_I_2
Definition: decompile.h:76
#define TAG_EXT_2
Definition: decompile.h:86
#define TAG_EXT_0
Definition: decompile.h:84
P_WBXML m_curpos
Definition: decompile.h:189
#define TAG_EXT_T_0
Definition: decompile.h:79
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
#define TAG_EXT_T_1
Definition: decompile.h:80
#define TAG_EXT_I_0
Definition: decompile.h:74
#define SWITCHPAGE_SIZE
Definition: decompile.h:96
#define TAG_EXT_T_2
Definition: decompile.h:81
#define TAG_EXT_1
Definition: decompile.h:85
#define TAG_EXT_I_1
Definition: decompile.h:75
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570

◆ Is_inline()

BOOL Is_inline ( P_WBXML_INFO  buffer)

Definition at line 665 of file decompile.c.

References IsTag(), and TAG_STR_I.

Referenced by Is_string(), and Read_string().

666 {
667  return IsTag(buffer, TAG_STR_I);
668 }
#define TAG_STR_I
Definition: decompile.h:72
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570

◆ Is_opaque()

BOOL Is_opaque ( P_WBXML_INFO  buffer)

Definition at line 685 of file decompile.c.

References IsTag(), and TAG_OPAQUE.

Referenced by Is_attrValue(), Read_attrValue(), and Read_content().

686 {
687  return IsTag(buffer, TAG_OPAQUE);
688 }
#define TAG_OPAQUE
Definition: decompile.h:87
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570

◆ Is_pi()

BOOL Is_pi ( P_WBXML_INFO  buffer)

Definition at line 680 of file decompile.c.

References IsTag(), and TAG_PI.

Referenced by Is_attrValue(), Read_body(), and Read_content().

681 {
682  return IsTag(buffer, TAG_PI);
683 }
#define TAG_PI
Definition: decompile.h:77
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570

◆ Is_string()

BOOL Is_string ( P_WBXML_INFO  buffer)

Definition at line 654 of file decompile.c.

References Is_inline(), and Is_tableref().

Referenced by Is_attrValue(), Read_attrValue(), and Read_content().

655 {
656  return (Is_inline(buffer) ||
657  Is_tableref(buffer));
658 }
BOOL Is_tableref(P_WBXML_INFO buffer)
Definition: decompile.c:670
BOOL Is_inline(P_WBXML_INFO buffer)
Definition: decompile.c:665

◆ Is_switchPage()

BOOL Is_switchPage ( P_WBXML_INFO  buffer)

Definition at line 660 of file decompile.c.

References IsTag(), and TAG_SWITCH_PAGE.

Referenced by Is_attrValue(), Is_extension(), Read_attrStart(), Read_attrValue(), Read_element(), and Read_extension().

661 {
662  return IsTag(buffer, TAG_SWITCH_PAGE);
663 }
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
#define TAG_SWITCH_PAGE
Definition: decompile.h:69

◆ Is_tableref()

BOOL Is_tableref ( P_WBXML_INFO  buffer)

Definition at line 670 of file decompile.c.

References IsTag(), and TAG_STR_T.

Referenced by Is_string(), and Read_string().

671 {
672  return IsTag(buffer, TAG_STR_T);
673 }
#define TAG_STR_T
Definition: decompile.h:82
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570

◆ Is_zero()

BOOL Is_zero ( P_WBXML_INFO  buffer)

Definition at line 690 of file decompile.c.

References BytesLeft(), ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, FALSE, tagWBXML_INFO::m_curpos, and ParseError().

Referenced by Read_publicid().

691 {
692  BOOL result = FALSE;
693 
694  if (buffer)
695  {
696  if (BytesLeft(buffer) >= 1)
697  {
698  result = ((*buffer->m_curpos) == 0);
699  }
700  else
701  {
703  }
704  }
705  else
706  {
708  }
709 
710  return result;
711 }
P_WBXML m_curpos
Definition: decompile.h:189
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548
int BOOL
Definition: decompile.h:108
#define FALSE
Definition: decompile.h:109

◆ IsCodepageTag()

BOOL IsCodepageTag ( P_WBXML_INFO  buffer,
CP_TAG_TYPE  type 
)

Definition at line 594 of file decompile.c.

References CP_TAG_ATTRSTART, CP_TAG_ATTRVALUE, CP_TAG_TAG, FALSE, tagWBXML_INFO::m_curpos, and TRUE.

Referenced by Is_attrValue(), Read_attrStart(), Read_attrValue(), and Read_stag().

595 {
596  WBXML_U_INT8 result = *(buffer->m_curpos);
597 
598  /* NOTE THAT THESE ARE NOT UNIQUE! */
599  switch (type)
600  {
601  case CP_TAG_TAG:
602  return TRUE;
603  case CP_TAG_ATTRSTART:
604  return ((result & 0x80) != 0x80);
605  case CP_TAG_ATTRVALUE:
606  return ((result & 0x80) == 0x80);
607  default:
608  return FALSE;
609  }
610 }
P_WBXML m_curpos
Definition: decompile.h:189
int type
Definition: smsc_cimd2.c:215
unsigned char WBXML_U_INT8
Definition: decompile.h:161
#define FALSE
Definition: decompile.h:109
#define TRUE
Definition: decompile.h:110

◆ IsTag()

BOOL IsTag ( P_WBXML_INFO  buffer,
WBXML_TAG  tag 
)

Definition at line 570 of file decompile.c.

References BytesLeft(), ERR_INTERNAL_BAD_PARAM, FALSE, tagWBXML_INFO::m_curpos, and ParseError().

Referenced by Is_entity(), Is_extension(), Is_inline(), Is_opaque(), Is_pi(), Is_switchPage(), Is_tableref(), Read_attrStart(), Read_element(), Read_extension(), and Read_stag().

571 {
572  BOOL result = FALSE;
573 
574  if (buffer)
575  {
576  if (BytesLeft(buffer) >= sizeof(WBXML_TAG))
577  {
578  result = ((*((WBXML_TAG*) buffer->m_curpos)) == tag);
579  }
580  else
581  {
582  /* No more data, so nope, not this tag */
583  result = FALSE;
584  }
585  }
586  else
587  {
589  }
590 
591  return result;
592 }
P_WBXML m_curpos
Definition: decompile.h:189
unsigned char WBXML_TAG
Definition: decompile.h:116
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548
int BOOL
Definition: decompile.h:108
#define FALSE
Definition: decompile.h:109

◆ mb_u_int32_to_long()

long mb_u_int32_to_long ( P_WBXML_MB_U_INT32  value)

Definition at line 873 of file decompile.c.

References ERR_INTERNAL_BAD_PARAM, MAX_MB_U_INT32_BYTES, and ParseError().

Referenced by DumpNode(), GetStringTableString(), Read_opaque(), and Read_strtbl().

874 {
875  long result = 0;
876 
877  if (value)
878  {
879  int i;
880  for (i = 0; i < MAX_MB_U_INT32_BYTES; i++)
881  {
882  result <<= 7;
883  result |= ((*value)[i] & 0x7f);
884 
885  if ( !( (*value)[i] & 0x80 ) )
886  break;
887  }
888  }
889  else
890  {
892  }
893 
894  return result;
895 }
#define MAX_MB_U_INT32_BYTES
Definition: decompile.h:164
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490

◆ Message()

void Message ( char *  msg)

Definition at line 485 of file decompile.c.

Referenced by ParseError(), and ParseWarning().

486 {
487  printf("%s\n", msg);
488 }
static XMLRPCDocument * msg
Definition: test_xmlrpc.c:86

◆ ParseError()

void ParseError ( WBXML_PARSE_ERROR  error)

Definition at line 490 of file decompile.c.

References ERR_END_OF_DATA, ERR_FILE_NOT_FOUND, ERR_FILE_NOT_READ, ERR_INTERNAL_BAD_PARAM, ERR_NOT_ENOUGH_MEMORY, ERR_TAG_NOT_FOUND, and Message().

Referenced by BytesLeft(), CodepageAttrstartName(), CodepageAttrvalueName(), Is_zero(), IsTag(), main(), mb_u_int32_to_long(), NewNode(), Read_attrStart(), Read_attrValue(), Read_bytes(), Read_extension(), Read_mb_u_int32(), Read_stag(), Read_string(), Read_termstr_rtn(), Read_u_int8(), Read_zero(), ReadBinary(), ReadCodepageTag(), and ReadFixedTag().

491 {
492  switch (error)
493  {
494  case ERR_END_OF_DATA:
495  Message("Input stream is incomplete (EOF).");
496  break;
497 
499  Message("Internal error: Bad parameter.");
500  break;
501 
502  case ERR_TAG_NOT_FOUND:
503  Message("Tag not found.");
504  break;
505 
506  case ERR_FILE_NOT_FOUND:
507  Message("File not found.");
508  break;
509 
510  case ERR_FILE_NOT_READ:
511  Message("File read error.");
512  break;
513 
515  Message("Not enough memory");
516  break;
517 
518  default:
519  Message("Unknown error.");
520  break;
521  }
522 
523  exit(error);
524 }
void error(int err, const char *fmt,...)
Definition: log.c:648
void Message(char *msg)
Definition: decompile.c:485

◆ ParseWarning()

void ParseWarning ( WBXML_PARSE_WARNING  warning)

Definition at line 526 of file decompile.c.

References Message(), WARN_FUTURE_EXPANSION_EXT_0, WARN_FUTURE_EXPANSION_EXT_1, and WARN_FUTURE_EXPANSION_EXT_2.

Referenced by Read_extension().

527 {
528  switch (warning)
529  {
531  Message("Token EXT_0 encountered. This token is reserved for future expansion.");
532  break;
533 
535  Message("Token EXT_1 encountered. This token is reserved for future expansion.");
536  break;
537 
539  Message("Token EXT_2 encountered. This token is reserved for future expansion.");
540  break;
541 
542  default:
543  Message("Unknown warning.");
544  break;
545  }
546 }
void warning(int err, const char *fmt,...)
Definition: log.c:660
void Message(char *msg)
Definition: decompile.c:485

◆ Read_attribute()

void Read_attribute ( P_WBXML_INFO  buffer)

Definition at line 1067 of file decompile.c.

References Is_attrValue(), Read_attrStart(), and Read_attrValue().

Referenced by Read_element().

1068 {
1069  Read_attrStart(buffer);
1070 
1071  while (Is_attrValue(buffer))
1072  {
1073  Read_attrValue(buffer);
1074  }
1075 }
BOOL Is_attrValue(P_WBXML_INFO buffer)
Definition: decompile.c:612
void Read_attrStart(P_WBXML_INFO buffer)
Definition: decompile.c:1077
void Read_attrValue(P_WBXML_INFO buffer)
Definition: decompile.c:1109

◆ Read_attrStart()

void Read_attrStart ( P_WBXML_INFO  buffer)

Definition at line 1077 of file decompile.c.

References AddAttrStartLiteralNode(), AddAttrStartNode(), CP_TAG_ATTRSTART, ERR_TAG_NOT_FOUND, Is_switchPage(), IsCodepageTag(), IsTag(), ParseError(), Read_index(), Read_switchPage(), ReadCodepageTag(), ReadFixedTag(), and TAG_LITERAL.

Referenced by Read_attribute(), and Read_pi().

1078 {
1079  if (Is_switchPage(buffer))
1080  {
1081  WBXML_TAG tag;
1082  Read_switchPage(buffer);
1083  tag = ReadCodepageTag(buffer, CP_TAG_ATTRSTART);
1084 
1085  AddAttrStartNode(buffer, tag);
1086  }
1087  else if (IsCodepageTag(buffer, CP_TAG_ATTRSTART))
1088  {
1089  WBXML_TAG tag;
1090  tag = ReadCodepageTag(buffer, CP_TAG_ATTRSTART);
1091 
1092  AddAttrStartNode(buffer, tag);
1093  }
1094  else if (IsTag(buffer, TAG_LITERAL))
1095  {
1096  WBXML_MB_U_INT32 index;
1097 
1098  ReadFixedTag(buffer, TAG_LITERAL);
1099  Read_index(buffer, &index);
1100 
1101  AddAttrStartLiteralNode(buffer, index);
1102  }
1103  else
1104  {
1106  }
1107 }
BOOL IsCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:594
unsigned char WBXML_TAG
Definition: decompile.h:116
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1398
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
void Read_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:1247
static void AddAttrStartLiteralNode(P_WBXML_INFO buffer, WBXML_MB_U_INT32 index)
Definition: decompile.c:444
static void AddAttrStartNode(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:437
#define TAG_LITERAL
Definition: decompile.h:73
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786
WBXML_TAG ReadCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:812

◆ Read_attrValue()

void Read_attrValue ( P_WBXML_INFO  buffer)

Definition at line 1109 of file decompile.c.

References AddAttrValueNode(), CP_TAG_ATTRVALUE, ERR_TAG_NOT_FOUND, Is_entity(), Is_extension(), Is_opaque(), Is_string(), Is_switchPage(), IsCodepageTag(), ParseError(), Read_entity(), Read_extension(), Read_opaque(), Read_string(), Read_switchPage(), and ReadCodepageTag().

Referenced by Read_attribute(), and Read_pi().

1110 {
1111  if (Is_switchPage(buffer))
1112  {
1113  WBXML_TAG tag;
1114  Read_switchPage(buffer);
1115  tag = ReadCodepageTag(buffer, CP_TAG_ATTRVALUE);
1116  AddAttrValueNode(buffer, tag);
1117  }
1118  else if (IsCodepageTag(buffer, CP_TAG_ATTRVALUE))
1119  {
1120  WBXML_TAG tag;
1121  tag = ReadCodepageTag(buffer, CP_TAG_ATTRVALUE);
1122  AddAttrValueNode(buffer, tag);
1123  }
1124  else if (Is_string(buffer))
1125  {
1126  Read_string(buffer);
1127  }
1128  else if (Is_extension(buffer))
1129  {
1130  Read_extension(buffer);
1131  }
1132  else if (Is_entity(buffer))
1133  {
1134  Read_entity(buffer);
1135  }
1136  else if (Is_opaque(buffer))
1137  {
1138  Read_opaque(buffer);
1139  }
1140  else
1141  {
1143  }
1144 }
BOOL IsCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:594
unsigned char WBXML_TAG
Definition: decompile.h:116
void Read_entity(P_WBXML_INFO buffer)
Definition: decompile.c:1272
void Read_extension(P_WBXML_INFO buffer)
Definition: decompile.c:1146
BOOL Is_extension(P_WBXML_INFO buffer)
Definition: decompile.c:627
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
BOOL Is_opaque(P_WBXML_INFO buffer)
Definition: decompile.c:685
void Read_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:1247
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
BOOL Is_string(P_WBXML_INFO buffer)
Definition: decompile.c:654
BOOL Is_entity(P_WBXML_INFO buffer)
Definition: decompile.c:675
static void AddAttrValueNode(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:451
void Read_opaque(P_WBXML_INFO buffer)
Definition: decompile.c:1297
void Read_string(P_WBXML_INFO buffer)
Definition: decompile.c:1231
WBXML_TAG ReadCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:812

◆ Read_body()

void Read_body ( P_WBXML_INFO  buffer)

Definition at line 953 of file decompile.c.

References Is_pi(), Read_element(), and Read_pi().

Referenced by Read_start().

954 {
955  while (Is_pi(buffer))
956  {
957  Read_pi(buffer);
958  }
959 
960  Read_element(buffer);
961 
962  while (Is_pi(buffer))
963  {
964  Read_pi(buffer);
965  }
966 }
void Read_element(P_WBXML_INFO buffer)
Definition: decompile.c:968
BOOL Is_pi(P_WBXML_INFO buffer)
Definition: decompile.c:680
void Read_pi(P_WBXML_INFO buffer)
Definition: decompile.c:1284

◆ Read_bytes()

void Read_bytes ( P_WBXML_INFO  buffer,
WBXML_LENGTH  length,
P_WBXML_BYTES  result 
)

Definition at line 765 of file decompile.c.

References BytesLeft(), ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, tagWBXML_INFO::m_curpos, malloc, and ParseError().

Referenced by Read_opaque(), and Read_strtbl().

766 {
767  if (buffer && result)
768  {
769  if (BytesLeft(buffer) >= length)
770  {
771  *result = (WBXML_BYTES) malloc(length*sizeof(unsigned char));
772  memcpy(*result, buffer->m_curpos, length);
773  buffer->m_curpos += length;
774  }
775  else
776  {
778  }
779  }
780  else
781  {
783  }
784 }
P_WBXML m_curpos
Definition: decompile.h:189
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
#define malloc(n)
Definition: gwmem.h:191
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548
unsigned char * WBXML_BYTES
Definition: decompile.h:174

◆ Read_charset()

void Read_charset ( P_WBXML_INFO  buffer)

Definition at line 1334 of file decompile.c.

References Read_mb_u_int32().

Referenced by Read_start().

1335 {
1336  WBXML_MB_U_INT32 result;
1337 
1338  Read_mb_u_int32(buffer, &result);
1339 }
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738

◆ Read_content()

void Read_content ( P_WBXML_INFO  buffer)

Definition at line 1011 of file decompile.c.

References Is_entity(), Is_extension(), Is_opaque(), Is_pi(), Is_string(), Read_element(), Read_entity(), Read_extension(), Read_opaque(), Read_pi(), and Read_string().

Referenced by Read_element().

1012 {
1013  if (Is_string(buffer))
1014  {
1015  Read_string(buffer);
1016  }
1017  else if (Is_extension(buffer))
1018  {
1019  Read_extension(buffer);
1020  }
1021  else if (Is_entity(buffer))
1022  {
1023  Read_entity(buffer);
1024  }
1025  else if (Is_pi(buffer))
1026  {
1027  Read_pi(buffer);
1028  }
1029  else if (Is_opaque(buffer))
1030  {
1031  Read_opaque(buffer);
1032  }
1033  else
1034  {
1035  /* Assume it is an element */
1036  Read_element(buffer);
1037  }
1038 }
void Read_entity(P_WBXML_INFO buffer)
Definition: decompile.c:1272
void Read_extension(P_WBXML_INFO buffer)
Definition: decompile.c:1146
BOOL Is_extension(P_WBXML_INFO buffer)
Definition: decompile.c:627
BOOL Is_opaque(P_WBXML_INFO buffer)
Definition: decompile.c:685
void Read_element(P_WBXML_INFO buffer)
Definition: decompile.c:968
BOOL Is_pi(P_WBXML_INFO buffer)
Definition: decompile.c:680
BOOL Is_string(P_WBXML_INFO buffer)
Definition: decompile.c:654
void Read_pi(P_WBXML_INFO buffer)
Definition: decompile.c:1284
BOOL Is_entity(P_WBXML_INFO buffer)
Definition: decompile.c:675
void Read_opaque(P_WBXML_INFO buffer)
Definition: decompile.c:1297
void Read_string(P_WBXML_INFO buffer)
Definition: decompile.c:1231

◆ Read_element()

void Read_element ( P_WBXML_INFO  buffer)

Definition at line 968 of file decompile.c.

References AddAttrEndNode(), CODEPAGE_TAG_HAS_ATTRS, CODEPAGE_TAG_HAS_CONTENT, Is_switchPage(), IsTag(), tagWBXML_NODE::m_child, tagWBXML_INFO::m_curnode, tagWBXML_NODE::m_parent, tagWBXML_INFO::m_tree, Read_attribute(), Read_content(), Read_stag(), Read_switchPage(), ReadFixedTag(), and TAG_END.

Referenced by Read_body(), and Read_content().

969 {
970  WBXML_TAG stagvalue = 0;
971 
972  if (Is_switchPage(buffer))
973  {
974  Read_switchPage(buffer);
975  }
976 
977  stagvalue = Read_stag(buffer);
978 
979  /* move the current node down to this one in the tree */
980  if (buffer->m_curnode)
981  buffer->m_curnode = buffer->m_curnode->m_child;
982  else buffer->m_curnode = buffer->m_tree;
983 
984  if ((stagvalue & CODEPAGE_TAG_HAS_ATTRS) == CODEPAGE_TAG_HAS_ATTRS)
985  {
986  do
987  {
988  Read_attribute(buffer);
989 
990  } while (!IsTag(buffer, TAG_END));
991 
992  ReadFixedTag(buffer, TAG_END);
993 
994  AddAttrEndNode(buffer);
995  }
996 
997  if ((stagvalue & CODEPAGE_TAG_HAS_CONTENT) == CODEPAGE_TAG_HAS_CONTENT)
998  {
999  while (!IsTag(buffer, TAG_END))
1000  {
1001  Read_content(buffer);
1002  }
1003 
1004  ReadFixedTag(buffer, TAG_END);
1005  }
1006 
1007  /* move the current node back up one */
1008  buffer->m_curnode = buffer->m_curnode->m_parent;
1009 }
unsigned char WBXML_TAG
Definition: decompile.h:116
P_WBXML_NODE m_tree
Definition: decompile.h:191
void Read_content(P_WBXML_INFO buffer)
Definition: decompile.c:1011
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
void Read_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:1247
void Read_attribute(P_WBXML_INFO buffer)
Definition: decompile.c:1067
#define CODEPAGE_TAG_HAS_CONTENT
Definition: decompile.h:92
P_WBXML_NODE m_curnode
Definition: decompile.h:192
void * m_child
Definition: decompile.h:143
#define TAG_END
Definition: decompile.h:70
static void AddAttrEndNode(P_WBXML_INFO buffer)
Definition: decompile.c:458
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786
WBXML_TAG Read_stag(P_WBXML_INFO buffer)
Definition: decompile.c:1040
void * m_parent
Definition: decompile.h:144
#define CODEPAGE_TAG_HAS_ATTRS
Definition: decompile.h:93

◆ Read_entcode()

void Read_entcode ( P_WBXML_INFO  buffer)

Definition at line 1278 of file decompile.c.

References Read_mb_u_int32().

Referenced by Read_entity().

1279 {
1280  WBXML_MB_U_INT32 result;
1281  Read_mb_u_int32(buffer, &result);
1282 }
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738

◆ Read_entity()

void Read_entity ( P_WBXML_INFO  buffer)

Definition at line 1272 of file decompile.c.

References Read_entcode(), ReadFixedTag(), and TAG_ENTITY.

Referenced by Read_attrValue(), and Read_content().

1273 {
1274  ReadFixedTag(buffer, TAG_ENTITY);
1275  Read_entcode(buffer);
1276 }
void Read_entcode(P_WBXML_INFO buffer)
Definition: decompile.c:1278
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786
#define TAG_ENTITY
Definition: decompile.h:71

◆ Read_extension()

void Read_extension ( P_WBXML_INFO  buffer)

Definition at line 1146 of file decompile.c.

References AddVariableIndexNode(), AddVariableStringNode(), ERR_TAG_NOT_FOUND, Is_switchPage(), IsTag(), ParseError(), ParseWarning(), Read_index(), Read_switchPage(), Read_termstr_rtn(), ReadFixedTag(), TAG_EXT_0, TAG_EXT_1, TAG_EXT_2, TAG_EXT_I_0, TAG_EXT_I_1, TAG_EXT_I_2, TAG_EXT_T_0, TAG_EXT_T_1, TAG_EXT_T_2, VAR_ESCAPED, VAR_UNCHANGED, VAR_UNESCAPED, WARN_FUTURE_EXPANSION_EXT_0, WARN_FUTURE_EXPANSION_EXT_1, and WARN_FUTURE_EXPANSION_EXT_2.

Referenced by Read_attrValue(), and Read_content().

1147 {
1148  if (Is_switchPage(buffer))
1149  {
1150  Read_switchPage(buffer);
1151  }
1152 
1153  if (IsTag(buffer, TAG_EXT_I_0))
1154  {
1155  char* str = NULL;
1156 
1157  ReadFixedTag(buffer, TAG_EXT_I_0);
1158  Read_termstr_rtn(buffer, &str);
1159 
1160  AddVariableStringNode(buffer, str, VAR_ESCAPED);
1161  }
1162  else if (IsTag(buffer, TAG_EXT_I_1))
1163  {
1164  char* str = NULL;
1165 
1166  ReadFixedTag(buffer, TAG_EXT_I_1);
1167  Read_termstr_rtn(buffer, &str);
1168 
1169  AddVariableStringNode(buffer, str, VAR_UNESCAPED);
1170  }
1171  else if (IsTag(buffer, TAG_EXT_I_2))
1172  {
1173  char* str = NULL;
1174 
1175  ReadFixedTag(buffer, TAG_EXT_I_2);
1176  Read_termstr_rtn(buffer, &str);
1177 
1178  AddVariableStringNode(buffer, str, VAR_UNCHANGED);
1179  }
1180  else if (IsTag(buffer, TAG_EXT_T_0))
1181  {
1182  WBXML_MB_U_INT32 index;
1183 
1184  ReadFixedTag(buffer, TAG_EXT_T_0);
1185  Read_index(buffer, &index);
1186 
1187  AddVariableIndexNode(buffer, index, VAR_ESCAPED);
1188  }
1189  else if (IsTag(buffer, TAG_EXT_T_1))
1190  {
1191  WBXML_MB_U_INT32 index;
1192 
1193  ReadFixedTag(buffer, TAG_EXT_T_1);
1194  Read_index(buffer, &index);
1195 
1196  AddVariableIndexNode(buffer, index, VAR_UNESCAPED);
1197  }
1198  else if (IsTag(buffer, TAG_EXT_T_2))
1199  {
1200  WBXML_MB_U_INT32 index;
1201 
1202  ReadFixedTag(buffer, TAG_EXT_T_2);
1203  Read_index(buffer, &index);
1204 
1205  AddVariableIndexNode(buffer, index, VAR_UNCHANGED);
1206  }
1207  else if (IsTag(buffer, TAG_EXT_0))
1208  {
1209  ReadFixedTag(buffer, TAG_EXT_0);
1210 
1212  }
1213  else if (IsTag(buffer, TAG_EXT_1))
1214  {
1215  ReadFixedTag(buffer, TAG_EXT_1);
1216 
1218  }
1219  else if (IsTag(buffer, TAG_EXT_2))
1220  {
1221  ReadFixedTag(buffer, TAG_EXT_2);
1222 
1224  }
1225  else
1226  {
1228  }
1229 }
#define TAG_EXT_I_2
Definition: decompile.h:76
#define TAG_EXT_2
Definition: decompile.h:86
#define TAG_EXT_0
Definition: decompile.h:84
void Read_termstr_rtn(P_WBXML_INFO buffer, char **result)
Definition: decompile.c:1341
#define TAG_EXT_T_0
Definition: decompile.h:79
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1398
BOOL Is_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:660
#define TAG_EXT_T_1
Definition: decompile.h:80
void Read_switchPage(P_WBXML_INFO buffer)
Definition: decompile.c:1247
#define TAG_EXT_I_0
Definition: decompile.h:74
static void AddVariableStringNode(P_WBXML_INFO buffer, char *string, WBXML_VARIABLE_TYPE type)
Definition: decompile.c:470
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
void ParseWarning(WBXML_PARSE_WARNING warning)
Definition: decompile.c:526
static void AddVariableIndexNode(P_WBXML_INFO buffer, char *string, WBXML_VARIABLE_TYPE type)
Definition: decompile.c:475
#define TAG_EXT_T_2
Definition: decompile.h:81
#define TAG_EXT_1
Definition: decompile.h:85
#define TAG_EXT_I_1
Definition: decompile.h:75
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786

◆ Read_index()

void Read_index ( P_WBXML_INFO  buffer,
P_WBXML_MB_U_INT32  result 
)

Definition at line 1398 of file decompile.c.

References Read_mb_u_int32().

Referenced by Read_attrStart(), Read_extension(), Read_publicid(), Read_stag(), and Read_tableref().

1399 {
1400  Read_mb_u_int32(buffer, result);
1401 }
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738

◆ Read_inline()

void Read_inline ( P_WBXML_INFO  buffer)

Definition at line 1258 of file decompile.c.

References Read_termstr(), ReadFixedTag(), and TAG_STR_I.

Referenced by Read_string().

1259 {
1260  ReadFixedTag(buffer, TAG_STR_I);
1261  Read_termstr(buffer);
1262 }
#define TAG_STR_I
Definition: decompile.h:72
void Read_termstr(P_WBXML_INFO buffer)
Definition: decompile.c:1387
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786

◆ Read_length()

void Read_length ( P_WBXML_INFO  buffer,
P_WBXML_MB_U_INT32  result 
)

Definition at line 1403 of file decompile.c.

References Read_mb_u_int32().

Referenced by Read_opaque().

1404 {
1405  Read_mb_u_int32(buffer, result);
1406 }
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738

◆ Read_mb_u_int32()

void Read_mb_u_int32 ( P_WBXML_INFO  buffer,
P_WBXML_MB_U_INT32  result 
)

Definition at line 738 of file decompile.c.

References BytesLeft(), ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, tagWBXML_INFO::m_curpos, MAX_MB_U_INT32_BYTES, and ParseError().

Referenced by Read_charset(), Read_entcode(), Read_index(), Read_length(), Read_publicid(), and Read_strtbl().

739 {
740  if (buffer && result)
741  {
742  int i;
743  for (i = 0; i < MAX_MB_U_INT32_BYTES; i++)
744  {
745  if (BytesLeft(buffer) >= 1)
746  {
747  (*result)[i] = *(buffer->m_curpos);
748  (buffer->m_curpos)++;
749 
750  if ( !( (*result)[i] & 0x80 ) )
751  break;
752  }
753  else
754  {
756  }
757  }
758  }
759  else
760  {
762  }
763 }
P_WBXML m_curpos
Definition: decompile.h:189
#define MAX_MB_U_INT32_BYTES
Definition: decompile.h:164
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548

◆ Read_opaque()

void Read_opaque ( P_WBXML_INFO  buffer)

Definition at line 1297 of file decompile.c.

References mb_u_int32_to_long(), Read_bytes(), Read_length(), ReadFixedTag(), and TAG_OPAQUE.

Referenced by Read_attrValue(), and Read_content().

1298 {
1299  WBXML_MB_U_INT32 length;
1300  WBXML_BYTES data;
1301 
1302  ReadFixedTag(buffer, TAG_OPAQUE);
1303  Read_length(buffer, &length);
1304  Read_bytes(buffer, mb_u_int32_to_long(&length), &data);
1305 }
#define TAG_OPAQUE
Definition: decompile.h:87
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
long mb_u_int32_to_long(P_WBXML_MB_U_INT32 value)
Definition: decompile.c:873
void Read_length(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1403
void Read_bytes(P_WBXML_INFO buffer, WBXML_LENGTH length, P_WBXML_BYTES result)
Definition: decompile.c:765
unsigned char * WBXML_BYTES
Definition: decompile.h:174
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786

◆ Read_pageindex()

void Read_pageindex ( P_WBXML_INFO  buffer,
P_WBXML_U_INT8  result 
)

Definition at line 1420 of file decompile.c.

References Read_u_int8().

Referenced by Read_switchPage().

1421 {
1422  Read_u_int8(buffer, result);
1423 }
void Read_u_int8(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
Definition: decompile.c:718

◆ Read_pi()

void Read_pi ( P_WBXML_INFO  buffer)

Definition at line 1284 of file decompile.c.

References Is_attrValue(), Read_attrStart(), Read_attrValue(), ReadFixedTag(), TAG_END, and TAG_PI.

Referenced by Read_body(), and Read_content().

1285 {
1286  ReadFixedTag(buffer, TAG_PI);
1287  Read_attrStart(buffer);
1288 
1289  while (Is_attrValue(buffer))
1290  {
1291  Read_attrValue(buffer);
1292  }
1293 
1294  ReadFixedTag(buffer, TAG_END);
1295 }
BOOL Is_attrValue(P_WBXML_INFO buffer)
Definition: decompile.c:612
void Read_attrStart(P_WBXML_INFO buffer)
Definition: decompile.c:1077
#define TAG_PI
Definition: decompile.h:77
#define TAG_END
Definition: decompile.h:70
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786
void Read_attrValue(P_WBXML_INFO buffer)
Definition: decompile.c:1109

◆ Read_publicid()

void Read_publicid ( P_WBXML_INFO  buffer)

Definition at line 1314 of file decompile.c.

References AddDTDNode(), Is_zero(), Read_index(), Read_mb_u_int32(), and ZERO_WBXML_MB_U_INT32.

Referenced by Read_start().

1315 {
1316  if (Is_zero(buffer))
1317  {
1318  WBXML_MB_U_INT32 index;
1319 
1320  Read_index(buffer, &index);
1321 
1322  AddDTDNode(buffer, ZERO_WBXML_MB_U_INT32, index);
1323  }
1324  else
1325  {
1326  WBXML_MB_U_INT32 result;
1327 
1328  Read_mb_u_int32(buffer, &result);
1329 
1330  AddDTDNode(buffer, result, ZERO_WBXML_MB_U_INT32);
1331  }
1332 }
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1398
BOOL Is_zero(P_WBXML_INFO buffer)
Definition: decompile.c:690
static void AddDTDNode(P_WBXML_INFO buffer, const WBXML_DTD_TYPE dtdnum, const WBXML_MB_U_INT32 index)
Definition: decompile.c:407
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738
const WBXML_MB_U_INT32 ZERO_WBXML_MB_U_INT32
Definition: decompile.c:72

◆ Read_stag()

WBXML_TAG Read_stag ( P_WBXML_INFO  buffer)

Definition at line 1040 of file decompile.c.

References AddCodepageLiteralTagNode(), AddCodepageTagNode(), CP_TAG_TAG, ERR_TAG_NOT_FOUND, IsCodepageTag(), IsTag(), ParseError(), Read_index(), ReadCodepageTag(), ReadFixedTag(), and TAG_LITERAL.

Referenced by Read_element().

1041 {
1042  if (IsCodepageTag(buffer, CP_TAG_TAG))
1043  {
1044  WBXML_TAG tag = ReadCodepageTag(buffer, CP_TAG_TAG);
1045 
1046  AddCodepageTagNode(buffer, tag);
1047 
1048  return tag;
1049  }
1050  else if (IsTag(buffer, TAG_LITERAL))
1051  {
1052  WBXML_MB_U_INT32 index;
1053 
1054  ReadFixedTag(buffer, TAG_LITERAL);
1055  Read_index(buffer, &index);
1056 
1057  AddCodepageLiteralTagNode(buffer, index);
1058  }
1059  else
1060  {
1062  }
1063 
1064  return 0;
1065 }
BOOL IsCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:594
unsigned char WBXML_TAG
Definition: decompile.h:116
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1398
#define TAG_LITERAL
Definition: decompile.h:73
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
static void AddCodepageLiteralTagNode(P_WBXML_INFO buffer, WBXML_MB_U_INT32 index)
Definition: decompile.c:430
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:570
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786
static void AddCodepageTagNode(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:423
WBXML_TAG ReadCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
Definition: decompile.c:812

◆ Read_start()

void Read_start ( P_WBXML_INFO  buffer)

Definition at line 935 of file decompile.c.

References Read_body(), Read_charset(), Read_publicid(), Read_strtbl(), and Read_version().

Referenced by main().

936 {
937  Read_version(buffer);
938  Read_publicid(buffer);
939  Read_charset(buffer);
940  Read_strtbl(buffer);
941  Read_body(buffer);
942 }
void Read_publicid(P_WBXML_INFO buffer)
Definition: decompile.c:1314
void Read_version(P_WBXML_INFO buffer)
Definition: decompile.c:1307
void Read_strtbl(P_WBXML_INFO buffer)
Definition: decompile.c:944
void Read_charset(P_WBXML_INFO buffer)
Definition: decompile.c:1334
void Read_body(P_WBXML_INFO buffer)
Definition: decompile.c:953

◆ Read_string()

void Read_string ( P_WBXML_INFO  buffer)

Definition at line 1231 of file decompile.c.

References ERR_TAG_NOT_FOUND, Is_inline(), Is_tableref(), ParseError(), Read_inline(), and Read_tableref().

Referenced by Read_attrValue(), and Read_content().

1232 {
1233  if (Is_inline(buffer))
1234  {
1235  Read_inline(buffer);
1236  }
1237  else if (Is_tableref(buffer))
1238  {
1239  Read_tableref(buffer);
1240  }
1241  else
1242  {
1244  }
1245 }
BOOL Is_tableref(P_WBXML_INFO buffer)
Definition: decompile.c:670
void Read_tableref(P_WBXML_INFO buffer)
Definition: decompile.c:1264
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
BOOL Is_inline(P_WBXML_INFO buffer)
Definition: decompile.c:665
void Read_inline(P_WBXML_INFO buffer)
Definition: decompile.c:1258

◆ Read_strtbl()

void Read_strtbl ( P_WBXML_INFO  buffer)

Definition at line 944 of file decompile.c.

References AddStringTableNode(), tagWBXML_STRING_TABLE::m_length, tagWBXML_STRING_TABLE::m_strings, mb_u_int32_to_long(), Read_bytes(), and Read_mb_u_int32().

Referenced by Read_start().

945 {
946  WBXML_STRING_TABLE result;
947  Read_mb_u_int32(buffer, &(result.m_length));
948  Read_bytes(buffer, mb_u_int32_to_long(&(result.m_length)), &(result.m_strings));
949 
950  AddStringTableNode(buffer, &result);
951 }
WBXML_MB_U_INT32 m_length
Definition: decompile.h:201
long mb_u_int32_to_long(P_WBXML_MB_U_INT32 value)
Definition: decompile.c:873
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:738
void Read_bytes(P_WBXML_INFO buffer, WBXML_LENGTH length, P_WBXML_BYTES result)
Definition: decompile.c:765
static void AddStringTableNode(P_WBXML_INFO buffer, const P_WBXML_STRING_TABLE strings)
Definition: decompile.c:416
WBXML_BYTES m_strings
Definition: decompile.h:202

◆ Read_switchPage()

void Read_switchPage ( P_WBXML_INFO  buffer)

Definition at line 1247 of file decompile.c.

References tagWBXML_INFO::m_curpage, Read_pageindex(), ReadFixedTag(), and TAG_SWITCH_PAGE.

Referenced by Read_attrStart(), Read_attrValue(), Read_element(), and Read_extension().

1248 {
1249  WBXML_U_INT8 pageindex;
1250 
1251  ReadFixedTag(buffer, TAG_SWITCH_PAGE);
1252  Read_pageindex(buffer, &pageindex);
1253 
1254  /* Use the new codepage */
1255  buffer->m_curpage = pageindex;
1256 }
void Read_pageindex(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
Definition: decompile.c:1420
WBXML_CODEPAGE m_curpage
Definition: decompile.h:193
unsigned char WBXML_U_INT8
Definition: decompile.h:161
#define TAG_SWITCH_PAGE
Definition: decompile.h:69
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786

◆ Read_tableref()

void Read_tableref ( P_WBXML_INFO  buffer)

Definition at line 1264 of file decompile.c.

References Read_index(), ReadFixedTag(), and TAG_STR_T.

Referenced by Read_string().

1265 {
1266  WBXML_MB_U_INT32 index;
1267 
1268  ReadFixedTag(buffer, TAG_STR_T);
1269  Read_index(buffer, &index);
1270 }
#define TAG_STR_T
Definition: decompile.h:82
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
Definition: decompile.h:166
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
Definition: decompile.c:1398
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
Definition: decompile.c:786

◆ Read_termstr()

void Read_termstr ( P_WBXML_INFO  buffer)

Definition at line 1387 of file decompile.c.

References AddStringNode(), free, and Read_termstr_rtn().

Referenced by Read_inline().

1388 {
1389  char* strbuf = NULL;
1390 
1391  Read_termstr_rtn(buffer, &strbuf);
1392 
1393  AddStringNode(buffer, strbuf);
1394 
1395  free(strbuf);
1396 }
void Read_termstr_rtn(P_WBXML_INFO buffer, char **result)
Definition: decompile.c:1341
#define free(p)
Definition: gwmem.h:194
static void AddStringNode(P_WBXML_INFO buffer, char *string)
Definition: decompile.c:464

◆ Read_termstr_rtn()

void Read_termstr_rtn ( P_WBXML_INFO  buffer,
char **  result 
)

Definition at line 1341 of file decompile.c.

References BytesLeft(), ERR_INTERNAL_BAD_PARAM, FALSE, free, tagWBXML_INFO::m_curpos, malloc, ParseError(), realloc, STRING_BLOCK_SIZE, and TRUE.

Referenced by Read_extension(), and Read_termstr().

1342 {
1343 
1344 #define STRING_BLOCK_SIZE 256
1345 
1346  int buflen = STRING_BLOCK_SIZE;
1347  char* strbuf = (char*) malloc(buflen);
1348  BOOL doubled = FALSE;
1349  int i = 0;
1350 
1351  if (!result)
1353 
1354  while ( (BytesLeft(buffer) >= 1) && (*(buffer->m_curpos) != 0) )
1355  {
1356  if (i>=buflen)
1357  {
1358  buflen += STRING_BLOCK_SIZE;
1359  strbuf = realloc(strbuf, buflen);
1360  }
1361 
1362  if (*(buffer->m_curpos) != '$' || doubled == TRUE)
1363  {
1364  strbuf[i] = *(buffer->m_curpos);
1365  buffer->m_curpos++;
1366  i++;
1367  if (doubled == TRUE)
1368  doubled = FALSE;
1369  }
1370  else
1371  {
1372  strbuf[i] = *(buffer->m_curpos);
1373  i++;
1374  doubled = TRUE;
1375  }
1376  }
1377 
1378  strbuf[i] = 0;
1379  buffer->m_curpos++;
1380 
1381  if (*result)
1382  free(*result);
1383 
1384  *result = strbuf;
1385 }
P_WBXML m_curpos
Definition: decompile.h:189
#define realloc(p, n)
Definition: gwmem.h:193
#define STRING_BLOCK_SIZE
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
#define free(p)
Definition: gwmem.h:194
#define malloc(n)
Definition: gwmem.h:191
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548
int BOOL
Definition: decompile.h:108
#define FALSE
Definition: decompile.h:109
#define TRUE
Definition: decompile.h:110

◆ Read_u_int8()

void Read_u_int8 ( P_WBXML_INFO  buffer,
P_WBXML_U_INT8  result 
)

Definition at line 718 of file decompile.c.

References BytesLeft(), ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, tagWBXML_INFO::m_curpos, and ParseError().

Referenced by Read_pageindex(), Read_version(), and Read_zero().

719 {
720  if (buffer && result)
721  {
722  if (BytesLeft(buffer) >= 1)
723  {
724  *result = *(buffer->m_curpos);
725  (buffer->m_curpos)++;
726  }
727  else
728  {
730  }
731  }
732  else
733  {
735  }
736 }
P_WBXML m_curpos
Definition: decompile.h:189
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548

◆ Read_version()

void Read_version ( P_WBXML_INFO  buffer)

Definition at line 1307 of file decompile.c.

References Read_u_int8().

Referenced by Read_start().

1308 {
1309  WBXML_U_INT8 result;
1310 
1311  Read_u_int8(buffer, &result);
1312 }
unsigned char WBXML_U_INT8
Definition: decompile.h:161
void Read_u_int8(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
Definition: decompile.c:718

◆ Read_zero()

void Read_zero ( P_WBXML_INFO  buffer)

Definition at line 1408 of file decompile.c.

References ERR_TAG_NOT_FOUND, ParseError(), and Read_u_int8().

1409 {
1410  WBXML_U_INT8 result;
1411 
1412  Read_u_int8(buffer, &result);
1413 
1414  if (result != (WBXML_U_INT8) 0)
1415  {
1417  }
1418 }
unsigned char WBXML_U_INT8
Definition: decompile.h:161
void Read_u_int8(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
Definition: decompile.c:718
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490

◆ ReadCodepageTag()

WBXML_TAG ReadCodepageTag ( P_WBXML_INFO  buffer,
CP_TAG_TYPE  type 
)

Definition at line 812 of file decompile.c.

References BytesLeft(), CP_TAG_ATTRSTART, CP_TAG_ATTRVALUE, CP_TAG_TAG, ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, ERR_TAG_NOT_FOUND, tagWBXML_INFO::m_curpos, and ParseError().

Referenced by Read_attrStart(), Read_attrValue(), and Read_stag().

813 {
814  WBXML_TAG tag = 0;
815 
816  if (buffer)
817  {
818  if (BytesLeft(buffer) >= sizeof(WBXML_TAG))
819  {
820  tag = *((WBXML_TAG*) buffer->m_curpos);
821 
822  switch (type)
823  {
824  case CP_TAG_TAG:
825  buffer->m_curpos += sizeof(WBXML_TAG);
826  break;
827 
828  case CP_TAG_ATTRSTART:
829  if ((tag & 0x80) != 0x80)
830  {
831  buffer->m_curpos += sizeof(WBXML_TAG);
832  }
833  else
834  {
836  }
837  break;
838 
839  case CP_TAG_ATTRVALUE:
840  if ((tag & 0x80) == 0x80)
841  {
842  buffer->m_curpos += sizeof(WBXML_TAG);
843  }
844  else
845  {
847  }
848  break;
849 
850  default:
852  break;
853  }
854  }
855  else
856  {
858  }
859  }
860  else
861  {
863  }
864 
865  return tag;
866 }
P_WBXML m_curpos
Definition: decompile.h:189
unsigned char WBXML_TAG
Definition: decompile.h:116
int type
Definition: smsc_cimd2.c:215
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548

◆ ReadFixedTag()

void ReadFixedTag ( P_WBXML_INFO  buffer,
WBXML_TAG  tag 
)

Definition at line 786 of file decompile.c.

References BytesLeft(), ERR_END_OF_DATA, ERR_INTERNAL_BAD_PARAM, ERR_TAG_NOT_FOUND, tagWBXML_INFO::m_curpos, and ParseError().

Referenced by Read_attrStart(), Read_element(), Read_entity(), Read_extension(), Read_inline(), Read_opaque(), Read_pi(), Read_stag(), Read_switchPage(), and Read_tableref().

787 {
788  if (buffer)
789  {
790  if (BytesLeft(buffer) >= sizeof(WBXML_TAG))
791  {
792  if ((*((WBXML_TAG*) buffer->m_curpos)) == tag)
793  {
794  buffer->m_curpos += sizeof(WBXML_TAG);
795  }
796  else
797  {
799  }
800  }
801  else
802  {
804  }
805  }
806  else
807  {
809  }
810 }
P_WBXML m_curpos
Definition: decompile.h:189
unsigned char WBXML_TAG
Definition: decompile.h:116
void ParseError(WBXML_PARSE_ERROR error)
Definition: decompile.c:490
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
Definition: decompile.c:548

Variable Documentation

◆ ZERO_WBXML_MB_U_INT32

const WBXML_MB_U_INT32 ZERO_WBXML_MB_U_INT32

Definition at line 72 of file decompile.c.

Referenced by Read_publicid().

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.