@@ -114,16 +114,16 @@ static int get_distinct(grib_accessor* a, double** val, long* len);
114
114
115
115
static int compare_doubles (const void * a, const void * b, int ascending)
116
116
{
117
- /* ascending is a boolean: 0 or 1 */
117
+ // ascending is a boolean: 0 or 1
118
118
double * arg1 = (double *)a;
119
119
double * arg2 = (double *)b;
120
120
if (ascending) {
121
121
if (*arg1 < *arg2)
122
- return -1 ; /* Smaller values come before larger ones*/
122
+ return -1 ; // Smaller values come before larger ones
123
123
}
124
124
else {
125
125
if (*arg1 > *arg2)
126
- return -1 ; /* Larger values come before smaller ones*/
126
+ return -1 ; // Larger values come before smaller ones
127
127
}
128
128
if (*arg1 == *arg2)
129
129
return 0 ;
@@ -155,7 +155,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
155
155
{
156
156
grib_context* c = a->context ;
157
157
grib_accessor_latitudes* self = (grib_accessor_latitudes*)a;
158
- int ret = 0 ;
158
+ int ret = GRIB_SUCCESS ;
159
159
double * v = val;
160
160
double dummyLon = 0 ;
161
161
size_t size = 0 ;
@@ -167,7 +167,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
167
167
if (ret) return ret;
168
168
size = count;
169
169
if (*len < size) {
170
- /* self->lats are computed in value_count so must free */
170
+ // self->lats are computed in value_count so must free
171
171
if (self->lats ) {
172
172
grib_context_free (c, self->lats );
173
173
self->lats = NULL ;
@@ -176,7 +176,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
176
176
}
177
177
self->save = 0 ;
178
178
179
- /* self->lats are computed in value_count*/
179
+ // self->lats are computed in value_count
180
180
if (self->lats ) {
181
181
int i;
182
182
*len = self->size ;
@@ -211,7 +211,7 @@ static int value_count(grib_accessor* a, long* len)
211
211
grib_handle* h = grib_handle_of_accessor (a);
212
212
grib_context* c = a->context ;
213
213
double * val = NULL ;
214
- int ret;
214
+ int ret = GRIB_SUCCESS ;
215
215
size_t size;
216
216
217
217
*len = 0 ;
@@ -251,9 +251,9 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
251
251
double * v = NULL ;
252
252
double * v1 = NULL ;
253
253
double dummyLon = 0 ;
254
- int ret = 0 ;
254
+ int ret = GRIB_SUCCESS ;
255
255
int i;
256
- long jScansPositively = 0 ; /* default: north to south */
256
+ long jScansPositively = 0 ; // default: north to south
257
257
size_t size = *len;
258
258
grib_context* c = a->context ;
259
259
@@ -276,14 +276,14 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
276
276
grib_iterator_delete (iter);
277
277
v = *val;
278
278
279
- /* See which direction the latitudes are to be scanned */
279
+ // See which direction the latitudes are to be scanned
280
280
if ((ret = grib_get_long_internal (grib_handle_of_accessor (a), " jScansPositively" , &jScansPositively)))
281
281
return ret;
282
282
if (jScansPositively) {
283
- qsort (v, *len, sizeof (double ), &compare_doubles_ascending); /* South to North*/
283
+ qsort (v, *len, sizeof (double ), &compare_doubles_ascending); // South to North
284
284
}
285
285
else {
286
- qsort (v, *len, sizeof (double ), &compare_doubles_descending); /* North to South*/
286
+ qsort (v, *len, sizeof (double ), &compare_doubles_descending); // North to South
287
287
}
288
288
289
289
v1 = (double *)grib_context_malloc_clear (c, size * sizeof (double ));
@@ -292,14 +292,14 @@ static int get_distinct(grib_accessor* a, double** val, long* len)
292
292
return GRIB_OUT_OF_MEMORY;
293
293
}
294
294
295
- /* Construct a unique set of lats by filtering out duplicates */
295
+ // Construct a unique set of lats by filtering out duplicates
296
296
prev = v[0 ];
297
297
v1[0 ] = prev;
298
298
count = 1 ;
299
299
for (i = 1 ; i < *len; i++) {
300
300
if (v[i] != prev) {
301
301
prev = v[i];
302
- v1[count] = prev; /* Value different from previous so store it */
302
+ v1[count] = prev; // Value different from previous so store it
303
303
count++;
304
304
}
305
305
}
0 commit comments