@@ -1289,6 +1289,7 @@ AK_CPL_Free(AK_CodePointLine* cpl)
12891289//------------------------------------------------------------------------------
12901290// CodePointLine: Mutation
12911291
1292+ // Returns 0 on success, -1 on failure.
12921293static inline int
12931294AK_CPL_resize_buffer (AK_CodePointLine * cpl , Py_ssize_t count )
12941295{
@@ -1980,20 +1981,20 @@ AK_CPL_ToArray(AK_CodePointLine* cpl,
19801981 }
19811982 }
19821983 switch (dtype -> kind ) {
1983- case 'b ' :
1984- return AK_CPL_to_array_bool (cpl , dtype );
1984+ case 'i ' :
1985+ return AK_CPL_to_array_int (cpl , dtype , tsep );
19851986 case 'f' :
19861987 return AK_CPL_to_array_float (cpl , dtype , tsep , decc );
19871988 case 'U' :
19881989 return AK_CPL_to_array_unicode (cpl , dtype );
1990+ case 'M' :
1991+ return AK_CPL_to_array_via_cast (cpl , dtype , NPY_UNICODE );
1992+ case 'b' :
1993+ return AK_CPL_to_array_bool (cpl , dtype );
19891994 case 'S' :
19901995 return AK_CPL_to_array_bytes (cpl , dtype );
19911996 case 'u' :
19921997 return AK_CPL_to_array_uint (cpl , dtype , tsep );
1993- case 'i' :
1994- return AK_CPL_to_array_int (cpl , dtype , tsep );
1995- case 'M' :
1996- return AK_CPL_to_array_via_cast (cpl , dtype , NPY_UNICODE );
19971998 case 'c' : // cannot pass tsep, decc as using NumPy cast
19981999 return AK_CPL_to_array_via_cast (cpl , dtype , NPY_STRING );
19992000 }
@@ -2008,7 +2009,7 @@ static inline int
20082009AK_line_select_keep (
20092010 PyObject * line_select ,
20102011 bool axis_target ,
2011- int lookup_number )
2012+ Py_ssize_t lookup_number )
20122013{
20132014 if (axis_target && (line_select != NULL )) {
20142015 PyObject * number = PyLong_FromLong (lookup_number );
@@ -2081,7 +2082,7 @@ AK_CPG_New(PyObject *dtypes, Py_UCS4 tsep, Py_UCS4 decc)
20812082void
20822083AK_CPG_Free (AK_CodePointGrid * cpg )
20832084{
2084- for (int i = 0 ; i < cpg -> lines_count ; ++ i ) {
2085+ for (Py_ssize_t i = 0 ; i < cpg -> lines_count ; ++ i ) {
20852086 AK_CPL_Free (cpg -> lines [i ]);
20862087 }
20872088 PyMem_Free (cpg -> lines );
@@ -2194,7 +2195,7 @@ PyObject* AK_CPG_ToArrayList(AK_CodePointGrid* cpg,
21942195 PyObject * dtypes = cpg -> dtypes ;
21952196
21962197 // Iterate over lines in the code point grid
2197- for (int i = 0 ; i < cpg -> lines_count ; ++ i ) {
2198+ for (Py_ssize_t i = 0 ; i < cpg -> lines_count ; ++ i ) {
21982199 // if axis is axis 1, apply keep
21992200 switch (AK_line_select_keep (line_select , 1 == axis , i )) {
22002201 case -1 :
@@ -2239,11 +2240,10 @@ PyObject* AK_CPG_ToArrayList(AK_CodePointGrid* cpg,
22392240 Py_DECREF (dtype_specifier );
22402241 }
22412242 // This function will observe if dtype is NULL and read dtype from the CPL's type_parser if necessary
2242- // NOTE: this creating might be multi-threadable for dtypes that permit C-only buffer transfers
2243+ // NOTE: this might be multi-threadable for dtypes that permit C-only buffer transfers
22432244 PyObject * array = AK_CPL_ToArray (cpg -> lines [i ], dtype , tsep , decc );
2244- // AK_DEBUG_MSG_OBJ("post AK_CPL_ToArray", dtype);
22452245 if (array == NULL ) {
2246- // if array creation has been aborted due to a bad character, we will already have decrefed the array, which seems to also decref dtype
2246+ // if array creation has been aborted due to a bad character, we will already have decrefed the array
22472247 Py_DECREF (list );
22482248 return NULL ;
22492249 }
@@ -2291,7 +2291,7 @@ AK_Dialect_check_quoting(int quoting)
22912291{
22922292 const AK_DialectStyleDesc * qs ;
22932293 for (qs = AK_Dialect_quote_styles ; qs -> name ; qs ++ ) {
2294- if ((int )qs -> style == quoting ) // can we compare to long and avoid
2294+ if ((int )qs -> style == quoting )
22952295 return 0 ;
22962296 }
22972297 PyErr_Format (PyExc_TypeError , "bad \"quoting\" value" );
@@ -2310,10 +2310,10 @@ typedef struct AK_Dialect{
23102310
23112311// check types and convert to C values
23122312#define AK_Dialect_CALL_SETTER (meth , name , target , src , default ) \
2313- do {\
2314- if (meth(name, target, src, default)) \
2315- goto error; \
2316- } while (0) \
2313+ do { \
2314+ if (meth(name, target, src, default)) \
2315+ goto error; \
2316+ } while (0) \
23172317
23182318static AK_Dialect *
23192319AK_Dialect_New (PyObject * delimiter ,
@@ -2463,7 +2463,6 @@ static inline int
24632463AK_DR_add_char (AK_DelimitedReader * dr , AK_CodePointGrid * cpg , Py_UCS4 c )
24642464{
24652465 // NOTE: ideally we could use line_select here; however, we would need to cache the lookup in another container as this is called once per char and line_select is a Python function; further, we would need to increment the field_number separately from another counter, which is done in AK_DR_close_field
2466-
24672466 if (AK_CPG_AppendPointAtLine (cpg ,
24682467 * (dr -> axis_pos ),
24692468 dr -> field_len ,
0 commit comments