@@ -13,7 +13,7 @@ ctypedef unsigned short uint16_t
13
13
# algorithm. It is partially documented here:
14
14
#
15
15
# https://cran.r-project.org/package=sas7bdat/vignettes/sas7bdat.pdf
16
- cdef const uint8_t[:] rle_decompress(int result_length, const uint8_t[:] inbuff):
16
+ cdef const uint8_t[:] rle_decompress(int result_length, const uint8_t[:] inbuff) except * :
17
17
18
18
cdef:
19
19
uint8_t control_byte, x
@@ -116,7 +116,7 @@ cdef const uint8_t[:] rle_decompress(int result_length, const uint8_t[:] inbuff)
116
116
# rdc_decompress decompresses data using the Ross Data Compression algorithm:
117
117
#
118
118
# http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/CUJ/1992/9210/ross/ross.htm
119
- cdef const uint8_t[:] rdc_decompress(int result_length, const uint8_t[:] inbuff):
119
+ cdef const uint8_t[:] rdc_decompress(int result_length, const uint8_t[:] inbuff) except * :
120
120
121
121
cdef:
122
122
uint8_t cmd
@@ -177,17 +177,14 @@ cdef const uint8_t[:] rdc_decompress(int result_length, const uint8_t[:] inbuff)
177
177
rpos += cnt
178
178
179
179
# short pattern
180
- elif (cmd >= 3 ) & (cmd <= 15 ) :
180
+ else :
181
181
ofs = cnt + 3
182
182
ofs += < uint16_t> inbuff[ipos] << 4
183
183
ipos += 1
184
184
for k in range (cmd):
185
185
outbuff[rpos + k] = outbuff[rpos - < int > ofs + k]
186
186
rpos += cmd
187
187
188
- else :
189
- raise ValueError (" unknown RDC command" )
190
-
191
188
# In py37 cython/clang sees `len(outbuff)` as size_t and not Py_ssize_t
192
189
if < Py_ssize_t> len (outbuff) != < Py_ssize_t> result_length:
193
190
raise ValueError (f" RDC: {len(outbuff)} != {result_length}\n " )
@@ -231,7 +228,7 @@ cdef class Parser:
231
228
int subheader_pointer_length
232
229
int current_page_type
233
230
bint is_little_endian
234
- const uint8_t[:] (* decompress)(int result_length, const uint8_t[:] inbuff)
231
+ const uint8_t[:] (* decompress)(int result_length, const uint8_t[:] inbuff) except *
235
232
object parser
236
233
237
234
def __init__ (self , object parser ):
@@ -294,8 +291,8 @@ cdef class Parser:
294
291
self .parser._current_row_in_chunk_index = self .current_row_in_chunk_index
295
292
self .parser._current_row_in_file_index = self .current_row_in_file_index
296
293
297
- cdef bint read_next_page(self ):
298
- cdef done
294
+ cdef bint read_next_page(self ) except ? True :
295
+ cdef bint done
299
296
300
297
done = self .parser._read_next_page()
301
298
if done:
@@ -316,7 +313,7 @@ cdef class Parser:
316
313
)
317
314
self .current_page_subheaders_count = self .parser._current_page_subheaders_count
318
315
319
- cdef readline(self ):
316
+ cdef bint readline(self ) except ? True :
320
317
321
318
cdef:
322
319
int offset, bit_offset, align_correction
@@ -385,7 +382,7 @@ cdef class Parser:
385
382
else :
386
383
raise ValueError (f" unknown page type: {self.current_page_type}" )
387
384
388
- cdef void process_byte_array_with_data(self , int offset, int length):
385
+ cdef void process_byte_array_with_data(self , int offset, int length) except * :
389
386
390
387
cdef:
391
388
Py_ssize_t j
0 commit comments