| 1032 | |
| 1033 | |
| 1034 | bool PAG_get_clump(thread_db* tdbb, USHORT type, USHORT* inout_len, UCHAR* entry) |
| 1035 | { |
| 1036 | /*********************************************** |
| 1037 | * |
| 1038 | * P A G _ g e t _ c l u m p |
| 1039 | * |
| 1040 | *********************************************** |
| 1041 | * |
| 1042 | * Functional description |
| 1043 | * Find 'type' clump |
| 1044 | * true - Found it |
| 1045 | * false - Not present |
| 1046 | * RETURNS |
| 1047 | * value of clump in entry |
| 1048 | * length in inout_len <-> input and output value to avoid B.O. |
| 1049 | * |
| 1050 | **************************************/ |
| 1051 | SET_TDBB(tdbb); |
| 1052 | |
| 1053 | WIN window(DB_PAGE_SPACE, HEADER_PAGE); |
| 1054 | pag* page = CCH_FETCH(tdbb, &window, LCK_read, pag_header); |
| 1055 | |
| 1056 | UCHAR* entry_p; |
| 1057 | const UCHAR* dummy; |
| 1058 | if (!find_type(tdbb, &window, &page, LCK_read, type, &entry_p, &dummy)) |
| 1059 | { |
| 1060 | CCH_RELEASE(tdbb, &window); |
| 1061 | *inout_len = 0; |
| 1062 | return false; |
| 1063 | } |
| 1064 | |
| 1065 | USHORT old_len = *inout_len; |
| 1066 | *inout_len = entry_p[1]; |
| 1067 | entry_p += 2; |
| 1068 | |
| 1069 | if (*inout_len) |
| 1070 | { |
| 1071 | // Avoid the B.O. but inform the caller the buffer is bigger. |
| 1072 | if (*inout_len < old_len) |
| 1073 | old_len = *inout_len; |
| 1074 | memcpy(entry, entry_p, old_len); |
| 1075 | } |
| 1076 | |
| 1077 | CCH_RELEASE(tdbb, &window); |
| 1078 | |
| 1079 | return true; |
| 1080 | } |
| 1081 | |
| 1082 | |
| 1083 | void PAG_header(thread_db* tdbb, bool info) |
no test coverage detected