mirror of
https://github.com/schrodinger/pymol-open-source.git
synced 2026-06-03 19:54:24 +08:00
clang-tidy modernize-use-nullptr
... and modernize-use-bool-literals for some "newer" files.
This commit is contained in:
@@ -35,11 +35,11 @@ static char * fgetcontents(FILE *fp, long *size) {
|
||||
|
||||
char *contents = (char*) mmalloc(filesize + 255);
|
||||
if (!contents)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (1 != fread(contents, filesize, 1, fp)) {
|
||||
mfree(contents);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (size)
|
||||
@@ -78,7 +78,7 @@ char * FileGetContents(const char *filename, long *size) {
|
||||
FILE *fp = pymol_fopen(filename, "rb");
|
||||
|
||||
if (!fp)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
contents = fgetcontents(fp, size);
|
||||
fclose(fp);
|
||||
|
||||
@@ -412,7 +412,7 @@ void renderTarget_t::layout(std::vector<rt_layout_t> &&desc,
|
||||
format, type, tex::filter::LINEAR, tex::filter::LINEAR,
|
||||
tex::wrap::CLAMP, tex::wrap::CLAMP));
|
||||
auto tex = _textures.back();
|
||||
tex->texture_data_2D(d.width, d.height, 0);
|
||||
tex->texture_data_2D(d.width, d.height, nullptr);
|
||||
|
||||
fbo::attachment loc;
|
||||
switch (_textures.size()) {
|
||||
|
||||
@@ -93,7 +93,7 @@ using namespace std;
|
||||
|
||||
static void glShaderSource1String(GLuint shad, const string &strobj){
|
||||
const GLchar *str = (const GLchar *)strobj.c_str();
|
||||
glShaderSource(shad, 1, (const GLchar **)&str, NULL);
|
||||
glShaderSource(shad, 1, (const GLchar **)&str, nullptr);
|
||||
}
|
||||
|
||||
bool CShaderPrg::reload(){
|
||||
@@ -249,13 +249,13 @@ PFNGLTEXIMAGE3DPROC getTexImage3D(){
|
||||
*/
|
||||
void disableShaders(PyMOLGlobals * G) {
|
||||
/* Auto-disable shader-based rendering */
|
||||
SettingSetGlobal_b(G, cSetting_use_shaders, 0);
|
||||
SettingSetGlobal_b(G, cSetting_use_shaders, false);
|
||||
}
|
||||
|
||||
static void disableGeometryShaders(PyMOLGlobals * G) {
|
||||
SettingSetGlobal_b(G, cSetting_use_geometry_shaders, 0);
|
||||
SettingSetGlobal_b(G, cSetting_use_geometry_shaders, false);
|
||||
if(G->ShaderMgr)
|
||||
G->ShaderMgr->SetPreprocVar("use_geometry_shaders", 0);
|
||||
G->ShaderMgr->SetPreprocVar("use_geometry_shaders", false);
|
||||
|
||||
if (G->Option && !G->Option->quiet)
|
||||
PRINTFB(G, FB_ShaderMgr, FB_Warnings)
|
||||
@@ -438,8 +438,8 @@ string CShaderMgr::GetShaderSource(const string &filename)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
char* buffer = NULL;
|
||||
const char *pl = NULL, *newpl, *tpl;
|
||||
char* buffer = nullptr;
|
||||
const char *pl = nullptr, *newpl, *tpl;
|
||||
std::ostringstream newbuffer;
|
||||
|
||||
/* "if_depth" counts the level of nesting, and "true_depth" how far the
|
||||
@@ -457,7 +457,7 @@ string CShaderMgr::GetShaderSource(const string &filename)
|
||||
string path(pymol_data);
|
||||
path.append(PATH_SEP).append("shaders").append(PATH_SEP).append(filename);
|
||||
|
||||
pl = buffer = FileGetContents(path.c_str(), NULL);
|
||||
pl = buffer = FileGetContents(path.c_str(), nullptr);
|
||||
|
||||
if (!buffer) {
|
||||
PRINTFB(G, FB_ShaderMgr, FB_Warnings)
|
||||
@@ -567,7 +567,7 @@ void CShaderMgr::Reload_Shader_Variables() {
|
||||
int bg_gradient = SettingGetGlobal_b(G, cSetting_bg_gradient);
|
||||
int bg_image_mode_solid;
|
||||
int stereo, stereo_mode;
|
||||
const char * bg_image_filename = SettingGet_s(G, NULL, NULL, cSetting_bg_image_filename);
|
||||
const char * bg_image_filename = SettingGet_s(G, nullptr, nullptr, cSetting_bg_image_filename);
|
||||
short bg_image = bg_image_filename && bg_image_filename[0];
|
||||
bg_image_mode_solid = !(bg_gradient || bg_image || OrthoBackgroundDataIsSet(*G->Ortho));
|
||||
|
||||
@@ -594,7 +594,7 @@ void CShaderMgr::Reload_Shader_Variables() {
|
||||
stereo = SettingGetGlobal_i(G, cSetting_stereo);
|
||||
stereo_mode = SettingGetGlobal_i(G, cSetting_stereo_mode);
|
||||
|
||||
SetPreprocVar("ANAGLYPH", (stereo && stereo_mode==cStereo_anaglyph) ? 1 : 0);
|
||||
SetPreprocVar("ANAGLYPH", stereo && stereo_mode == cStereo_anaglyph);
|
||||
SetPreprocVar("ray_trace_mode_3", SettingGetGlobal_i(G, cSetting_ray_trace_mode) == 3);
|
||||
SetPreprocVar("transparency_mode_3", SettingGetGlobal_i(G, cSetting_transparency_mode)==3);
|
||||
|
||||
@@ -664,7 +664,7 @@ void CShaderPrg::ErrorMsgWithShaderInfoLog(const GLuint sid, const char * msg) {
|
||||
GLint infoLogLength = 0;
|
||||
glGetShaderiv(sid, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
vector<GLchar> infoLog(infoLogLength);
|
||||
glGetShaderInfoLog(sid, infoLogLength, NULL, infoLog.data());
|
||||
glGetShaderInfoLog(sid, infoLogLength, nullptr, infoLog.data());
|
||||
|
||||
PRINTFB(G, FB_ShaderPrg, FB_Errors) " ShaderPrg-Error: %s; name='%s'\n",
|
||||
msg, name.c_str() ENDFB(G);
|
||||
@@ -713,9 +713,9 @@ void CShaderMgr::Config() {
|
||||
#endif
|
||||
|
||||
// static preprocessor values
|
||||
preproc_vars["GLEW_VERSION_3_0"] = GLEW_VERSION_3_0 ? 1 : 0;
|
||||
preproc_vars["GLEW_VERSION_3_0"] = GLEW_VERSION_3_0 ? true : false;
|
||||
if (TM3_IS_ONEBUF){
|
||||
preproc_vars["ONE_DRAW_BUFFER"] = 1;
|
||||
preproc_vars["ONE_DRAW_BUFFER"] = true;
|
||||
}
|
||||
#ifdef PURE_OPENGL_ES_2
|
||||
preproc_vars["PURE_OPENGL_ES_2"] = 1;
|
||||
@@ -812,7 +812,7 @@ void CShaderMgr::Config() {
|
||||
}
|
||||
#endif
|
||||
shaders_present |= 0x1;
|
||||
SettingSetGlobal_b(G, cSetting_use_shaders, 1);
|
||||
SettingSetGlobal_b(G, cSetting_use_shaders, true);
|
||||
|
||||
is_configured = true;
|
||||
return;
|
||||
@@ -834,7 +834,7 @@ void getGLVersion(PyMOLGlobals * G, int *major, int* minor) {
|
||||
/* query the version string */
|
||||
const char* verstr = (const char*) glGetString(GL_VERSION);
|
||||
/* attempt to store the values into major and minor */
|
||||
if ((verstr==NULL) || (sscanf(verstr,"%d.%d", major, minor) != 2)) {
|
||||
if (!verstr || sscanf(verstr, "%d.%d", major, minor) != 2) {
|
||||
*major = *minor = 0;
|
||||
/* Use PyMOL FB system, instead of fprintf */
|
||||
PRINTFD(G, FB_ObjectVolume)
|
||||
@@ -859,8 +859,7 @@ void getGLSLVersion(PyMOLGlobals * G, int* major, int* minor) {
|
||||
/* GL version 1 */
|
||||
if (1==gl_major) {
|
||||
const char* extstr = (const char*) glGetString(GL_EXTENSIONS);
|
||||
if ((extstr!=NULL) &&
|
||||
(strstr(extstr, "GL_ARB_shading_language_100")!=NULL)){
|
||||
if (extstr && strstr(extstr, "GL_ARB_shading_language_100")) {
|
||||
*major = 1;
|
||||
*minor = 0;
|
||||
}
|
||||
@@ -869,7 +868,7 @@ void getGLSLVersion(PyMOLGlobals * G, int* major, int* minor) {
|
||||
else if (gl_major>=2) {
|
||||
const char* verstr = (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
|
||||
if ((verstr==NULL) || (sscanf(verstr, "%d.%d", major, minor)!=2)){
|
||||
if (!verstr || sscanf(verstr, "%d.%d", major, minor) != 2) {
|
||||
*major = *minor = 0;
|
||||
|
||||
if (G && G->Option && !G->Option->quiet) {
|
||||
@@ -889,7 +888,7 @@ void getGLSLVersion(PyMOLGlobals * G, int* major, int* minor) {
|
||||
CShaderMgr::CShaderMgr(PyMOLGlobals * G_)
|
||||
{
|
||||
G = G_;
|
||||
current_shader = 0;
|
||||
current_shader = nullptr;
|
||||
shaders_present = 0;
|
||||
stereo_flag = 0;
|
||||
stereo_blend = 0;
|
||||
@@ -958,7 +957,7 @@ CShaderPrg * CShaderMgr::GetShaderPrg(std::string name, short set_current_shader
|
||||
|
||||
auto it = programs.find(name);
|
||||
if (it == programs.end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (set_current_shader)
|
||||
current_shader = it->second;
|
||||
@@ -1029,24 +1028,24 @@ CShaderPrg *CShaderMgr::Enable_DefaultShaderWithSettings(
|
||||
|
||||
CShaderPrg *CShaderMgr::Enable_DefaultShader(int pass){
|
||||
CShaderPrg * shaderPrg = Get_DefaultShader(pass);
|
||||
return Setup_DefaultShader(shaderPrg, NULL, NULL);
|
||||
return Setup_DefaultShader(shaderPrg, nullptr, nullptr);
|
||||
}
|
||||
|
||||
CShaderPrg *CShaderMgr::Enable_LineShader(int pass){
|
||||
CShaderPrg * shaderPrg = Get_LineShader(pass);
|
||||
return Setup_DefaultShader(shaderPrg, NULL, NULL);
|
||||
return Setup_DefaultShader(shaderPrg, nullptr, nullptr);
|
||||
}
|
||||
|
||||
CShaderPrg *CShaderMgr::Enable_SurfaceShader(int pass){
|
||||
CShaderPrg * shaderPrg = Get_SurfaceShader(pass);
|
||||
return Setup_DefaultShader(shaderPrg, NULL, NULL);
|
||||
return Setup_DefaultShader(shaderPrg, nullptr, nullptr);
|
||||
}
|
||||
|
||||
CShaderPrg *CShaderMgr::Enable_ConnectorShader(int pass){
|
||||
CShaderPrg * shaderPrg = Get_ConnectorShader(pass);
|
||||
if (!shaderPrg)
|
||||
return 0;
|
||||
shaderPrg = Setup_DefaultShader(shaderPrg, NULL, NULL);
|
||||
return nullptr;
|
||||
shaderPrg = Setup_DefaultShader(shaderPrg, nullptr, nullptr);
|
||||
shaderPrg->SetLightingEnabled(0);
|
||||
{
|
||||
float front, back;
|
||||
@@ -1061,7 +1060,7 @@ CShaderPrg *CShaderMgr::Enable_ConnectorShader(int pass){
|
||||
shaderPrg->Set2f("screenSize", width, height);
|
||||
|
||||
{
|
||||
float v_scale = SceneGetScreenVertexScale(G, NULL);
|
||||
float v_scale = SceneGetScreenVertexScale(G, nullptr);
|
||||
shaderPrg->Set1f("screenOriginVertexScale", v_scale/2.f);
|
||||
}
|
||||
|
||||
@@ -1072,7 +1071,7 @@ CShaderPrg *CShaderMgr::Setup_DefaultShader(CShaderPrg * shaderPrg,
|
||||
const CSetting *set1,
|
||||
const CSetting *set2) {
|
||||
if (!shaderPrg){
|
||||
current_shader = NULL;
|
||||
current_shader = nullptr;
|
||||
return shaderPrg;
|
||||
}
|
||||
shaderPrg->Enable();
|
||||
@@ -1115,7 +1114,7 @@ CShaderPrg *CShaderMgr::Enable_CylinderShader(const char *shader_name, int pass)
|
||||
SceneGetWidthHeightStereo(G, &width, &height);
|
||||
shaderPrg = GetShaderPrg(shader_name, 1, pass);
|
||||
if (!shaderPrg)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
shaderPrg->Enable();
|
||||
|
||||
shaderPrg->SetLightingEnabled(1); // lighting on by default
|
||||
@@ -1148,7 +1147,7 @@ CShaderPrg *CShaderMgr::Get_DefaultSphereShader(int pass){
|
||||
|
||||
CShaderPrg *CShaderMgr::Enable_DefaultSphereShader(int pass) {
|
||||
CShaderPrg *shaderPrg = Get_DefaultSphereShader(pass);
|
||||
if (!shaderPrg) return NULL;
|
||||
if (!shaderPrg) return nullptr;
|
||||
shaderPrg->Enable();
|
||||
shaderPrg->SetLightingEnabled(1);
|
||||
shaderPrg->Set1f("sphere_size_scale", 1.f);
|
||||
@@ -1165,7 +1164,7 @@ CShaderPrg *CShaderMgr::Enable_DefaultSphereShader(int pass) {
|
||||
|
||||
#ifdef _PYMOL_ARB_SHADERS
|
||||
CShaderPrg *CShaderMgr::Enable_SphereShaderARB(){
|
||||
CShaderPrg *shaderPrg = NULL;
|
||||
CShaderPrg *shaderPrg = nullptr;
|
||||
/* load the vertex program */
|
||||
if (current_shader)
|
||||
current_shader->Disable();
|
||||
@@ -1296,7 +1295,7 @@ CShaderPrg *CShaderMgr::Enable_LabelShader(int pass){
|
||||
CShaderPrg *shaderPrg;
|
||||
shaderPrg = Get_LabelShader(pass);
|
||||
if (!shaderPrg)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
shaderPrg->Enable();
|
||||
return Setup_LabelShader(shaderPrg);
|
||||
}
|
||||
@@ -1305,7 +1304,7 @@ CShaderPrg *CShaderMgr::Enable_ScreenShader(){
|
||||
CShaderPrg *shaderPrg;
|
||||
shaderPrg = Get_ScreenShader();
|
||||
if (!shaderPrg)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
shaderPrg->Enable();
|
||||
|
||||
int ortho_width, ortho_height;
|
||||
@@ -1319,7 +1318,7 @@ CShaderPrg *CShaderMgr::Enable_RampShader(){
|
||||
CShaderPrg *shaderPrg;
|
||||
shaderPrg = Get_RampShader();
|
||||
if (!shaderPrg)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
shaderPrg->Enable();
|
||||
return Setup_LabelShader(shaderPrg);
|
||||
}
|
||||
@@ -1344,7 +1343,7 @@ CShaderPrg *CShaderMgr::Setup_LabelShader(CShaderPrg *shaderPrg) {
|
||||
shaderPrg->SetBgUniforms();
|
||||
|
||||
{
|
||||
float v_scale = SceneGetScreenVertexScale(G, NULL);
|
||||
float v_scale = SceneGetScreenVertexScale(G, nullptr);
|
||||
shaderPrg->Set1f("screenOriginVertexScale", v_scale/2.f);
|
||||
}
|
||||
{
|
||||
@@ -1364,7 +1363,7 @@ CShaderPrg *CShaderMgr::Get_LabelShader(int pass){
|
||||
|
||||
CShaderPrg *CShaderMgr::Get_ScreenShader() {
|
||||
if (is_picking)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return GetShaderPrg("screen");
|
||||
}
|
||||
|
||||
@@ -1780,7 +1779,7 @@ const char *CShaderMgr::GetAttributeName(int uid)
|
||||
{
|
||||
auto uloc = attribute_uids.find(uid);
|
||||
if (uloc == attribute_uids.end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return attribute_uids[uid].c_str();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,11 @@ CShaderPrg *CShaderPrg::NewARB(PyMOLGlobals * G, const char * name, const string
|
||||
glDeleteProgramsARB(2, programs);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int CShaderPrg::DisableARB() {
|
||||
G->ShaderMgr->current_shader = 0;
|
||||
G->ShaderMgr->current_shader = nullptr;
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
glDisable(GL_VERTEX_PROGRAM_ARB);
|
||||
return 1;
|
||||
@@ -159,7 +159,7 @@ int CShaderPrg::Enable() {
|
||||
|
||||
int CShaderPrg::Disable() {
|
||||
glUseProgram(0);
|
||||
G->ShaderMgr->current_shader = 0;
|
||||
G->ShaderMgr->current_shader = nullptr;
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
return 1;
|
||||
@@ -443,7 +443,7 @@ void CShaderPrg::SetBgUniforms() {
|
||||
int bg_width, bg_height;
|
||||
int scene_width, scene_height;
|
||||
|
||||
Set3fv("bgSolidColor", ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)));
|
||||
Set3fv("bgSolidColor", ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)));
|
||||
|
||||
SceneGetWidthHeight(G, &scene_width, &scene_height);
|
||||
std::tie(bg_width, bg_height) = OrthoGetBackgroundSize(*G->Ortho);
|
||||
|
||||
@@ -112,5 +112,5 @@ void * AtomInfoTypeConverter::allocCopy(int destversion, const AtomInfoType *src
|
||||
return allocCopy<AtomInfoType_1_8_1>(src);
|
||||
}
|
||||
printf("ERROR: AtomInfoTypeConverter: unknown destversion=%d from AtomInfoVERSION=%d\n", destversion, AtomInfoVERSION);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,6 @@ void *Copy_To_BondType_Version(int bondInfo_version, BondType *Bond, int NBond){
|
||||
default:
|
||||
printf("ERROR: Copy_To_BondType_Version: unknown bondInfo_version=%d from BondInfoVERSION=%d\n", bondInfo_version, BondInfoVERSION);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static void tolowerinplace(char *p) {
|
||||
// CIF stuff
|
||||
|
||||
static const char * EMPTY_STRING = "";
|
||||
static cif_array EMPTY_ARRAY(NULL);
|
||||
static cif_array EMPTY_ARRAY(nullptr);
|
||||
|
||||
/*
|
||||
* Class to store CIF loops. Only for parsing, do not use in any higher level
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
// get table value, return NULL if indices out of bounds
|
||||
const char * cif_loop::get_value_raw(int row, int col) const {
|
||||
if (row >= nrows)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return values[row * ncols + col];
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ int cif_array::get_nrows() const {
|
||||
// or value in ['.', '?']
|
||||
const char * cif_array::get_value(int row) const {
|
||||
if (col < 0)
|
||||
return (row > 0) ? NULL : pointer.value;
|
||||
return (row > 0) ? nullptr : pointer.value;
|
||||
return pointer.loop->get_value_raw(row, col);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ template <> float cif_array::as<float >(int row) const { return as_d
|
||||
*/
|
||||
const cif_array * cif_data::get_arr(const char * key, const char * alias1, const char * alias2) const {
|
||||
const char * p;
|
||||
const char * aliases[] = {alias1, alias2, NULL};
|
||||
const char * aliases[] = {alias1, alias2, nullptr};
|
||||
m_str_cifarray_t::const_iterator it;
|
||||
|
||||
for (int j = 0; key; key = aliases[j++]) {
|
||||
@@ -190,13 +190,13 @@ const cif_array * cif_data::get_arr(const char * key, const char * alias1, const
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Get a pointer to array or to a default value if not found
|
||||
const cif_array * cif_data::get_opt(const char * key, const char * alias1, const char * alias2) const {
|
||||
const cif_array * arr = get_arr(key, alias1, alias2);
|
||||
if (arr == NULL)
|
||||
if (arr == nullptr)
|
||||
return &EMPTY_ARRAY;
|
||||
return arr;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ cif_file::cif_file(const char* filename, const char* contents_) {
|
||||
if (contents_) {
|
||||
contents = mstrdup(contents_);
|
||||
} else {
|
||||
contents = FileGetContents(filename, NULL);
|
||||
contents = FileGetContents(filename, nullptr);
|
||||
if (!contents)
|
||||
std::cerr << "ERROR: Failed to load file '" << filename << "'" << std::endl;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ bool cif_file::parse() {
|
||||
prev = *p;
|
||||
if (p - q == 1 && (*q == '?' || *q == '.')) {
|
||||
// store values '.' (inapplicable) and '?' (unknown) as null-pointers
|
||||
q = NULL;
|
||||
q = nullptr;
|
||||
keypossible.push_back(false);
|
||||
} else {
|
||||
if (*p)
|
||||
@@ -286,7 +286,7 @@ bool cif_file::parse() {
|
||||
}
|
||||
}
|
||||
|
||||
cif_data *current_data = NULL, *current_frame = NULL, *global_block = NULL;
|
||||
cif_data *current_data = nullptr, *current_frame = nullptr, *global_block = nullptr;
|
||||
|
||||
// parse into dictionary
|
||||
for (unsigned int i = 0, n = tokens.size(); i < n; i++) {
|
||||
@@ -308,7 +308,7 @@ bool cif_file::parse() {
|
||||
} else if (strcasecmp("loop_", tokens[i]) == 0) {
|
||||
int ncols = 0;
|
||||
int nrows = 0;
|
||||
cif_loop *loop = NULL;
|
||||
cif_loop *loop = nullptr;
|
||||
|
||||
// loop data
|
||||
if (current_frame) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
const char * get(int i) const {
|
||||
if (i < 1 || i > size())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return (*this)[i - 1].c_str();
|
||||
}
|
||||
};
|
||||
@@ -239,7 +239,7 @@ static void ObjectMoleculeConnectDiscrete(ObjectMolecule * I) {
|
||||
continue;
|
||||
|
||||
int nbond = 0;
|
||||
BondType * bond = NULL;
|
||||
BondType * bond = nullptr;
|
||||
|
||||
ObjectMoleculeConnect(I, &nbond, &bond, I->AtomInfo, I->CSet[i], true, 3);
|
||||
|
||||
@@ -357,7 +357,7 @@ static bond_dict_t * get_global_components_bond_dict(PyMOLGlobals * G) {
|
||||
if (bond_dict.empty()) {
|
||||
const char * pymol_data = getenv("PYMOL_DATA");
|
||||
if (!pymol_data || !pymol_data[0])
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
std::string path(pymol_data);
|
||||
path.append(PATH_SEP).append("chem_comp_bond-top100.cif");
|
||||
@@ -402,7 +402,7 @@ static void ConnectComponent(ObjectMolecule * I, int i_start, int i_end,
|
||||
|
||||
// get residue bond dictionary
|
||||
auto res_dict = bond_dict->get(G, LexStr(G, ai[i_start].resn));
|
||||
if (res_dict == NULL)
|
||||
if (res_dict == nullptr)
|
||||
return;
|
||||
|
||||
// for all pairs of atoms in given set
|
||||
@@ -444,7 +444,7 @@ static void ConnectComponent(ObjectMolecule * I, int i_start, int i_end,
|
||||
* connecting bonds (C->N, O3*->P)
|
||||
*/
|
||||
static int ObjectMoleculeConnectComponents(ObjectMolecule * I,
|
||||
bond_dict_t * bond_dict=NULL) {
|
||||
bond_dict_t * bond_dict=nullptr) {
|
||||
|
||||
PyMOLGlobals * G = I->Obj.G;
|
||||
int i_start = 0, i_prev_c = 0, i_prev_o3 = 0;
|
||||
@@ -608,8 +608,8 @@ static bool get_assembly_chains(PyMOLGlobals * G,
|
||||
|
||||
const cif_array *arr_id, *arr_asym_id_list;
|
||||
|
||||
if ((arr_id = data->get_arr("_pdbx_struct_assembly_gen.assembly_id")) == NULL ||
|
||||
(arr_asym_id_list = data->get_arr("_pdbx_struct_assembly_gen.asym_id_list")) == NULL)
|
||||
if ((arr_id = data->get_arr("_pdbx_struct_assembly_gen.assembly_id")) == nullptr ||
|
||||
(arr_asym_id_list = data->get_arr("_pdbx_struct_assembly_gen.asym_id_list")) == nullptr)
|
||||
return false;
|
||||
|
||||
for (int i = 0, nrows = arr_id->get_nrows(); i < nrows; ++i) {
|
||||
@@ -645,11 +645,11 @@ CoordSet ** read_pdbx_struct_assembly(PyMOLGlobals * G,
|
||||
const cif_array *arr_id, *arr_assembly_id, *arr_oper_expr, *arr_asym_id_list;
|
||||
|
||||
|
||||
if ((arr_id = data->get_arr("_pdbx_struct_oper_list.id")) == NULL ||
|
||||
(arr_assembly_id = data->get_arr("_pdbx_struct_assembly_gen.assembly_id")) == NULL ||
|
||||
(arr_oper_expr = data->get_arr("_pdbx_struct_assembly_gen.oper_expression")) == NULL ||
|
||||
(arr_asym_id_list = data->get_arr("_pdbx_struct_assembly_gen.asym_id_list")) == NULL)
|
||||
return NULL;
|
||||
if ((arr_id = data->get_arr("_pdbx_struct_oper_list.id")) == nullptr ||
|
||||
(arr_assembly_id = data->get_arr("_pdbx_struct_assembly_gen.assembly_id")) == nullptr ||
|
||||
(arr_oper_expr = data->get_arr("_pdbx_struct_assembly_gen.oper_expression")) == nullptr ||
|
||||
(arr_asym_id_list = data->get_arr("_pdbx_struct_assembly_gen.asym_id_list")) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
const cif_array * arr_matrix[] = {
|
||||
data->get_opt("_pdbx_struct_oper_list.matrix[1][1]"),
|
||||
@@ -680,7 +680,7 @@ CoordSet ** read_pdbx_struct_assembly(PyMOLGlobals * G,
|
||||
}
|
||||
}
|
||||
|
||||
CoordSet ** csets = NULL;
|
||||
CoordSet ** csets = nullptr;
|
||||
int csetbeginidx = 0;
|
||||
|
||||
// assembly
|
||||
@@ -806,12 +806,12 @@ static CSymmetry * read_symmetry(PyMOLGlobals * G, cif_data * data) {
|
||||
};
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
if (cell[i] == NULL)
|
||||
return NULL;
|
||||
if (cell[i] == nullptr)
|
||||
return nullptr;
|
||||
|
||||
CSymmetry * symmetry = SymmetryNew(G);
|
||||
if (!symmetry)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
symmetry->Crystal->Dim[i] = cell[i]->as_d();
|
||||
@@ -845,7 +845,7 @@ static CSymmetry * read_symmetry(PyMOLGlobals * G, cif_data * data) {
|
||||
static CoordSet ** read_chem_comp_atom_model(PyMOLGlobals * G, cif_data * data,
|
||||
AtomInfoType ** atInfoPtr) {
|
||||
|
||||
const cif_array *arr_x, *arr_y = NULL, *arr_z = NULL;
|
||||
const cif_array *arr_x, *arr_y = nullptr, *arr_z = nullptr;
|
||||
|
||||
// setting to exclude one or more coordinate columns
|
||||
unsigned mask = SettingGetGlobal_i(G, cSetting_chem_comp_cartn_use);
|
||||
@@ -875,7 +875,7 @@ static CoordSet ** read_chem_comp_atom_model(PyMOLGlobals * G, cif_data * data,
|
||||
}
|
||||
|
||||
if (!arr_x || !arr_y || !arr_z) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PRINTFB(G, FB_Executive, FB_Details)
|
||||
@@ -913,7 +913,7 @@ static CoordSet ** read_chem_comp_atom_model(PyMOLGlobals * G, cif_data * data,
|
||||
ai->partialCharge = arr_partial_charge->as_d(i);
|
||||
ai->formalCharge = arr_formal_charge->as_i(i);
|
||||
|
||||
ai->hetatm = 1;
|
||||
ai->hetatm = true;
|
||||
|
||||
ai->visRep = auto_show;
|
||||
AtomInfoSetStereo(ai, arr_stereo->as_s(i));
|
||||
@@ -975,9 +975,9 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
AtomInfoType ** atInfoPtr, CifContentInfo &info, bool discrete) {
|
||||
|
||||
const cif_array *arr_x, *arr_y, *arr_z;
|
||||
const cif_array *arr_name = NULL, *arr_resn = NULL, *arr_resi = NULL,
|
||||
*arr_chain = NULL, *arr_symbol,
|
||||
*arr_group_pdb, *arr_alt, *arr_ins_code = NULL, *arr_b, *arr_u,
|
||||
const cif_array *arr_name = nullptr, *arr_resn = nullptr, *arr_resi = nullptr,
|
||||
*arr_chain = nullptr, *arr_symbol,
|
||||
*arr_group_pdb, *arr_alt, *arr_ins_code = nullptr, *arr_b, *arr_u,
|
||||
*arr_q, *arr_ID, *arr_mod_num, *arr_entity_id, *arr_segi;
|
||||
|
||||
if ((arr_x = data->get_arr("_atom_site?cartn_x")) &&
|
||||
@@ -989,7 +989,7 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
(arr_z = data->get_arr("_atom_site?fract_z"))) {
|
||||
info.fractional = true;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info.use_auth) {
|
||||
@@ -1057,7 +1057,7 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
if (mod_num < 1) {
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: model numbers < 1 not supported: %d\n", mod_num ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
atoms_per_model[mod_num - 1] += 1;
|
||||
@@ -1126,7 +1126,7 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
ai->alt[0] = arr_alt->as_s(i)[0];
|
||||
|
||||
ai->id = arr_ID->as_i(i);
|
||||
ai->b = (arr_u != NULL) ?
|
||||
ai->b = (arr_u != nullptr) ?
|
||||
arr_u->as_d(i) * 78.95683520871486 : // B = U * 8 * pi^2
|
||||
arr_b->as_d(i);
|
||||
ai->q = arr_q->as_d(i, 1.0);
|
||||
@@ -1139,7 +1139,7 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
ai->segi = std::move(segi); // steal reference
|
||||
|
||||
if ('H' == arr_group_pdb->as_s(i)[0]) {
|
||||
ai->hetatm = 1;
|
||||
ai->hetatm = true;
|
||||
ai->flags = cAtomFlag_ignore;
|
||||
}
|
||||
|
||||
@@ -1168,7 +1168,7 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
AtomInfoAssignColors(G, ai);
|
||||
}
|
||||
|
||||
if (arr_entity_id != NULL) {
|
||||
if (arr_entity_id != nullptr) {
|
||||
AtomInfoSetEntityId(G, ai, arr_entity_id->as_s(i));
|
||||
}
|
||||
|
||||
@@ -1184,8 +1184,8 @@ static CoordSet ** read_atom_site(PyMOLGlobals * G, cif_data * data,
|
||||
* Update `info` with entity polymer information
|
||||
*/
|
||||
static bool read_entity_poly(PyMOLGlobals * G, const cif_data * data, CifContentInfo &info) {
|
||||
const cif_array *arr_entity_id = NULL, *arr_type = NULL,
|
||||
*arr_num = NULL, *arr_mon_id = NULL;
|
||||
const cif_array *arr_entity_id = nullptr, *arr_type = nullptr,
|
||||
*arr_num = nullptr, *arr_mon_id = nullptr;
|
||||
|
||||
if (!(arr_entity_id = data->get_arr("_entity_poly.entity_id")) ||
|
||||
!(arr_type = data->get_arr("_entity_poly.type")))
|
||||
@@ -1298,7 +1298,7 @@ static bool add_missing_ca(PyMOLGlobals * G,
|
||||
int oldAtomCount = VLAGetSize(atInfo);
|
||||
int atomCount = oldAtomCount;
|
||||
int current_resv = 0;
|
||||
const seqvec_t * current_seq = NULL;
|
||||
const seqvec_t * current_seq = nullptr;
|
||||
const char * current_entity_id = "";
|
||||
|
||||
for (int i = 0; i < oldAtomCount; ++i) {
|
||||
@@ -1316,7 +1316,7 @@ static bool add_missing_ca(PyMOLGlobals * G,
|
||||
}
|
||||
|
||||
current_resv = 0;
|
||||
current_seq = NULL;
|
||||
current_seq = nullptr;
|
||||
current_entity_id = entity_id;
|
||||
|
||||
if (info.is_polypeptide(entity_id) && !info.is_excluded_chain(atInfo[i].segi)) {
|
||||
@@ -1358,9 +1358,9 @@ static bool add_missing_ca(PyMOLGlobals * G,
|
||||
static bool read_ss_(PyMOLGlobals * G, cif_data * data, char ss,
|
||||
sshashmap &ssrecords, CifContentInfo &info)
|
||||
{
|
||||
const cif_array *arr_beg_chain = NULL, *arr_beg_resi = NULL,
|
||||
*arr_end_chain = NULL, *arr_end_resi = NULL,
|
||||
*arr_beg_ins_code = NULL, *arr_end_ins_code = NULL;
|
||||
const cif_array *arr_beg_chain = nullptr, *arr_beg_resi = nullptr,
|
||||
*arr_end_chain = nullptr, *arr_end_resi = nullptr,
|
||||
*arr_beg_ins_code = nullptr, *arr_end_ins_code = nullptr;
|
||||
|
||||
std::string prefix = "_struct_conf.";
|
||||
if (ss == 'S')
|
||||
@@ -1382,7 +1382,7 @@ static bool read_ss_(PyMOLGlobals * G, cif_data * data, char ss,
|
||||
return false;
|
||||
}
|
||||
|
||||
const cif_array *arr_conf_type_id = (ss == 'S') ? NULL :
|
||||
const cif_array *arr_conf_type_id = (ss == 'S') ? nullptr :
|
||||
data->get_arr("_struct_conf.conf_type_id");
|
||||
|
||||
int nrows = arr_beg_chain->get_nrows();
|
||||
@@ -1548,7 +1548,7 @@ static bool read_atom_site_aniso(PyMOLGlobals * G, cif_data * data,
|
||||
|
||||
// read aniso table
|
||||
for (int i = 0; i < arr_u11->get_nrows(); i++) {
|
||||
ai = NULL;
|
||||
ai = nullptr;
|
||||
|
||||
if (mmcif) {
|
||||
find1(id_dict, ai, arr_label->as_i(i));
|
||||
@@ -1583,10 +1583,10 @@ static BondType * read_geom_bond(PyMOLGlobals * G, cif_data * data,
|
||||
|
||||
const cif_array *arr_ID_1, *arr_ID_2;
|
||||
if ((arr_ID_1 = data->get_arr("_geom_bond.atom_site_id_1",
|
||||
"_geom_bond_atom_site_label_1")) == NULL ||
|
||||
"_geom_bond_atom_site_label_1")) == nullptr ||
|
||||
(arr_ID_2 = data->get_arr("_geom_bond.atom_site_id_2",
|
||||
"_geom_bond_atom_site_label_2")) == NULL)
|
||||
return NULL;
|
||||
"_geom_bond_atom_site_label_2")) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
const cif_array *arr_symm_1 = data->get_opt("_geom_bond?site_symmetry_1");
|
||||
const cif_array *arr_symm_2 = data->get_opt("_geom_bond?site_symmetry_2");
|
||||
@@ -1648,11 +1648,11 @@ static BondType * read_chemical_conn_bond(PyMOLGlobals * G, cif_data * data) {
|
||||
|
||||
const cif_array *arr_number, *arr_atom_1, *arr_atom_2, *arr_type;
|
||||
|
||||
if ((arr_number = data->get_arr("_atom_site?chemical_conn_number")) == NULL ||
|
||||
(arr_atom_1 = data->get_arr("_chemical_conn_bond?atom_1")) == NULL ||
|
||||
(arr_atom_2 = data->get_arr("_chemical_conn_bond?atom_2")) == NULL ||
|
||||
(arr_type = data->get_arr("_chemical_conn_bond?type")) == NULL)
|
||||
return NULL;
|
||||
if ((arr_number = data->get_arr("_atom_site?chemical_conn_number")) == nullptr ||
|
||||
(arr_atom_1 = data->get_arr("_chemical_conn_bond?atom_1")) == nullptr ||
|
||||
(arr_atom_2 = data->get_arr("_chemical_conn_bond?atom_2")) == nullptr ||
|
||||
(arr_type = data->get_arr("_chemical_conn_bond?type")) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
int nAtom = arr_number->get_nrows();
|
||||
int nBond = arr_atom_1->get_nrows();
|
||||
@@ -1702,13 +1702,13 @@ static bool read_struct_conn_(PyMOLGlobals * G, cif_data * data,
|
||||
return false;
|
||||
|
||||
const cif_array
|
||||
*col_asym_id[2] = {NULL, NULL},
|
||||
*col_comp_id[2] = {NULL, NULL},
|
||||
*col_seq_id[2] = {NULL, NULL},
|
||||
*col_atom_id[2] = {NULL, NULL},
|
||||
*col_alt_id[2] = {NULL, NULL},
|
||||
*col_ins_code[2] = {NULL, NULL},
|
||||
*col_symm[2] = {NULL, NULL};
|
||||
*col_asym_id[2] = {nullptr, nullptr},
|
||||
*col_comp_id[2] = {nullptr, nullptr},
|
||||
*col_seq_id[2] = {nullptr, nullptr},
|
||||
*col_atom_id[2] = {nullptr, nullptr},
|
||||
*col_alt_id[2] = {nullptr, nullptr},
|
||||
*col_ins_code[2] = {nullptr, nullptr},
|
||||
*col_symm[2] = {nullptr, nullptr};
|
||||
|
||||
if (info.use_auth) {
|
||||
col_asym_id[0] = data->get_arr("_struct_conn.ptnr1_auth_asym_id");
|
||||
@@ -1848,10 +1848,10 @@ static BondType * read_chem_comp_bond(PyMOLGlobals * G, cif_data * data,
|
||||
|
||||
const cif_array *col_ID_1, *col_ID_2, *col_comp_id;
|
||||
|
||||
if ((col_ID_1 = data->get_arr("_chem_comp_bond.atom_id_1")) == NULL ||
|
||||
(col_ID_2 = data->get_arr("_chem_comp_bond.atom_id_2")) == NULL ||
|
||||
(col_comp_id = data->get_arr("_chem_comp_bond.comp_id")) == NULL)
|
||||
return NULL;
|
||||
if ((col_ID_1 = data->get_arr("_chem_comp_bond.atom_id_1")) == nullptr ||
|
||||
(col_ID_2 = data->get_arr("_chem_comp_bond.atom_id_2")) == nullptr ||
|
||||
(col_comp_id = data->get_arr("_chem_comp_bond.comp_id")) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
// "_chem_comp_bond.type" seems to be non-standard here. It's found in the
|
||||
// wild with values like "double" and "aromatic". mmcif_nmr-star.dic defines
|
||||
@@ -1914,10 +1914,10 @@ static BondType * read_pymol_bond(PyMOLGlobals * G, cif_data * data,
|
||||
|
||||
const cif_array *col_ID_1, *col_ID_2, *col_order;
|
||||
|
||||
if ((col_ID_1 = data->get_arr("_pymol_bond.atom_site_id_1")) == NULL ||
|
||||
(col_ID_2 = data->get_arr("_pymol_bond.atom_site_id_2")) == NULL ||
|
||||
(col_order = data->get_arr("_pymol_bond.order")) == NULL)
|
||||
return NULL;
|
||||
if ((col_ID_1 = data->get_arr("_pymol_bond.atom_site_id_1")) == nullptr ||
|
||||
(col_ID_2 = data->get_arr("_pymol_bond.atom_site_id_2")) == nullptr ||
|
||||
(col_order = data->get_arr("_pymol_bond.order")) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
int nrows = col_ID_1->get_nrows();
|
||||
int nAtom = VLAGetSize(atInfo);
|
||||
@@ -1956,7 +1956,7 @@ static BondType * read_pymol_bond(PyMOLGlobals * G, cif_data * data,
|
||||
static ObjectMolecule *ObjectMoleculeReadCifData(PyMOLGlobals * G,
|
||||
cif_data * datablock, int discrete, bool quiet)
|
||||
{
|
||||
CoordSet ** csets = NULL;
|
||||
CoordSet ** csets = nullptr;
|
||||
int ncsets;
|
||||
CifContentInfo info(G, SettingGetGlobal_b(G, cSetting_cif_use_auth));
|
||||
const char * assembly_id = SettingGetGlobal_s(G, cSetting_assembly);
|
||||
@@ -2001,7 +2001,7 @@ static ObjectMolecule *ObjectMoleculeReadCifData(PyMOLGlobals * G,
|
||||
info.type = CIF_CHEM_COMP;
|
||||
} else {
|
||||
ObjectMoleculeFree(I);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// get number of atoms and coordinate sets
|
||||
@@ -2098,7 +2098,7 @@ static ObjectMolecule *ObjectMoleculeReadCifData(PyMOLGlobals * G,
|
||||
|
||||
// guess valences for distance based bonding
|
||||
if (SettingGetGlobal_b(G, cSetting_pdb_hetatm_guess_valences)) {
|
||||
ObjectMoleculeGuessValences(I, 0, NULL, NULL, false);
|
||||
ObjectMoleculeGuessValences(I, 0, nullptr, nullptr, false);
|
||||
}
|
||||
} else {
|
||||
if (!I->NBond)
|
||||
@@ -2157,17 +2157,17 @@ ObjectMolecule *ObjectMoleculeReadCifStr(PyMOLGlobals * G, ObjectMolecule * I,
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: loading mmCIF into existing object not supported, please use 'create'\n"
|
||||
" to append to an existing object.\n" ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (multiplex > 0) {
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: loading mmCIF with multiplex=1 not supported, please use 'split_states'.\n"
|
||||
" after loading the object." ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * filename = NULL;
|
||||
const char * filename = nullptr;
|
||||
auto cif = std::make_shared<cif_file>(filename, st);
|
||||
|
||||
for (auto it = cif->datablocks.begin(); it != cif->datablocks.end(); ++it) {
|
||||
@@ -2196,7 +2196,7 @@ ObjectMolecule *ObjectMoleculeReadCifStr(PyMOLGlobals * G, ObjectMolecule * I,
|
||||
ExecutiveManageObject(G, (CObject*) obj, zoom, true);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2210,7 +2210,7 @@ const bond_dict_t::mapped_type * bond_dict_t::get(PyMOLGlobals * G, const char *
|
||||
return &it->second;
|
||||
|
||||
if (unknown_resn.count(key))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#ifndef _PYMOL_NOPY
|
||||
if (try_download) {
|
||||
@@ -2252,7 +2252,7 @@ const bond_dict_t::mapped_type * bond_dict_t::get(PyMOLGlobals * G, const char *
|
||||
// don't try downloading again
|
||||
unknown_resn.insert(key);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// vi:sw=2:ts=2:expandtab
|
||||
|
||||
@@ -240,7 +240,7 @@ int ObjectMoleculeSetMissingNeighborCoords(
|
||||
// adding coordinates will invalidate pointer
|
||||
float center_coord_copy[3];
|
||||
copy3f(center_coord, center_coord_copy);
|
||||
center_coord = NULL;
|
||||
center_coord = nullptr;
|
||||
|
||||
for (int i = 0; i < n_missing; ++i) {
|
||||
float bondlength = AtomInfoGetBondLength(G,
|
||||
@@ -322,7 +322,7 @@ int ObjectMoleculeAddSeleHydrogensRefactored(ObjectMolecule* I, int sele, int st
|
||||
}
|
||||
|
||||
// grow index arrays
|
||||
for (StateIterator iter(G, NULL, cSelectorUpdateTableAllStates, I->NCSet);
|
||||
for (StateIterator iter(G, nullptr, cSelectorUpdateTableAllStates, I->NCSet);
|
||||
iter.next();) {
|
||||
CoordSet* cs = I->CSet[iter.state];
|
||||
if (cs)
|
||||
@@ -334,7 +334,7 @@ int ObjectMoleculeAddSeleHydrogensRefactored(ObjectMolecule* I, int sele, int st
|
||||
|
||||
AtomInfoUniquefyNames(G,
|
||||
I->AtomInfo, n_atom_old,
|
||||
I->AtomInfo + n_atom_old, NULL,
|
||||
I->AtomInfo + n_atom_old, nullptr,
|
||||
I->NAtom - n_atom_old);
|
||||
|
||||
// fill coordinates
|
||||
|
||||
@@ -50,9 +50,9 @@ CoordSet ** get_assembly_csets(PyMOLGlobals * G,
|
||||
const char * assembly_id = SettingGetGlobal_s(G, cSetting_assembly);
|
||||
|
||||
if (!assembly_id || !assembly_id[0])
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const MMTF_BioAssembly * assembly = NULL;
|
||||
const MMTF_BioAssembly * assembly = nullptr;
|
||||
|
||||
// look up assembly by name
|
||||
for (auto a = container->bioAssemblyList,
|
||||
@@ -67,7 +67,7 @@ CoordSet ** get_assembly_csets(PyMOLGlobals * G,
|
||||
if (!assembly) {
|
||||
PRINTFB(G, FB_Executive, FB_Details)
|
||||
" ExecutiveLoad-Detail: No such assembly: '%s'\n", assembly_id ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PRINTFB(G, FB_Executive, FB_Details)
|
||||
@@ -113,13 +113,13 @@ ObjectMolecule * ObjectMoleculeReadMmtfStr(PyMOLGlobals * G, ObjectMolecule * I,
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: loading MMTF into existing object not supported, please use 'create'\n"
|
||||
" to append to an existing object.\n" ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (multiplex > 0) {
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: multiplex not supported for MMTF\n" ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MMTF_container * container = MMTF_container_new();
|
||||
@@ -128,7 +128,7 @@ ObjectMolecule * ObjectMoleculeReadMmtfStr(PyMOLGlobals * G, ObjectMolecule * I,
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" Error: Failed to load MMTF file\n" ENDFB(G);
|
||||
MMTF_container_free(container);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
|
||||
@@ -124,8 +124,8 @@ const char * MOLV3000Parse(PyMOLGlobals * G,
|
||||
bool inside_bond = false;
|
||||
bool inside_any = false;
|
||||
int auto_show = RepGetAutoShowMask(G);
|
||||
const char * error = NULL;
|
||||
AtomInfoType * ai = NULL;
|
||||
const char * error = nullptr;
|
||||
AtomInfoType * ai = nullptr;
|
||||
std::string line;
|
||||
std::string key, value;
|
||||
|
||||
@@ -254,7 +254,7 @@ const char * MOLV3000Parse(PyMOLGlobals * G,
|
||||
if (error) {
|
||||
PRINTFB(G, FB_ObjectMolecule, FB_Errors)
|
||||
" MOL-V3000-Error: %s.\n", error ENDFB(G);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
||||
@@ -95,8 +95,8 @@ void SeleCoordIterator::init(PyMOLGlobals * G_, int sele_, int state_) {
|
||||
void SeleCoordIterator::reset() {
|
||||
a = cNDummyAtoms - 1;
|
||||
state = statearg;
|
||||
prev_obj = NULL;
|
||||
cs = NULL;
|
||||
prev_obj = nullptr;
|
||||
cs = nullptr;
|
||||
|
||||
if (isMultistate()) {
|
||||
state = 0;
|
||||
|
||||
@@ -61,7 +61,7 @@ std::string & CifDataValueFormatter::nextbuf() {
|
||||
}
|
||||
|
||||
const char * CifDataValueFormatter::quoted(const char * s) {
|
||||
const char * quote = NULL;
|
||||
const char * quote = nullptr;
|
||||
|
||||
if (!strchr(s, '\n')) {
|
||||
if (!has_quotespace(s, '\'')) {
|
||||
|
||||
@@ -177,7 +177,7 @@ std::string MaeExportGetSubGroupId(PyMOLGlobals * G,
|
||||
const CObject * obj)
|
||||
{
|
||||
std::string subgroupid;
|
||||
const SpecRec * rec = NULL;
|
||||
const SpecRec * rec = nullptr;
|
||||
|
||||
// obj -> spec rec
|
||||
for (ObjectIterator iter(G); iter.next();) {
|
||||
|
||||
@@ -158,10 +158,10 @@ public:
|
||||
m_buffer.resize(1280);
|
||||
m_buffer[0] = '\0';
|
||||
|
||||
m_mat_ref.ptr = NULL;
|
||||
m_mat_ref.ptr = nullptr;
|
||||
m_offset = 0;
|
||||
m_last_cs = NULL;
|
||||
m_last_obj = NULL;
|
||||
m_last_cs = nullptr;
|
||||
m_last_obj = nullptr;
|
||||
m_last_state = -1;
|
||||
m_retain_ids = false;
|
||||
m_id = 0;
|
||||
@@ -365,7 +365,7 @@ void MoleculeExporter::execute(int sele, int state) {
|
||||
void MoleculeExporter::setRefObject(const char * ref_object, int ref_state) {
|
||||
double matrix[16];
|
||||
|
||||
m_mat_ref.ptr = NULL;
|
||||
m_mat_ref.ptr = nullptr;
|
||||
|
||||
if (!ref_object || !ref_object[0])
|
||||
return;
|
||||
@@ -537,7 +537,7 @@ struct MoleculeExporterPDB : public MoleculeExporter {
|
||||
void beginObject() {
|
||||
MoleculeExporter::beginObject();
|
||||
|
||||
m_conect_all = SettingGet_b(G, m_iter.obj->Obj.Setting, NULL, cSetting_pdb_conect_all);
|
||||
m_conect_all = SettingGet_b(G, m_iter.obj->Obj.Setting, nullptr, cSetting_pdb_conect_all);
|
||||
|
||||
if (m_multi == cMolExportByObject) {
|
||||
m_offset += VLAprintf(m_buffer, m_offset, "HEADER %.40s\n", m_iter.obj->Obj.Name);
|
||||
@@ -684,7 +684,7 @@ struct MoleculeExporterCIF : public MoleculeExporter {
|
||||
|
||||
void writeAtom() {
|
||||
const AtomInfoType * ai = m_iter.getAtomInfo();
|
||||
const char * entity_id = NULL;
|
||||
const char * entity_id = nullptr;
|
||||
|
||||
#ifdef _PYMOL_IP_PROPERTIES
|
||||
char entity_id_buf[16];
|
||||
@@ -1527,7 +1527,7 @@ PyObject *MoleculeExporterGetPyBonds(PyMOLGlobals * G,
|
||||
SelectorTmp tmpsele1(G, selection);
|
||||
int sele = tmpsele1.getIndex();
|
||||
if (sele < 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
int unblock = PAutoBlock(G);
|
||||
|
||||
@@ -1565,9 +1565,9 @@ public:
|
||||
void init(PyMOLGlobals * G_) {
|
||||
MoleculeExporter::init(G_);
|
||||
|
||||
m_model = NULL;
|
||||
m_model = nullptr;
|
||||
m_n_cs = 0;
|
||||
m_atom_list = NULL;
|
||||
m_atom_list = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -1594,7 +1594,7 @@ protected:
|
||||
|
||||
const float * getRefPtr() {
|
||||
RefPosType * ref_pos = m_iter.cs->RefPos;
|
||||
const float * ref_ptr = NULL;
|
||||
const float * ref_ptr = nullptr;
|
||||
|
||||
if (ref_pos) {
|
||||
ref_pos += m_iter.getIdx();
|
||||
@@ -1692,7 +1692,7 @@ PyObject *ExecutiveSeleToChemPyModel(PyMOLGlobals * G,
|
||||
|
||||
int sele = SelectorIndexByName(G, s1);
|
||||
if (sele < 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
int unblock = PAutoBlock(G);
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ bool MovieSceneRecall(PyMOLGlobals * G, const char * name, float animate,
|
||||
* name: name to rename or delete, or "*" to delete all
|
||||
* new_name: new scene name to rename, or NULL to delete
|
||||
*/
|
||||
static bool MovieSceneRename(PyMOLGlobals * G, const char * name, const char * new_name = NULL) {
|
||||
static bool MovieSceneRename(PyMOLGlobals * G, const char * name, const char * new_name = nullptr) {
|
||||
|
||||
if (strcmp(name, "*") == 0) {
|
||||
// delete all scenes
|
||||
@@ -620,7 +620,7 @@ static const char * MovieSceneGetNextKey(PyMOLGlobals * G, bool next) {
|
||||
*/
|
||||
static bool MovieSceneOrderBeforeAfter(PyMOLGlobals * G, const char * key, bool before)
|
||||
{
|
||||
const char * location = NULL;
|
||||
const char * location = nullptr;
|
||||
const char * key2 = SettingGetGlobal_s(G, cSetting_scene_current_name);
|
||||
|
||||
if (before) {
|
||||
@@ -715,7 +715,7 @@ bool MovieSceneFunc(PyMOLGlobals * G, const char * key,
|
||||
status = MovieSceneOrderBeforeAfter(G, prev_name.c_str(), beforeafter == 1);
|
||||
|
||||
} else if (strcmp(action, "delete") == 0) {
|
||||
status = MovieSceneRename(G, key, NULL);
|
||||
status = MovieSceneRename(G, key, nullptr);
|
||||
} else if (strcmp(action, "rename") == 0) {
|
||||
status = MovieSceneRename(G, key, new_key);
|
||||
} else if (strcmp(action, "order") == 0) {
|
||||
@@ -730,8 +730,8 @@ bool MovieSceneFunc(PyMOLGlobals * G, const char * key,
|
||||
}
|
||||
|
||||
// trigger GUI updates (scene buttons, Tcl/Tk menu)
|
||||
SettingSetGlobal_b(G, cSetting_scenes_changed, 1);
|
||||
SettingGenerateSideEffects(G, cSetting_scenes_changed, NULL, 0, true);
|
||||
SettingSetGlobal_b(G, cSetting_scenes_changed, true);
|
||||
SettingGenerateSideEffects(G, cSetting_scenes_changed, nullptr, 0, true);
|
||||
|
||||
return status;
|
||||
|
||||
@@ -753,7 +753,7 @@ void MovieScenesInit(PyMOLGlobals * G) {
|
||||
void MovieScenesFree(PyMOLGlobals * G) {
|
||||
if (G->scenes) {
|
||||
delete G->scenes;
|
||||
G->scenes = NULL;
|
||||
G->scenes = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,11 +783,11 @@ static PyObject * PConvToPyObject(const MovieScene &v) {
|
||||
}
|
||||
|
||||
static bool PConvFromPyObject(PyMOLGlobals *, PyObject * obj, MovieSceneAtom &out) {
|
||||
return PConvArgsFromPyList(NULL, obj, out.color, out.visRep);
|
||||
return PConvArgsFromPyList(nullptr, obj, out.color, out.visRep);
|
||||
}
|
||||
|
||||
static bool PConvFromPyObject(PyMOLGlobals *, PyObject * obj, MovieSceneObject &out) {
|
||||
return PConvArgsFromPyList(NULL, obj, out.color, out.visRep);
|
||||
return PConvArgsFromPyList(nullptr, obj, out.color, out.visRep);
|
||||
}
|
||||
|
||||
static bool PConvFromPyObject(PyMOLGlobals * G, PyObject * obj, MovieScene &out) {
|
||||
@@ -798,7 +798,7 @@ static bool PConvFromPyObject(PyMOLGlobals * G, PyObject * obj, MovieScene &out)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!PConvArgsFromPyList(NULL, obj,
|
||||
if (!PConvArgsFromPyList(nullptr, obj,
|
||||
out.storemask,
|
||||
out.frame,
|
||||
out.message,
|
||||
|
||||
Reference in New Issue
Block a user