return SR_OK;
}
-SR_PRIV ssize_t ResourceReader::read_callback(const struct sr_resource *res,
+SR_PRIV gssize ResourceReader::read_callback(const struct sr_resource *res,
void *buf, size_t count, void *cb_data) noexcept
{
try {
const char *name, void *cb_data) noexcept;
static SR_PRIV int close_callback(struct sr_resource *res,
void *cb_data) noexcept;
- static SR_PRIV ssize_t read_callback(const struct sr_resource *res,
+ static SR_PRIV gssize read_callback(const struct sr_resource *res,
void *buf, size_t count, void *cb_data) noexcept;
friend class Context;
};
#ifndef LIBSIGROK_PROTO_H
#define LIBSIGROK_PROTO_H
-#include <unistd.h>
-
/**
* @file
*
const char *name, void *cb_data);
typedef int (*sr_resource_close_callback)(struct sr_resource *res,
void *cb_data);
-typedef ssize_t (*sr_resource_read_callback)(const struct sr_resource *res,
+typedef gssize (*sr_resource_read_callback)(const struct sr_resource *res,
void *buf, size_t count, void *cb_data);
SR_API int sr_resource_set_hooks(struct sr_context *ctx,
G_GNUC_WARN_UNUSED_RESULT;
SR_PRIV int sr_resource_close(struct sr_context *ctx,
struct sr_resource *res);
-SR_PRIV ssize_t sr_resource_read(struct sr_context *ctx,
+SR_PRIV gssize sr_resource_read(struct sr_context *ctx,
const struct sr_resource *res, void *buf, size_t count)
G_GNUC_WARN_UNUSED_RESULT;
SR_PRIV void *sr_resource_load(struct sr_context *ctx, int type,
return SR_OK;
}
-static ssize_t resource_read_default(const struct sr_resource *res,
+static gssize resource_read_default(const struct sr_resource *res,
void *buf, size_t count, void *cb_data)
{
FILE *file;
sr_err("%s: invalid handle.", __func__);
return SR_ERR_ARG;
}
- if (count > SSIZE_MAX) {
+ if (count > G_MAXSSIZE) {
sr_err("%s: count %zu too large.", __func__, count);
return SR_ERR_ARG;
}
*
* @private
*/
-SR_PRIV ssize_t sr_resource_read(struct sr_context *ctx,
+SR_PRIV gssize sr_resource_read(struct sr_context *ctx,
const struct sr_resource *res, void *buf, size_t count)
{
- ssize_t n_read;
+ gssize n_read;
n_read = (*ctx->resource_read_cb)(res, buf, count,
ctx->resource_cb_data);
struct sr_resource res;
void *buf;
size_t res_size;
- ssize_t n_read;
+ gssize n_read;
if (sr_resource_open(ctx, &res, type, name) != SR_OK)
return NULL;