int eid, xlate = 0;
u_int16_t ofrefnum;
u_char nlmask, nlchar;
-
+
+ *rbuflen = 0;
+
ibuf += 2;
memcpy(&ofrefnum, ibuf, sizeof( ofrefnum ));
ibuf += sizeof( u_short );
goto afp_read_err;
}
-#define min(a,b) ((a)<(b)?(a):(b))
- *rbuflen = min( reqcount, *rbuflen );
+#ifndef WITH_SENDFILE
+ *rbuflen = MIN(reqcount, *rbuflen);
err = read_file(ofork, eid, offset, nlmask, nlchar, rbuf, rbuflen, xlate);
if (err < 0)
goto afp_read_done;
-
+#endif
/* dsi can stream requests. we can only do this if we're not checking
* for an end-of-line character. oh well. */
if ((obj->proto == AFPPROTO_DSI) && (*rbuflen < reqcount) && !nlmask) {
#endif /* NDEBUG */
#define STRCMP(a,b,c) (strcmp(a,c) b 0)
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? a : b)
+#endif
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? a : b)
+#endif
#if BYTE_ORDER == BIG_ENDIAN
#define hton64(x) (x)
#endif
#include <atalk/dsi.h>
-
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif /* ! min */
+#include <atalk/util.h>
/* streaming i/o for afp_read. this is all from the perspective of the
* client. it basically does the reverse of dsi_write. on first entry,
dsi->in_write++;
if (dsi_stream_send(dsi, buf, buflen)) {
dsi->datasize = size - buflen;
- return min(dsi->datasize, buflen);
+ return MIN(dsi->datasize, buflen);
}
return -1; /* error */
if (len == buflen) {
dsi->datasize -= len;
- return min(dsi->datasize, buflen);
+ return MIN(dsi->datasize, buflen);
}
return -1;