Now also parse new diffs
[handlerosm.git] / osmbinary / format.c
blob049e699b534046586623c82133d955e768c2fc50
1 #include <time.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7 #include <string.h>
8 #include <stdlib.h>
10 #include "osmbinary.h"
12 void writenode(int bi, node_t *this) {
13 write(bi, "N", 1);
14 write(bi, &this->id, sizeof(this->id));
15 write(bi, &this->lat, sizeof(this->lat));
16 write(bi, &this->lon, sizeof(this->lon));
17 write(bi, &this->stamp, sizeof(this->stamp));
18 write(bi, &this->userlen, sizeof(this->userlen));
19 write(bi, this->user, this->userlen);
22 void writetag(int bi, tag_t *this) {
23 write(bi, "T", 1);
24 write(bi, &this->klen, sizeof(this->klen));
25 write(bi, this->k, this->klen);
26 write(bi, &this->vlen, sizeof(this->vlen));
27 write(bi, this->v, this->vlen);
30 void writeother(int bi, other_t *this, char type) {
31 write(bi, &type, 1);
32 write(bi, &this->id, sizeof(this->id));
33 write(bi, &this->stamp, sizeof(this->stamp));
34 write(bi, &this->userlen, sizeof(this->userlen));
35 write(bi, this->user, this->userlen);
38 void writend(int bi, nd_t *this) {
39 write(bi, "D", 1);
40 write(bi, &this->id, sizeof(this->id));
43 void writemember(int bi, member_t *this) {
44 write(bi, "M", 1);
45 write(bi, &this->typelen, sizeof(this->typelen));
46 write(bi, this->type, this->typelen);
47 write(bi, &this->reflen, sizeof(this->reflen));
48 write(bi, this->ref, this->reflen);
49 write(bi, &this->rolelen, sizeof(this->rolelen));
50 write(bi, this->role, this->rolelen);