| 1296 | |
| 1297 | |
| 1298 | static ISC_STATUS string_filter(USHORT action, BlobControl* control) |
| 1299 | { |
| 1300 | /************************************** |
| 1301 | * |
| 1302 | * s t r i n g _ f i l t e r |
| 1303 | * |
| 1304 | ************************************** |
| 1305 | * |
| 1306 | * Functional description |
| 1307 | * Handle stuff for batched string filters. This is used by filter_blr |
| 1308 | * and filter_acl. |
| 1309 | * |
| 1310 | **************************************/ |
| 1311 | filter_tmp* string; |
| 1312 | |
| 1313 | switch (action) |
| 1314 | { |
| 1315 | case isc_blob_filter_close: |
| 1316 | while (string = (filter_tmp*) control->ctl_data[0]) |
| 1317 | { |
| 1318 | control->ctl_data[0] = (IPTR) string->tmp_next; |
| 1319 | gds__free(string); |
| 1320 | } |
| 1321 | return FB_SUCCESS; |
| 1322 | |
| 1323 | case isc_blob_filter_get_segment: |
| 1324 | { |
| 1325 | if (!(string = (filter_tmp*) control->ctl_data[1])) |
| 1326 | return isc_segstr_eof; |
| 1327 | |
| 1328 | USHORT length = string->tmp_length - control->ctl_data[2]; |
| 1329 | const bool outOfBuffer = (length > control->ctl_buffer_length); |
| 1330 | |
| 1331 | if (outOfBuffer) |
| 1332 | length = control->ctl_buffer_length; |
| 1333 | memcpy(control->ctl_buffer, string->tmp_string + (USHORT) control->ctl_data[2], length); |
| 1334 | control->ctl_data[2] += length; |
| 1335 | if (control->ctl_data[2] == string->tmp_length) { |
| 1336 | control->ctl_data[1] = (IPTR) string->tmp_next; |
| 1337 | control->ctl_data[2] = 0; |
| 1338 | } |
| 1339 | control->ctl_segment_length = length; |
| 1340 | return (!outOfBuffer) ? FB_SUCCESS : isc_segment; |
| 1341 | } |
| 1342 | |
| 1343 | case isc_blob_filter_put_segment: |
| 1344 | case isc_blob_filter_create: |
| 1345 | case isc_blob_filter_seek: |
| 1346 | case isc_blob_filter_open: |
| 1347 | return isc_uns_ext; |
| 1348 | |
| 1349 | case isc_blob_filter_alloc: |
| 1350 | case isc_blob_filter_free: |
| 1351 | return FB_SUCCESS; |
| 1352 | |
| 1353 | default: |
| 1354 | BUGCHECK(289); // Unknown blob filter ACTION |
| 1355 | return isc_uns_ext; |
no outgoing calls
no test coverage detected