Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/readstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ typedef struct readstat_parser_s {
readstat_io_t *io;
const char *input_encoding;
const char *output_encoding;
long row_limit;
long row_offset;
int64_t row_limit;
int64_t row_offset;
} readstat_parser_t;

readstat_parser_t *readstat_parser_init(void);
Expand Down Expand Up @@ -405,8 +405,8 @@ readstat_error_t readstat_set_file_character_encoding(readstat_parser_t *parser,
// Defaults to UTF-8. Pass in NULL to disable transliteration.
readstat_error_t readstat_set_handler_character_encoding(readstat_parser_t *parser, const char *encoding);

readstat_error_t readstat_set_row_limit(readstat_parser_t *parser, long row_limit);
readstat_error_t readstat_set_row_offset(readstat_parser_t *parser, long row_offset);
readstat_error_t readstat_set_row_limit(readstat_parser_t *parser, int64_t row_limit);
readstat_error_t readstat_set_row_offset(readstat_parser_t *parser, int64_t row_offset);

/* Parse binary / portable files */
readstat_error_t readstat_parse_dta(readstat_parser_t *parser, const char *path, void *user_ctx);
Expand Down
4 changes: 2 additions & 2 deletions src/readstat_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ readstat_error_t readstat_set_handler_character_encoding(readstat_parser_t *pars
return READSTAT_OK;
}

readstat_error_t readstat_set_row_limit(readstat_parser_t *parser, long row_limit) {
readstat_error_t readstat_set_row_limit(readstat_parser_t *parser, int64_t row_limit) {
parser->row_limit = row_limit;
return READSTAT_OK;
}

readstat_error_t readstat_set_row_offset(readstat_parser_t *parser, long row_offset) {
readstat_error_t readstat_set_row_offset(readstat_parser_t *parser, int64_t row_offset) {
parser->row_offset = row_offset;
return READSTAT_OK;
}
6 changes: 3 additions & 3 deletions src/sas/readstat_sas7bdat_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ typedef struct sas7bdat_ctx_s {
uint32_t parsed_row_count;
uint32_t parsed_deleted_row_count;
uint32_t column_count;
uint32_t row_limit;
int64_t row_limit;
uint32_t deleted_row_count;
uint32_t row_offset;
int64_t row_offset;

uint64_t header_size;
uint64_t page_count;
Expand Down Expand Up @@ -1571,7 +1571,7 @@ readstat_error_t readstat_parse_sas7bdat(readstat_parser_t *parser, const char *
if (ctx->handle.value && ctx->parsed_row_count != ctx->row_limit) {
retval = READSTAT_ERROR_ROW_COUNT_MISMATCH;
if (ctx->handle.error) {
snprintf(ctx->error_buf, sizeof(ctx->error_buf), "ReadStat: Expected %d rows in file, found %d",
snprintf(ctx->error_buf, sizeof(ctx->error_buf), "ReadStat: Expected %" PRId64 " rows in file, found %" PRIu32,
ctx->row_limit, ctx->parsed_row_count);
ctx->handle.error(ctx->error_buf, ctx->user_ctx);
}
Expand Down
4 changes: 2 additions & 2 deletions src/sas/readstat_xport_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ typedef struct xport_ctx_s {

int obs_count;
int var_count;
int row_limit;
int row_offset;
int64_t row_limit;
int64_t row_offset;
size_t row_length;
int parsed_row_count;
char file_label[256*4+1];
Expand Down
4 changes: 2 additions & 2 deletions src/spss/readstat_por.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ typedef struct por_ctx_s {
int obs_count;
int var_count;
int var_offset;
int row_limit;
int row_offset;
int64_t row_limit;
int64_t row_offset;
readstat_variable_t **variables;
spss_varinfo_t *varinfo;
ck_hash_table_t *var_dict;
Expand Down
4 changes: 2 additions & 2 deletions src/spss/readstat_sav.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ typedef struct sav_ctx_s {
int var_offset;
int var_count;
int record_count;
int row_limit;
int row_offset;
int64_t row_limit;
int64_t row_offset;
int current_row;
int value_labels_count;
int fweight_index;
Expand Down
2 changes: 1 addition & 1 deletion src/spss/readstat_sav_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ readstat_error_t readstat_parse_sav(readstat_parser_t *parser, const char *path,
if (parser->row_offset > 0)
ctx->row_offset = parser->row_offset;
if (ctx->record_count >= 0) {
int record_count_after_skipping = ctx->record_count - ctx->row_offset;
int64_t record_count_after_skipping = ctx->record_count - ctx->row_offset;
if (record_count_after_skipping < 0) {
record_count_after_skipping = 0;
ctx->row_offset = ctx->record_count;
Expand Down
4 changes: 2 additions & 2 deletions src/test/test_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ typedef struct rt_test_group_s {
} rt_test_group_t;

typedef struct rt_test_args_s {
long row_limit;
long row_offset;
int64_t row_limit;
int64_t row_offset;
} rt_test_args_t;


Expand Down
4 changes: 2 additions & 2 deletions src/txt/readstat_txt_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static readstat_error_t txt_parse_delimited(readstat_parser_t *parser,
readstat_schema_t *schema = ctx->schema;
readstat_error_t retval = READSTAT_OK;
readstat_io_t *io = parser->io;
int k=0;
int64_t k=0;

while (1) {
for (int j=0; j<schema->entry_count; j++) {
Expand Down Expand Up @@ -122,7 +122,7 @@ static readstat_error_t txt_parse_fixed_width(readstat_parser_t *parser,
readstat_schema_t *schema = ctx->schema;
readstat_io_t *io = parser->io;
readstat_error_t retval = READSTAT_OK;
int k=0;
int64_t k=0;
while (1) {
int j=0;
for (int i=0; i<schema->rows_per_observation; i++) {
Expand Down
Loading