@@ -62,7 +62,6 @@ image_band_json(Imaging im) {
6262 // Bands can be 4 bands * 2 characters each
6363 int len = strlen (format ) + 8 + 1 ;
6464 int err ;
65- ModeData * modedata = getModeData (im -> mode );
6665
6766 json = calloc (1 , len );
6867
@@ -74,10 +73,10 @@ image_band_json(Imaging im) {
7473 json ,
7574 len ,
7675 format ,
77- modedata -> band_names [0 ],
78- modedata -> band_names [1 ],
79- modedata -> band_names [2 ],
80- modedata -> band_names [3 ]
76+ im -> modedata -> band_names [0 ],
77+ im -> modedata -> band_names [1 ],
78+ im -> modedata -> band_names [2 ],
79+ im -> modedata -> band_names [3 ]
8180 );
8281 if (err < 0 ) {
8382 return NULL ;
@@ -99,7 +98,7 @@ single_band_json(Imaging im) {
9998 return NULL ;
10099 }
101100
102- err = PyOS_snprintf (json , len , format , getModeData ( im -> mode ) -> band_names [0 ]);
101+ err = PyOS_snprintf (json , len , format , im -> modedata -> band_names [0 ]);
103102 if (err < 0 ) {
104103 return NULL ;
105104 }
189188export_imaging_schema (Imaging im , struct ArrowSchema * schema ) {
190189 int retval = 0 ;
191190 char * band_json ;
192- ModeData * modedata = getModeData (im -> mode );
193191
194- if (strcmp (modedata -> arrow_band_format , "" ) == 0 ) {
192+ if (strcmp (im -> modedata -> arrow_band_format , "" ) == 0 ) {
195193 return IMAGING_ARROW_INCOMPATIBLE_MODE ;
196194 }
197195
@@ -200,10 +198,10 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
200198 return IMAGING_ARROW_MEMORY_LAYOUT ;
201199 }
202200
203- modedata = getModeData (im -> mode );
204-
205201 if (im -> bands == 1 ) {
206- retval = export_named_type (schema , modedata -> arrow_band_format , modedata -> band_names [0 ]);
202+ retval = export_named_type (schema ,
203+ im -> modedata -> arrow_band_format ,
204+ im -> modedata -> band_names [0 ]);
207205 if (retval != 0 ) {
208206 return retval ;
209207 }
@@ -225,7 +223,7 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
225223 schema -> children = calloc (1 , sizeof (struct ArrowSchema * ));
226224 schema -> children [0 ] = (struct ArrowSchema * )calloc (1 , sizeof (struct ArrowSchema ));
227225 retval = export_named_type (
228- schema -> children [0 ], modedata -> arrow_band_format , modedata -> name
226+ schema -> children [0 ], im -> modedata -> arrow_band_format , im -> modedata -> name
229227 );
230228 if (retval != 0 ) {
231229 free (schema -> children [0 ]);
@@ -409,7 +407,7 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
409407
410408int
411409export_imaging_array (Imaging im , struct ArrowArray * array ) {
412- if (strcmp (getModeData ( im -> mode ) -> arrow_band_format , "" ) == 0 ) {
410+ if (strcmp (im -> modedata -> arrow_band_format , "" ) == 0 ) {
413411 return IMAGING_ARROW_INCOMPATIBLE_MODE ;
414412 }
415413
0 commit comments