Skip to content

Commit 21edb35

Browse files
committed
remove obsolete custom changes to tskit
1 parent cd8d650 commit 21edb35

2 files changed

Lines changed: 1 addition & 81 deletions

File tree

treerec/tskit/core.c

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
#include <kastore.h>
3333
#include <tskit/core.h>
3434

35-
#define UUID_NUM_BYTES 16
36-
#define TSK_JSON_BINARY_HEADER_SIZE 21
37-
38-
static const uint8_t _tsk_json_binary_magic[4] = { 'J', 'B', 'L', 'B' };
35+
#define UUID_NUM_BYTES 16
3936

4037
#if defined(_WIN32)
4138

@@ -98,22 +95,6 @@ get_random_bytes(uint8_t *buf)
9895

9996
#endif
10097

101-
static uint64_t
102-
tsk_load_u64_le(const uint8_t *p)
103-
{
104-
uint64_t value;
105-
106-
value = (uint64_t) p[0];
107-
value |= (uint64_t) p[1] << 8;
108-
value |= (uint64_t) p[2] << 16;
109-
value |= (uint64_t) p[3] << 24;
110-
value |= (uint64_t) p[4] << 32;
111-
value |= (uint64_t) p[5] << 40;
112-
value |= (uint64_t) p[6] << 48;
113-
value |= (uint64_t) p[7] << 56;
114-
return value;
115-
}
116-
11798
/* Generate a new UUID4 using a system-generated source of randomness.
11899
* Note that this function writes a NULL terminator to the end of this
119100
* string, so that the total length of the buffer must be 37 bytes.
@@ -208,22 +189,6 @@ tsk_strerror_internal(int err)
208189
ret = "An incompatible type for a column was found in the file. "
209190
"(TSK_ERR_BAD_COLUMN_TYPE)";
210191
break;
211-
case TSK_ERR_JSON_STRUCT_METADATA_BAD_MAGIC:
212-
ret = "JSON binary struct metadata does not begin with the expected "
213-
"magic bytes. (TSK_ERR_JSON_STRUCT_METADATA_BAD_MAGIC)";
214-
break;
215-
case TSK_ERR_JSON_STRUCT_METADATA_TRUNCATED:
216-
ret = "JSON binary struct metadata is shorter than the expected size. "
217-
"(TSK_ERR_JSON_STRUCT_METADATA_TRUNCATED)";
218-
break;
219-
case TSK_ERR_JSON_STRUCT_METADATA_INVALID_LENGTH:
220-
ret = "A length field in the JSON binary struct metadata header is invalid. "
221-
"(TSK_ERR_JSON_STRUCT_METADATA_INVALID_LENGTH)";
222-
break;
223-
case TSK_ERR_JSON_STRUCT_METADATA_BAD_VERSION:
224-
ret = "JSON binary struct metadata uses an unsupported version number. "
225-
"(TSK_ERR_JSON_STRUCT_METADATA_BAD_VERSION)";
226-
break;
227192

228193
/* Out of bounds errors */
229194
case TSK_ERR_BAD_OFFSET:

treerec/tskit/core.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -309,26 +309,6 @@ not found in the file.
309309
An unsupported type was provided for a column in the file.
310310
*/
311311
#define TSK_ERR_BAD_COLUMN_TYPE -105
312-
313-
/**
314-
The JSON binary struct metadata does not begin with the expected magic bytes.
315-
*/
316-
#define TSK_ERR_JSON_STRUCT_METADATA_BAD_MAGIC -106
317-
318-
/**
319-
The JSON binary struct metadata is shorter than the expected size.
320-
*/
321-
#define TSK_ERR_JSON_STRUCT_METADATA_TRUNCATED -107
322-
323-
/**
324-
A length field in the JSON binary struct metadata header is invalid.
325-
*/
326-
#define TSK_ERR_JSON_STRUCT_METADATA_INVALID_LENGTH -108
327-
328-
/**
329-
The JSON binary struct metadata uses an unsupported version number.
330-
*/
331-
#define TSK_ERR_JSON_STRUCT_METADATA_BAD_VERSION -109
332312
/** @} */
333313

334314
/**
@@ -1132,31 +1112,6 @@ bool tsk_isfinite(double val);
11321112
#define TSK_UUID_SIZE 36
11331113
int tsk_generate_uuid(char *dest, int flags);
11341114

1135-
/**
1136-
@brief Extract the binary payload from ``json+struct`` encoded metadata.
1137-
1138-
@rst
1139-
Metadata produced by the JSONStructCodec consists of a fixed-size
1140-
header followed by canonical JSON bytes and an optional binary payload. This helper
1141-
validates the framing, returning pointers to the embedded JSON and binary sections
1142-
without copying.
1143-
1144-
The output pointers reference memory owned by the caller and remain valid only while
1145-
the original metadata buffer is alive.
1146-
@endrst
1147-
1148-
@param[in] metadata Pointer to the encoded metadata bytes.
1149-
@param[in] metadata_length Number of bytes available at ``metadata``.
1150-
@param[out] json On success, set to the start of the JSON bytes.
1151-
@param[out] json_length On success, set to the JSON length in bytes.
1152-
@param[out] blob On success, set to the start of the binary payload.
1153-
@param[out] blob_length On success, set to the payload length in bytes.
1154-
@return Return 0 on success or a negative value on failure.
1155-
*/
1156-
int tsk_json_struct_metadata_get_blob(char *metadata, tsk_size_t metadata_length,
1157-
char **json, tsk_size_t *json_length, char **blob,
1158-
tsk_size_t *blob_length);
1159-
11601115
/* TODO most of these can probably be macros so they compile out as no-ops.
11611116
* Lets do the 64 bit tsk_size_t switch first though. */
11621117
void *tsk_malloc(tsk_size_t size);

0 commit comments

Comments
 (0)