| 1145 | |
| 1146 | |
| 1147 | ISC_STATUS filter_trans(USHORT action, BlobControl* control) |
| 1148 | { |
| 1149 | /************************************** |
| 1150 | * |
| 1151 | * f i l t e r _ t r a n s |
| 1152 | * |
| 1153 | ************************************** |
| 1154 | * |
| 1155 | * Functional description |
| 1156 | * Pretty print a transaction description. |
| 1157 | * |
| 1158 | **************************************/ |
| 1159 | if (action != isc_blob_filter_open) |
| 1160 | return string_filter(action, control); |
| 1161 | |
| 1162 | // Initialize for retrieval |
| 1163 | UCHAR buffer[BUFFER_MEDIUM]; |
| 1164 | const SLONG l = control->ctl_handle->ctl_total_length; |
| 1165 | UCHAR* const temp = (l <= (SLONG) sizeof(buffer)) ? buffer : (UCHAR*) gds__alloc((SLONG) l); |
| 1166 | UCHAR* p = temp; |
| 1167 | // FREE: at procedure exit |
| 1168 | if (!p) // NOMEM: |
| 1169 | return isc_virmemexh; |
| 1170 | |
| 1171 | USHORT length; |
| 1172 | const ISC_STATUS status = caller(isc_blob_filter_get_segment, control, (USHORT) l, temp, &length); |
| 1173 | |
| 1174 | if (!status) |
| 1175 | { |
| 1176 | TEXT line[BUFFER_SMALL]; |
| 1177 | sprintf(line, "Transaction description version: %d", (int) *p++); |
| 1178 | string_put(control, line); |
| 1179 | TEXT* out = line; |
| 1180 | const UCHAR* const end = temp + length; |
| 1181 | |
| 1182 | while (p < end) |
| 1183 | { |
| 1184 | const UCHAR c = *p++; |
| 1185 | length = *p++; |
| 1186 | if (p + length > end) |
| 1187 | { |
| 1188 | sprintf(out, "item %d with inconsistent length", (int) p[-1]); |
| 1189 | string_put(control, line); |
| 1190 | goto break_out; |
| 1191 | } |
| 1192 | |
| 1193 | switch (c) |
| 1194 | { |
| 1195 | case TDR_HOST_SITE: |
| 1196 | sprintf(out, "Host site: %.*s", length, p); |
| 1197 | break; |
| 1198 | |
| 1199 | case TDR_DATABASE_PATH: |
| 1200 | sprintf(out, "Database path: %.*s", length, p); |
| 1201 | break; |
| 1202 | |
| 1203 | case TDR_REMOTE_SITE: |
| 1204 | sprintf(out, " Remote site: %.*s", length, p); |
nothing calls this directly
no test coverage detected