Ticket #2094: DigestCode2094.cpp

File DigestCode2094.cpp, 907 bytes (added by shinta, 17 years ago)
Line 
1static inline uint32
2swap_uint32(uint32 value)
3{
4 swap_data(B_UINT32_TYPE, &value, sizeof(value), B_SWAP_HOST_TO_BENDIAN);
5 return value;
6}
7
8static inline uint32
9get_uint32_color(rgb_color color)
10{
11 return swap_uint32(*reinterpret_cast<uint32 *>(&color));
12}
13
14BView::BView(BMessage *archive)
15 : BHandler(archive)
16{
17...snip...
18
19 rgb_color color;
20 int32 colorValue;
21 if (archive->FindInt32("_color", 0, &colorValue) == B_OK) {
22 *reinterpret_cast<int32 *>(&color) = swap_uint32(colorValue);
23 SetHighColor(color);
24 }
25 if (archive->FindInt32("_color", 1, &colorValue) == B_OK) {
26 *reinterpret_cast<int32 *>(&color) = swap_uint32(colorValue);
27 SetLowColor(color);
28 }
29 if (archive->FindInt32("_color", 2, &colorValue) == B_OK) {
30 *reinterpret_cast<int32 *>(&color) = swap_uint32(colorValue);
31 SetViewColor(color);
32 }
33
34 uint32 evMask;
35 uint32 options;
36
37...snip...
38}
39
40
41