Commit a915db91 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Using size_t for length

parent ea338438
......@@ -31,7 +31,7 @@
#define EXIT_ON_ARRAY_ERROR(array, ...) blc_array_fatal_error(array, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
typedef struct blc_dim {
int length;
size_t length;
size_t step;
} blc_dim;
......@@ -45,7 +45,6 @@ typedef struct blc_array
void def_array(uint32_t type, uint32_t format, int dims_nb, blc_dim *dims);
void def_array(uint32_t type, uint32_t format, char const *dims_string);
void destroy();
void add_dim(int length, int step);
......
......@@ -131,8 +131,8 @@ int blc_array::sprint_dims(char *string, int string_size){
if (dims_nb==0) width+=snprintf(string, string_size, "0");
else {
width+=sprintf(string, "%d", dims[0].length);
for(i=1; i<dims_nb; i++) width+=sprintf(string+width, "x%d", dims[i].length);
width+=sprintf(string, "%lu", dims[0].length);
for(i=1; i<dims_nb; i++) width+=sprintf(string+width, "x%lu", dims[i].length);
}
if (width >= string_size) EXIT_ON_ERROR("The reserved size %d is too small to store the %d dims.",size, dims_nb);
return width;
......@@ -144,8 +144,8 @@ int blc_array::fprint_dims(FILE *file)const {
if (dims_nb==0) width+=fprintf(file, "0");
else {
width+=fprintf(file, "%d", dims[0].length);
for(i=1; i<dims_nb; i++) width+=fprintf(file, "x%d", dims[i].length);
width+=fprintf(file, "%lu", dims[0].length);
for(i=1; i<dims_nb; i++) width+=fprintf(file, "x%lu", dims[i].length);
}
return width;
}
......@@ -187,7 +187,7 @@ void blc_array::sscan_dims(char const *string){
dim->length=length;
dim->step=size;
size*=dim->length;
}while(sscanf(string, "x%d%n", &dim->length, &pos)==1);
}while(sscanf(string, "x%lu%n", &dim->length, &pos)==1);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment