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

« back to all changes in this revision

Viewing changes to erts/emulator/drivers/common/ram_file_drv.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090215164252-dxpjjuq108nz4noa
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
 
90
90
#define BFILE_BLOCK  1024
91
91
 
92
 
#define get_int32(s) ((((unsigned char*) (s))[0] << 24) | \
93
 
                      (((unsigned char*) (s))[1] << 16) | \
94
 
                      (((unsigned char*) (s))[2] << 8)  | \
95
 
                      (((unsigned char*) (s))[3]))
96
 
 
97
 
#define put_int32(i, s) {((char*)(s))[0] = (char)((i) >> 24) & 0xff; \
98
 
                        ((char*)(s))[1] = (char)((i) >> 16) & 0xff; \
99
 
                        ((char*)(s))[2] = (char)((i) >> 8)  & 0xff; \
100
 
                        ((char*)(s))[3] = (char)((i)        & 0xff);}
101
 
 
102
 
#define get_int16(s) ((((unsigned char*)  (s))[0] << 8) | \
103
 
                      (((unsigned char*)  (s))[1]))
104
 
 
105
 
 
106
 
#define put_int16(i, s) {((unsigned char*)(s))[0] = ((i) >> 8) & 0xff; \
107
 
                        ((unsigned char*)(s))[1] = (i)         & 0xff;}
108
 
 
109
 
#define get_int8(s) ((((unsigned char*)  (s))[0] ))
110
 
 
111
 
 
112
 
#define put_int8(i, s) { ((unsigned char*)(s))[0] = (i)         & 0xff;}
113
 
 
114
92
typedef unsigned char uchar;
115
93
 
116
94
static ErlDrvData rfile_start(ErlDrvPort, char*);
138
116
    ErlDrvPort port;    /* the associcated port */
139
117
    int flags;          /* flags read/write */
140
118
    ErlDrvBinary* bin;  /* binary to hold binary file */
141
 
    uchar* buf;         /* buffer start (in binary) */
 
119
    char* buf;          /* buffer start (in binary) */
142
120
    int size;           /* buffer size (allocated) */
143
121
    int cur;            /* current position in buffer */
144
122
    int end;            /* end position in buffer */
316
294
}
317
295
 
318
296
 
319
 
static int ram_file_write(RamFile *f, uchar *buf, int len, 
 
297
static int ram_file_write(RamFile *f, char *buf, int len, 
320
298
                          int *location, int *error)
321
299
{
322
300
    int cur = f->cur;
417
395
 
418
396
    if ((bin = driver_alloc_binary(usize)) == NULL)
419
397
        return error_reply(f, ENOMEM);
420
 
    outp = (unsigned char*)bin->orig_bytes;
421
 
    inp = f->buf;
 
398
    outp = (uchar*)bin->orig_bytes;
 
399
    inp = (uchar*)f->buf;
422
400
 
423
401
    while(len > 0) {
424
402
        int c1, c2, c3;
475
453
 
476
454
    if ((bin = driver_alloc_binary(usize)) == NULL)
477
455
        return error_reply(f, ENOMEM);
478
 
    outp = (unsigned char*)bin->orig_bytes;
479
 
    inp  = f->buf;
 
456
    outp = (uchar*)bin->orig_bytes;
 
457
    inp  = (uchar*)f->buf;
480
458
 
481
459
    while(len > 0) {
482
460
        if ((n = uu_decode(*inp++)) < 0)