Preparing for release of 3.0.0pre5
[rsync.git] / io.h
blob6ce4e10c736dc328aaa6fa90637ad9771cf03b1a
1 /*
2 * Copyright (C) 2007 Wayne Davison
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, visit the http://fsf.org website.
18 extern int protocol_version;
20 static inline int32
21 read_varint30(int f)
23 if (protocol_version < 30)
24 return read_int(f);
25 return read_varint(f);
28 static inline int64
29 read_varlong30(int f, uchar min_bytes)
31 if (protocol_version < 30)
32 return read_longint(f);
33 return read_varlong(f, min_bytes);
36 static inline void
37 write_varint30(int f, int32 x)
39 if (protocol_version < 30)
40 write_int(f, x);
41 else
42 write_varint(f, x);
45 static inline void
46 write_varlong30(int f, int64 x, uchar min_bytes)
48 if (protocol_version < 30)
49 write_longint(f, x);
50 else
51 write_varlong(f, x, min_bytes);