[trunk] Follow up to r1691. Handle signed case.
This commit is contained in:
parent
bdb4d96678
commit
b8cc257ac5
|
@ -3001,8 +3001,16 @@ int imagetoraw_common(opj_image_t * image, const char *outfile, opj_bool big_end
|
||||||
unsigned char temp1;
|
unsigned char temp1;
|
||||||
unsigned char temp2;
|
unsigned char temp2;
|
||||||
curr = (signed short int) (*ptr & mask);
|
curr = (signed short int) (*ptr & mask);
|
||||||
|
if( big_endian )
|
||||||
|
{
|
||||||
temp1 = (unsigned char) (curr >> 8);
|
temp1 = (unsigned char) (curr >> 8);
|
||||||
temp2 = (unsigned char) curr;
|
temp2 = (unsigned char) curr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp2 = (unsigned char) (curr >> 8);
|
||||||
|
temp1 = (unsigned char) curr;
|
||||||
|
}
|
||||||
res = fwrite(&temp1, 1, 1, rawFile);
|
res = fwrite(&temp1, 1, 1, rawFile);
|
||||||
if( res < 1 ) {
|
if( res < 1 ) {
|
||||||
fprintf(stderr, "failed to write 1 byte for %s\n", outfile);
|
fprintf(stderr, "failed to write 1 byte for %s\n", outfile);
|
||||||
|
|
Loading…
Reference in New Issue