Merge pull request #24 from mkrupcale/encode-unsigned-long-pointer-increment

bits: grib_encode_unsigned_long: increment pointer, not the pointed-to value
This commit is contained in:
shahramn 2020-03-17 18:12:04 +00:00 committed by GitHub
commit a2d3d57789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -280,12 +280,7 @@ int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, l
else {
tmp = ((val >> len) | ((*p) & dmasks[n]));
}
*p = tmp;
(*p)++;
/*Beware of code like this! compiler warning: operation may be undefined
Read GCC manual on -Wsequence-point*/
/* *p = ((val << -len) | ((*p)++ & dmasks[n])); */
*p++ = tmp;
}
/* write the middle words */

View File

@ -107,8 +107,7 @@ int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, l
else {
tmp = ((val >> len) | ((*p) & dmasks[n]));
}
*p = tmp;
(*p)++;
*p++ = tmp;
}
/* write the middle words */