Merge pull request #8248 from Yay295/patch-2

Use local variable instead of casting every line
This commit is contained in:
Andrew Murray 2024-07-20 10:49:37 +10:00 committed by GitHub
commit f8a9a18e7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1186,29 +1186,27 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
encoder->encode = ImagingJpegEncode; encoder->encode = ImagingJpegEncode;
strncpy(((JPEGENCODERSTATE *)encoder->state.context)->rawmode, rawmode, 8); JPEGENCODERSTATE *jpeg_encoder_state = (JPEGENCODERSTATE *)encoder->state.context;
strncpy(jpeg_encoder_state->rawmode, rawmode, 8);
((JPEGENCODERSTATE *)encoder->state.context)->keep_rgb = keep_rgb; jpeg_encoder_state->keep_rgb = keep_rgb;
((JPEGENCODERSTATE *)encoder->state.context)->quality = quality; jpeg_encoder_state->quality = quality;
((JPEGENCODERSTATE *)encoder->state.context)->qtables = qarrays; jpeg_encoder_state->qtables = qarrays;
((JPEGENCODERSTATE *)encoder->state.context)->qtablesLen = qtablesLen; jpeg_encoder_state->qtablesLen = qtablesLen;
((JPEGENCODERSTATE *)encoder->state.context)->subsampling = subsampling; jpeg_encoder_state->subsampling = subsampling;
((JPEGENCODERSTATE *)encoder->state.context)->progressive = progressive; jpeg_encoder_state->progressive = progressive;
((JPEGENCODERSTATE *)encoder->state.context)->smooth = smooth; jpeg_encoder_state->smooth = smooth;
((JPEGENCODERSTATE *)encoder->state.context)->optimize = optimize; jpeg_encoder_state->optimize = optimize;
((JPEGENCODERSTATE *)encoder->state.context)->streamtype = streamtype; jpeg_encoder_state->streamtype = streamtype;
((JPEGENCODERSTATE *)encoder->state.context)->xdpi = xdpi; jpeg_encoder_state->xdpi = xdpi;
((JPEGENCODERSTATE *)encoder->state.context)->ydpi = ydpi; jpeg_encoder_state->ydpi = ydpi;
((JPEGENCODERSTATE *)encoder->state.context)->restart_marker_blocks = jpeg_encoder_state->restart_marker_blocks = restart_marker_blocks;
restart_marker_blocks; jpeg_encoder_state->restart_marker_rows = restart_marker_rows;
((JPEGENCODERSTATE *)encoder->state.context)->restart_marker_rows = jpeg_encoder_state->comment = comment;
restart_marker_rows; jpeg_encoder_state->comment_size = comment_size;
((JPEGENCODERSTATE *)encoder->state.context)->comment = comment; jpeg_encoder_state->extra = extra;
((JPEGENCODERSTATE *)encoder->state.context)->comment_size = comment_size; jpeg_encoder_state->extra_size = extra_size;
((JPEGENCODERSTATE *)encoder->state.context)->extra = extra; jpeg_encoder_state->rawExif = rawExif;
((JPEGENCODERSTATE *)encoder->state.context)->extra_size = extra_size; jpeg_encoder_state->rawExifLen = rawExifLen;
((JPEGENCODERSTATE *)encoder->state.context)->rawExif = rawExif;
((JPEGENCODERSTATE *)encoder->state.context)->rawExifLen = rawExifLen;
return (PyObject *)encoder; return (PyObject *)encoder;
} }