| 961 | |
| 962 | |
| 963 | SLONG blb::BLB_lseek(USHORT mode, SLONG offset) |
| 964 | { |
| 965 | /************************************** |
| 966 | * |
| 967 | * b l b : : l s e e k |
| 968 | * |
| 969 | ************************************** |
| 970 | * |
| 971 | * Functional description |
| 972 | * Position a blob for direct access. Seek is only defined for stream |
| 973 | * type blobs. |
| 974 | * |
| 975 | **************************************/ |
| 976 | |
| 977 | if (!(blb_flags & BLB_stream)) |
| 978 | ERR_post(Arg::Gds(isc_bad_segstr_type)); |
| 979 | |
| 980 | if (mode == 1) |
| 981 | offset += blb_seek; |
| 982 | else if (mode == 2) |
| 983 | offset = blb_length + offset; |
| 984 | |
| 985 | if (offset < 0) |
| 986 | offset = 0; |
| 987 | |
| 988 | if (offset > (SLONG) blb_length) |
| 989 | offset = blb_length; |
| 990 | |
| 991 | blb_seek = offset; |
| 992 | blb_flags |= BLB_seek; |
| 993 | blb_flags &= ~BLB_eof; |
| 994 | |
| 995 | return offset; |
| 996 | } |
| 997 | |
| 998 | |
| 999 | // This function can't take from_desc as const because it may call store_array, |