"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "contrib/mmtf-c/mmtf_parser.cpp" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

mmtf_parser.cpp  (pymol-v1.8.6.0.tar.bz2):mmtf_parser.cpp  (pymol-v2.1.0.tar.bz2)
skipping to change at line 307 skipping to change at line 307
free(thing->atomIdList); free(thing->atomIdList);
free(thing->altLocList); free(thing->altLocList);
free(thing->occupancyList); free(thing->occupancyList);
free(thing->groupIdList); free(thing->groupIdList);
free(thing->groupTypeList); free(thing->groupTypeList);
free(thing->secStructList); free(thing->secStructList);
free(thing->insCodeList); free(thing->insCodeList);
free(thing->sequenceIndexList); free(thing->sequenceIndexList);
free(thing->groupsPerChain); free(thing->groupsPerChain);
free(thing->chainsPerModel); free(thing->chainsPerModel);
// PyMOL
free(thing->pymolRepsList);
free(thing->pymolColorList);
} }
void MMTF_BioAssembly_destroy(MMTF_BioAssembly* bio_assembly) { void MMTF_BioAssembly_destroy(MMTF_BioAssembly* bio_assembly) {
IF_NULL_PTRERROR_RETURN(bio_assembly, ); IF_NULL_PTRERROR_RETURN(bio_assembly, );
FREE_LIST(MMTF_Transform, bio_assembly->transformList); FREE_LIST(MMTF_Transform, bio_assembly->transformList);
free(bio_assembly->name); free(bio_assembly->name);
} }
void MMTF_Transform_destroy(MMTF_Transform* transform) { void MMTF_Transform_destroy(MMTF_Transform* transform) {
IF_NULL_PTRERROR_RETURN(transform, ); IF_NULL_PTRERROR_RETURN(transform, );
free(transform->chainIndexList); free(transform->chainIndexList);
} }
skipping to change at line 472 skipping to change at line 476
return output; return output;
} }
// Delta decode // Delta decode
int32_t* MMTF_parser_delta_decode(const int32_t* input, uint32_t input_length, u int32_t* output_length) { int32_t* MMTF_parser_delta_decode(const int32_t* input, uint32_t input_length, u int32_t* output_length) {
(*output_length) = input_length; (*output_length) = input_length;
int32_t* output = MALLOC_ARRAY(int32_t, (*output_length)); // The output nee ds to be freed by the calling process int32_t* output = MALLOC_ARRAY(int32_t, (*output_length)); // The output nee ds to be freed by the calling process
IF_NULL_ALLOCERROR_RETURN_NULL(output); IF_NULL_ALLOCERROR_RETURN_NULL(output);
output[0] = input[0]; if (input_length > 0) {
output[0] = input[0];
}
uint32_t i; uint32_t i;
for (i = 1; i < input_length; ++i) { for (i = 1; i < input_length; ++i) {
output[i] = output[i - 1] + input[i]; output[i] = output[i - 1] + input[i];
} }
return output; return output;
} }
// Recursive indexing decode // Recursive indexing decode
int32_t* MMTF_parser_recursive_indexing_decode_from_16(const int16_t* input, uin t32_t input_length, uint32_t* output_length) { int32_t* MMTF_parser_recursive_indexing_decode_from_16(const int16_t* input, uin t32_t input_length, uint32_t* output_length) {
skipping to change at line 496 skipping to change at line 503
if (input[i] != INT16_MAX && input[i] != INT16_MIN) { if (input[i] != INT16_MAX && input[i] != INT16_MIN) {
++(*output_length); ++(*output_length);
} }
} }
int32_t* output = (int32_t*)MALLOC_ARRAY(int32_t, (*output_length)); // The output needs to be freed by the calling process int32_t* output = (int32_t*)MALLOC_ARRAY(int32_t, (*output_length)); // The output needs to be freed by the calling process
IF_NULL_ALLOCERROR_RETURN_NULL(output); IF_NULL_ALLOCERROR_RETURN_NULL(output);
size_t j = 0; size_t j = 0;
output[j] = 0;
if (input_length > 0) {
output[0] = 0;
}
for (i = 0; i < input_length; ++i) { for (i = 0; i < input_length; ++i) {
output[j] += input[i]; output[j] += input[i];
if (input[i] != INT16_MAX && input[i] != INT16_MIN && j + 1 < *output_le ngth) { if (input[i] != INT16_MAX && input[i] != INT16_MIN && j + 1 < *output_le ngth) {
++j; ++j;
output[j] = 0; output[j] = 0;
} }
} }
skipping to change at line 756 skipping to change at line 766
default: default:
fprintf(stderr, "Error in %s: the entry encoded in the MMTF is not a str ing.\n", __FUNCTION__); fprintf(stderr, "Error in %s: the entry encoded in the MMTF is not a str ing.\n", __FUNCTION__);
return NULL; return NULL;
} }
char* result = NULL; char* result = NULL;
MMTF_parser_put_string(object, &result); MMTF_parser_put_string(object, &result);
return result; return result;
} }
static
char MMTF_parser_fetch_char(const msgpack_object* object) { char MMTF_parser_fetch_char(const msgpack_object* object) {
switch (object->type) { switch (object->type) {
#ifdef MMTF_ACCEPT_MSGPACK_BIN_AS_STR #ifdef MMTF_ACCEPT_MSGPACK_BIN_AS_STR
case MMTF_MSGPACK_TYPE(BIN): case MMTF_MSGPACK_TYPE(BIN):
fprintf(stderr, "Warning in %s: type BIN, expected STR ('%.*s')\n", __FU NCTION__, fprintf(stderr, "Warning in %s: type BIN, expected STR ('%.*s')\n", __FU NCTION__,
object->via.bin.size, object->via.bin.ptr); object->via.bin.size, object->via.bin.ptr);
#endif #endif
case MMTF_MSGPACK_TYPE(STR): case MMTF_MSGPACK_TYPE(STR):
break; break;
default: default:
skipping to change at line 793 skipping to change at line 804
} }
return result; return result;
} }
float MMTF_parser_fetch_float(const msgpack_object* object) { float MMTF_parser_fetch_float(const msgpack_object* object) {
switch (object->type) { switch (object->type) {
case /* FLOAT64 */ MMTF_MSGPACK_TYPE(FLOAT): case /* FLOAT64 */ MMTF_MSGPACK_TYPE(FLOAT):
#if MSGPACK_VERSION_MAJOR >= 2 #if MSGPACK_VERSION_MAJOR >= 2
case /* FLOAT32 */ 0x0a: // msgpack-c >= 2.1 case /* FLOAT32 */ 0x0a: // msgpack-c >= 2.1
return (float)object->via.f64;
#endif #endif
return (float)object->via.f64;
default: default:
fprintf(stderr, "Error in %s: the entry encoded in the MMTF is not a flo at.\n", __FUNCTION__); fprintf(stderr, "Error in %s: the entry encoded in the MMTF is not a flo at.\n", __FUNCTION__);
return NAN; return NAN;
} }
} }
/* /*
* Fetch a compressed typed array * Fetch a compressed typed array
*/ */
static static
skipping to change at line 958 skipping to change at line 969
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int8_array, secStructList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int8_array, secStructList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, bFactorList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, bFactorList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, xCoordList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, xCoordList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, yCoordList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, yCoordList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, zCoordList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, zCoordList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, occupancyList); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, float_array, occupancyList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, chainsPerModel); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, chainsPerModel);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, groupsPerChain); FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, groupsPerChain);
FETCH_AND_ASSIGN_WITHCOUNT(thing, string_array, experimentalMethods); FETCH_AND_ASSIGN_WITHCOUNT(thing, string_array, experimentalMethods);
FETCH_AND_ASSIGN_ARRAY(thing, float, unitCell); FETCH_AND_ASSIGN_ARRAY(thing, float, unitCell);
// PyMOL
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, pymolRepsList);
FETCH_AND_ASSIGN_DUMMYCOUNT(thing, int32_array, pymolColorList);
MAP_ITERATE_END(); MAP_ITERATE_END();
return true; return true;
} }
/* /*
* Decode a MMTF_container from a string * Decode a MMTF_container from a string
*/ */
bool MMTF_unpack_from_string(const char* buffer, size_t msgsize, MMTF_container* thing) { bool MMTF_unpack_from_string(const char* buffer, size_t msgsize, MMTF_container* thing) {
bool status; bool status;
 End of changes. 7 change blocks. 
3 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)