~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/percept/c_src/egd_coding.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-07 15:07:37 UTC
  • mfrom: (1.2.1 upstream) (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090507150737-i4yb5elwinm7r0hc
Tags: 1:13.b-dfsg1-1
* Removed another bunch of non-free RFCs from original tarball
  (closes: #527053).
* Fixed build-dependencies list by adding missing comma. This requires
  libsctp-dev again. Also, added libsctp1 dependency to erlang-base and
  erlang-base-hipe packages because the shared library is loaded via
  dlopen now and cannot be added using dh_slibdeps (closes: #526682).
* Weakened dependency of erlang-webtool on erlang-observer to recommends
  to avoid circular dependencies (closes: #526627).
* Added solaris-i386 to HiPE enabled architectures.
* Made script sources in /usr/lib/erlang/erts-*/bin directory executable,
  which is more convenient if a user wants to create a target Erlang system.
* Shortened extended description line for erlang-dev package to make it
  fit 80x25 terminals.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ``The contents of this file are subject to the Erlang Public License,
2
 
 * Version 1.1, (the "License"); you may not use this file except in
3
 
 * compliance with the License. You should have received a copy of the
4
 
 * Erlang Public License along with this software. If not, it can be
5
 
 * retrieved via the world wide web at http://www.erlang.org/.
6
 
 * 
7
 
 * Software distributed under the License is distributed on an "AS IS"
8
 
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
 
 * the License for the specific language governing rights and limitations
10
 
 * under the License.
11
 
 * 
12
 
 * The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
 * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
 * AB. All Rights Reserved.''
15
 
 * 
16
 
 *     $Id$
17
 
 */
18
 
unsigned int decode16(unsigned char**);
19
 
unsigned char *encode16(unsigned char*, unsigned int);
20
 
unsigned int decode32(unsigned char**);
21
 
unsigned char *encode32(unsigned char*, unsigned int);
22
 
 
23
 
 
24
 
int decode(char **data) {
25
 
    return decode32((unsigned char**) data);
26
 
}
27
 
 
28
 
unsigned char *encode(unsigned char *buffer, int data) {
29
 
    return encode32(buffer, (unsigned int)data);
30
 
}
31
 
 
32
 
unsigned int decode_color(char **data) {
33
 
    return decode(data);
34
 
}
35
 
 
36
 
unsigned char *encode_color(unsigned char *buffer, unsigned int color) {
37
 
    return encode(buffer, color);
38
 
}
39
 
 
40
 
unsigned int decode16(unsigned char **data) {
41
 
    unsigned int value = 0;
42
 
    value = (*data)[0];
43
 
    value = (value << 8) + (*data)[1];
44
 
    *data += 2;
45
 
    return value;
46
 
}
47
 
 
48
 
unsigned char *encode16(unsigned char *buffer, unsigned int data) {
49
 
    buffer[1] = data & 0xff;
50
 
    buffer[0] = (data >> 8) & 0xff;
51
 
    return buffer;
52
 
}
53
 
 
54
 
unsigned int decode32(unsigned char **data) {
55
 
    unsigned int value = 0;
56
 
    value = (*data)[0];
57
 
    value = (value << 8) + (*data)[1];
58
 
    value = (value << 8) + (*data)[2];
59
 
    value = (value << 8) + (*data)[3];
60
 
    *data += 4;
61
 
    return value;
62
 
}
63
 
 
64
 
unsigned char *encode32(unsigned char *buffer, unsigned int data) {
65
 
    buffer[3] = data & 0xff;
66
 
    buffer[2] = (data >> 8) & 0xff;
67
 
    buffer[1] = (data >> 16) & 0xff;
68
 
    buffer[0] = (data >> 24) & 0xff;
69
 
    return buffer;
70
 
}