1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
$NetBSD: patch-lib_libucsi_section.h,v 1.1 2011/07/15 22:59:21 jmcneill Exp $
--- lib/libucsi/section.h.orig 2011-06-28 05:50:24.000000000 +0000
+++ lib/libucsi/section.h
@@ -112,7 +112,7 @@ static inline struct section * section_c
if (len < 3)
return NULL;
- bswap16(buf+1);
+ ubswap16(buf+1);
if (len != ret->length + 3U)
return NULL;
@@ -134,9 +134,9 @@ static inline int section_check_crc(stru
uint32_t crc;
/* the crc check has to be performed on the unswapped data */
- bswap16(buf+1);
+ ubswap16(buf+1);
crc = crc32(CRC32_INIT, buf, len);
- bswap16(buf+1);
+ ubswap16(buf+1);
/* the crc check includes the crc value,
* the result should therefore be zero.
@@ -165,7 +165,7 @@ static inline struct section_ext * secti
return NULL;
}
- bswap16((uint8_t *)section + sizeof(struct section));
+ ubswap16((uint8_t *)section + sizeof(struct section));
return (struct section_ext *)section;
}
@@ -183,7 +183,7 @@ static inline struct section_ext * secti
if (section->syntax_indicator == 0)
return NULL;
- bswap16((uint8_t *)section + sizeof(struct section));
+ ubswap16((uint8_t *)section + sizeof(struct section));
if (update_crc) {
uint8_t * buf = (uint8_t *) section;
@@ -191,13 +191,13 @@ static inline struct section_ext * secti
uint32_t crc;
/* the crc has to be performed on the swapped data */
- bswap16(buf+1);
+ ubswap16(buf+1);
crc = crc32(CRC32_INIT, buf, len-4);
- bswap16(buf+1);
+ ubswap16(buf+1);
/* update the CRC */
*((uint32_t*) (buf+len-4)) = crc;
- bswap32(buf+len-4);
+ ubswap32(buf+len-4);
}
return (struct section_ext *)section;
|