ReactOS  0.4.14-dev-49-gfb4591c
isonum.c
Go to the documentation of this file.
1 /* @(#)isonum.c 1.9 10/12/19 Copyright 2006-2010 J. Schilling */
2 #include <schily/mconfig.h>
3 #ifndef lint
4 static UConst char sccsid[] =
5  "@(#)isonum.c 1.9 10/12/19 Copyright 2006-2010 J. Schilling";
6 #endif
7 /*
8  * Copyright (c) 2006-2010 J. Schilling
9  */
10 /*
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2
13  * as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program; see the file COPYING. If not, write to the Free Software
22  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  */
24 
25 #include "mkisofs.h"
26 
27 
28 EXPORT void set_721 __PR((void *vp, UInt32_t i));
29 EXPORT void set_722 __PR((void *vp, UInt32_t i));
30 EXPORT void set_723 __PR((void *vp, UInt32_t i));
31 EXPORT void set_731 __PR((void *vp, UInt32_t i));
32 EXPORT void set_732 __PR((void *vp, UInt32_t i));
33 EXPORT void set_733 __PR((void *vp, UInt32_t i));
34 EXPORT UInt32_t get_711 __PR((void *vp));
35 EXPORT UInt32_t get_721 __PR((void *vp));
36 EXPORT UInt32_t get_723 __PR((void *vp));
37 EXPORT UInt32_t get_731 __PR((void *vp));
38 EXPORT UInt32_t get_732 __PR((void *vp));
39 EXPORT UInt32_t get_733 __PR((void *vp));
40 
41 /*
42  * ISO-9660 7.2.1
43  * Set 16 bit unsigned int, store Least significant byte first
44  */
45 EXPORT void
46 set_721(vp, i)
47  void *vp;
48  UInt32_t i;
49 {
50  Uchar *p = vp;
51 
52  p[0] = i & 0xff;
53  p[1] = (i >> 8) & 0xff;
54 }
55 
56 /*
57  * ISO-9660 7.2.2
58  * Set 16 bit unsigned int, store Most significant byte first
59  */
60 EXPORT void
61 set_722(vp, i)
62  void *vp;
63  UInt32_t i;
64 {
65  Uchar *p = vp;
66 
67  p[0] = (i >> 8) & 0xff;
68  p[1] = i & 0xff;
69 }
70 
71 /*
72  * ISO-9660 7.2.3
73  * Set 16 bit unsigned int, store Both Byte orders
74  */
75 EXPORT void
76 set_723(vp, i)
77  void *vp;
78  UInt32_t i;
79 {
80  Uchar *p = vp;
81 
82  p[3] = p[0] = i & 0xff;
83  p[2] = p[1] = (i >> 8) & 0xff;
84 }
85 
86 /*
87  * ISO-9660 7.3.1
88  * Set 32 bit unsigned int, store Least significant byte first
89  */
90 EXPORT void
91 set_731(vp, i)
92  void *vp;
93  UInt32_t i;
94 {
95  Uchar *p = vp;
96 
97  p[0] = i & 0xff;
98  p[1] = (i >> 8) & 0xff;
99  p[2] = (i >> 16) & 0xff;
100  p[3] = (i >> 24) & 0xff;
101 }
102 
103 /*
104  * ISO-9660 7.3.2
105  * Set 32 bit unsigned int, store Most significant byte first
106  */
107 EXPORT void
108 set_732(vp, i)
109  void *vp;
110  UInt32_t i;
111 {
112  Uchar *p = vp;
113 
114  p[3] = i & 0xff;
115  p[2] = (i >> 8) & 0xff;
116  p[1] = (i >> 16) & 0xff;
117  p[0] = (i >> 24) & 0xff;
118 }
119 
120 /*
121  * ISO-9660 7.3.3
122  * Set 32 bit unsigned int, store Both Byte orders
123  */
124 EXPORT void
125 set_733(vp, i)
126  void *vp;
127  UInt32_t i;
128 {
129  Uchar *p = vp;
130 
131  p[7] = p[0] = i & 0xff;
132  p[6] = p[1] = (i >> 8) & 0xff;
133  p[5] = p[2] = (i >> 16) & 0xff;
134  p[4] = p[3] = (i >> 24) & 0xff;
135 }
136 
137 /*
138  * ISO-9660 7.1.1
139  * Get 8 bit unsigned int
140  */
141 EXPORT UInt32_t
143  void *vp;
144 {
145  Uchar *p = vp;
146 
147  return (*p & 0xff);
148 }
149 
150 /*
151  * ISO-9660 7.2.1
152  * Get 16 bit unsigned int, stored with Least significant byte first
153  */
154 EXPORT UInt32_t
156  void *vp;
157 {
158  Uchar *p = vp;
159 
160  return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
161 }
162 
163 
164 /*
165  * ISO-9660 7.2.3
166  * Get 16 bit unsigned int, stored with Both Byte orders
167  */
168 EXPORT UInt32_t
170  void *vp;
171 {
172  Uchar *p = vp;
173 #if 0
174  if (p[0] != p[3] || p[1] != p[2]) {
175  comerrno(EX_BAD, _("Invalid format 7.2.3 number\n"));
176  }
177 #endif
178  return (get_721(p));
179 }
180 
181 
182 /*
183  * ISO-9660 7.3.1
184  * Get 32 bit unsigned int, stored with Least significant byte first
185  */
186 EXPORT UInt32_t
188  void *vp;
189 {
190  Uchar *p = vp;
191 
192  return ((p[0] & 0xff)
193  | ((p[1] & 0xff) << 8)
194  | ((p[2] & 0xff) << 16)
195  | ((p[3] & 0xff) << 24));
196 }
197 
198 /*
199  * ISO-9660 7.3.2
200  * Get 32 bit unsigned int, stored with Most significant byte first
201  */
202 EXPORT UInt32_t
204  void *vp;
205 {
206  Uchar *p = vp;
207 
208  return ((p[3] & 0xff)
209  | ((p[2] & 0xff) << 8)
210  | ((p[1] & 0xff) << 16)
211  | ((p[0] & 0xff) << 24));
212 }
213 
214 /*
215  * ISO-9660 7.3.3
216  * Get 32 bit unsigned int, stored with Both Byte orders
217  */
218 EXPORT UInt32_t
220  void *vp;
221 {
222  Uchar *p = vp;
223 
224  return ((p[0] & 0xff)
225  | ((p[1] & 0xff) << 8)
226  | ((p[2] & 0xff) << 16)
227  | ((p[3] & 0xff) << 24));
228 }
EXPORT void set_732(void *vp, UInt32_t i)
Definition: isonum.c:108
EXPORT UInt32_t get_731(void *vp)
Definition: isonum.c:187
unsigned char Uchar
Definition: utypes.h:45
EXPORT void set_721(void *vp, UInt32_t i)
Definition: isonum.c:46
#define UConst
Definition: ccomdefs.h:72
EXPORT void set_722(void *vp, UInt32_t i)
Definition: isonum.c:61
EXPORT UInt32_t get_732(void *vp)
Definition: isonum.c:203
EXPORT void set_731(void *vp, UInt32_t i)
Definition: isonum.c:91
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static UConst char sccsid[]
Definition: isonum.c:4
#define _(X)
Definition: i386-dis.c:36
EXPORT UInt32_t get_733(void *vp)
Definition: isonum.c:219
EXPORT UInt32_t get_711(void *vp)
Definition: isonum.c:142
EXPORT UInt32_t get_721(void *vp)
Definition: isonum.c:155
EXPORT UInt32_t get_723(void *vp)
Definition: isonum.c:169
EXPORT void comerrno(int err, char *msg, va_alist)
Definition: comerr.c:137
EXPORT void set_721 __PR((void *vp, UInt32_t i))
GLfloat GLfloat p
Definition: glext.h:8902
EXPORT void set_723(void *vp, UInt32_t i)
Definition: isonum.c:76
EXPORT void set_733(void *vp, UInt32_t i)
Definition: isonum.c:125
#define EX_BAD
Definition: standard.h:62