diff --git a/layer0/Crystal.cpp b/layer0/Crystal.cpp index 379169e0b..6a1d7897a 100644 --- a/layer0/Crystal.cpp +++ b/layer0/Crystal.cpp @@ -30,7 +30,7 @@ Z* ------------------------------------------------------------------- PyObject *CrystalAsPyList(const CCrystal * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(2); @@ -45,7 +45,7 @@ int CrystalFromPyList(CCrystal * I, PyObject * list) int ok = true, rok = true; int ll = 0; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -116,7 +116,7 @@ CGO *CrystalGetUnitCellCGO(const CCrystal * I) { PyMOLGlobals *G = I->G; float v[3]; - CGO *cgo = NULL; + CGO *cgo = nullptr; auto const ucv = SettingGet(G, cSetting_cell_centered) ? unitCellVerticesCentered diff --git a/layer0/Field.cpp b/layer0/Field.cpp index e27bedece..19ab14166 100644 --- a/layer0/Field.cpp +++ b/layer0/Field.cpp @@ -37,7 +37,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) { #ifndef _PYMOL_NUMPY printf("No numpy support\n"); - return NULL; + return nullptr; #else PyObject *result; @@ -65,7 +65,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) if(typenum == -1) { printf("error: no typenum for type %d and base_size %d\n", field->type, field->base_size); - return NULL; + return nullptr; } auto dims = pymol::malloc(field->n_dim()); @@ -82,13 +82,13 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) return result; ok_except1: printf("FieldAsNumPyArray failed\n"); - return NULL; + return nullptr; #endif } PyObject *FieldAsPyList(PyMOLGlobals * G, CField * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int n_elem; int pse_export_version = SettingGetGlobal_f(G, cSetting_pse_export_version) * 1000; @@ -137,7 +137,7 @@ CField *FieldNewFromPyList(PyMOLGlobals * G, PyObject * list) auto I = new CField(); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) diff --git a/layer0/File.cpp b/layer0/File.cpp index 0fa40230e..8d8848d90 100644 --- a/layer0/File.cpp +++ b/layer0/File.cpp @@ -34,7 +34,7 @@ static long fgetsize(FILE *fp) { /** * Allocate memory and read the entire file from the given file pointer. - * The file size is stored into the size pointer if not NULL. + * The file size is stored into the size pointer if not nullptr. */ static char * fgetcontents(FILE *fp, long *size) { long filesize = fgetsize(fp); @@ -66,7 +66,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) { if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, len_filename, wfilename.data(), wfilename.size())) - return NULL; + return nullptr; fp = _wfopen(wfilename.data(), wmode.data()); } @@ -77,7 +77,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) { /** * Allocate memory and read the entire file for the given filename. - * The file size is stored into the size pointer if not NULL. + * The file size is stored into the size pointer if not nullptr. */ char * FileGetContents(const char *filename, long *size) { char *contents; diff --git a/layer0/GraphicsUtil.cpp b/layer0/GraphicsUtil.cpp index 62df61211..64e22d0de 100755 --- a/layer0/GraphicsUtil.cpp +++ b/layer0/GraphicsUtil.cpp @@ -29,7 +29,7 @@ bool glCheckOkay() { /** * GL debugging callback - enable with "pymol --gldebug" * - * glDebugMessageCallback(gl_debug_proc, NULL); + * glDebugMessageCallback(gl_debug_proc, nullptr); * glEnable(GL_DEBUG_OUTPUT); */ void GLAPIENTRY gl_debug_proc( diff --git a/layer0/Isosurf.cpp b/layer0/Isosurf.cpp index 887cf1f2b..33ed241c4 100644 --- a/layer0/Isosurf.cpp +++ b/layer0/Isosurf.cpp @@ -97,14 +97,14 @@ static void _IsosurfFree(CIsosurf * I) void IsosurfFree(PyMOLGlobals * G) { _IsosurfFree(G->Isosurf); - G->Isosurf = NULL; + G->Isosurf = nullptr; } /*===========================================================================*/ PyObject *IsosurfAsPyList(PyMOLGlobals * G, Isofield * field) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(4); @@ -139,9 +139,9 @@ Isofield *IsosurfNewFromPyList(PyMOLGlobals * G, PyObject * list) int dim4[4]; int a; - Isofield *result = NULL; + Isofield *result = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO ENABLE BACKWARDS COMPATIBILITY... @@ -395,10 +395,10 @@ static CIsosurf *IsosurfNew(PyMOLGlobals * G) int c; CIsosurf *I = pymol::calloc(1); I->G = G; - I->VertexCodes = NULL; - I->ActiveEdges = NULL; - I->Point = NULL; - I->Line = NULL; + I->VertexCodes = nullptr; + I->ActiveEdges = nullptr; + I->Point = nullptr; + I->Line = nullptr; I->Skip = 0; for(c = 0; c < 256; c++) I->Code[c] = -1; @@ -1040,13 +1040,13 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, CField *points = field->points.get(); /* flags marking excluded regions to avoid (currently wasteful) */ - int *flag = NULL; + int *flag = nullptr; /* variable length array for recording segment paths */ int *active_cell = VLAlloc(int, 1000); /* ordered list of coordinates for processing */ - int *order = NULL; + int *order = nullptr; int range_size; /* total points in region being drawn */ int range_dim[3]; /* dimension of drawn region */ @@ -1149,7 +1149,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, for(pass = 0; pass < 2; pass++) { /* one pass down the gradient, one up */ int have_prev = false; /* flag & storage for previous gradient & locus */ - int *prev_locus = NULL; + int *prev_locus = nullptr; int locus[3]; /* what cell are we in? */ float fract[3] = { 0.0F, 0.0F, 0.0F }; /* where in the cell are we? */ @@ -1214,7 +1214,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, if((!have_prev) || (have_prev && ((locus[0] != prev_locus[0]) || (locus[1] != prev_locus[1]) || (locus[2] != prev_locus[2])))) { - /* above: prev_locus may be NULL, so relying upon shortcut logic eval */ + /* above: prev_locus may be nullptr, so relying upon shortcut logic eval */ /* stop if we hit a flagged cell (flag always in lower corner) */ @@ -1674,7 +1674,7 @@ static int IsosurfDrawLines(CIsosurf * II) #ifdef Trace LCount++; #endif - Cur = NULL; + Cur = nullptr; if(I->NLine != (*I->Num)[I->NSeg]) { /* any new lines? */ I->Num->check(I->NSeg + 1); (*I->Num)[I->NSeg] = I->NLine - (*I->Num)[I->NSeg]; @@ -1736,8 +1736,8 @@ static int IsosurfFindLines(CIsosurf * II) printf("IsosurfFindLines: bad index: %i \n", index); #endif while(cod > 0) { - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; switch (cod) { case 40: case 32: @@ -1773,8 +1773,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { @@ -1836,8 +1836,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { @@ -1899,8 +1899,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { diff --git a/layer0/ListMacros.h b/layer0/ListMacros.h index 4179bdf5b..73a0a6368 100644 --- a/layer0/ListMacros.h +++ b/layer0/ListMacros.h @@ -25,12 +25,12 @@ Z* ------------------------------------------------------------------- #include"Err.h" #include"Result.h" -#define ListInit(List) List = NULL +#define ListInit(List) List = nullptr #define ListAppend(List,Elem,Link,ElemType) \ { \ ElemType *current = (List); \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ previous = current; \ @@ -40,7 +40,7 @@ Z* ------------------------------------------------------------------- previous->Link = Elem; \ else \ (List) = Elem; \ - (Elem)->Link = NULL; \ + (Elem)->Link = nullptr; \ } /** @@ -69,7 +69,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){ #define ListFree(List,Link,ElemType) \ { \ ElemType *current = List; \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ if(previous) \ @@ -79,13 +79,13 @@ void ListAppendT(ElemType*& list, ElemType* ele){ } \ if(previous) \ mfree(previous); \ - (List) = NULL; \ + (List) = nullptr; \ } #define ListDetach(List,Elem,Link,ElemType) \ { \ ElemType *current = List; \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ if(current == (Elem)) \ @@ -99,7 +99,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){ previous->Link = current->Link; \ else \ (List) = current->Link; \ - (Elem)->Link = NULL; \ + (Elem)->Link = nullptr; \ } \ } @@ -143,7 +143,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){ } #define ListIterate(List,Counter,Link) \ - ( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : NULL)) + ( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : nullptr)) /* Elem handling routines */ @@ -166,7 +166,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){ } \ } -#define ListElemFree(Elem) { mfree(Elem); Elem = NULL; } +#define ListElemFree(Elem) { mfree(Elem); Elem = nullptr; } /** * Retrives position of element in list diff --git a/layer0/Map.cpp b/layer0/Map.cpp index e8aac4058..bc8bd37ad 100644 --- a/layer0/Map.cpp +++ b/layer0/Map.cpp @@ -519,7 +519,7 @@ int MapSetupExpress(MapType * I) int *link = I->Link; int st, flag; int *i_ptr3, *i_ptr4, *i_ptr5; - int *e_list = NULL; + int *e_list = nullptr; int mx0 = I->iMax[0], mx1 = I->iMax[1], a, am1, ap2, *i_ptr1, b, bm1, bp2, *i_ptr2; unsigned int mapSize; int ok = true; @@ -744,13 +744,13 @@ float MapGetSeparation(PyMOLGlobals * G, float range, const float *mx, const flo MapType *MapNew(PyMOLGlobals * G, float range, const float *vert, int nVert, const float *extent) { - return (_MapNew(G, range, vert, nVert, extent, NULL, -1, 0)); + return (_MapNew(G, range, vert, nVert, extent, nullptr, -1, 0)); } MapType *MapNewCached(PyMOLGlobals * G, float range, const float *vert, int nVert, const float *extent, int group_id, int block_id) { - return (_MapNew(G, range, vert, nVert, extent, NULL, group_id, block_id)); + return (_MapNew(G, range, vert, nVert, extent, nullptr, group_id, block_id)); } MapType *MapNewFlagged(PyMOLGlobals * G, float range, const float *vert, int nVert, @@ -776,7 +776,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV " MapNew-Debug: entered.\n" ENDFD; CHECKOK(ok, I); if (!ok){ - return NULL; + return nullptr; } /* Initialize */ I->G = G; @@ -788,7 +788,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV CHECKOK(ok, I->Link); if (!ok){ MapFree(I); - return NULL; + return nullptr; } for(a = 0; a < nVert; a++) I->Link[a] = -1; @@ -932,7 +932,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV CHECKOK(ok, I->Head); if (!ok){ MapFree(I); - return NULL; + return nullptr; } /* initialize */ /* for(a=0;aDim[0];a++) diff --git a/layer0/Match.cpp b/layer0/Match.cpp index c9f62aaf5..d2f6f6655 100644 --- a/layer0/Match.cpp +++ b/layer0/Match.cpp @@ -88,7 +88,7 @@ CMatch *MatchNew(PyMOLGlobals * G, unsigned int na, unsigned int nb, int dist_ma if(!(I->mat && I->smat && ((!dist_mats) || (I->da && I->db)))) { MatchFree(I); - I = NULL; + I = nullptr; } return (I); } @@ -270,7 +270,7 @@ int MatchMatrixFromFile(CMatch * I, const char *fname, int quiet) std::string buffer; const char *p; char cc[255]; - char *code = NULL; + char *code = nullptr; unsigned int x, y; int a; int n_entry; diff --git a/layer0/Matrix.cpp b/layer0/Matrix.cpp index 7c84a9441..488754036 100644 --- a/layer0/Matrix.cpp +++ b/layer0/Matrix.cpp @@ -48,7 +48,7 @@ Z* ------------------------------------------------------------------- #define XX_FALSE 0 #endif #ifndef XX_NULL -#define XX_NULL NULL +#define XX_NULL nullptr #endif #define XX_MATRIX_STACK_STORAGE_MAX 5 @@ -1340,7 +1340,7 @@ float MatrixFitRMSTTTf(PyMOLGlobals * G, int n, const float *v1, const float *v2 /*========================================================================*/ /** - * @param G Only used for feedback, can be NULL + * @param G Only used for feedback, can be nullptr * @param[in] a 3x3 matrix * @param[out] wr 3x1 eigenvalues (real part of complex number) * @param[out] wi 3x1 eigenvalues (imag part of complex number) diff --git a/layer0/MemoryDebug.cpp b/layer0/MemoryDebug.cpp index 460c62854..b7252cd7e 100644 --- a/layer0/MemoryDebug.cpp +++ b/layer0/MemoryDebug.cpp @@ -80,7 +80,7 @@ void MemoryZero(char *p, char *q) * Update `size` and reallocate this vla * * @param size number of elements - * @return reallocated pointer or NULL if realloc failed + * @return reallocated pointer or nullptr if realloc failed */ static VLARec* VLARec_resize(VLARec* vla, ov_size size) { @@ -153,7 +153,7 @@ void VLAFree(void *ptr) { VLARec *vla; if(!ptr) { - printf("VLAFree-ERR: tried to free NULL pointer!\n"); + printf("VLAFree-ERR: tried to free nullptr pointer!\n"); exit(EXIT_FAILURE); } vla = &(((VLARec *) ptr)[-1]); @@ -169,7 +169,7 @@ size_t VLAGetSize(const void *ptr) void *VLANewCopy(const void *ptr) { - if(ptr) { /* NULL protected */ + if(ptr) { /* nullptr protected */ const VLARec *vla; VLARec *new_vla; vla = &((VLARec *) ptr)[-1]; @@ -183,14 +183,14 @@ void *VLANewCopy(const void *ptr) } return ((void *) &(new_vla[1])); } else { - return NULL; + return nullptr; } } void *VLASetSize(void *ptr, size_t new_size) { VLARec *vla; - char *start = NULL; + char *start = nullptr; char *stop; size_t soffset = 0; vla = &((VLARec *) ptr)[-1]; @@ -283,7 +283,7 @@ void *VLAInsertRaw(void *ptr, int index, unsigned int count) void *VLASetSizeForSure(void *ptr, size_t new_size) { VLARec *vla; - char *start = NULL; + char *start = nullptr; char *stop; size_t soffset = 0; vla = &((VLARec *) ptr)[-1]; diff --git a/layer0/MyPNG.cpp b/layer0/MyPNG.cpp index 1707f3e22..94a4c276d 100644 --- a/layer0/MyPNG.cpp +++ b/layer0/MyPNG.cpp @@ -77,7 +77,7 @@ static unsigned char base64_decoding_table[] = { static unsigned char *base64_decode(const char *data, size_t input_length=0) { - unsigned char *decoded_data = NULL; + unsigned char *decoded_data = nullptr; unsigned int triple; unsigned int i = 0, j = 0, k; char c; @@ -107,7 +107,7 @@ static unsigned char *base64_decode(const char *data, ok_except1: mfree(decoded_data); - return NULL; + return nullptr; } typedef struct { @@ -182,7 +182,7 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, { #ifdef _PYMOL_LIBPNG int ok = true; - FILE *fp = NULL; + FILE *fp = nullptr; png_structp png_ptr; png_infop info_ptr; int bit_depth = 8; @@ -204,7 +204,7 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, } else { fp = pymol_fopen(file_name, "wb"); } - if(fp == NULL) { + if(fp == nullptr) { ok = false; goto cleanup; } else if(feof(fp)) { @@ -214,21 +214,21 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, } /* Create and initialize the png_struct with the desired error handler * functions. If you want to use the default stderr and longjump method, - * you can supply NULL for the last three parameters. We also check that + * you can supply nullptr for the last three parameters. We also check that * the library version is compatible with the one used at compile time, * in case we are using dynamically linked libraries. REQUIRED. */ - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if(png_ptr == NULL) { + if(png_ptr == nullptr) { ok = false; goto cleanup; } /* Allocate/initialize the image information data. REQUIRED */ info_ptr = png_create_info_struct(png_ptr); - if(info_ptr == NULL) { - png_destroy_write_struct(&png_ptr, (png_infopp) NULL); + if(info_ptr == nullptr) { + png_destroy_write_struct(&png_ptr, (png_infopp) nullptr); ok = false; goto cleanup; } @@ -238,16 +238,16 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, */ if(setjmp(png_jmpbuf(png_ptr))) { /* If we get here, we had a problem reading the file */ - png_destroy_write_struct(&png_ptr, (png_infopp) NULL); + png_destroy_write_struct(&png_ptr, (png_infopp) nullptr); ok = false; goto cleanup; } if (io_ptr) { - png_set_write_fn(png_ptr, (void*) io_ptr, write_data_to_buffer, NULL); + png_set_write_fn(png_ptr, (void*) io_ptr, write_data_to_buffer, nullptr); } else { /* set up the output control if you are using standard C streams */ - png_set_write_fn(png_ptr, (void*) fp, write_data_to_file, NULL); + png_set_write_fn(png_ptr, (void*) fp, write_data_to_file, nullptr); } /* Set the image information here. Width and height are up to 2^31, @@ -366,13 +366,13 @@ std::unique_ptr MyPNGRead(const char *file_name) std::unique_ptr img; #ifdef _PYMOL_LIBPNG - FILE *png_file = NULL; - png_struct *png_ptr = NULL; - png_info *info_ptr = NULL; + FILE *png_file = nullptr; + png_struct *png_ptr = nullptr; + png_info *info_ptr = nullptr; png_byte buf[8]; - png_byte *png_pixels = NULL; - png_byte **row_pointers = NULL; - png_byte *pix_ptr = NULL; + png_byte *png_pixels = nullptr; + png_byte **row_pointers = nullptr; + png_byte *pix_ptr = nullptr; png_uint_32 row_bytes = 0; png_uint_32 width; @@ -384,7 +384,7 @@ std::unique_ptr MyPNGRead(const char *file_name) int i; int ok = true; double file_gamma; - uchar2p data = {NULL, NULL}; + uchar2p data = {NULL, nullptr}; if(!file_name) return nullptr; @@ -397,7 +397,7 @@ std::unique_ptr MyPNGRead(const char *file_name) } else { png_file = pymol_fopen(file_name, "rb"); - if(png_file == NULL) + if(png_file == nullptr) return nullptr; /* read and check signature in PNG file */ @@ -413,7 +413,7 @@ std::unique_ptr MyPNGRead(const char *file_name) } /* create png and info structures */ if(ok) { - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if(!png_ptr) ok = false; } @@ -443,7 +443,7 @@ std::unique_ptr MyPNGRead(const char *file_name) /* get size and bit-depth of the PNG-image */ png_get_IHDR(png_ptr, info_ptr, - &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); + &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); /* set-up the transformations */ @@ -465,21 +465,21 @@ std::unique_ptr MyPNGRead(const char *file_name) /* get the new color-type and bit-depth (after expansion/stripping) */ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); /* row_bytes is the width x number of channels x (bit-depth / 8) */ row_bytes = png_get_rowbytes(png_ptr, info_ptr); - if((png_pixels = (png_byte *) malloc(row_bytes * height * sizeof(png_byte))) == NULL) { + if((png_pixels = (png_byte *) malloc(row_bytes * height * sizeof(png_byte))) == nullptr) { ok = false; } } if(ok) { - if((row_pointers = (png_byte **) malloc(height * sizeof(png_bytep))) == NULL) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + if((row_pointers = (png_byte **) malloc(height * sizeof(png_bytep))) == nullptr) { + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); free(png_pixels); - png_pixels = NULL; + png_pixels = nullptr; ok = false; } } @@ -512,13 +512,13 @@ std::unique_ptr MyPNGRead(const char *file_name) } - if(row_pointers != (unsigned char **) NULL) + if(row_pointers != (unsigned char **) nullptr) free(row_pointers); - if(png_pixels != (unsigned char *) NULL) + if(png_pixels != (unsigned char *) nullptr) free(png_pixels); if(png_ptr) { - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) nullptr); } if(png_file) fclose(png_file); diff --git a/layer0/Pixmap.cpp b/layer0/Pixmap.cpp index b4762aaa4..87016e522 100644 --- a/layer0/Pixmap.cpp +++ b/layer0/Pixmap.cpp @@ -122,7 +122,7 @@ void PixmapInitFromBytemap(PyMOLGlobals * G, CPixmap * I, unsigned char red, blue, green, alpha, no_alpha; unsigned char ored = 0, oblue = 0, ogreen = 0; if(!outline_rgb[3]) - outline_rgb = NULL; + outline_rgb = nullptr; else { ored = outline_rgb[0]; ogreen = outline_rgb[1]; diff --git a/layer0/Result.h b/layer0/Result.h index 973ab9f89..86024162f 100644 --- a/layer0/Result.h +++ b/layer0/Result.h @@ -149,7 +149,7 @@ template class Result const ResultT& result() const { return m_result; } /** - * Pointer to the expected object. Never NULL. Call is invalid if this + * Pointer to the expected object. Never nullptr. Call is invalid if this * instance is in error state. */ ResultT* operator->() diff --git a/layer0/ShaderMgr.cpp b/layer0/ShaderMgr.cpp index 726599872..8e587e738 100644 --- a/layer0/ShaderMgr.cpp +++ b/layer0/ShaderMgr.cpp @@ -292,7 +292,7 @@ static void disableShaders(PyMOLGlobals * G); #ifdef WIN32 /* REMOVE US */ PFNGLTEXIMAGE3DPROC getTexImage3D(){ - static PFNGLTEXIMAGE3DPROC my_glTexImage3D = NULL; + static PFNGLTEXIMAGE3DPROC my_glTexImage3D = nullptr; if (!my_glTexImage3D) my_glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D"); return my_glTexImage3D; @@ -432,10 +432,10 @@ static bool shader_cache_initialized = false; // filename -> contents (static filesystem) static std::map shader_cache_raw; -// preproc variable -> NULL terminated list of filenames ("used by") +// preproc variable -> nullptr terminated list of filenames ("used by") std::map ifdef_deps; -// filename -> NULL terminated list of filenames ("included by") +// filename -> nullptr terminated list of filenames ("included by") std::map include_deps; std::string CShaderMgr::GetShaderSource(const std::string &filename) diff --git a/layer0/Sphere.cpp b/layer0/Sphere.cpp index e8a3a6061..a40a5dfee 100644 --- a/layer0/Sphere.cpp +++ b/layer0/Sphere.cpp @@ -282,7 +282,7 @@ void SphereInit(PyMOLGlobals * G) I->Array[i].NTri = Sphere_NTri[i]; if (i){ - I->Array[i].Mesh = NULL; + I->Array[i].Mesh = nullptr; I->Array[i].NMesh = 0; } else { I->Array[i].Mesh = (int *) (void *) mesh; @@ -641,7 +641,7 @@ static SphereRec *MakeDotSphere(PyMOLGlobals * G, int level) result->nDot = S->NDot; result->NStrip = nStrip; result->NVertTot = nVertTot; - result->Mesh = NULL; + result->Mesh = nullptr; result->NMesh = 0; if(!level) { /* provide mesh for S->Sphere[0] only...rest, to do. */ result->Mesh = (int *) mesh; diff --git a/layer0/Tetsurf.cpp b/layer0/Tetsurf.cpp index 66e9a682f..0d78b535e 100644 --- a/layer0/Tetsurf.cpp +++ b/layer0/Tetsurf.cpp @@ -304,12 +304,12 @@ static CTetsurf *TetsurfNew(PyMOLGlobals * G) int v000, v100, v010, v110, v001, v101, v011, v111; I->G = G; - I->Tri = NULL; - I->PtLink = NULL; + I->Tri = nullptr; + I->PtLink = nullptr; - I->VertexCodes = NULL; - I->ActiveEdges = NULL; - I->Point = NULL; + I->VertexCodes = nullptr; + I->ActiveEdges = nullptr; + I->Point = nullptr; last_nv = nv; @@ -390,7 +390,7 @@ static void _TetsurfFree(CTetsurf * I) void TetsurfFree(PyMOLGlobals * G) { _TetsurfFree(G->Tetsurf); - G->Tetsurf = NULL; + G->Tetsurf = nullptr; } @@ -519,7 +519,7 @@ void TetsurfGetRange(PyMOLGlobals * G, * triangle strip with a single triangle) * @param[out] vert Normals (triangle modes only) and vertices for * strips according to `num` - * @param[in] range Min and max indices of box (6i - can be NULL, + * @param[in] range Min and max indices of box (6i - can be nullptr, * then use entire field) * @param[in] mode Geometry mode (points, lines, triangles) * @param[in] carvehelper For carving (optional) @@ -766,8 +766,8 @@ static int TetsurfFindActiveBoxes(CTetsurf * II, cIsosurfaceMode mode, int &n_st int i000, i001, i010, i011, i100, i101, i110, i111; float *c000, *c001, *c010, *c011, *c100, *c101, *c110, *c111; float d000, d001, d010, d011, d100, d101, d110, d111; - float *g000 = NULL, *g001 = NULL, *g010 = NULL, *g011 = NULL, *g100 = NULL, *g101 = - NULL, *g110 = NULL, *g111 = NULL; + float *g000 = nullptr, *g001 = nullptr, *g010 = nullptr, *g011 = nullptr, *g100 = nullptr, *g101 = + nullptr, *g110 = nullptr, *g111 = nullptr; int active; int n_active = 0; @@ -1376,7 +1376,7 @@ static int TetsurfFindActiveBoxes(CTetsurf * II, cIsosurfaceMode mode, int &n_st tt->done = true; while(1) { - p2 = NULL; + p2 = nullptr; idx = p1->Link; while(idx > 0) { tt = I->Tri + I->PtLink[idx].tri; diff --git a/layer0/Texture.cpp b/layer0/Texture.cpp index 02868bcd1..69b4f6d9a 100644 --- a/layer0/Texture.cpp +++ b/layer0/Texture.cpp @@ -140,7 +140,7 @@ bool TextureIsCharTextured(PyMOLGlobals* G, int char_id, float* extent) } } { - unsigned char *buffer = NULL; + unsigned char *buffer = nullptr; if (!I->texture) { is_new = true; } diff --git a/layer0/Tracker.cpp b/layer0/Tracker.cpp index 0536826d9..33cc838da 100644 --- a/layer0/Tracker.cpp +++ b/layer0/Tracker.cpp @@ -235,7 +235,7 @@ int TrackerNewListCopy(CTracker * I, int list_id, TrackerRef * ref) int iter_id = TrackerNewIter(I, 0, list_id); if(iter_id) { int cand_id; - while((cand_id = TrackerIterNextCandInList(I, iter_id, NULL))) { + while((cand_id = TrackerIterNextCandInList(I, iter_id, nullptr))) { TrackerLink(I, cand_id, new_list_id, 1); } TrackerDelIter(I, iter_id); @@ -806,7 +806,7 @@ int TrackerUnlink(CTracker * I, int cand_id, int list_id) int already_linked = false; auto hashStartIt = I->hash2member.find(hash_key); auto I_member = I->member.data(); - TrackerMember *member = NULL; + TrackerMember *member = nullptr; ov_word member_index{}; { @@ -930,14 +930,14 @@ int TrackerUnitTest(PyMOLGlobals * G) /* first test simple new/del */ for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); if(!cand_id[a]) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; %d==0\n", __LINE__, cand_id[a]); } for(a = 0; a < N_ID; a++) { - list_id[a] = TrackerNewList(I, NULL); + list_id[a] = TrackerNewList(I, nullptr); if(!list_id[a]) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; %d==0\n", __LINE__, list_id[a]); @@ -967,8 +967,8 @@ int TrackerUnitTest(PyMOLGlobals * G) } for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); - list_id[a] = TrackerNewList(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); + list_id[a] = TrackerNewList(I, nullptr); } /* test simple serial linking and unlinking */ @@ -1116,10 +1116,10 @@ int TrackerUnitTest(PyMOLGlobals * G) list_idx = (int) (N_ID * dist(mt)); if(!cand_id[cand_idx]) { - cand_id[cand_idx] = TrackerNewCand(I, NULL); + cand_id[cand_idx] = TrackerNewCand(I, nullptr); } if(!list_id[list_idx]) { - list_id[list_idx] = TrackerNewList(I, NULL); + list_id[list_idx] = TrackerNewList(I, nullptr); } if(cand_id[cand_idx] && list_id[list_idx]) { @@ -1203,8 +1203,8 @@ int TrackerUnitTest(PyMOLGlobals * G) /* okay, now let's mix in some iterators... */ for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); - list_id[a] = TrackerNewList(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); + list_id[a] = TrackerNewList(I, nullptr); } if(TrackerGetNCand(I) != N_ID) { @@ -1249,7 +1249,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } len = 0; - while(TrackerIterNextListInCand(I, iter_id[a], NULL)) + while(TrackerIterNextListInCand(I, iter_id[a], nullptr)) len++; if(len != TrackerGetNListForCand(I, cand_id[cand_idx])) @@ -1271,7 +1271,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } len = 0; - while(TrackerIterNextCandInList(I, iter_id[a], NULL)) + while(TrackerIterNextCandInList(I, iter_id[a], nullptr)) len++; if(len != TrackerGetNCandForList(I, list_id[list_idx])) @@ -1324,7 +1324,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } for(b = 0; b < N_ID; b++) { - if(TrackerIterNextListInCand(I, iter_id[b], NULL)) + if(TrackerIterNextListInCand(I, iter_id[b], nullptr)) cnt++; } } @@ -1357,9 +1357,9 @@ int TrackerUnitTest(PyMOLGlobals * G) for(a = 0; a < N_ID; a++) { if(!cand_id[a]) - cand_id[a] = TrackerNewCand(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); if(!list_id[a]) - list_id[a] = TrackerNewList(I, NULL); + list_id[a] = TrackerNewList(I, nullptr); } { @@ -1390,7 +1390,7 @@ int TrackerUnitTest(PyMOLGlobals * G) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; 0==%d\n", __LINE__, iter_id[a]); } - TrackerIterNextListInCand(I, iter_id[a], NULL); + TrackerIterNextListInCand(I, iter_id[a], nullptr); } for(a = 0; a < N_ID; a++) { @@ -1403,7 +1403,7 @@ int TrackerUnitTest(PyMOLGlobals * G) for(a = 0; a < N_ID; a++) { len = 1; - while(TrackerIterNextListInCand(I, iter_id[a], NULL)) + while(TrackerIterNextListInCand(I, iter_id[a], nullptr)) len++; diff = abs(len - TrackerGetNListForCand(I, iter_start[a])); diff --git a/layer0/Triangle.cpp b/layer0/Triangle.cpp index 6038c9d88..0d7445a62 100644 --- a/layer0/Triangle.cpp +++ b/layer0/Triangle.cpp @@ -313,8 +313,8 @@ static int TriangleAdjustNormals(TriangleSurfaceRec * II, float *v, float *vn, i TriangleSurfaceRec *I = II; int ok = true; /* points all normals to the average of the intersecting triangles in order to maximum surface smoothness */ - float *tNorm = NULL, *tWght; - int *vFlag = NULL; + float *tNorm = nullptr, *tWght; + int *vFlag = nullptr; float *v0, *v1, *v2, *tn, vt1[3], vt2[3], *vn0, *tn0, *tn1, *tn2, *tw; int a, *t, i0, i1, i2; float tmp[3]; @@ -2011,8 +2011,8 @@ static int TriangleFixProblems(TriangleSurfaceRec * II, float *v, float *vn, int int problemFlag; int a, l, e; int i0, i1, i2, s01 = 0, s02 = 0, s12; - int *pFlag = NULL; - int *vFlag = NULL; + int *pFlag = nullptr; + int *vFlag = nullptr; problemFlag = false; pFlag = pymol::malloc(n); @@ -2150,10 +2150,10 @@ static int TriangleBruteForceClosure(TriangleSurfaceRec * II, float *v, float *v int a, b, c, d; int i0, i1, i2; float *v1, *v2, *v0, vt1[3], vt2[3], vt3[3], vt4[3], *n0, *n1, *n2, tNorm[3]; - int *pFlag = NULL; - int *pair = NULL; + int *pFlag = nullptr; + int *pair = nullptr; int pc; - int *active = NULL; + int *active = nullptr; int ac; int hits; int p1, p2; @@ -2281,9 +2281,9 @@ int *TrianglePointsToSurface(PyMOLGlobals * G, float *v, float *vn, int n, float cutoff, int *nTriPtr, int **stripPtr, float *extent, int cavity_mode) { - TriangleSurfaceRec *I = NULL; + TriangleSurfaceRec *I = nullptr; int ok = true; - int *result = NULL; + int *result = nullptr; MapType *map; int a; diff --git a/layer0/Word.cpp b/layer0/Word.cpp index af4444593..5f7ec01d9 100644 --- a/layer0/Word.cpp +++ b/layer0/Word.cpp @@ -152,7 +152,7 @@ CWordMatcher *WordMatcherNew(PyMOLGlobals * G, const char *st, CWordMatchOptions int force) { - CWordMatcher *result = NULL; + CWordMatcher *result = nullptr; int needed = force; char wildcard = option->wildcard; @@ -160,7 +160,7 @@ CWordMatcher *WordMatcherNew(PyMOLGlobals * G, const char *st, CWordMatchOptions wildcard = 0; /* space as wildcard means no wildcard */ if(!st) - return NULL; + return nullptr; { /* first determine if we need to incur the overhead of the matcher */ int escape = false; const char *p = st; @@ -488,7 +488,7 @@ int WordMatcherMatchAlpha(CWordMatcher * I, const char *text) int n_node = I->n_node; while((n_node--) > 0) { - if(recursive_match(I, cur_node, text, NULL)) + if(recursive_match(I, cur_node, text, nullptr)) return true; else { while(cur_node->continued) { @@ -665,7 +665,7 @@ int WordListMatch(PyMOLGlobals * G, CWordList * I, const char *name, int ignore_ int WordInit(PyMOLGlobals * G) { - CWord *I = NULL; + CWord *I = nullptr; I = (G->Word = pymol::calloc(1)); if(I) { diff --git a/layer0/ccealignmodule.cpp b/layer0/ccealignmodule.cpp index 32649a2a1..151fde080 100644 --- a/layer0/ccealignmodule.cpp +++ b/layer0/ccealignmodule.cpp @@ -123,7 +123,7 @@ pcePoint getCoords(PyObject* L, int length) pcePoint coords = (pcePoint) malloc(sizeof(cePoint)*length); if (!coords) - return NULL; + return nullptr; // loop through the arguments, pulling out the // XYZ coordinates. @@ -610,7 +610,7 @@ PyObject* findBest( pcePoint coordsA, pcePoint coordsB, pathCache paths, int buf if ( bestRMSD == 1e6 ) { std::cout << "ERROR: Best RMSD found was 1e6. Broken.\n"; - return NULL; + return nullptr; } PyObject* pyU = Py_BuildValue( "[f,f,f,f, f,f,f,f, f,f,f,f, f,f,f,f]", diff --git a/layer0/vla.h b/layer0/vla.h index 71b8b132d..e2a4e1c31 100644 --- a/layer0/vla.h +++ b/layer0/vla.h @@ -44,10 +44,10 @@ template class vla void swap(vla& other) noexcept { std::swap(m_vla, other.m_vla); } public: - // implicit NULL constructor + // implicit nullptr constructor vla() = default; - // NULL assignment + // nullptr assignment vla& operator=(std::nullptr_t) { freeP(); @@ -67,7 +67,7 @@ template class vla explicit vla(std::size_t size) { m_vla = VLACalloc(T, size); } // constructor with initializer list - // Empty list constructs a NULL VLA to be consistent with default constructor + // Empty list constructs a nullptr VLA to be consistent with default constructor vla(std::initializer_list init) { if (init.size() == 0) diff --git a/layer1/Basis.cpp b/layer1/Basis.cpp index 5f19412b2..404f76e56 100644 --- a/layer1/Basis.cpp +++ b/layer1/Basis.cpp @@ -1522,7 +1522,7 @@ int BasisHitPerspective(BasisCallRec * BC) int *cache_cache = cache->Cache; int *cache_CacheLink = cache->CacheLink; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; if(new_ray) { /* see if we can eliminate this ray right away using the mask */ @@ -2023,7 +2023,7 @@ int BasisHitOrthoscopic(BasisCallRec * BC) float r_tri1 = _0, r_tri2 = _0, r_dist = _0; /* zero inits to suppress compiler warnings */ float r_sphere0 = _0, r_sphere1 = _0, r_sphere2 = _0; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; check_interior_flag = BC->check_interior && (!BC->pass); @@ -2349,7 +2349,7 @@ int BasisHitShadow(BasisCallRec * BC) float r_tri1 = _0, r_tri2 = _0, r_dist; /* zero inits to suppress compiler warnings */ float r_sphere0 = _0, r_sphere1 = _0, r_sphere2 = _0; float r_trans = _0; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; /* assumption: always heading in the negative Z direction with our vector... */ vt[0] = r->base[0]; @@ -2823,11 +2823,11 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, float ll; CPrimitive *prm; int i; - int *tempRef = NULL; + int *tempRef = nullptr; int n = 0, h, q, x, y, z, j, k, l, e; int extra_vert = 0; float p[3], dd[3], *d1, *d2, vd[3], cx[3], cy[3]; - float *tempVertex = NULL; + float *tempVertex = nullptr; float xs, ys; int remapMode = true; /* remap mode means that some objects will span more * than one voxel, so we have to worry about populating @@ -3220,7 +3220,7 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, I->Map = MapNewCached(I->G, -sep, tempVertex, n, extent, group_id, block_base); CHECKOK(ok, I->Map); } else { - I->Map = MapNewCached(I->G, sep, tempVertex, n, NULL, group_id, block_base); + I->Map = MapNewCached(I->G, sep, tempVertex, n, nullptr, group_id, block_base); CHECKOK(ok, I->Map); } } @@ -3238,8 +3238,8 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, impact of this optimization is to reduce the size of the express list (I->Map->Elist) array by about 3-fold */ - int *prm_spanner = NULL; - int *spanner = NULL; + int *prm_spanner = nullptr; + int *spanner = nullptr; float *v = tempVertex; int j, k, l, jj, kk, ll; int nVertex = I->NVertex; @@ -3548,11 +3548,11 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, } else { /* simple sphere mode */ - I->Map = MapNewCached(I->G, -sep, I->Vertex, I->NVertex, NULL, group_id, block_base); + I->Map = MapNewCached(I->G, -sep, I->Vertex, I->NVertex, nullptr, group_id, block_base); CHECKOK(ok, I->Map); if (ok){ if(perspective) { - ok &= MapSetupExpressPerp(I->Map, I->Vertex, front, I->NVertex, false, NULL); + ok &= MapSetupExpressPerp(I->Map, I->Vertex, front, I->NVertex, false, nullptr); } else { ok &= MapSetupExpressXYVert(I->Map, I->Vertex, I->NVertex, false); } @@ -3567,11 +3567,11 @@ int BasisInit(PyMOLGlobals * G, CBasis * I, int group_id) { int ok = true; I->G = G; - I->Radius = NULL; - I->Radius2 = NULL; - I->Normal = NULL; - I->Vert2Normal = NULL; - I->Precomp = NULL; + I->Radius = nullptr; + I->Radius2 = nullptr; + I->Normal = nullptr; + I->Vert2Normal = nullptr; + I->Precomp = nullptr; I->Vertex = VLACacheAlloc(I->G, float, 1, group_id, cCache_basis_vertex); CHECKOK(ok, I->Vertex); if (ok) @@ -3589,7 +3589,7 @@ int BasisInit(PyMOLGlobals * G, CBasis * I, int group_id) if (ok) I->Precomp = VLACacheAlloc(I->G, float, 1, group_id, cCache_basis_precomp); CHECKOK(ok, I->Precomp); - I->Map = NULL; + I->Map = nullptr; I->NVertex = 0; I->NNormal = 0; return ok; @@ -3601,7 +3601,7 @@ void BasisFinish(CBasis * I, int group_id) { if(I->Map) { MapFree(I->Map); - I->Map = NULL; + I->Map = nullptr; } VLACacheFreeP(I->G, I->Radius2, group_id, cCache_basis_radius2, false); VLACacheFreeP(I->G, I->Radius, group_id, cCache_basis_radius, false); @@ -3609,7 +3609,7 @@ void BasisFinish(CBasis * I, int group_id) VLACacheFreeP(I->G, I->Vert2Normal, group_id, cCache_basis_vert2normal, false); VLACacheFreeP(I->G, I->Normal, group_id, cCache_basis_normal, false); VLACacheFreeP(I->G, I->Precomp, group_id, cCache_basis_precomp, false); - I->Vertex = NULL; + I->Vertex = nullptr; } diff --git a/layer1/ButMode.cpp b/layer1/ButMode.cpp index df9ebb50f..d1a048ebd 100644 --- a/layer1/ButMode.cpp +++ b/layer1/ButMode.cpp @@ -479,7 +479,7 @@ static bool ButModeDrawFastImpl(Block * block, short definitely , CGO *orthoCGO) /*========================================================================*/ int ButModeInit(PyMOLGlobals * G) { - CButMode *I = NULL; + CButMode *I = nullptr; if((I = (G->ButMode = new CButMode(G)))) { int a; diff --git a/layer1/CGO.cpp b/layer1/CGO.cpp index e5aaa0594..64516f1ef 100644 --- a/layer1/CGO.cpp +++ b/layer1/CGO.cpp @@ -415,7 +415,7 @@ CGO *CGONewFromPyList(PyMOLGlobals * G, PyObject * list, int version, bool shoul int ok = true; auto I = CGONew(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO ENABLE BACKWARDS COMPATIBILITY... @@ -435,7 +435,7 @@ CGO *CGONewFromPyList(PyMOLGlobals * G, PyObject * list, int version, bool shoul CGOFree(I); } { - CGO *cgo = NULL; + CGO *cgo = nullptr; if (shouldCombine && I && I->has_begin_end){ cgo = CGOCombineBeginEnd(I, 0); CGOFree(I); @@ -502,7 +502,7 @@ static float *CGO_add(CGO * I, unsigned c) float *at; VLACheck(I->op, float, I->c + c); if (!I->op){ - return NULL; + return nullptr; } at = I->op + I->c; I->c += c; @@ -514,7 +514,7 @@ static float *CGO_size(CGO * I, int sz) float *at; VLASize(I->op, float, sz); if (!I->op){ - return NULL; + return nullptr; } at = I->op + I->c; I->c = sz; @@ -1496,7 +1496,7 @@ CGO *CGODrawText(const CGO * I, int est, float *camera) if (cgo && cgo->has_begin_end){ /* this is mainly for VFontWriteToCGO() that still creates CGOBegin/CGOEnd */ if(cgo && cgo->has_begin_end){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; convertcgo = CGOCombineBeginEnd(cgo, 0); CGOFree(cgo); cgo = convertcgo; @@ -1541,7 +1541,7 @@ bool CGOCombineBeginEnd(CGO ** I, bool do_not_split_lines) { CGO *cgo = CGOCombineBeginEnd(*I, 0, do_not_split_lines); CGOFree(*I); *I = cgo; - return (cgo != NULL); + return (cgo != nullptr); } /** @@ -1559,7 +1559,7 @@ CGO *CGOCombineBeginEnd(const CGO * I, int est, bool do_not_split_lines) int ok = true; if (!I) - return NULL; + return nullptr; cgo = CGONewSized(I->G, 0); ok &= cgo ? true : false; @@ -2288,8 +2288,8 @@ static int OptimizePointsToVBO(const CGO *I, CGO *cgo, int num_total_vertices_po }*/ if (shouldCompress){ int cnt, nxtn = VERTEX_POS_SIZE, incr = 0; - float *vertexValsDA = NULL, *nxtVals = NULL, *colorValsDA = NULL, *normalValsDA = NULL; - float *pickColorValsDA = NULL, *pickColorValsTMP; + float *vertexValsDA = nullptr, *nxtVals = nullptr, *colorValsDA = nullptr, *normalValsDA = nullptr; + float *pickColorValsDA = nullptr, *pickColorValsTMP; nxtVals = vertexValsDA = sp->floatdata; @@ -2767,10 +2767,10 @@ static bool CGOProcessScreenCGOtoArrays(PyMOLGlobals* G, CGO* cgo, } bool CGOOptimizeToVBONotIndexed(CGO ** I) { - CGO *cgo = CGOOptimizeToVBONotIndexed(*I, 0, true, NULL); + CGO *cgo = CGOOptimizeToVBONotIndexed(*I, 0, true, nullptr); CGOFree(*I); *I = cgo; - return (cgo != NULL); + return (cgo != nullptr); } /** @@ -2811,7 +2811,7 @@ CGO *CGOOptimizeToVBONotIndexed(const CGO * I, int est, bool addshaders, float * if (num_total_vertices_points>0){ if (!OptimizePointsToVBO(I, cgo, num_total_vertices_points, min, max, &has_draw_buffer, addshaders)){ CGOFree(cgo); - return NULL; + return nullptr; } } if (num_total_indexes>0){ @@ -3239,7 +3239,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeToVBOIndexed() VBO Memory Limitation: The requested \n operation requires a larger buffer than PyMOL currently allows. \n The operation has not entirely completed successfully.\n" ENDFB(I->G); firePyMOLLimitationWarning(); CGOFree(cgo); - return NULL; + return nullptr; } #endif @@ -3247,7 +3247,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, /* This does not need to be indexed (for now) */ if (!OptimizePointsToVBO(I, cgo, num_total_vertices_points, min, max, &has_draw_buffer, addshaders)){ CGOFree(cgo); - return NULL; + return nullptr; } } @@ -3258,7 +3258,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, uchar *colorValsUC = 0; uchar *normalValsC = 0; short ambient_occlusion = 0; - float *sumarray = NULL; + float *sumarray = nullptr; int n_data = 0; if (embedTransparencyInfo){ @@ -3560,7 +3560,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, FreeP(vertexVals); } if (ok && num_total_vertices_lines>0){ - float *vertexVals = 0, *colorVals = 0, *normalVals = NULL, *nxtVals; + float *vertexVals = 0, *colorVals = 0, *normalVals = nullptr, *nxtVals; float *pickColorVals; uchar *colorValsUC = 0; uchar *normalValsC = 0; @@ -3849,7 +3849,7 @@ struct OptimizeSphereData * @param[out] cgo output CGO * @param[in] num_total_spheres Number of spheres to optimize * @param[out] leftOverCGO CGO data not relevant to spheres. - * @pre cgo must not be NULL + * @pre cgo must not be nullptr * * Note: To use leftOverCGO, it must already be preallocated. */ @@ -3997,7 +3997,7 @@ static OptimizeSphereData GetOptimizeSphereData(const CGO* I, CGO*& cgo, int num * @param[in] addshaders adds shader call to CGO * @param[in] num_total_spheres number of total spheres to optimize * @param[in] sphereData Optimized Sphere Data - * @pre cgo must not be NULL + * @pre cgo must not be nullptr */ static bool PopulateGLBufferOptimizedSphereData(const CGO* I, CGO* cgo, bool addshaders, int num_total_spheres, const OptimizeSphereData& sphereData) @@ -4155,7 +4155,7 @@ CGO *CGOSimplify(const CGO * I, int est, short sphere_quality, bool stick_round_ auto G = I->G; int ok = true; if (sphere_quality < 0){ - sphere_quality = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_sphere_quality); + sphere_quality = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_sphere_quality); } std::unique_ptr cgo_managed(CGONew(G, I->c + est)); @@ -4203,10 +4203,10 @@ CGO *CGOSimplify(const CGO * I, int est, short sphere_quality, bool stick_round_ ok &= CGOSimpleCylinder(cgo, cyl->origin, v1, cyl->tube_size, color1, cyl->color2, cgo->alpha, alpha2, true, bcap, fcap, &pickcolor2, stick_round_nub); } else { ok &= CGOColorv(cgo, color1); - ok &= CGOSimpleCylinder(cgo, cyl->origin, mid, cyl->tube_size, color1, NULL, cgo->alpha, alpha2, false, fcap, cCylCap::None, nullptr, stick_round_nub); + ok &= CGOSimpleCylinder(cgo, cyl->origin, mid, cyl->tube_size, color1, nullptr, cgo->alpha, alpha2, false, fcap, cCylCap::None, nullptr, stick_round_nub); ok &= CGOColorv(cgo, cyl->color2); ok &= CGOPickColor(cgo, pickcolor2.index, pickcolor2.bond); - ok &= CGOSimpleCylinder(cgo, mid, v1, cyl->tube_size, cyl->color2, NULL, cgo->alpha, alpha2, false, cCylCap::None, bcap, nullptr, stick_round_nub); + ok &= CGOSimpleCylinder(cgo, mid, v1, cyl->tube_size, cyl->color2, nullptr, cgo->alpha, alpha2, false, cCylCap::None, bcap, nullptr, stick_round_nub); } } break; @@ -4455,7 +4455,7 @@ CGO *CGOSimplifyNoCompress(const CGO * I, int est, short sphere_quality, bool st int ok = true; if (sphere_quality < 0){ - sphere_quality = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_sphere_quality); + sphere_quality = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_sphere_quality); } cgo = CGONewSized(I->G, I->c + est); @@ -4580,7 +4580,7 @@ CGO *CGOSimplifyNoCompress(const CGO * I, int est, short sphere_quality, bool st CGO *CGOOptimizeTextures(const CGO * I, int est) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_textures; int ok = true; num_total_textures = CGOCountNumberOfOperationsOfType(I, CGO_DRAW_TEXTURE); @@ -4591,20 +4591,20 @@ CGO *CGOOptimizeTextures(const CGO * I, int est) worldPos = pymol::malloc(num_total_textures * 18); if (!worldPos){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() worldPos could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } screenValues = pymol::malloc(num_total_textures * 18); if (!screenValues){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() screenValues could not be allocated\n" ENDFB(I->G); FreeP(worldPos); - return NULL; + return nullptr; } textExtents = pymol::malloc(num_total_textures * 12); if (!textExtents){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() textExtents could not be allocated\n" ENDFB(I->G); FreeP(screenValues); FreeP(worldPos); - return NULL; + return nullptr; } pickColorVals = pymol::malloc(num_total_textures * 12); /* pick index and bond */ if (!pickColorVals){ @@ -4612,7 +4612,7 @@ CGO *CGOOptimizeTextures(const CGO * I, int est) FreeP(textExtents); FreeP(screenValues); FreeP(worldPos); - return NULL; + return nullptr; } cgo = CGONewSized(I->G, 0); @@ -4793,7 +4793,7 @@ CGO *CGOConvertToLabelShader(const CGO *I, CGO * addTo){ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_labels; int ok = true; num_total_labels = CGOCountNumberOfOperationsOfType(I, CGO_DRAW_LABEL); @@ -4804,7 +4804,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) worldPos = pymol::malloc(num_total_labels * 6 * 17); if (!worldPos){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeLabels() worldPos could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } screenValues = worldPos + (num_total_labels * 18); targetPos = screenValues + (num_total_labels * 18); @@ -4922,7 +4922,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) }; if (ok) { - float *pickArray = NULL; + float *pickArray = nullptr; if (addshaders){ CGOEnable(cgo, GL_LABEL_SHADER); } @@ -4952,7 +4952,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) CGO *CGOOptimizeConnectors(const CGO * I, int est) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_connectors; int ok = true; int use_geometry_shaders = SettingGetGlobal_b(I->G, cSetting_use_geometry_shaders); @@ -4963,12 +4963,12 @@ CGO *CGOOptimizeConnectors(const CGO * I, int est) float *targetPt3d, *labelCenterPt3d, *indentFactor, *screenWorldOffset, *connectorColor, *textSize; float *bkgrdColor, *relExtLength, *connectorWidth; uchar *relativeMode, *drawBkgrd; - uchar *isCenterPt = NULL; + uchar *isCenterPt = nullptr; int place3 = 0, place2 = 0, place = 0; targetPt3d = pymol::calloc(num_total_connectors * 20 * factor); /* too much, relativeMode only needs 1 byte per vertex, instead of 1 float */ if (!targetPt3d){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeConnectors() could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } labelCenterPt3d = targetPt3d + (num_total_connectors*3 * factor); indentFactor = labelCenterPt3d + (num_total_connectors*3 * factor); @@ -5369,14 +5369,14 @@ int CGORenderRay(CGO * I, CRay * ray, RenderInfo * info, const float *color, Obj float white[] = { 1.0, 1.0, 1.0 }; float zee[] = { 0.0, 0.0, 1.0 }; int ok = true; - const float *n0 = NULL, *n1 = NULL, *n2 = NULL, *v0 = NULL, *v1 = NULL, *v2 = NULL, *c0 = - NULL, *c1 = NULL, *c2 = NULL; + const float *n0 = nullptr, *n1 = nullptr, *n2 = nullptr, *v0 = nullptr, *v1 = nullptr, *v2 = nullptr, *c0 = + nullptr, *c1 = nullptr, *c2 = nullptr; float rampc0[3], rampc1[3], rampc2[3]; int mode = -1; /* workaround; multi-state ray-trace bug */ if (!I) { assert("TODO investigate" && false); - return 0; /* not sure if it should return 0 or 1, 0 - fails, but is it a memory issue? might not be since the arg is NULL */ + return 0; /* not sure if it should return 0 or 1, 0 - fails, but is it a memory issue? might not be since the arg is nullptr */ } I->G->CGORenderer->alpha = @@ -5991,9 +5991,9 @@ static int CGOSimpleEllipsoid(CGO* I, const float* v, float vdw, scale_sq[1] = scale[1] * scale[1]; scale_sq[2] = scale[2] * scale[2]; - ds = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_ellipsoid_quality); + ds = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_ellipsoid_quality); if(ds < 0) - ds = SettingGet_i(I->G, NULL, NULL, cSetting_ellipsoid_quality); + ds = SettingGet_i(I->G, nullptr, nullptr, cSetting_ellipsoid_quality); if(ds < 0) ds = 0; if(ds > 3) @@ -6654,7 +6654,7 @@ void CGO::move_append(CGO&& src_) /** * Appends `src` to the end of this CGO and then free's `src` - * and sets the pointer to NULL. + * and sets the pointer to nullptr. */ void CGO::free_append(CGO * &src) { free_append(std::move(src)); @@ -6808,7 +6808,7 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ break; case CGO_BEGIN: { - const float *last_vertex = NULL, *last_color = NULL, *current_color = NULL, *color = NULL ; + const float *last_vertex = nullptr, *last_color = nullptr, *current_color = nullptr, *color = nullptr ; unsigned int last_pick_color_idx = 0; int last_pick_color_bnd = cPickableNoPick ; int nverts = 0, err = 0; @@ -6853,8 +6853,8 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ tot_ncyls++; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -6932,7 +6932,7 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ return (cgo); } else { CGOFree(cgo); - return NULL; + return nullptr; } } @@ -7029,8 +7029,8 @@ CGO *CGOSplitUpLinesForPicking(const CGO * I){ last_pick_color_bnd = cgo->current_pick_color_bond; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -7240,9 +7240,9 @@ CGO* CGOColorByRamp(PyMOLGlobals* G, const CGO* I, ObjectGadgetRamp* ramp, int ok = true; float white[3] = { 1.f, 1.f, 1.f}; - float probe_radius = SettingGet_f(G, set1, NULL, cSetting_solvent_radius); + float probe_radius = SettingGet_f(G, set1, nullptr, cSetting_solvent_radius); float v_above[3], n0[3] = { 0.f, 0.f, 0.f }; - int ramp_above = SettingGet_i(G, set1, NULL, cSetting_surface_ramp_above_mode) == 1; + int ramp_above = SettingGet_i(G, set1, nullptr, cSetting_surface_ramp_above_mode) == 1; for (auto it = I->begin(); ok && !it.is_stop(); ++it) { const auto op = it.op_code(); @@ -7634,7 +7634,7 @@ CGO *CGOConvertTrianglesToAlpha(const CGO * I){ return (cgo); } else { CGOFree(cgo); - return NULL; + return nullptr; } } @@ -8054,7 +8054,7 @@ CGO *CGOConvertLinesToTrilines(const CGO * I, bool addshaders){ int line_counter = 0; GLuint glbuff = 0; - const float *colorv = NULL; + const float *colorv = nullptr; unsigned int buff_size = nLines * 6 * (8 * sizeof(float)); // VBO memory -- number of lines x 4 vertices per line x (vertex + otherVertex + normal + texCoord + color) @@ -8113,8 +8113,8 @@ CGO *CGOConvertLinesToTrilines(const CGO * I, bool addshaders){ last_vertex = pc; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -8398,7 +8398,7 @@ void copyAttributeForVertex(bool isInterleaved, int &nvert, AttribDesc &attribDe const int vertexDataSize, std::vector &dataPtrs, std::vector &attrOffset){ int ord = attribDesc.order; void *dataPtr = dataPtrs[ord]; - unsigned char *pc = NULL; + unsigned char *pc = nullptr; auto attrSize = GetSizeOfVertexFormat(attribDesc.m_format); if (isInterleaved){ dataPtr = (unsigned char*) dataPtr + nvert * vertexDataSize + attrOffset[ord]; @@ -8718,7 +8718,7 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & // - pickvbo is interleaved so that for multiple channels, pick data for each vertex // is contiguous VertexBuffer *vbo = I->G->ShaderMgr->newGPUBuffer(layout); - VertexBuffer *pickvbo = NULL; + VertexBuffer *pickvbo = nullptr; if (pickDataSize){ pickvbo = I->G->ShaderMgr->newGPUBuffer(VertexBuffer::SEQUENTIAL, GL_DYNAMIC_DRAW); pickvbohash = pickvbo->get_hash_id(); @@ -8794,9 +8794,9 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & allAttrBS |= (1 << attrDesc->order); } auto attrOffset = *attrOffsetIt; - unsigned char *first_value = NULL; + unsigned char *first_value = nullptr; first_value = (attrDesc->default_value ? attrDesc->default_value : - (attrDesc->repeat_value ? attrDesc->repeat_value : NULL)); + (attrDesc->repeat_value ? attrDesc->repeat_value : nullptr)); if (first_value){ auto attrSize = GetSizeOfVertexFormat(attrDesc->m_format); memcpy(((unsigned char*)allData)+attrOffset, first_value, attrSize); @@ -8814,9 +8814,9 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & allAttrBS |= (1 << attrDesc.order); } dataPtrs.push_back(curAllDataPtr); - unsigned char *first_value = NULL; + unsigned char *first_value = nullptr; first_value = (attrDesc.default_value ? attrDesc.default_value : - (attrDesc.repeat_value ? attrDesc.repeat_value : NULL)); + (attrDesc.repeat_value ? attrDesc.repeat_value : nullptr)); if (first_value){ memcpy((unsigned char*)curAllDataPtr, first_value, attrSizes[pl]); } @@ -9246,7 +9246,7 @@ CGO *CGOConvertLinesToCylinderShader(const CGO *I, CGO *addTo, bool add_color){ int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; bool interp_same, interp_value = false; @@ -9332,7 +9332,7 @@ CGO *CGOConvertCrossesToCylinderShader(const CGO *I, CGO *addTo, float cross_siz int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; addTo->add(G->ShaderMgr->GetAttributeUID("a_cap"), cCylShaderBothCapsRound); @@ -9534,8 +9534,8 @@ CGO *CGOConvertShaderCylindersToCylinderShader(const CGO *I, CGO *addTo){ AttribDesc *fdesc; static unsigned char cyl_flags[] = { 0, 4, 6, 2, 1, 5, 7, 3 }; // right(4)/up(2)/out(1) - attrDesc[1].attrOps[0].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, NULL, "attr_vertex2" } ); - attrDesc[1].attrOps[1].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, NULL, "attr_vertex2" } ); + attrDesc[1].attrOps[0].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, nullptr, "attr_vertex2" } ); + attrDesc[1].attrOps[1].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, nullptr, "attr_vertex2" } ); attrDesc.push_back({"attr_flags", VertexFormat::UByte}); fdesc = &attrDesc[attrDesc.size()-1]; @@ -9553,7 +9553,7 @@ CGO *CGOConvertShaderCylindersToCylinderShader(const CGO *I, CGO *addTo){ int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; bool interp_same; diff --git a/layer1/CGO.h b/layer1/CGO.h index e23c83f1c..22883bfdb 100644 --- a/layer1/CGO.h +++ b/layer1/CGO.h @@ -642,7 +642,7 @@ namespace cgo { struct shadercylinder2ndcolor { static const int op_code = CGO_SHADER_CYLINDER_WITH_2ND_COLOR; shadercylinder2ndcolor(CGO *I, const float *_origin, const float *_axis, const float _radius, - int _cap, const float *_color2, Pickable *pickcolor2 = NULL, + int _cap, const float *_color2, Pickable *pickcolor2 = nullptr, const float alpha = -1.f); float origin[3], axis[3], tube_size; int cap; @@ -959,7 +959,7 @@ void CGOFreeVBOs(CGO *I); CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est=0, const float *color=NULL, bool addshaders=true, bool embedTransparencyInfo=false); #define CGOOptimizeToVBOIndexedWithColorEmbedTransparentInfo(I, est, color, addshaders) CGOOptimizeToVBOIndexed(I, est, color, addshaders, true) #define CGOOptimizeToVBOIndexedWithColor CGOOptimizeToVBOIndexed -#define CGOOptimizeToVBOIndexedNoShader(I, est) CGOOptimizeToVBOIndexed(I, est, NULL, false) +#define CGOOptimizeToVBOIndexedNoShader(I, est) CGOOptimizeToVBOIndexed(I, est, nullptr, false) bool CGOOptimizeToVBONotIndexed(CGO ** I); CGO* CGOOptimizeToVBONotIndexed(const CGO* I, int est = 0, @@ -970,7 +970,7 @@ CGO* CGOOptimizeToVBONotIndexed(const CGO* I, int est = 0, CGO *CGOOptimizeSpheresToVBONonIndexed(const CGO * I, int est=0, bool addshaders=false, CGO *leftOverCGO=NULL); -#define CGOOptimizeSpheresToVBONonIndexedNoShader(I, est) CGOOptimizeSpheresToVBONonIndexed(I, est, false, NULL) +#define CGOOptimizeSpheresToVBONonIndexedNoShader(I, est) CGOOptimizeSpheresToVBONonIndexed(I, est, false, nullptr) /** * Creates a VBO-based Bezier CGO. diff --git a/layer1/CGOGL.cpp b/layer1/CGOGL.cpp index 369bbced4..0ff3a21f4 100644 --- a/layer1/CGOGL.cpp +++ b/layer1/CGOGL.cpp @@ -149,7 +149,7 @@ static void CGO_gl_vertex_cross(CCGORenderer* I, CGO_op_data v) } #ifndef PURE_OPENGL_ES_2 } else { - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep && I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep && I->rep->obj) @@ -542,7 +542,7 @@ static void CGO_gl_draw_buffers_indexed(CCGORenderer* I, CGO_op_data pc) int* ix = (int*) (z_value + n_tri); int* sort_mem = ix + n_tri; int t_mode; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep && I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep && I->rep->obj) @@ -675,7 +675,7 @@ static void CGO_gl_draw_custom(CCGORenderer* I, CGO_op_data pc) VertexBuffer* vbo = I->G->ShaderMgr->getGPUBuffer(sp->vboid); if (!vbo) return; - IndexBuffer* ibo = NULL; + IndexBuffer* ibo = nullptr; if (sp->iboid) { ibo = I->G->ShaderMgr->getGPUBuffer(sp->iboid); } @@ -837,7 +837,7 @@ static void CGO_gl_draw_labels(CCGORenderer* I, CGO_op_data pc) I->info ? I->info->pass : RenderPass::Antialias); if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -899,8 +899,8 @@ static void CGO_gl_draw_connectors(CCGORenderer* I, CGO_op_data pc) } if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; - float v_scale = SceneGetScreenVertexScale(I->G, NULL); + CSetting *set1 = nullptr, *set2 = nullptr; + float v_scale = SceneGetScreenVertexScale(I->G, nullptr); if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -1053,7 +1053,7 @@ static void CGO_gl_linewidth(CCGORenderer* I, CGO_op_data pc) * call glLineWidth and set the "line_width" uniform */ static void glLineWidthAndUniform( - float line_width, CShaderPrg* shaderPrg = NULL) + float line_width, CShaderPrg* shaderPrg = nullptr) { #ifndef _WEBGL glLineWidth(line_width); @@ -1072,9 +1072,9 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) bool openVR = SceneGetStereo(I->G) == cStereo_openvr; char varwidth = 0; float vScale = - (I->info ? I->info->vertex_scale : SceneGetScreenVertexScale(I->G, NULL)); + (I->info ? I->info->vertex_scale : SceneGetScreenVertexScale(I->G, nullptr)); - CSetting *csSetting = NULL, *objSetting = NULL; + CSetting *csSetting = nullptr, *objSetting = nullptr; auto shaderPrg = I->G->ShaderMgr->Get_Current_Shader(); if (I->rep && I->rep->cs) { csSetting = I->rep->cs->Setting.get(); @@ -1084,7 +1084,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) } switch (mode) { case LINEWIDTH_DYNAMIC_WITH_SCALE_RIBBON: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_ribbon_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_ribbon_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1093,7 +1093,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_DYNAMIC_WITH_SCALE_DASH: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_dash_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_dash_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1102,7 +1102,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_DYNAMIC_WITH_SCALE: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_line_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1111,7 +1111,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_WITH_SCALE: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_line_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width); if (I->info && I->info->width_scale_flag) { line_width *= I->info->width_scale; } @@ -1123,7 +1123,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) line_width = SettingGet_f(I->G, I->rep->cs->Setting.get(), I->rep->obj->Setting.get(), cSetting_mesh_width); } else { - line_width = SettingGet_f(I->G, NULL, NULL, cSetting_mesh_width); + line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_mesh_width); } if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); @@ -1147,12 +1147,12 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) break; } case CYLINDERWIDTH_DYNAMIC_MESH: { - CSetting* setting = NULL; + CSetting* setting = nullptr; float mesh_width; if (I && I->rep && I->rep->obj) { setting = I->rep->obj->Setting.get(); } - mesh_width = SettingGet_f(I->G, setting, NULL, cSetting_mesh_width); + mesh_width = SettingGet_f(I->G, setting, nullptr, cSetting_mesh_width); if (shaderPrg) { const float* color = I->color ? I->color : g_ones4f; shaderPrg->Set1f("uni_radius", @@ -1341,7 +1341,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) } break; case LINEWIDTH_FOR_LINES: { float line_width = SceneGetDynamicLineWidth( - I->info, SettingGet_f(I->G, NULL, NULL, cSetting_line_width)); + I->info, SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width)); if (I->info && I->info->width_scale_flag) { line_width *= I->info->width_scale; } @@ -1350,7 +1350,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) case SET_LABEL_SCALE_UNIFORMS: { if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -1741,7 +1741,7 @@ static void CGO_gl_sphere(CCGORenderer* I, CGO_op_data varg) if (I->isPicking) { SphereRender(I->G, 0, v, I->color, I->alpha, v[3]); } else { - SphereRender(I->G, I->sphere_quality, v, NULL, I->alpha, v[3]); + SphereRender(I->G, I->sphere_quality, v, nullptr, I->alpha, v[3]); } } @@ -1899,7 +1899,7 @@ static int* get_pickcolorsset_ptr(int op, float* pc) RETURN_PICKCOLORSETPTR_CASE(cylinder_buffers); RETURN_PICKCOLORSETPTR_CASE(custom); } - return NULL; + return nullptr; } void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, @@ -2014,7 +2014,7 @@ void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, int srcp; float* pca = nullptr; int* pickDataSrc; - uchar* pickColorDestUC = NULL; + uchar* pickColorDestUC = nullptr; bool free_pick_color_dest = false; int destOffset = 0, bufsizemult = 1; size_t pickvbo = 0; @@ -2144,7 +2144,7 @@ void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, if (free_pick_color_dest) { delete[] pickColorDestUC; - pickColorDestUC = NULL; + pickColorDestUC = nullptr; free_pick_color_dest = false; } } @@ -2248,11 +2248,11 @@ void CGORenderGL(CGO* I, const float* color, CSetting* set1, CSetting* set2, int mode = -1; int vc = 0; // triangle normals - const float *n0 = NULL, *n1 = NULL, *n2 = NULL; + const float *n0 = nullptr, *n1 = nullptr, *n2 = nullptr; // triangle vertices - const float *v0 = NULL, *v1 = NULL, *v2 = NULL; + const float *v0 = nullptr, *v1 = nullptr, *v2 = nullptr; // triangle colors - const float *c0 = color, *c1 = NULL, *c2 = NULL; + const float *c0 = color, *c1 = nullptr, *c2 = nullptr; for (auto it = I->begin(); !it.is_stop(); ++it) { const auto op = it.op_code(); diff --git a/layer1/COLLADA.cpp b/layer1/COLLADA.cpp index 16273b930..5b3ed45bd 100644 --- a/layer1/COLLADA.cpp +++ b/layer1/COLLADA.cpp @@ -281,27 +281,27 @@ static void ColladaWritePhongEffect(xmlTextWriterPtr w, char *id, if (amb > PRECISION) { sprintf(value, "0.5 0.5 0.5 %5.3f", amb); - ColladaWriteCommonColorElement(w, (char *)"ambient", NULL, value); + ColladaWriteCommonColorElement(w, (char *)"ambient", nullptr, value); } if (spec > PRECISION) { sprintf(value, "0.5 0.5 0.5 %5.3f", spec); - ColladaWriteCommonColorElement(w, (char *)"specular", NULL, value); + ColladaWriteCommonColorElement(w, (char *)"specular", nullptr, value); } if(shin > PRECISION) { sprintf(value, "%5.3f", shin); - ColladaWriteCommonFloatElement(w, (char *)"shininess", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"shininess", nullptr, value); } if(trans > PRECISION) { sprintf(value, "%5.3f", trans); - ColladaWriteCommonFloatElement(w, (char *)"transparency", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"transparency", nullptr, value); } if(iref > PRECISION) { sprintf(value, "%5.3f", iref); - ColladaWriteCommonFloatElement(w, (char *)"index_of_refraction", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"index_of_refraction", nullptr, value); } xmlTextWriterEndElement(w); // phong @@ -750,20 +750,20 @@ void RayRenderCOLLADA(CRay * I, int width, int height, /* Create a new XML DOM tree, to which the COLLADA document will be * written */ doc = xmlNewDoc(BAD_CAST XML_VERSION); - if (doc == NULL) { + if (doc == nullptr) { printf("ColladaRender: Error creating the xml document tree (xmlNewDoc).\n"); return; } /* Create a new XmlWriter */ - w = xmlNewTextWriterTree(doc, NULL, 0); - if (w == NULL) { + w = xmlNewTextWriterTree(doc, nullptr, 0); + if (w == nullptr) { printf("ColladaRender: Error creating the xml writer (xmlNewTextWriterTree).\n"); return; } /* Start the XML document */ - rc = xmlTextWriterStartDocument(w, NULL, XML_ENCODING, NULL); + rc = xmlTextWriterStartDocument(w, nullptr, XML_ENCODING, nullptr); if (rc < 0) { printf("ColladaRender: Error at xmlTextWriterStartDocument\n"); return; @@ -970,7 +970,7 @@ void RayRenderCOLLADA(CRay * I, int width, int height, /* color */ const float *bg_color; - bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); sprintf(next, "%6.4f %6.4f %6.4f", bg_color[0], bg_color[1], bg_color[2]); UtilConcatVLA(&colors_str, &col_str_cc, next); @@ -1244,7 +1244,7 @@ void RayRenderCOLLADA(CRay * I, int width, int height, const int j_arr[] = {2, 3, 2}; int nCapTri = 0; cCylCap captype[2] = {prim->cap1, prim->cap2}; - CGO *cgocap[2] = {NULL, NULL}; + CGO *cgocap[2] = {NULL, nullptr}; if(prim->type == cPrimSausage) { captype[0] = captype[1] = cCylCapRound; diff --git a/layer1/Character.cpp b/layer1/Character.cpp index cefc6e66f..4d902ca30 100644 --- a/layer1/Character.cpp +++ b/layer1/Character.cpp @@ -126,7 +126,7 @@ unsigned char *CharacterGetPixmapBuffer(PyMOLGlobals * G, int id) CharRec *rec = I->Char + id; return rec->Pixmap.buffer; } - return NULL; + return nullptr; } int CharacterNewFromBitmap(PyMOLGlobals * G, int width, int height, @@ -401,7 +401,7 @@ int CharacterGetGeometry(PyMOLGlobals * G, int id, int CharacterInit(PyMOLGlobals * G) { - CCharacter *I = NULL; + CCharacter *I = nullptr; if((I = (G->Character = pymol::calloc(1)))) { I->MaxAlloc = 5; I->Char = VLACalloc(CharRec, I->MaxAlloc + 1); diff --git a/layer1/Color.cpp b/layer1/Color.cpp index 1c8382fb3..b7fb67697 100644 --- a/layer1/Color.cpp +++ b/layer1/Color.cpp @@ -80,7 +80,7 @@ static void lookup_color(CColor * I, const float *in, float *out, int big_endian void ColorGetBkrdContColor(PyMOLGlobals * G, float *rgb, int invert_flag) { - const float *bkrd = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bkrd = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); if(!invert_flag) { if((bkrd[0] + bkrd[1] + bkrd[2]) > 0.5F) { @@ -774,7 +774,7 @@ const char *ColorGetName(PyMOLGlobals * G, int index) if (a < I->Ext.size()) { return I->Ext[a].Name; } else - return NULL; + return nullptr; } return (NULL); } @@ -1733,7 +1733,7 @@ int ColorLookupColor(PyMOLGlobals * G, float *color) /*========================================================================*/ int ColorInit(PyMOLGlobals * G) { - CColor *I = NULL; + CColor *I = nullptr; if ((G->Color = new CColor())) { I = G->Color; @@ -1763,13 +1763,13 @@ void ColorUpdateFront(PyMOLGlobals * G, const float *back) } void ColorUpdateFrontFromSettings(PyMOLGlobals * G){ - int bg_gradient = SettingGet_b(G, NULL, NULL, cSetting_bg_gradient); - const char * bg_image_filename = SettingGet_s(G, NULL, NULL, cSetting_bg_image_filename); + int bg_gradient = SettingGet_b(G, nullptr, nullptr, cSetting_bg_gradient); + const char * bg_image_filename = SettingGet_s(G, nullptr, nullptr, cSetting_bg_image_filename); short bg_image = bg_image_filename && bg_image_filename[0]; if (!bg_gradient){ if (!bg_image && !OrthoBackgroundDataIsSet(*G->Ortho)){ - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); ColorUpdateFront(G, v); } else { float v[] = { 0.f, 0.f, 0.f }; @@ -1777,8 +1777,8 @@ void ColorUpdateFrontFromSettings(PyMOLGlobals * G){ } } else { float vv[3]; - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb_bottom)); - const float *vb = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb_top)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb_bottom)); + const float *vb = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb_top)); average3f(v, vb, vv); ColorUpdateFront(G, vv); } diff --git a/layer1/Control.cpp b/layer1/Control.cpp index db865e85d..0dd335360 100644 --- a/layer1/Control.cpp +++ b/layer1/Control.cpp @@ -853,7 +853,7 @@ void CControl::draw(CGO* orthoCGO) /*========================================================================*/ int ControlInit(PyMOLGlobals * G) { - CControl *I = NULL; + CControl *I = nullptr; if((I = (G->Control = new CControl(G)))) { I->active = true; I->TextColor[0] = 1.0; diff --git a/layer1/Extrude.cpp b/layer1/Extrude.cpp index a00201aee..0a13d276a 100644 --- a/layer1/Extrude.cpp +++ b/layer1/Extrude.cpp @@ -56,7 +56,7 @@ CExtrude *ExtrudeCopyPointsNormalsColors(CExtrude * orig) CopyArray(I->sf, orig->sf, float, I->N); /* PUTTY: scale factors */ } else { ExtrudeFree(I); - I = NULL; + I = nullptr; } return (I); } @@ -66,19 +66,19 @@ void ExtrudeInit(PyMOLGlobals * G, CExtrude * I) I->G = G; I->N = 0; - I->p = NULL; - I->n = NULL; - I->c = NULL; + I->p = nullptr; + I->n = nullptr; + I->c = nullptr; I->alpha = nullptr; - I->i = NULL; + I->i = nullptr; - I->sv = NULL; /* shape vertices */ - I->sn = NULL; /* shape normals */ - I->tv = NULL; /* transformed vertices */ - I->tn = NULL; /* transformed normals */ + I->sv = nullptr; /* shape vertices */ + I->sn = nullptr; /* shape normals */ + I->tv = nullptr; /* transformed vertices */ + I->tn = nullptr; /* transformed normals */ I->Ns = 0; /* number of shape points */ - I->sf = NULL; + I->sf = nullptr; } int ExtrudeCircle(CExtrude * I, int n, float size) @@ -131,10 +131,10 @@ int ExtrudeCircle(CExtrude * I, int n, float size) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } PRINTFD(I->G, FB_Extrude) @@ -234,10 +234,10 @@ int ExtrudeRectangle(CExtrude * I, float width, float length, int mode) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; return ok; } @@ -350,10 +350,10 @@ int ExtrudeDumbbell1(CExtrude * I, float width, float length, int mode) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } v = I->sv; @@ -455,10 +455,10 @@ int ExtrudeDumbbell2(CExtrude * I, int n, int sign, float length, float size) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } I->Ns = n; @@ -817,7 +817,7 @@ void ExtrudeCGOTraceFrame(CExtrude * I, CGO * cgo) * cgo: CGO to add to * index: sampling index in `I` * inv_dir: inverse direction of normal if true - * color: RGB color or NULL to use color from `I` + * color: RGB color or nullptr to use color from `I` */ static void TubeCapFlat(const CExtrude * I, CGO * cgo, int index, bool inv_dir, const float * color) { @@ -859,7 +859,7 @@ void TubeCapFlat(const CExtrude * I, CGO * cgo, int index, bool inv_dir, const f * I: tube instance * cgo: CGO to add to * cap: 0: no caps, 1: flat caps, 2: round caps - * color_override: RGB color or NULL to use color from `I` + * color_override: RGB color or nullptr to use color from `I` * use_spheres: do round caps with spheres instead of triangles * dash: if > 0, skip every segment which is a multiple of `dash` */ @@ -872,7 +872,7 @@ int ExtrudeCGOSurfaceTube(const CExtrude* I, CGO* cgo, cCylCap cap, float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; int start, stop; int ok = true; PRINTFD(I->G, FB_Extrude) @@ -1239,7 +1239,7 @@ int ExtrudeCGOSurfaceVariableTube(const CExtrude* I, CGO* cgo, cCylCap cap) float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL, *AN = NULL, *an; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr, *AN = nullptr, *an; float v0[3]; float *sf; /* PUTTY: scale factor from ExtrudeMakeSausLUT() */ int ok = true; @@ -1513,7 +1513,7 @@ int ExtrudeCGOSurfacePolygon(const CExtrude * I, CGO * cgo, cCylCap cap, const f float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float v0[3]; int ok = true; @@ -1709,7 +1709,7 @@ int ExtrudeCGOSurfacePolygonTaper(const CExtrude * I, CGO * cgo, int sampling, float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float s0[3]; float f; int subN; @@ -1851,7 +1851,7 @@ int ExtrudeCGOSurfaceStrand(const CExtrude * I, CGO * cgo, int sampling, const f float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float v0[3], n0[3], s0[3], z[3] = { 1.0, 0.0, 1.0 }; int subN; int ok = true; diff --git a/layer1/FontGLUT.cpp b/layer1/FontGLUT.cpp index 4e6aba73a..1528576ab 100644 --- a/layer1/FontGLUT.cpp +++ b/layer1/FontGLUT.cpp @@ -131,7 +131,7 @@ const char* CFontGLUT::RenderOpenGL(const RenderInfo* info, const char* st, if(st && (*st)) { - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); first = font_info->first; last = first + font_info->num_chars; @@ -332,7 +332,7 @@ const char* CFontGLUT::RenderRay(CRay* ray, const char* st, float size, sampling = ray->Sampling; if(st && (*st)) { - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); if(rpos) { float loc[3]; diff --git a/layer1/FontType.cpp b/layer1/FontType.cpp index e1ee26b7e..97b025392 100644 --- a/layer1/FontType.cpp +++ b/layer1/FontType.cpp @@ -91,11 +91,11 @@ static const char* FontTypeRenderOpenGLImpl(const RenderInfo* info, CFontType* I int linenum = 0; short cont = 0; float descender = TypeFaceGetDescender(I->TypeFace) / 2.f; - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); copy2f(TextGetLabelBuffer(G), text_buffer); sampling = info->sampling; if(st && (*st)) { - float *line_widths = NULL; + float *line_widths = nullptr; float screenWorldOffset[3] = { 0.0F, 0.0F, 0.0F }; float tot_height; if (nlines>1){ @@ -335,11 +335,11 @@ const char* CFontType::RenderRay(CRay* ray, const char* st, float size, int nlines = countchrs(st, '\n') + 1; int linenum = 0; float descender = TypeFaceGetDescender(I->TypeFace); - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); copy2f(TextGetLabelBuffer(G), text_buffer); if(st && (*st)) { float origpos[3]; - float *line_widths = NULL; + float *line_widths = nullptr; float tot_height; if (nlines>1){ line_widths = pymol::calloc(nlines); diff --git a/layer1/Movie.cpp b/layer1/Movie.cpp index 0c6fb649e..49d9248dd 100644 --- a/layer1/Movie.cpp +++ b/layer1/Movie.cpp @@ -66,7 +66,7 @@ void MovieViewReinterpolate(PyMOLGlobals *G) MovieView(G, 3, -1, -1, power, bias, 1, /* note simple always = 1 for camera motion...*/ linear, SettingGetGlobal_b(G,cSetting_movie_loop) ? 1 : 0 , - hand, 5, 1, NULL, 0.5, -1, 1); + hand, 5, 1, nullptr, 0.5, -1, 1); } int MovieXtoFrame(PyMOLGlobals *G, BlockRect *rect, int frames, int x, int nearest) @@ -213,7 +213,7 @@ void MovieCopyPrepare(PyMOLGlobals * G, int *width, int *height, int *length) SettingSetGlobal_i(G, cSetting_overlay, 5); nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } start = 0; stop = nFrame; @@ -274,7 +274,7 @@ int MovieCopyFrame(PyMOLGlobals * G, int frame, int width, int height, int rowby int nFrame; nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } if((frame < nFrame) && (ptr)) { @@ -333,7 +333,7 @@ int MoviePurgeFrame(PyMOLGlobals * G, int frame) int i; nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } if(!I->CacheSave) { if(frame < nFrame) { @@ -411,7 +411,7 @@ static int MovieCmdFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) int warn = false; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); @@ -463,7 +463,7 @@ int MovieFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) if(ok && (ll > 6)) { PyObject *tmp; VLAFreeP(I->ViewElem); - I->ViewElem = NULL; + I->ViewElem = nullptr; tmp = PyList_GetItem(list, 6); if(tmp && !(tmp == Py_None)) ok = ViewElemVLAFromPyList(G, tmp, &I->ViewElem, I->NFrame); @@ -483,7 +483,7 @@ static PyObject *MovieCmdAsPyList(PyMOLGlobals * G) { CMovie *I = G->Movie; - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NFrame); @@ -499,7 +499,7 @@ static PyObject *MovieCmdAsPyList(PyMOLGlobals * G) PyObject *MovieAsPyList(PyMOLGlobals * G) { CMovie *I = G->Movie; - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(7); PyList_SetItem(result, 0, PyInt_FromLong(I->NFrame)); @@ -561,7 +561,7 @@ void MoviePlay(PyMOLGlobals * G, int cmd) if(I->Playing && !SettingGetGlobal_b(G, cSetting_movie_loop)) { /* if not looping, and at end of movie, then automatically rewind and force execution of the first movie command */ - if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, NULL))) { + if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, nullptr))) { SceneSetFrame(G, 7, 0); } } @@ -573,7 +573,7 @@ void MoviePlay(PyMOLGlobals * G, int cmd) if(!SettingGetGlobal_b(G, cSetting_movie_loop)) { /* if not looping, and at end of movie, then automatically rewind and force execution of the first movie command */ - if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, NULL))) { + if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, nullptr))) { SceneSetFrame(G, 7, 0); } } @@ -635,7 +635,7 @@ static void MovieModalPNG(PyMOLGlobals * G, CMovie * I, CMovieModal * M) OrthoBusyPrime(G); M->nFrame = I->NFrame; if(!M->nFrame) { - M->nFrame = SceneGetNFrame(G, NULL); + M->nFrame = SceneGetNFrame(G, nullptr); if(M->nFrame < 1) { M->nFrame = 1; } @@ -1131,7 +1131,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, first = 0; if(last < 0) { - last = SceneGetNFrame(G, NULL) - 1; + last = SceneGetNFrame(G, nullptr) - 1; } if(last >= I->NFrame) { last = I->NFrame - 1; @@ -1167,7 +1167,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, " MovieView: Setting frame %d.\n", frame + 1 ENDFB(G); } if(scene_name && (!scene_name[0])) - scene_name = NULL; + scene_name = nullptr; SceneToViewElem(G, I->ViewElem + frame, scene_name); if(state>=0) { I->ViewElem[frame].state = state; @@ -1211,7 +1211,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, case 3: if(I->ViewElem) { int view_found = false; - CViewElem *first_view = NULL, *last_view = NULL; + CViewElem *first_view = nullptr, *last_view = nullptr; if(first < 0) first = 0; @@ -1313,7 +1313,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, power, bias, simple, linear, hand, scene_cut); } first_view = last_view; - last_view = NULL; + last_view = nullptr; } } } @@ -1351,7 +1351,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, if(first < 0) first = 0; if(last < 0) { - last = SceneGetNFrame(G, NULL) - 1; + last = SceneGetNFrame(G, nullptr) - 1; } for(frame = first; frame <= last; frame++) { if((frame >= 0) && (frame < I->NFrame)) { diff --git a/layer1/Ortho.cpp b/layer1/Ortho.cpp index 4adbead98..8e0b55950 100644 --- a/layer1/Ortho.cpp +++ b/layer1/Ortho.cpp @@ -480,7 +480,7 @@ void OrthoClear(PyMOLGlobals * G) COrtho *I = G->Ortho; for(a = 0; a <= OrthoSaveLines; a++) I->Line[a][0] = 0; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); OrthoRestorePrompt(G); OrthoInvalidateDoDraw(G); OrthoDirty(G); @@ -662,7 +662,7 @@ void OrthoBusyDraw(PyMOLGlobals * G, int force) if(*c) { TextSetColor(G, white); TextSetPos2i(G, cBusyMargin, y - (cBusySpacing / 2)); - TextDrawStr(G, c, NULL); + TextDrawStr(G, c, nullptr); y -= cBusySpacing; } @@ -742,7 +742,7 @@ void OrthoRestorePrompt(PyMOLGlobals * G) if(!I->InputFlag) { if(I->Saved[0]) { if(I->CurChar) { - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); } curLine = I->CurLine & OrthoSaveLines; strcpy(I->Line[curLine], I->Saved); @@ -1056,7 +1056,7 @@ void OrthoParseCurrentLine(PyMOLGlobals * G) I->History[I->HistoryLine][0] = 0; I->HistoryView = I->HistoryLine; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); if(WordMatch(G, buffer, "quit", true) == 0) /* don't log quit */ PLog(G, buffer, cPLog_pml); OrthoDirty(G); /* this will force a redraw, if necessary */ @@ -1100,7 +1100,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) if(cc > wrap) { *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); cc = 0; q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; @@ -1109,7 +1109,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) if(cc >= OrthoLineLength - 6) { /* fail safe */ *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, false); + OrthoNewLine(G, nullptr, false); cc = 0; q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; @@ -1118,7 +1118,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) } else { *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; p++; @@ -1228,7 +1228,7 @@ void OrthoDoViewportWhenReleased(PyMOLGlobals *G) void OrthoUngrab(PyMOLGlobals * G) { COrtho *I = G->Ortho; - I->GrabbedBy = NULL; + I->GrabbedBy = nullptr; } @@ -1244,7 +1244,7 @@ void OrthoDetach(PyMOLGlobals * G, Block * block) { COrtho *I = G->Ortho; if(I->GrabbedBy == block) - I->GrabbedBy = NULL; + I->GrabbedBy = nullptr; auto iter = std::find(I->Blocks.begin(), I->Blocks.end(), block); if(iter != I->Blocks.end()){ I->Blocks.erase(iter); @@ -1428,7 +1428,7 @@ void bg_grad(PyMOLGlobals * G) { if (!(bg_gradient != BgGradient::None || bg_image_filename || I->bgData) || !G->ShaderMgr->ShadersPresent()) { - const float *bg_rgb = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bg_rgb = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); SceneGLClearColor(bg_rgb[0], bg_rgb[1], bg_rgb[2], 1.0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); return; @@ -1475,14 +1475,14 @@ void bg_grad(PyMOLGlobals * G) { } glDisable(GL_DEPTH_TEST); - CGORender(I->bgCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->bgCGO, nullptr, nullptr, nullptr, nullptr, nullptr); glEnable(GL_DEPTH_TEST); } void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) { COrtho *I = G->Ortho; - CGO *orthoCGO = NULL; + CGO *orthoCGO = nullptr; int x, y; int l, lcount; char *str; @@ -1513,13 +1513,13 @@ void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) I->HaveSeqViewer = false; } - if(SettingGet_i(G, NULL, NULL, cSetting_internal_prompt)) + if(SettingGet_i(G, nullptr, nullptr, cSetting_internal_prompt)) skip_prompt = 0; else skip_prompt = 1; - double_pump = SettingGet_i(G, NULL, NULL, cSetting_stereo_double_pump_mono); - bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + double_pump = SettingGet_i(G, nullptr, nullptr, cSetting_stereo_double_pump_mono); + bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); I->OverlayColor[0] = 1.0F - bg_color[0]; I->OverlayColor[1] = 1.0F - bg_color[1]; @@ -1995,13 +1995,13 @@ void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) void OrthoRenderCGO(PyMOLGlobals * G){ COrtho *I = G->Ortho; if (I->orthoCGO) { - SceneDrawImageOverlay(G, 0, NULL); + SceneDrawImageOverlay(G, 0, nullptr); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); if (I->orthoCGO) - CGORender(I->orthoCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->orthoCGO, nullptr, nullptr, nullptr, nullptr, nullptr); if (I->orthoFastCGO) - CGORender(I->orthoFastCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->orthoFastCGO, nullptr, nullptr, nullptr, nullptr, nullptr); G->ShaderMgr->Disable_Current_Shader(); glEnable(GL_DEPTH_TEST); } @@ -2147,7 +2147,7 @@ static void OrthoLayoutPanel(PyMOLGlobals * G, int m_top, int m_left, int m_bottom, int m_right) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int controlHeight = DIP2PIXEL(20); int butModeHeight = ButModeGetHeight(G); @@ -2226,7 +2226,7 @@ void OrthoReshape(PyMOLGlobals * G, int width, int height, int force) if(!G->HaveGUI && width < 0) return; - Block *block = NULL; + Block *block = nullptr; int sceneBottom, sceneRight = 0; int textBottom = 0; int internal_gui_width; @@ -2327,7 +2327,7 @@ void OrthoReshape(PyMOLGlobals * G, int width, int height, int force) block = SceneGetBlock(G); block->setMargin(sceneTop, 0, sceneBottom, sceneRight); - block = NULL; + block = nullptr; for(auto block : I->Blocks){ block->reshape(width, height); } @@ -2374,7 +2374,7 @@ ClickSide OrthoGetWrapClickSide(PyMOLGlobals* G) int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int handled = 0; PRINTFB(G, FB_Ortho, FB_Blather) @@ -2393,7 +2393,7 @@ int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) if(I->WrapXFlag) { if(state == P_GLUT_DOWN) { - x = get_wrap_x(x, NULL, G->Option->winX, &I->WrapClickSide); + x = get_wrap_x(x, nullptr, G->Option->winX, &I->WrapClickSide); } else { x = get_wrap_x(x, &I->LastX, G->Option->winX, &I->WrapClickSide); } @@ -2428,12 +2428,12 @@ int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) if(I->GrabbedBy) { block = I->GrabbedBy; handled = block->release(button, x, y, mod); - I->ClickedIn = NULL; + I->ClickedIn = nullptr; } if(I->ClickedIn) { block = I->ClickedIn; handled = block->release(button, x, y, mod); - I->ClickedIn = NULL; + I->ClickedIn = nullptr; } I->ActiveButton = -1; } @@ -2457,11 +2457,11 @@ int OrthoDrag(PyMOLGlobals * G, int x, int y, int mod) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int handled = 0; if(I->WrapXFlag) { - x = get_wrap_x(x, &I->LastX, G->Option->winX, NULL); + x = get_wrap_x(x, &I->LastX, G->Option->winX, nullptr); } I->LastX = x; @@ -2555,7 +2555,7 @@ void OrthoSplash(PyMOLGlobals * G) /*========================================================================*/ int OrthoInit(PyMOLGlobals * G, int showSplash) { - COrtho *I = NULL; + COrtho *I = nullptr; if((I = (G->Ortho = new COrtho()))) { @@ -2572,8 +2572,8 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->WizardTextColor[1] = 1.0F; I->WizardTextColor[2] = 0.2F; - I->GrabbedBy = NULL; - I->ClickedIn = NULL; + I->GrabbedBy = nullptr; + I->ClickedIn = nullptr; I->DrawText = 1; I->HaveSeqViewer = false; I->TextColor[0] = 0.83F; @@ -2591,7 +2591,7 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->HistoryLine = 0; I->HistoryView = 0; I->Line[I->CurLine & OrthoSaveLines][I->CurChar] = 0; - I->WizardPromptVLA = NULL; + I->WizardPromptVLA = nullptr; I->SplashFlag = false; I->ShowLines = 1; I->Saved[0] = 0; @@ -2601,10 +2601,10 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->DrawTime = 0.0; I->bg_texture_id = 0; I->bg_texture_needs_update = 0; - I->bgCGO = NULL; + I->bgCGO = nullptr; I->bgData = nullptr; - I->orthoCGO = NULL; - I->orthoFastCGO = NULL; + I->orthoCGO = nullptr; + I->orthoFastCGO = nullptr; if(showSplash) { OrthoSplash(G); @@ -2646,7 +2646,7 @@ void OrthoFree(PyMOLGlobals * G) VLAFreeP(I->WizardPromptVLA); PopFree(G); { - I->cmdActiveQueue = NULL; + I->cmdActiveQueue = nullptr; } I->bgData = nullptr; @@ -2814,7 +2814,7 @@ void OrthoSetBackgroundImage(PyMOLGlobals * G, const char *image_data, int width short should_update = 0; if (I->bgData){ FreeP(I->bgData); - I->bgData = NULL; + I->bgData = nullptr; I->bgWidth = 0; I->bgHeight = 0; should_update = 1; diff --git a/layer1/P.cpp b/layer1/P.cpp index e78f4c718..e81196efa 100644 --- a/layer1/P.cpp +++ b/layer1/P.cpp @@ -70,7 +70,7 @@ the initialization functions for these libraries on startup. #include /** - * Use with functions which return a PyObject - if they return NULL, then an + * Use with functions which return a PyObject - if they return nullptr, then an * unexpected exception has occured. */ #define ASSERT_PYOBJECT_NOT_NULL(obj, return_value) \ @@ -341,15 +341,15 @@ int PLabelAtomAlt(PyMOLGlobals * G, AtomInfoType * at, const char *model, const /* local to this C code module */ -static PyObject *P_pymol = NULL; -static PyObject *P_pymol_dict = NULL; /* must be refomed into globals and instance properties */ -static PyObject *P_cmd = NULL; +static PyObject *P_pymol = nullptr; +static PyObject *P_pymol_dict = nullptr; /* must be refomed into globals and instance properties */ +static PyObject *P_cmd = nullptr; -static PyObject *P_povray = NULL; -static PyObject *P_traceback = NULL; -static PyObject *P_parser = NULL; +static PyObject *P_povray = nullptr; +static PyObject *P_traceback = nullptr; +static PyObject *P_parser = nullptr; -static PyObject *P_vfont = NULL; +static PyObject *P_vfont = nullptr; /* module import helper */ @@ -375,11 +375,11 @@ PyObject * PGetAttrOrFatal(PyObject * o, const char * name) { /* used elsewhere */ -PyObject *P_menu = NULL; /* menu definitions are currently global */ -PyObject *P_xray = NULL; /* okay as global */ -PyObject *P_chempy = NULL; /* okay as global */ -PyObject *P_models = NULL; /* okay as global */ -PyObject *P_setting = NULL; /* okay as global -- just used for names */ +PyObject *P_menu = nullptr; /* menu definitions are currently global */ +PyObject *P_xray = nullptr; /* okay as global */ +PyObject *P_chempy = nullptr; /* okay as global */ +PyObject *P_models = nullptr; /* okay as global */ +PyObject *P_setting = nullptr; /* okay as global -- just used for names */ PyObject *P_CmdException = nullptr; PyObject *P_QuietException = nullptr; PyObject *P_IncentiveOnlyException = nullptr; @@ -452,16 +452,16 @@ static PyObject *SettingWrapperObjectSubScript(PyObject *obj, PyObject *key){ auto& wobj = reinterpret_cast(obj)->wobj; int setting_id; - PyObject *ret = NULL; + PyObject *ret = nullptr; if (!check_wrapper_scope(wobj)) { - return NULL; + return nullptr; } auto G = wobj->G; if ((setting_id = get_and_check_setting_index(G, key)) == -1) { - return NULL; + return nullptr; } if (wobj->idx >= 0){ @@ -476,7 +476,7 @@ PyObject *SettingWrapperObjectSubScript(PyObject *obj, PyObject *key){ if (!ret) { // object-state, object, or global ret = SettingGetPyObject(G, - wobj->cs ? wobj->cs->Setting.get() : NULL, + wobj->cs ? wobj->cs->Setting.get() : nullptr, wobj->obj->Setting.get(), setting_id); } } @@ -548,7 +548,7 @@ static PyObject* SettingWrapperObjectIter(PyObject *self) auto& wobj = reinterpret_cast(self)->wobj; if (!check_wrapper_scope(wobj)) { - return NULL; + return nullptr; } int unique_id = wobj->atomInfo->unique_id; @@ -663,7 +663,7 @@ PyObject * WrapperObjectSubScript(PyObject *obj, PyObject *key){ auto wobj = static_cast(obj); if (!check_wrapper_scope(wobj)) - return NULL; + return nullptr; PyMOLGlobals* G = wobj->G; PyObject* ret = nullptr; @@ -679,7 +679,7 @@ PyObject * WrapperObjectSubScript(PyObject *obj, PyObject *key){ if (ObjectMoleculeUpdateMMStereoInfoForState(G, wobj->obj, wobj->state - 1) < 0) { PyErr_SetString(P_CmdException, "please install rdkit or set SCHRODINGER variable"); - return NULL; + return nullptr; } break; case ATOM_PROP_TEXT_TYPE: @@ -994,8 +994,8 @@ int WrapperObjectAssignSubScript(PyObject *obj, PyObject *key, PyObject *val){ /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ #ifdef WIN32 -static PyObject *P_time = NULL; -static PyObject *P_sleep = NULL; +static PyObject *P_time = nullptr; +static PyObject *P_sleep = nullptr; #endif /* END PROPRIETARY CODE SEGMENT */ @@ -1075,7 +1075,7 @@ void PCatchInit(void); /* PyObject *GetBondsDict(PyMOLGlobals *G) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyObject_GetAttrString(P_chempy,"bonds"); if(!result) ErrMessage(G,"PyMOL","can't find 'chempy.bonds.bonds'"); return(result); @@ -1086,7 +1086,7 @@ PyObject *PGetFontDict(PyMOLGlobals * G, float size, int face, int style) { /* assumes we have a valid interpreter lock */ assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; if(!P_vfont) { P_vfont = PyImport_ImportModule("pymol.vfont"); @@ -1300,15 +1300,15 @@ ov_status PCacheGet(PyMOLGlobals * G, ov_status status = OV_STATUS_NO; if(G->P_inst->cache) { - PyObject *entry = NULL; - PyObject *output = NULL; + PyObject *entry = nullptr; + PyObject *output = nullptr; if(OV_OK(CacheCreateEntry(&entry, input))) { output = PYOBJECT_CALLMETHOD(G->P_inst->cmd, "_cache_get", "OOO", entry, Py_None, G->P_inst->cmd); if(output == Py_None) { Py_DECREF(output); - output = NULL; + output = nullptr; } else { status = OV_STATUS_YES; } @@ -1337,7 +1337,7 @@ void PSleepWhileBusy(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; #else @@ -1359,7 +1359,7 @@ void PSleepUnlocked(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; #else @@ -1382,7 +1382,7 @@ void PSleep(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; PLockAPIAsGlut(G, true); @@ -1423,10 +1423,10 @@ static WrapperObject * WrapperObjectNew() { auto wobj = static_cast( PyType_GenericNew(&Wrapper_Type, Py_None, Py_None)); - wobj->dict = NULL; - wobj->settingWrapperObject = NULL; + wobj->dict = nullptr; + wobj->settingWrapperObject = nullptr; #ifdef _PYMOL_IP_PROPERTIES - wobj->propertyWrapperObject = NULL; + wobj->propertyWrapperObject = nullptr; #endif return wobj; } @@ -1655,7 +1655,7 @@ int PLockAPIAsGlut(PyMOLGlobals * G, int block_if_busy) PUnblock(G); tv.tv_sec = 0; tv.tv_usec = 50000; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PBlock(G); } #else @@ -1904,7 +1904,7 @@ void PInit(PyMOLGlobals * G, int global_instance) G->P_inst->exec = PGetAttrOrFatal(P_pymol, "exec_str"); if(global_instance) { - PCatch_install(NULL, NULL); + PCatch_install(NULL, nullptr); } P_traceback = PImportModuleOrFatal("traceback"); @@ -1999,7 +1999,7 @@ void PInit(PyMOLGlobals * G, int global_instance) Wrapper_Type.tp_basicsize = sizeof(WrapperObject); Wrapper_Type.tp_dealloc = &WrapperObjectDealloc; Wrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; - wrapperMappingMethods.mp_length = NULL; + wrapperMappingMethods.mp_length = nullptr; wrapperMappingMethods.mp_subscript = &WrapperObjectSubScript; wrapperMappingMethods.mp_ass_subscript = &WrapperObjectAssignSubScript; Wrapper_Type.tp_as_mapping = &wrapperMappingMethods; @@ -2008,7 +2008,7 @@ void PInit(PyMOLGlobals * G, int global_instance) settingWrapper_Type.tp_basicsize = sizeof(SettingPropertyWrapperObject); settingWrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; settingWrapper_Type.tp_iter = &SettingWrapperObjectIter; - settingMappingMethods.mp_length = NULL; + settingMappingMethods.mp_length = nullptr; settingMappingMethods.mp_subscript = &SettingWrapperObjectSubScript; settingMappingMethods.mp_ass_subscript = &SettingWrapperObjectAssignSubScript; settingWrapper_Type.tp_as_mapping = &settingMappingMethods; @@ -2633,7 +2633,7 @@ static PyMethodDef PCatch_methods[] = { {"flush", PCatchFlush, METH_VARARGS}, {"isatty", PCatchIsAtty, METH_VARARGS}, // called by pip.main(["install", "..."]) {"_install", PCatch_install, METH_VARARGS}, - {NULL, NULL} /* sentinel */ + {NULL, nullptr} /* sentinel */ }; void PCatchInit(void) @@ -2641,7 +2641,7 @@ void PCatchInit(void) assert(PyGILState_Check()); static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "pcatch", NULL, -1, PCatch_methods }; + "pcatch", nullptr, -1, PCatch_methods }; PyObject * pcatch = PyModule_Create(&moduledef); if (pcatch) { PyDict_SetItemString(PyImport_GetModuleDict(), "pcatch", pcatch); diff --git a/layer1/P.h b/layer1/P.h index 9916efbaf..4a2338926 100644 --- a/layer1/P.h +++ b/layer1/P.h @@ -180,7 +180,7 @@ PyObject *PXIncRef(PyObject * obj); /** * Like `Py_INCREF` but returns the input argument for convenience. - * Does not accept NULL, unlike `PXIncRef`. + * Does not accept nullptr, unlike `PXIncRef`. */ inline PyObject* PIncRef(PyObject* obj) { diff --git a/layer1/PConv.cpp b/layer1/PConv.cpp index 9b4d6dca6..76173f257 100644 --- a/layer1/PConv.cpp +++ b/layer1/PConv.cpp @@ -37,7 +37,7 @@ Z* ------------------------------------------------------------------- */ PyObject *PConvPickleLoads(PyObject * str) { - PyObject *picklemod = NULL, *obj = NULL; + PyObject *picklemod = nullptr, *obj = nullptr; ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name)); obj = PYOBJECT_CALLMETHOD(picklemod, "loads", "O", str); ok_except1: @@ -50,7 +50,7 @@ PyObject *PConvPickleLoads(PyObject * str) */ PyObject *PConvPickleDumps(PyObject * obj) { - PyObject *picklemod = NULL, *str = NULL; + PyObject *picklemod = nullptr, *str = nullptr; ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name)); str = PYOBJECT_CALLMETHOD(picklemod, "dumps", "Oi", obj, 1); ok_except1: @@ -62,7 +62,7 @@ PyObject *PConvAutoNone(PyObject * result) { /* automatically own Py_None */ if(result == Py_None) Py_INCREF(result); - else if(result == NULL) { + else if(result == nullptr) { result = Py_None; Py_INCREF(result); } @@ -523,7 +523,7 @@ int PConvPyListToFloatArrayImpl(PyObject * obj, float **f, bool as_vla) int ok = true; float *ff; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if (PyBytes_Check(obj)){ // binary_dump @@ -539,7 +539,7 @@ int PConvPyListToFloatArrayImpl(PyObject * obj, float **f, bool as_vla) auto strval = PyBytes_AsSomeString(obj); memcpy(*f, strval.data(), slen); } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = (int) PyList_Size(obj); @@ -568,13 +568,13 @@ int PConvPyListToFloatVLANoneOkay(PyObject * obj, float **f) float *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if(obj == Py_None) { - *f = NULL; + *f = nullptr; ok = true; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -599,10 +599,10 @@ int PConvPyList3ToFloatVLA(PyObject * obj, float **f) PyObject *triple; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -636,10 +636,10 @@ int PConvPyListToDoubleArray(PyObject * obj, double **f) double *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; l = 0; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -661,7 +661,7 @@ int PConvPyListToIntArrayImpl(PyObject * obj, int **f, bool as_vla) int *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if (PyBytes_Check(obj)){ // binary_dump @@ -677,7 +677,7 @@ int PConvPyListToIntArrayImpl(PyObject * obj, int **f, bool as_vla) auto strval = PyBytes_AsSomeString(obj); memcpy(*f, strval.data(), slen); } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -703,9 +703,9 @@ ov_status PConvPyTupleToIntVLA(int **result, PyObject * tuple) { ov_status status = OV_STATUS_FAILURE; if(!(tuple && PyTuple_Check(tuple))) { - *result = NULL; + *result = nullptr; } else { - int *vla = NULL; + int *vla = nullptr; ov_size size = PyTuple_Size(tuple); vla = VLAlloc(int, size); if(vla) { @@ -724,9 +724,9 @@ ov_status PConvPyTupleToFloatVLA(float **result, PyObject * tuple) { ov_status status = OV_STATUS_FAILURE; if(!(tuple && PyTuple_Check(tuple))) { - *result = NULL; + *result = nullptr; } else { - float *vla = NULL; + float *vla = nullptr; ov_size size = PyTuple_Size(tuple); vla = VLAlloc(float, size); if(vla) { @@ -962,7 +962,7 @@ PyObject *PConvFloatArrayToPyList(const float *f, int l, bool dump_binary) PyObject *PConvFloatArrayToPyListNullOkay(const float *f, int l) { int a; - PyObject *result = NULL; + PyObject *result = nullptr; if(f) { result = PyList_New(l); for(a = 0; a < l; a++) @@ -983,7 +983,7 @@ PyObject *PConvDoubleArrayToPyList(const double *f, int l) PyObject *PConvFloatVLAToPyList(const float *f) { int a, l; - PyObject *result = NULL; + PyObject *result = nullptr; l = VLAGetSize(f); result = PyList_New(l); for(a = 0; a < l; a++) { @@ -994,7 +994,7 @@ PyObject *PConvFloatVLAToPyList(const float *f) PyObject *PConvFloatVLAToPyTuple(float *vla) { - PyObject *result = NULL; + PyObject *result = nullptr; if(vla) { ov_size size = VLAGetSize(vla); result = PyTuple_New(size); @@ -1011,7 +1011,7 @@ PyObject *PConvFloatVLAToPyTuple(float *vla) PyObject *PConvIntVLAToPyList(const int *f) { int a, l; - PyObject *result = NULL; + PyObject *result = nullptr; l = VLAGetSize(f); result = PyList_New(l); for(a = 0; a < l; a++) @@ -1021,7 +1021,7 @@ PyObject *PConvIntVLAToPyList(const int *f) PyObject *PConvIntVLAToPyTuple(int *vla) { - PyObject *result = NULL; + PyObject *result = nullptr; if(vla) { ov_size size = VLAGetSize(vla); result = PyTuple_New(size); @@ -1103,7 +1103,7 @@ PyObject *PConvStringVLAToPyList(const char *vla) { int a, c, n = 0; const char *p; - PyObject *result = NULL; + PyObject *result = nullptr; p = vla; c = VLAGetSize(vla); while(c--) { /* count strings */ @@ -1127,7 +1127,7 @@ PyObject *PConvStringVLAToPyList(const char *vla) int PConvPyListToStringVLA(PyObject * obj, char **vla_ptr) { int a, l, ll; - char *vla = NULL, *q; + char *vla = nullptr, *q; PyObject *i; if(obj) if(PyList_Check(obj)) { diff --git a/layer1/PConv.h b/layer1/PConv.h index 21e5f5975..6aacec94c 100644 --- a/layer1/PConv.h +++ b/layer1/PConv.h @@ -90,7 +90,7 @@ Z* ------------------------------------------------------------------- /* NOTE: the string routines will write strings up to the specified - * length, PLUS a NULL...so watch out for array overruns */ + * length, PLUS a nullptr...so watch out for array overruns */ int PConvAttrToStrMaxLen(PyObject * obj, const char *attr, char *str, ov_size ll); @@ -151,7 +151,7 @@ int PConvPyObjectToChar(PyObject * object, char *value); /* NOTE: the string routines will write strings up to the specified - * length, PLUS a NULL...so watch out for array overruns */ + * length, PLUS a nullptr...so watch out for array overruns */ int PConvPyObjectToStrMaxLen(PyObject * object, char *value, int ln); int PConvPyObjectToStrMaxClean(PyObject * object, char *value, int ln); diff --git a/layer1/Picking.cpp b/layer1/Picking.cpp index bce1feedc..11a4a61b2 100644 --- a/layer1/Picking.cpp +++ b/layer1/Picking.cpp @@ -187,7 +187,7 @@ void PickColorManager::colorNext(unsigned char* color, /** * Get identifier for the 1-based picking color index. - * Returns NULL if the index is out of bounds. + * Returns nullptr if the index is out of bounds. */ const Picking* PickColorManager::getIdentifier(unsigned index) const { diff --git a/layer1/Pop.cpp b/layer1/Pop.cpp index eea647730..9a98d3f8d 100644 --- a/layer1/Pop.cpp +++ b/layer1/Pop.cpp @@ -58,7 +58,7 @@ void PopFree(PyMOLGlobals * G) /*========================================================================*/ int PopInit(PyMOLGlobals * G) { - CPop *I = NULL; + CPop *I = nullptr; if((I = (G->Pop = new CPop(G)))) { I->active = false; diff --git a/layer1/PyMOLObject.cpp b/layer1/PyMOLObject.cpp index caf8b2975..969fdeefe 100644 --- a/layer1/PyMOLObject.cpp +++ b/layer1/PyMOLObject.cpp @@ -63,11 +63,11 @@ int ObjectMotionGetLength(pymol::CObject *I) void ObjectMotionReinterpolate(pymol::CObject *I) { - float power = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_power); - float bias = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_bias); - int simple = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_motion_simple); - float linear = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_linear); - int hand = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_motion_hand); + float power = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_power); + float bias = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_bias); + int simple = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_motion_simple); + float linear = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_linear); + int hand = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_motion_hand); /* int ObjectMotion(pymol::CObject * I, int action, int first, @@ -206,7 +206,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, ViewElemSmooth(I->ViewElem + first, I->ViewElem + last, window, wrap); } } - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_movie_auto_interpolate)){ + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_movie_auto_interpolate)){ action = 3; /* reinterpolate */ last = save_last; } @@ -287,7 +287,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, case 2: /* interpolate & reinterpolate */ case 3: { - CViewElem *first_view = NULL, *last_view = NULL; + CViewElem *first_view = nullptr, *last_view = nullptr; int view_found = false; if(first < 0) @@ -389,7 +389,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, power, bias, simple, linear, hand, 0.0F); } first_view = last_view; - last_view = NULL; + last_view = nullptr; } } } @@ -457,10 +457,10 @@ void ObjectAdjustStateRebuildRange(pymol::CObject * I, int *start, int *stop) { /* on entry, start and stop should hold the valid range for the object */ int defer_builds_mode = - SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_defer_builds_mode); - int async_builds = SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_async_builds); - int max_threads = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_max_threads); - int all_states = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_all_states); + SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_defer_builds_mode); + int async_builds = SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_async_builds); + int max_threads = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_max_threads); + int all_states = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_all_states); int dummy; if (all_states) return; @@ -625,7 +625,7 @@ void ObjectMakeValidName(PyMOLGlobals * G, char *name, bool quiet) /** * Get a pointer to an object state. * @param state State (0-indexed) or -2/-3 for current state - * @return NULL if state is out of bounds or empty + * @return nullptr if state is out of bounds or empty */ CObjectState* pymol::CObject::getObjectState(int state) { @@ -672,7 +672,7 @@ int ObjectGetCurrentState(const pymol::CObject * I, int ignore_all_states) // object-level state=0 (all states) if (!ignore_all_states && - SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states)) + SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states)) return -1; return std::max(-1, I->getCurrentState()); @@ -680,7 +680,7 @@ int ObjectGetCurrentState(const pymol::CObject * I, int ignore_all_states) PyObject *ObjectAsPyList(const pymol::CObject * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(14); PyList_SetItem(result, 0, PyInt_FromLong(I->type)); PyList_SetItem(result, 1, PyString_FromString(I->Name)); @@ -712,7 +712,7 @@ int ObjectFromPyList(PyMOLGlobals * G, PyObject * list, pymol::CObject * I) int ll = 0; I->G = G; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -758,7 +758,7 @@ int ObjectFromPyList(PyMOLGlobals * G, PyObject * list, pymol::CObject * I) PyObject *tmp; int nFrame; VLAFreeP(I->ViewElem); - I->ViewElem = NULL; + I->ViewElem = nullptr; if(ok) ok = PConvPyIntToInt(PyList_GetItem(list, 12), &nFrame); if(ok && nFrame) { @@ -794,7 +794,7 @@ int ObjectCopyHeader(pymol::CObject * I, const pymol::CObject * src) for(a = 0; a < 16; a++) I->TTT[a] = src->TTT[a]; } - I->ViewElem = NULL; /* to do */ + I->ViewElem = nullptr; /* to do */ return (ok); } @@ -819,7 +819,7 @@ void ObjectCombineTTT(pymol::CObject * I, const float *ttt, int reverse_order, i combineTTT44f44f(ttt, cpy, I->TTT); } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -850,7 +850,7 @@ void ObjectTranslateTTT(pymol::CObject * I, const float *v, int store) I->TTT[11] += v[2]; } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -879,7 +879,7 @@ void ObjectSetTTT(pymol::CObject * I, const float *ttt, int state, int store) return; } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -905,7 +905,7 @@ int ObjectGetTTT(pymol::CObject * I, const float **ttt, int state) *ttt = I->TTT; return 1; } else { - *ttt = NULL; + *ttt = nullptr; } } else { @@ -920,7 +920,7 @@ void ObjectResetTTT(pymol::CObject * I,int store) I->TTTFlag = false; if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -983,7 +983,7 @@ int ObjectGetTotalMatrix(pymol::CObject * I, int state, int history, double *mat /*========================================================================*/ void ObjectPrepareContext(pymol::CObject * I, RenderInfo * info) { - CRay * ray = info ? info->ray : NULL; + CRay * ray = info ? info->ray : nullptr; if(I->ViewElem) { int frame = SceneGetFrame(I->G); @@ -1390,7 +1390,7 @@ void ObjectStateResetMatrix(CObjectState* I) PyObject *ObjectStateAsPyList(CObjectState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(1); @@ -1413,7 +1413,7 @@ int ObjectStateFromPyList(PyMOLGlobals * G, PyObject * list, CObjectState * I) if(list && (list != Py_None)) { /* allow None */ if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... diff --git a/layer1/PyMOLObject.h b/layer1/PyMOLObject.h index 0ca97deab..33d907464 100644 --- a/layer1/PyMOLObject.h +++ b/layer1/PyMOLObject.h @@ -100,7 +100,7 @@ struct CObject { CObject(PyMOLGlobals* G); /// @pre `0 <= state && state < getNFrame()` - /// @return NULL if state is empty (not active) + /// @return nullptr if state is empty (not active) virtual CObjectState* _getObjectState(int state) { return nullptr; } public: diff --git a/layer1/Ray.cpp b/layer1/Ray.cpp index 101e08dc7..be9ba6e04 100644 --- a/layer1/Ray.cpp +++ b/layer1/Ray.cpp @@ -358,7 +358,7 @@ static void fill_background_image(CRay * I, unsigned int *buffer, int width, int if(opaque_back < 0) opaque_back = SettingGetGlobal_i(I->G, cSetting_opaque_background); - tmpf = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + tmpf = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); mult3f(tmpf, 255.f, bg_rgb); if(opaque_back) { @@ -1653,7 +1653,7 @@ static VectorHash *VectorHash_New(void) I->elem = VLACalloc(VectorHashElem, 100); if(!I->elem) { VectorHash_Free(I); - I = NULL; + I = nullptr; } } return I; @@ -1752,7 +1752,7 @@ static void unique_vector_add(VectorHash * vh, float *vector, int *index_array, int *index_count) { int index = *vector_count; - switch (VectorHash_GetOrSetKeyValue(vh, vector, NULL, &index)) { + switch (VectorHash_GetOrSetKeyValue(vh, vector, nullptr, &index)) { case 1: { float *vector_slot = vector_array + 3 * (*vector_count); @@ -2218,7 +2218,7 @@ void RayRenderIDTF(CRay * I, char **node_vla, char **rsrc_vla) int mesh_cnt = 0; IdtfResourceMesh *mesh_vla = VLACalloc(IdtfResourceMesh, 1); if(mesh_vla) { - IdtfResourceMesh *mesh = NULL; + IdtfResourceMesh *mesh = nullptr; int a; for(a = 0; a < I->NPrimitive; a++) { @@ -2242,14 +2242,14 @@ void RayRenderIDTF(CRay * I, char **node_vla, char **rsrc_vla) ) { mesh_cnt++; } else { - mesh = NULL; + mesh = nullptr; } } } break; default: /* close/terminate mesh */ if(mesh) { - mesh = NULL; + mesh = nullptr; } break; } @@ -2591,7 +2591,7 @@ void RayRenderPOV(CRay * I, int width, int height, char **headerVLA_ptr, if(antialias < 0) antialias = SettingGetGlobal_i(I->G, cSetting_antialias); - bkrd = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + bkrd = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); RayExpandPrimitives(I); RayTransformFirst(I, 0, identity); @@ -3272,7 +3272,7 @@ int RayTraceThread(CRayThreadInfo * T) const float *tmpf; int chromadepth; - tmpf = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + tmpf = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); mult3f(tmpf, 255.f, bg_rgb); /* MemoryDebugDump(); @@ -3449,7 +3449,7 @@ int RayTraceThread(CRayThreadInfo * T) if(I->NBasis > 2) bp2 = I->Basis + 2; else - bp2 = NULL; + bp2 = nullptr; render_height = T->y_stop - T->y_start; @@ -5519,7 +5519,7 @@ extern int n_sausages; extern int n_skipped; #endif -float *rayDepthPixels = NULL; +float *rayDepthPixels = nullptr; int rayVolume = 0, rayWidth = 0, rayHeight = 0; /*========================================================================*/ @@ -5527,7 +5527,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, float angle, int antialias, unsigned int *return_bg) { int a, x, y; - unsigned int *image_copy = NULL; + unsigned int *image_copy = nullptr; unsigned int back_mask, fore_mask = 0, trace_word = 0; unsigned int background; size_t buffer_size; @@ -5544,7 +5544,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, int perspective = SettingGetGlobal_i(I->G, cSetting_ray_orthoscopic); int n_light = SettingGetGlobal_i(I->G, cSetting_light_count); float ambient; - float *depth = NULL; + float *depth = nullptr; float front = I->Volume[4]; float back = I->Volume[5]; float fov = I->Fov; @@ -5630,7 +5630,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, ambient = SettingGetGlobal_f(I->G, cSetting_ambient); bkrd_is_gradient = SettingGetGlobal_b(I->G, cSetting_bg_gradient); - bg_image_filename = SettingGet_s(I->G, NULL, NULL, cSetting_bg_image_filename); + bg_image_filename = SettingGet_s(I->G, nullptr, nullptr, cSetting_bg_image_filename); I->bkgrd_data = OrthoBackgroundDataGet(*I->G->Ortho); if (!I->bkgrd_data && bg_image_filename && bg_image_filename[0]){ I->bkgrd_data = MyPNGRead(bg_image_filename); @@ -5644,12 +5644,12 @@ void RayRender(CRay * I, unsigned int *image, double timing, bkrd_is_gradient = 0; } if (bkrd_is_gradient){ - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb_top)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb_top)); copy3f(bkrd_ptr, bkrd_top); - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb_bottom)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb_bottom)); copy3f(bkrd_ptr, bkrd_bottom); } else { - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); copy3f(bkrd_ptr, bkrd_top); copy3f(bkrd_ptr, bkrd_bottom); } @@ -5917,7 +5917,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, thread_info[bc - 1].vert2prim = vert2prim_ptr; thread_info[bc - 1].prim = I->Primitive; thread_info[bc - 1].n_prim = I->NPrimitive; - thread_info[bc - 1].clipBox = NULL; + thread_info[bc - 1].clipBox = nullptr; thread_info[bc - 1].phase = bc - 1; thread_info[bc - 1].perspective = false; thread_info[bc - 1].front = _0; @@ -5945,7 +5945,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, float factor = SettingGetGlobal_f(I->G, cSetting_ray_hint_shadow); for(bc = 2; ok && bc < I->NBasis; bc++) { ok &= BasisMakeMap(I->Basis + bc, vert2prim_ptr, I->Primitive, I->NPrimitive, - NULL, bc - 1, cCache_ray_map, false, _0, I->PrimSize * factor); + nullptr, bc - 1, cCache_ray_map, false, _0, I->PrimSize * factor); } } @@ -6097,7 +6097,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, rt[a].background = background; rt[a].phase = a; rt[a].n_thread = n_thread; - rt[a].edging = NULL; + rt[a].edging = nullptr; rt[a].edging_cutoff = oversample_cutoff; /* info needed for busy indicator */ rt[a].perspective = perspective; rt[a].fov = fov; @@ -7519,7 +7519,7 @@ CRay *RayNew(PyMOLGlobals * G, int antialias) BasisInit(I->G, I->Basis, 0); BasisInit(I->G, I->Basis + 1, 1); I->NBasis = 2; - I->Primitive = NULL; + I->Primitive = nullptr; I->NPrimitive = 0; I->CheckInterior = false; if(antialias < 0) @@ -7531,7 +7531,7 @@ CRay *RayNew(PyMOLGlobals * G, int antialias) I->Random[a] = (float) ((rand() / (1.0 + RAND_MAX)) - 0.5); } - I->Wobble = SettingGet_i(I->G, NULL, NULL, cSetting_ray_texture); + I->Wobble = SettingGet_i(I->G, nullptr, nullptr, cSetting_ray_texture); { auto v = SettingGet(I->G, cSetting_ray_texture_settings); int color = SettingGetGlobal_color(I->G, cSetting_ray_interior_color); diff --git a/layer1/Rep.cpp b/layer1/Rep.cpp index 214a7c958..68b029563 100644 --- a/layer1/Rep.cpp +++ b/layer1/Rep.cpp @@ -59,7 +59,7 @@ Rep* Rep::rebuild() /*========================================================================*/ /** * Rebuild if necessary (according to invalidation status). Returns either this - * instance, or deletes this instance and returns a new one, or NULL if the rep + * instance, or deletes this instance and returns a new one, or nullptr if the rep * became empty/inactive. */ Rep* Rep::update() diff --git a/layer1/Scene.cpp b/layer1/Scene.cpp index faffdfd4d..646e5a46d 100644 --- a/layer1/Scene.cpp +++ b/layer1/Scene.cpp @@ -360,7 +360,7 @@ void ScenePrimeAnimation(PyMOLGlobals * G) if(G->HaveGUI) { CScene *I = G->Scene; UtilZeroMem(I->ani_elem, sizeof(CViewElem)); - SceneToViewElem(G, I->ani_elem, NULL); + SceneToViewElem(G, I->ani_elem, nullptr); I->ani_elem[0].specification_level = 2; I->n_ani_elem = 0; } @@ -435,7 +435,7 @@ void SceneLoadAnimation(PyMOLGlobals * G, double duration, int hand) if(target > MAX_ANI_ELEM) target = MAX_ANI_ELEM; UtilZeroMem(I->ani_elem + 1, sizeof(CViewElem) * target); - SceneToViewElem(G, I->ani_elem + target, NULL); + SceneToViewElem(G, I->ani_elem + target, nullptr); I->ani_elem[target].specification_level = 2; now = UtilGetSeconds(G); I->ani_elem[0].timing_flag = true; @@ -1168,7 +1168,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ switch (sdof_mode) { case SDOF_NORMAL_MODE: if((x != 0.0F) || (y != 0.0F)) { - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; I->m_view.translate(x * factor, y * factor, 0.0f); invalidate = true; @@ -1187,7 +1187,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ break; case SDOF_CLIP_MODE: if((x != 0.0F) || (y != 0.0F)) { - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; I->m_view.translate(x * factor, y * factor, 0.0f); invalidate = true; @@ -1214,7 +1214,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ { /* when dragging, we treat all axes proportionately */ - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; x *= factor; y *= factor; @@ -1228,8 +1228,8 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v2, v2); - EditorDrag(G, NULL, -1, cButModeMovDrag, - SettingGetGlobal_i(G, cSetting_state) - 1, NULL, v2, NULL); + EditorDrag(G, nullptr, -1, cButModeMovDrag, + SettingGetGlobal_i(G, cSetting_state) - 1, nullptr, v2, nullptr); } break; } @@ -1300,8 +1300,8 @@ void SceneRotateScaled(PyMOLGlobals * G, float rx, float ry, float rz, int sdof_ /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), axis, v2); - EditorDrag(G, NULL, -1, cButModeRotDrag, - SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, NULL); + EditorDrag(G, nullptr, -1, cButModeRotDrag, + SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, nullptr); invalidate = true; } } @@ -1396,14 +1396,14 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char case SceneClipMode::Slab: if(sele[0]) { if(!ExecutiveGetExtent(G, sele, mn, mx, true, state, false)) - sele = NULL; + sele = nullptr; else { average3f(mn, mx, cent); /* get center of selection */ subtract3f(cent, glm::value_ptr(I->m_view.origin()), v0); /* how far from origin? */ MatrixTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v0, offset); /* convert to view-space */ } } else { - sele = NULL; + sele = nullptr; } avg = (I->m_view.m_clip().m_front + I->m_view.m_clip().m_back) / 2.0F; movement /= 2.0F; @@ -1425,7 +1425,7 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char SceneClipSet(G, -pos.z - movement, -pos.z + movement); } else { if(!ExecutiveGetCameraExtent(G, sele, mn, mx, true, state)) - sele = NULL; + sele = nullptr; if(sele) { if(sele[0]) { average3f(mn, mx, cent); /* get center of selection */ @@ -1434,7 +1434,7 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char subtract3f(mn, origin, mn); /* how far from origin? */ SceneClipSet(G, -pos.z - mx[2] - movement, -pos.z - mn[2] + movement); } else { - sele = NULL; + sele = nullptr; } } } @@ -1843,7 +1843,7 @@ static int SceneMakeSizedImage(PyMOLGlobals * G, int width, int height, int anti * * Modifies `G->Scene->Image`. * - * @param prior_only Return NULL if there is no prior image (`G->Scene->Image` is NULL) + * @param prior_only Return nullptr if there is no prior image (`G->Scene->Image` is nullptr) * @return The scene image */ pymol::Image* SceneImagePrepare(PyMOLGlobals* G, bool prior_only) @@ -2287,7 +2287,7 @@ int SceneMakeMovieImage(PyMOLGlobals * G, switch (mode) { case cSceneImage_Ray: SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, show_timing, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, show_timing, -1); break; case cSceneImage_Draw: SceneMakeSizedImage(G, width, height, SettingGetGlobal_i(G, cSetting_antialias)); @@ -3028,7 +3028,7 @@ int SceneDrawImageOverlay(PyMOLGlobals * G, int override , CGO *orthoCGO){ if(((!text) || overlay) && (override || I->CopyType == true) && I->Image && !I->Image->empty()) { /* show transparent bg as checkboard? */ int show_alpha = SettingGetGlobal_b(G, cSetting_show_alpha_checker); - const float *bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); unsigned int bg_rr, bg_r = (unsigned int) (255 * bg_color[0]); unsigned int bg_gg, bg_g = (unsigned int) (255 * bg_color[1]); unsigned int bg_bb, bg_b = (unsigned int) (255 * bg_color[2]); @@ -3373,7 +3373,7 @@ void SceneDoRoving(PyMOLGlobals * G, float old_front, float old_back, float old_origin, int adjust_flag, int zoom_flag) { - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if(SettingGetGlobal_b(G, cSetting_roving_origin)) { CScene *I = G->Scene; @@ -3530,7 +3530,7 @@ bool SceneGetVisible(PyMOLGlobals * G, const float *v1) /** * Get the depth (camera space Z) of v1 * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetRawDepth(PyMOLGlobals * G, const float *v1) { @@ -3551,7 +3551,7 @@ float SceneGetRawDepth(PyMOLGlobals * G, const float *v1) * Get the depth (camera space Z) of v1 in normalized clip space * from 0.0 (near) to 1.0 (far) * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetDepth(PyMOLGlobals * G, const float *v1) { @@ -3562,10 +3562,10 @@ float SceneGetDepth(PyMOLGlobals * G, const float *v1) /*========================================================================*/ /** - * Get the angstrom per pixel factor at v1. If v1 is NULL, return the + * Get the angstrom per pixel factor at v1. If v1 is nullptr, return the * factor at the origin, but clamped to an empirical positive value. * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetScreenVertexScale(PyMOLGlobals * G, const float *v1) @@ -3597,7 +3597,7 @@ static void SceneRovingCleanup(PyMOLGlobals * G) I->RovingCleanupFlag = false; - s = SettingGet_s(G, NULL, NULL, cSetting_roving_selection); + s = SettingGet_s(G, nullptr, nullptr, cSetting_roving_selection); sprintf(buffer, "cmd.hide('lines','''%s''')", s); PParse(G, buffer); @@ -3648,7 +3648,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) if(I->RovingCleanupFlag) SceneRovingCleanup(G); - s = SettingGet_s(G, NULL, NULL, cSetting_roving_selection); + s = SettingGet_s(G, nullptr, nullptr, cSetting_roving_selection); sticks = SettingGetGlobal_f(G, cSetting_roving_sticks); lines = SettingGetGlobal_f(G, cSetting_roving_lines); labels = SettingGetGlobal_f(G, cSetting_roving_labels); @@ -3816,7 +3816,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) auto_save = SettingGetGlobal_i(G, cSetting_auto_zoom); SettingSetGlobal_i(G, cSetting_auto_zoom, 0); - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map1_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map1_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3829,7 +3829,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map2_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map2_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3842,7 +3842,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map3_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map3_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3863,7 +3863,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) auto_save = SettingGetGlobal_i(G, cSetting_auto_zoom); SettingSetGlobal_i(G, cSetting_auto_zoom, 0); - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map1_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map1_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3876,7 +3876,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map2_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map2_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3889,7 +3889,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map3_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map3_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3964,7 +3964,7 @@ bool call_raw_image_callback(PyMOLGlobals * G) { * @param dpi dots per inch * @param format ?? * @param quiet if true, don't print messages - * @param out_img if not NULL, store the image data here + * @param out_img if not nullptr, store the image data here * @param filename if not empty, store the image to this file as PNG */ @@ -4127,7 +4127,7 @@ int SceneReinitialize(PyMOLGlobals * G) /*========================================================================*/ int SceneInit(PyMOLGlobals * G) { - CScene *I = NULL; + CScene *I = nullptr; I = (G->Scene = new CScene(G)); if(I) { assert(!I->RovingDirtyFlag); @@ -4697,11 +4697,11 @@ void SceneUpdate(PyMOLGlobals * G, int force) for ( auto it = I->Obj.begin(); it != I->Obj.end(); ++it) { if ((*it)->type != cObjectMolecule || force || defer_builds_mode != 5) { int static_singletons = - SettingGet_b(G, (*it)->Setting.get(), NULL, cSetting_static_singletons); + SettingGet_b(G, (*it)->Setting.get(), nullptr, cSetting_static_singletons); int async_builds = - SettingGet_b(G, (*it)->Setting.get(), NULL, cSetting_async_builds); + SettingGet_b(G, (*it)->Setting.get(), nullptr, cSetting_async_builds); int max_threads = - SettingGet_i(G, (*it)->Setting.get(), NULL, cSetting_max_threads); + SettingGet_i(G, (*it)->Setting.get(), nullptr, cSetting_max_threads); int nFrame = 0; nFrame = (*it)->getNFrame(); if((nFrame > 1) || (!static_singletons)) { @@ -4775,11 +4775,11 @@ int SceneRenderCached(PyMOLGlobals * G) auto show_progress = SettingGet(G, cSetting_show_progress); SettingSetGlobal_i(G, cSetting_show_progress, 0); SceneRay(G, 0, 0, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, false, -1); SettingSetGlobal_i(G,cSetting_show_progress, show_progress); } else if(moviePlaying && SettingGetGlobal_b(G, cSetting_ray_trace_frames)) { SceneRay(G, 0, 0, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, true, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, true, -1); } else if((moviePlaying && SettingGetGlobal_b(G, cSetting_draw_frames)) || (draw_mode == 2)) { SceneMakeSizedImage(G, 0, 0, SettingGetGlobal_i(G, cSetting_antialias)); } else if(I->CopyType == true) { /* true vs. 2 */ @@ -5312,7 +5312,7 @@ void SceneZoom(PyMOLGlobals * G, float scale){ } int SceneGetTwoSidedLighting(PyMOLGlobals * G){ - return SceneGetTwoSidedLightingSettings(G, NULL, NULL); + return SceneGetTwoSidedLightingSettings(G, nullptr, nullptr); } int SceneGetTwoSidedLightingSettings(PyMOLGlobals * G, @@ -5446,7 +5446,7 @@ void SceneTranslateSceneXYWithScale(PyMOLGlobals * G, float x, float y){ vScale = SceneGetExactScreenVertexScale(G, glm::value_ptr(I->m_view.origin())); /* if(stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); }*/ v2[0] = x * vScale; @@ -5467,7 +5467,7 @@ void SceneTranslateSceneXYWithScale(PyMOLGlobals * G, float x, float y){ moved_flag = true; } I->m_view.setPos(pos); - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if(moved_flag && SettingGetGlobal_b(G, cSetting_roving_origin)) { SceneGetCenter(G, v2); /* gets position of center of screen */ SceneOriginSet(G, v2, true); diff --git a/layer1/Scene.h b/layer1/Scene.h index 4e4440b4e..466711fb3 100644 --- a/layer1/Scene.h +++ b/layer1/Scene.h @@ -244,7 +244,7 @@ int SceneGetBackgroundColorAlreadySet(PyMOLGlobals * G); void SceneSetDoNotClearBackground(PyMOLGlobals * G, int); int SceneGetDoNotClearBackground(PyMOLGlobals * G); -void SceneProgramLighting(PyMOLGlobals * G, CShaderPrg * shaderPrg = NULL); +void SceneProgramLighting(PyMOLGlobals * G, CShaderPrg * shaderPrg = nullptr); void SceneGLClear(PyMOLGlobals * G, GLbitfield mask); #ifdef _PYMOL_IOS diff --git a/layer1/SceneMouse.cpp b/layer1/SceneMouse.cpp index 6aee75676..72d8dddfc 100644 --- a/layer1/SceneMouse.cpp +++ b/layer1/SceneMouse.cpp @@ -34,7 +34,7 @@ NamedPicking::NamedPicking(const Picking& pick) static void SceneNoteMouseInteraction(PyMOLGlobals* G) { SceneAbortAnimation(G); - if (SettingGet_b(G, NULL, NULL, cSetting_mouse_restart_movie_delay)) { + if (SettingGet_b(G, nullptr, nullptr, cSetting_mouse_restart_movie_delay)) { SceneRestartFrameTimer(G); } } @@ -113,7 +113,7 @@ void SceneClickButtonAddTo(PyMOLGlobals* G, pymol::CObject* obj, } } else { auto buf2 = pymol::string_format("%s(%s)", sel_mode_kw, buffer); - SelectorCreate(G, selName.c_str(), buf2.c_str(), NULL, false, NULL); + SelectorCreate(G, selName.c_str(), buf2.c_str(), nullptr, false, nullptr); if (obj->type == cObjectMolecule) { if (SettingGet(G, cSetting_logging)) { auto objMol = (ObjectMolecule*) obj; @@ -284,7 +284,7 @@ void SceneClickObject(PyMOLGlobals* G, pymol::CObject* obj, const NamedPicking& if (ObjectMoleculeGetAtomTxfVertex((ObjectMolecule*) obj, LastPicked.context.state, LastPicked.src.index, v1)) { EditorFavorOrigin(G, v1); - ExecutiveOrigin(G, NULL, true, NULL, v1, 0); + ExecutiveOrigin(G, nullptr, true, nullptr, v1, 0); } } if (obj->type == cObjectMolecule) { @@ -503,7 +503,7 @@ void SceneClickPickBond(PyMOLGlobals* G, int x, int y, int mode, const NamedPick { auto buffer = pymol::string_format("%s`%d", obj->Name, I->LastPicked.src.index + 1); - SelectorCreate(G, cEditorSele1, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorSele1, buffer.c_str(), nullptr, true, nullptr); } if (LastPicked.src.bond >= 0) { @@ -524,7 +524,7 @@ void SceneClickPickBond(PyMOLGlobals* G, int x, int y, int mode, const NamedPick PLog(G, buffer, cPLog_pym); } auto buffer = pymol::string_format("%s`%d", obj->Name, atIndex + 1); - SelectorCreate(G, cEditorSele2, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorSele2, buffer.c_str(), nullptr, true, nullptr); EditorActivate(G, SettingGetGlobal_i(G, cSetting_state) - 1, true); if (mode == cButModePkTorBnd) { @@ -816,7 +816,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) x = x - I->margin.left; if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); I->LastX = x; I->LastY = y; @@ -826,7 +826,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) auto obj = EditorDragObject(G); if (obj) { if (SettingGetGlobal_b(G, cSetting_movie_auto_store)) { - ObjectTranslateTTT(obj, NULL, true); + ObjectTranslateTTT(obj, nullptr, true); I->MotionGrabbedObj = obj; obj->Grabbed = true; if (SettingGetGlobal_i(G, cSetting_movie_auto_interpolate)) { @@ -834,7 +834,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) I->ReinterpolateObj = obj; } } else { - ObjectTranslateTTT(obj, NULL, false); + ObjectTranslateTTT(obj, nullptr, false); } } } @@ -857,7 +857,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) x = x - I->margin.left; if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); I->LastX = x; I->LastY = y; @@ -866,7 +866,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModePickAtom: case cButModeMenu: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -895,7 +895,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModePickBond: case cButModePkTorBnd: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { y = y - I->margin.bottom; @@ -928,7 +928,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeMoveAtom: case cButModeMoveAtomZ: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -963,7 +963,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeRotView: case cButModeMovView: { if (SettingGetGlobal_b(G, cSetting_movie_auto_store)) { - ObjectTranslateTTT(obj, NULL, true); + ObjectTranslateTTT(obj, nullptr, true); I->MotionGrabbedObj = obj; obj->Grabbed = true; if (SettingGetGlobal_i(G, cSetting_movie_auto_interpolate)) { @@ -971,7 +971,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) I->ReinterpolateObj = obj; } } else { - ObjectTranslateTTT(obj, NULL, false); + ObjectTranslateTTT(obj, nullptr, false); } } break; } @@ -1031,7 +1031,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeDragMol: case cButModeDragObj: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -1188,12 +1188,12 @@ void SceneRelease(Block* block, int button, int x, int y, int mod, double when) ObjectMotionReinterpolate(I->ReinterpolateObj); } I->ReinterpolateFlag = true; - I->ReinterpolateObj = NULL; + I->ReinterpolateObj = nullptr; } if (I->MotionGrabbedObj) { if (ExecutiveValidateObjectPtr(G, I->MotionGrabbedObj, 0)) { I->MotionGrabbedObj->Grabbed = false; - I->MotionGrabbedObj = NULL; + I->MotionGrabbedObj = nullptr; } } } @@ -1325,7 +1325,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } /* transform into model coodinate space */ @@ -1366,11 +1366,11 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) eff_width = I->Width; if (stereo_via_adjacent_array(I->StereoMode)) { eff_width = I->Width / 2; - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } virtual_trackball = - SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball); + SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball); if (virtual_trackball == 2 && (!I->prev_no_z_rotation1 || !I->prev_no_z_rotation2)) { @@ -1428,12 +1428,12 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) normalize23f(v2, n2); cross_product3f(n1, n2, cp); theta = - (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_scale) * 2 * 180 * + (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_scale) * 2 * 180 * asin(sqrt1f(cp[0] * cp[0] + cp[1] * cp[1] + cp[2] * cp[2])) / cPI); dx = (v1[0] - v2[0]); dy = (v1[1] - v2[1]); - dt = (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_limit) * + dt = (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_limit) * sqrt1f(dx * dx + dy * dy) / scale); if (theta > dt) @@ -1448,7 +1448,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), axis, v2); v1[0] = (float) (cPI * theta / 180.0); - EditorDrag(G, NULL, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, + EditorDrag(G, nullptr, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, v3); I->LastX = x; I->LastY = y; @@ -1466,7 +1466,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) copy3f(glm::value_ptr(I->m_view.origin()), v1); vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } if (mode == cButModeMovDragZ) { @@ -1487,7 +1487,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v2, v2); MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v3, v3); - EditorDrag(G, NULL, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, + EditorDrag(G, nullptr, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, v3); } I->LastX = x; @@ -1525,7 +1525,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } /* transform into model coodinate space */ @@ -1566,7 +1566,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } switch (mode) { @@ -1651,7 +1651,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } v2[0] = (x - I->LastX) * vScale; @@ -1675,7 +1675,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) /* scale properly given the current projection matrix */ vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } switch (mode) { @@ -1726,7 +1726,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, glm::value_ptr(I->m_view.origin())); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } v2[0] = (x - I->LastX) * vScale; @@ -1747,7 +1747,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) moved_flag = true; } - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if (moved_flag && SettingGetGlobal_b(G, cSetting_roving_origin)) { SceneGetCenter(G, v2); /* gets position of center of screen */ SceneOriginSet(G, v2, true); @@ -1769,11 +1769,11 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) SceneNoteMouseInteraction(G); virtual_trackball = - SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball); + SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball); eff_width = I->Width; if (stereo_via_adjacent_array(I->StereoMode)) { eff_width = I->Width / 2; - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } if (virtual_trackball == 2 && (!I->prev_no_z_rotation1 || !I->prev_no_z_rotation2)) { @@ -1805,7 +1805,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) { short r1lt, r2lt; - if (SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball) == 2) { + if (SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball) == 2) { r1lt = I->prev_no_z_rotation1; r2lt = I->prev_no_z_rotation2; } else { @@ -1835,13 +1835,13 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) normalize23f(v2, n2); cross_product3f(n1, n2, cp); theta = - (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_scale) * 2 * 180 * + (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_scale) * 2 * 180 * asin(sqrt1f(cp[0] * cp[0] + cp[1] * cp[1] + cp[2] * cp[2])) / cPI); dx = (v1[0] - v2[0]); dy = (v1[1] - v2[1]); - dt = (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_limit) * + dt = (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_limit) * sqrt1f(dx * dx + dy * dy) / scale); if (theta > dt) theta = dt; @@ -1976,7 +1976,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) pos[1] += (float) dy * ms; SettingSet_3fv(G->Setting, which_light, pos); - SettingGenerateSideEffects(G, which_light, NULL, 0, 1); + SettingGenerateSideEffects(G, which_light, nullptr, 0, 1); I->LastX = x; I->LastY = y; } break; @@ -2009,7 +2009,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) } copy3f(SettingGet(G, which_light), pos); - SettingGenerateSideEffects(G, which_light, NULL, 0, 1); + SettingGenerateSideEffects(G, which_light, nullptr, 0, 1); pos[2] -= factor * ms; diff --git a/layer1/ScenePicking.cpp b/layer1/ScenePicking.cpp index 3c03959b8..3cd559897 100644 --- a/layer1/ScenePicking.cpp +++ b/layer1/ScenePicking.cpp @@ -27,13 +27,13 @@ int SceneDoXYPick(PyMOLGlobals * G, int x, int y, ClickSide click_side) } SceneDontCopyNext(G); - I->LastPicked.context.object = NULL; + I->LastPicked.context.object = nullptr; SceneRenderInfo renderInfo{}; renderInfo.pick = &I->LastPicked; renderInfo.mousePos = Offset2D{x, y}; renderInfo.clickSide = click_side; SceneRender(G, renderInfo); - return (I->LastPicked.context.object != NULL); + return (I->LastPicked.context.object != nullptr); /* did we pick something? */ } @@ -124,7 +124,7 @@ static std::vector SceneGetPickIndices(PyMOLGlobals* G, GridSetViewport(G, &I->grid, slot); } SceneRenderAll( - G, context, NULL, &pickmgr, RenderPass::Antialias, true, 0.0F, &I->grid, 0, SceneRenderWhich::AllObjects); + G, context, nullptr, &pickmgr, RenderPass::Antialias, true, 0.0F, &I->grid, 0, SceneRenderWhich::AllObjects); } } @@ -218,11 +218,11 @@ static void SceneRenderPickingSinglePick(PyMOLGlobals* G, " SceneClick-Detail: obj %p index %d bond %d\n", pick->context.object, pick->src.index, pick->src.bond ENDFB(G); } - // if cPickableNoPick then set object to NULL since nothing picked + // if cPickableNoPick then set object to nullptr since nothing picked if (pick->src.bond == cPickableNoPick) - pick->context.object = NULL; + pick->context.object = nullptr; } else { - pick->context.object = NULL; + pick->context.object = nullptr; } #ifndef PURE_OPENGL_ES_2 diff --git a/layer1/SceneRay.cpp b/layer1/SceneRay.cpp index 857067caa..e81bd441a 100644 --- a/layer1/SceneRay.cpp +++ b/layer1/SceneRay.cpp @@ -97,13 +97,13 @@ bool SceneRay(PyMOLGlobals * G, #else CScene *I = G->Scene; - CRay *ray = NULL; + CRay *ray = nullptr; float height, width; float aspRat; float rayView[16]; double timing; - char *charVLA = NULL; - char *headerVLA = NULL; + char *charVLA = nullptr; + char *headerVLA = nullptr; float fov; int stereo_hand = 0; auto grid_mode = SettingGet(G, cSetting_grid_mode); @@ -270,7 +270,7 @@ bool SceneRay(PyMOLGlobals * G, RenderInfo info; info.ray = ray; info.ortho = ortho; - info.vertex_scale = SceneGetScreenVertexScale(G, NULL); + info.vertex_scale = SceneGetScreenVertexScale(G, nullptr); info.use_shaders = SettingGetGlobal_b(G, cSetting_use_shaders); if(SettingGetGlobal_b(G, cSetting_dynamic_width)) { @@ -282,7 +282,7 @@ bool SceneRay(PyMOLGlobals * G, } for (auto* obj : I->Obj) { - // ObjectGroup used to have fRender = NULL + // ObjectGroup used to have fRender = nullptr if (obj->type != cObjectGroup) { if(SceneGetDrawFlag(&I->grid, slot_vla, obj->grid_slot)) { float color[3]; @@ -394,7 +394,7 @@ bool SceneRay(PyMOLGlobals * G, RayRenderPOV(ray, ray_width, ray_height, &headerVLA, &charVLA, I->m_view.m_clipSafe().m_front, I->m_view.m_clipSafe().m_back, fov, angle, antialias); if(!(charVLA_ptr && headerVLA_ptr)) { /* immediate mode */ - strcpy(prefix, SettingGet_s(G, NULL, NULL, cSetting_batch_prefix)); + strcpy(prefix, SettingGet_s(G, nullptr, nullptr, cSetting_batch_prefix)); #ifndef _PYMOL_NOPY if(PPovrayRender(G, headerVLA, charVLA, prefix, ray_width, ray_height, antialias)) { @@ -791,7 +791,7 @@ void SceneRenderRayVolume(PyMOLGlobals * G, CScene *I){ glDrawPixels(rayVolumeImage->getWidth(), rayVolumeImage->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, rayVolumeImage->bits()); } else { - SceneDrawImageOverlay(G, 1, NULL); + SceneDrawImageOverlay(G, 1, nullptr); } } #endif diff --git a/layer1/SceneRender.cpp b/layer1/SceneRender.cpp index ee9f65e8c..94aec2f51 100644 --- a/layer1/SceneRender.cpp +++ b/layer1/SceneRender.cpp @@ -243,7 +243,7 @@ void SceneRender(PyMOLGlobals* G, const SceneRenderInfo& renderInfo) (stereo && stereo_mode != 0); // are we doing stereo? if (!must_render_stereo) { if (G->StereoCapable && - SettingGet(G, NULL, NULL, cSetting_stereo_double_pump_mono)) { + SettingGet(G, nullptr, nullptr, cSetting_stereo_double_pump_mono)) { /* force stereo rendering */ must_render_stereo = true; stereo_double_pump_mono = true; @@ -368,7 +368,7 @@ void SceneRender(PyMOLGlobals* G, const SceneRenderInfo& renderInfo) /* make note of how large pixels are at the origin */ - I->VertexScale = SceneGetScreenVertexScale(G, NULL); + I->VertexScale = SceneGetScreenVertexScale(G, nullptr); /* determine the direction in which we are looking relative */ @@ -596,7 +596,7 @@ void SceneRenderAA(PyMOLGlobals* G) GL_FRAMEBUFFER_EXT, G->ShaderMgr->default_framebuffer_id); if (!I->offscreenCGO) { CGO* unitCGO = GenerateUnitScreenCGO(G); - ok &= unitCGO != NULL; + ok &= unitCGO != nullptr; if (ok) { auto antialias_mode = SettingGet(G, cSetting_antialias_shader); @@ -629,11 +629,11 @@ void SceneRenderAA(PyMOLGlobals* G) CGOFreeWithoutVBOs(unitCGO); I->offscreenCGO->use_shader = true; } else { - I->offscreenCGO = NULL; + I->offscreenCGO = nullptr; } } if (ok && I->offscreenCGO) { - CGORender(I->offscreenCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenCGO, nullptr, nullptr, nullptr, nullptr, nullptr); G->ShaderMgr->Disable_Current_Shader(); glBindTexture(GL_TEXTURE_2D, 0); glEnable(GL_DEPTH_TEST); @@ -846,7 +846,7 @@ void SceneRenderAll(PyMOLGlobals* G, SceneUnitContext* context, float* normal, break; case SceneRenderWhich::OnlyNonGadgets: for (auto obj : I->NonGadgetObjs) { - // ObjectGroup used to have fRender = NULL + // ObjectGroup used to have fRender = nullptr if (obj->type != cObjectGroup) { SceneRenderAllObject( G, I, context, &info, normal, state, obj, grid, slot_vla, fat); @@ -858,7 +858,7 @@ void SceneRenderAll(PyMOLGlobals* G, SceneUnitContext* context, float* normal, for (auto obj : I->NonGadgetObjs) { /* EXPERIMENTAL RAY-VOLUME COMPOSITION CODE */ if (obj->type != - cObjectGroup && // ObjectGroup used to have fRender = NULL + cObjectGroup && // ObjectGroup used to have fRender = nullptr (!rayVolume || obj->type == cObjectVolume)) { SceneRenderAllObject( G, I, context, &info, normal, state, obj, grid, slot_vla, fat); @@ -965,7 +965,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, #ifdef PURE_OPENGL_ES_2 if (!onlySelections) { EditorRender(G, curState); - CGORender(G->DebugCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(G->DebugCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } #else if (!use_shaders) @@ -979,7 +979,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, if (!onlySelections) { if (!use_shaders) glNormal3fv(normal); - CGORender(G->DebugCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(G->DebugCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } if (!use_shaders) { glPopMatrix(); /* 1 */ @@ -994,7 +994,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, EditorRender(G, curState); } // transparency-mode == 3 render all objects for this pass - SceneRenderAll(G, context, normal, NULL, pass, false, width_scale, + SceneRenderAll(G, context, normal, nullptr, pass, false, width_scale, grid, times, SceneRenderWhich::OnlyNonGadgets); // opaque } else { #else @@ -1004,7 +1004,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, for (const auto pass2 : passes) { /* render opaque, then antialiased, then transparent... */ - SceneRenderAll(G, context, normal, NULL, pass2, false, + SceneRenderAll(G, context, normal, nullptr, pass2, false, width_scale, grid, times, SceneRenderWhich::GadgetsLast); } cont = false; @@ -1015,7 +1015,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, // background glBlendFunc_default(); - SceneRenderAll(G, context, normal, NULL, + SceneRenderAll(G, context, normal, nullptr, RenderPass::Transparent /* gadgets render in transp pass */, false, width_scale, grid, times, SceneRenderWhich::OnlyGadgets); glDisable(GL_BLEND); @@ -1074,7 +1074,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, GL_DEFAULT_SHADER_WITH_SETTINGS, GL_OIT_COPY_SHADER); I->offscreenOIT_CGO_copy->use_shader = true; } - CGORender(I->offscreenOIT_CGO_copy, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenOIT_CGO_copy, nullptr, nullptr, nullptr, nullptr, nullptr); } if (!I->offscreenOIT_CGO) { I->offscreenOIT_CGO = GenerateUnitScreenCGO(G); @@ -1082,14 +1082,14 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, GL_DEFAULT_SHADER_WITH_SETTINGS, GL_OIT_SHADER); I->offscreenOIT_CGO->use_shader = true; } - CGORender(I->offscreenOIT_CGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenOIT_CGO, nullptr, nullptr, nullptr, nullptr, nullptr); glBlendFunc_default(); if ((currentFrameBuffer == G->ShaderMgr->default_framebuffer_id) && t_mode_3) { // onlySelections and t_mode_3, render only gadgets - SceneRenderAll(G, context, normal, NULL, + SceneRenderAll(G, context, normal, nullptr, RenderPass::Transparent /* gadgets render in transp pass */, false, width_scale, grid, times, SceneRenderWhich::OnlyGadgets); } diff --git a/layer1/Seq.cpp b/layer1/Seq.cpp index c16c03394..99188279d 100644 --- a/layer1/Seq.cpp +++ b/layer1/Seq.cpp @@ -333,7 +333,7 @@ void CSeq::draw(CGO* orthoCGO) } fill_color = ColorGet(G, fill_color_index); if(unaligned_color_index < 0) { - unaligned_color = NULL; + unaligned_color = nullptr; } else { unaligned_color = ColorGet(G, unaligned_color_index); } diff --git a/layer1/Setting.cpp b/layer1/Setting.cpp index bd3382f32..7986a2f03 100644 --- a/layer1/Setting.cpp +++ b/layer1/Setting.cpp @@ -187,12 +187,12 @@ SettingUniqueEntry *SettingFindSettingUniqueEntry(PyMOLGlobals * G, int unique_i } } } - return NULL; + return nullptr; } int SettingUniqueCheck(PyMOLGlobals * G, int unique_id, int setting_id) { - return SettingFindSettingUniqueEntry(G, unique_id, setting_id) != NULL; + return SettingFindSettingUniqueEntry(G, unique_id, setting_id) != nullptr; } /** @@ -283,7 +283,7 @@ PyObject *SettingUniqueGetPyObject(PyMOLGlobals * G, int unique_id, int index) } } - return NULL; + return nullptr; } static int SettingUniqueEntry_IsSame(SettingUniqueEntry *entry, int setting_type, const void *value){ @@ -359,7 +359,7 @@ bool SettingUniqueUnset(PyMOLGlobals * G, int unique_id, int setting_id) int SettingUniqueSetTypedValue(PyMOLGlobals * G, int unique_id, int setting_id, int setting_type, const void *value) -/* set value to NULL in order to delete setting */ +/* set value to nullptr in order to delete setting */ { CSettingUnique *I = G->SettingUnique; int isset = false; @@ -793,7 +793,7 @@ PyObject *SettingUniqueAsPyList(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; CSettingUnique *I = G->SettingUnique; { auto n_entry = I->id2offset.size(); @@ -801,7 +801,7 @@ PyObject *SettingUniqueAsPyList(PyMOLGlobals * G) if(result) { n_entry = 0; for (auto id2offset : I->id2offset) { - PyObject *setting_list = NULL; + PyObject *setting_list = nullptr; auto unique_id = id2offset.first; auto offset = id2offset.second; { @@ -908,7 +908,7 @@ PyObject *SettingGetGlobalsAsPyList(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; CSetting *I = G->Setting; result = SettingAsPyList(I); return (PConvAutoNone(result)); @@ -921,11 +921,11 @@ static PyObject *get_list(CSetting * I, int index, bool incl_blacklisted) { assert(PyGILState_Check()); - PyObject *result = NULL, *value = NULL; + PyObject *result = nullptr, *value = nullptr; int setting_type = SettingInfo[index].type; if (!incl_blacklisted && is_session_blacklisted(index)) { - return NULL; + return nullptr; } switch (setting_type) { @@ -963,7 +963,7 @@ PyObject *SettingAsPyList(CSetting * I, bool incl_blacklisted) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; int a; if(I) { @@ -973,7 +973,7 @@ PyObject *SettingAsPyList(CSetting * I, bool incl_blacklisted) for(a = 0; a < cSetting_INIT; a++) { if(I->info[a].defined) { PyObject * item = get_list(I, a, incl_blacklisted); - if (item != NULL) { + if (item != nullptr) { list.push_back(item); } } @@ -1020,7 +1020,7 @@ static int set_list(CSetting * I, PyObject * list) const char * val_s; }; - if (list == NULL || CPythonVal_IsNone(list)) + if (list == nullptr || CPythonVal_IsNone(list)) return true; ok_assert(1, PyList_Check(list)); @@ -1074,9 +1074,9 @@ CSetting *SettingNewFromPyList(PyMOLGlobals * G, PyObject * list) int ok = true; ov_size size; ov_size a; - CSetting *I = NULL; + CSetting *I = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) { @@ -1103,7 +1103,7 @@ int SettingFromPyList(CSetting * I, PyObject * list) ov_size a; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = PyList_Check(list); if(ok) { @@ -1121,7 +1121,7 @@ int SettingFromPyList(CSetting * I, PyObject * list) * Get the indices of all settings that have changed since last calling * this function. Resets the "changed" flag. * - * @param name object name or NULL/"" for global settings + * @param name object name or nullptr/"" for global settings * @param state object state */ std::vector SettingGetUpdateList(PyMOLGlobals * G, const char * name, int state) @@ -1190,7 +1190,7 @@ const char * SettingGetTextPtr(PyMOLGlobals * G, const CSetting * set1, const CS int index, char *buffer) { int type; - const char *sptr = NULL; + const char *sptr = nullptr; const float *ptr; type = SettingGetType(G, index); switch (type) { @@ -1237,7 +1237,7 @@ const char * SettingGetTextPtr(PyMOLGlobals * G, const CSetting * set1, const CS case cSetting_string: return SettingGet_s(G, set1, set2, index); default: - return NULL; + return nullptr; } return buffer; } @@ -1412,7 +1412,7 @@ PyObject *SettingGetPyObject(PyMOLGlobals * G, const CSetting * set1, const CSet { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; const float *ptr; int type = SettingGetType(G, index); @@ -1455,7 +1455,7 @@ PyObject *SettingGetTuple(PyMOLGlobals * G, const CSetting * set1, const CSettin { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; const float *ptr; int type = SettingGetType(G, index); @@ -1682,7 +1682,7 @@ const char * _SettingGet(int index, const CSetting * I) default: PRINTFB(G, FB_Setting, FB_Errors) "Setting-Error: type read mismatch (string) %d\n", index ENDFB(G); - result = NULL; + result = nullptr; } return (char*) result; } @@ -1696,7 +1696,7 @@ const float * _SettingGet(int index, const CSetting * I) PyMOLGlobals *G = I->G; PRINTFB(G, FB_Setting, FB_Errors) " Setting-Error: type read mismatch (float3) %d\n", index ENDFB(G); - return NULL; + return nullptr; } return I->info[index].float3_; } @@ -2771,7 +2771,7 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i case cSetting_bg_rgb_bottom: { /* clamp this value */ - 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); if(!(bg_image_filename && bg_image_filename[0]) && SettingGetGlobal_b(G, cSetting_bg_gradient) && !OrthoBackgroundDataIsSet(*G->Ortho)) { ColorUpdateFrontFromSettings(G); @@ -2784,9 +2784,9 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i case cSetting_bg_rgb: { /* clamp this value */ - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); { - 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); if(!(bg_image_filename && bg_image_filename[0]) && !OrthoBackgroundDataIsSet(*G->Ortho)) { ColorUpdateFront(G, v); ExecutiveInvalidateRep(G, inv_sele, cRepAll, cRepInvColor); @@ -2955,7 +2955,7 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i int scaleFactor = SettingGetGlobal_i(G, cSetting_display_scale_factor); if (scaleFactor > 0) { _gScaleFactor = scaleFactor; - ExecutiveInvalidateRep(G, NULL, cRepLabel, cRepInvRep); + ExecutiveInvalidateRep(G, nullptr, cRepLabel, cRepInvRep); OrthoCommandIn(G, "viewport"); } else { SettingSetGlobal_i(G, cSetting_display_scale_factor, 1); @@ -3127,8 +3127,8 @@ int SettingCheckFontID(PyMOLGlobals * G, CSetting * set1, CSetting * set2, int f PRINTFB(G, FB_Setting, FB_Warnings) "RepLabel-Warning: GLUT labels (label_font_id 0-4) are no longer available for labelling\n the scene since they are not resizeable label_font_id=%d setting back to 5 (default) \n", font_id ENDFB(G); - if (SettingGet_i(G, set1, NULL, cSetting_label_font_id) == font_id && SettingSet_i(set1, cSetting_label_font_id, 5)){ - } else if (SettingGet_i(G, set2, NULL, cSetting_label_font_id) == font_id && SettingSet_i(set2, cSetting_label_font_id, 5)){ + if (SettingGet_i(G, set1, nullptr, cSetting_label_font_id) == font_id && SettingSet_i(set1, cSetting_label_font_id, 5)){ + } else if (SettingGet_i(G, set2, nullptr, cSetting_label_font_id) == font_id && SettingSet_i(set2, cSetting_label_font_id, 5)){ } else if (SettingGetGlobal_i(G, cSetting_label_font_id) == font_id){ SettingSetGlobal_i(G, cSetting_label_font_id, 5); }; @@ -3140,14 +3140,14 @@ int SettingCheckFontID(PyMOLGlobals * G, CSetting * set1, CSetting * set2, int f /** * State index iterator constructor, see Setting.h for documentation. * - * @param set Optional object settings (can be NULL) + * @param set Optional object settings (can be nullptr) * @param nstate Maximum number of states */ StateIterator::StateIterator( PyMOLGlobals* G, CSetting* set, StateIndex_t state_, int nstate) { if (state_ == cStateCurrent) { - state_ = SettingGet_i(G, set, NULL, cSetting_state) - 1; + state_ = SettingGet_i(G, set, nullptr, cSetting_state) - 1; } if (state_ == cStateAll) { @@ -3156,7 +3156,7 @@ StateIterator::StateIterator( } else { // given state or static singleton state = (state_ > 0 && nstate == 1 - && SettingGet_b(G, set, NULL, cSetting_static_singletons)) ? 0 : state_; + && SettingGet_b(G, set, nullptr, cSetting_static_singletons)) ? 0 : state_; end = state + 1; } diff --git a/layer1/Setting.h b/layer1/Setting.h index d5972c665..331334cdf 100644 --- a/layer1/Setting.h +++ b/layer1/Setting.h @@ -105,7 +105,7 @@ struct SettingRec { void delete_s() { if (str_) { delete str_; - str_ = NULL; + str_ = nullptr; } } }; diff --git a/layer1/Symmetry.cpp b/layer1/Symmetry.cpp index 25194dac0..b614ab2c0 100644 --- a/layer1/Symmetry.cpp +++ b/layer1/Symmetry.cpp @@ -29,7 +29,7 @@ Z* ------------------------------------------------------------------- PyObject *SymmetryAsPyList(CSymmetry * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(2); @@ -47,9 +47,9 @@ static int SymmetryFromPyList(CSymmetry * I, PyObject * list) PyObject *secondval; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -81,12 +81,12 @@ static int SymmetryFromPyList(CSymmetry * I, PyObject * list) CSymmetry *SymmetryNewFromPyList(PyMOLGlobals * G, PyObject * list) { - CSymmetry *I = NULL; + CSymmetry *I = nullptr; I = new CSymmetry(G); if(I) { if(!SymmetryFromPyList(I, list)) { delete I; - I = NULL; + I = nullptr; } } return (I); diff --git a/layer1/Text.cpp b/layer1/Text.cpp index fd31175e0..8513c5b05 100644 --- a/layer1/Text.cpp +++ b/layer1/Text.cpp @@ -404,13 +404,13 @@ void TextDrawStrAt(PyMOLGlobals * G, const char *st, int x, int y , CGO *orthoCG { CText *I = G->Text; TextSetPos3f(G, (float) x, (float) y, 0.0F); - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } void TextDrawStr(PyMOLGlobals * G, const char *st , CGO *orthoCGO) { CText *I = G->Text; - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } void TextDrawChar(PyMOLGlobals * G, char ch , CGO *orthoCGO) @@ -418,7 +418,7 @@ void TextDrawChar(PyMOLGlobals * G, char ch , CGO *orthoCGO) char st[2] = { 0, 0 }; CText *I = G->Text; st[0] = ch; - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } const char *TextRenderRay(PyMOLGlobals * G, CRay * ray, int text_id, diff --git a/layer1/TypeFace.cpp b/layer1/TypeFace.cpp index 97a95f473..750cdd415 100644 --- a/layer1/TypeFace.cpp +++ b/layer1/TypeFace.cpp @@ -162,7 +162,7 @@ float TypeFaceGetKerning(CTypeFace * I, CTypeFace *TypeFaceLoad(PyMOLGlobals * G, unsigned char *dat, unsigned int len) { - return NULL; + return nullptr; } void TypeFaceFree(CTypeFace * face) diff --git a/layer1/View.cpp b/layer1/View.cpp index 1b0d3b16f..9330494cd 100644 --- a/layer1/View.cpp +++ b/layer1/View.cpp @@ -340,9 +340,9 @@ void ViewElemArrayPurge(PyMOLGlobals * G, CViewElem * view, int nFrame) PyObject *ViewElemAsPyList(PyMOLGlobals * G, const CViewElem * view) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(21); @@ -433,7 +433,7 @@ int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) ov_size ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -483,7 +483,7 @@ int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) if(ok) ok = PConvPyIntToInt(PyList_GetItem(list, 13), &view->scene_flag); if(ok && view->scene_flag) { - const char *ptr = NULL; + const char *ptr = nullptr; view->scene_flag = false; if(PConvPyStrToStrPtr(PyList_GetItem(list, 14), &ptr)) { OVreturn_word result = OVLexicon_GetFromCString(G->Lexicon, ptr); @@ -525,15 +525,15 @@ int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt int nFrame) { int ok = true; - CViewElem *vla = NULL; + CViewElem *vla = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) ok = (PyList_Size(list) == nFrame); if(ok) - ok = ((vla = VLACalloc(CViewElem, nFrame)) != NULL); + ok = ((vla = VLACalloc(CViewElem, nFrame)) != nullptr); if(ok) { int a; for(a = 0; a < nFrame; a++) { @@ -553,10 +553,10 @@ int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt PyObject *ViewElemVLAAsPyList(PyMOLGlobals * G, const CViewElem * vla, int nFrame) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(nFrame); for(a = 0; a < nFrame; a++) { @@ -587,7 +587,7 @@ CViewIterator ViewGetIterator(CView * I) int ViewIterate(CView * I, CViewIterator * iter, CRay * ray, int at_least_once) { int result; - CViewElem *elem = NULL; + CViewElem *elem = nullptr; if((!I) || (!I->NView)) { /* trusting short-circuit to avoid segfault */ if(at_least_once) { diff --git a/layer1/Wizard.cpp b/layer1/Wizard.cpp index 9fbb9a411..6b5347ef1 100644 --- a/layer1/Wizard.cpp +++ b/layer1/Wizard.cpp @@ -195,7 +195,7 @@ void WizardRefresh(PyMOLGlobals * G) { CWizard *I = G->Wizard; - char *vla = NULL; + char *vla = nullptr; pymol::pautoblock block(G); /* get the current prompt */ @@ -495,7 +495,7 @@ int CWizard::click(int button, int x, int y, int mod) { pymol::pblock block(G); auto wiz = WizardGet(G); - PyObject* menuList = NULL; + PyObject* menuList = nullptr; if (wiz) { menuList = WizardCallPython(G, wiz, "get_menu", PyObject_CallMethod, "s", I->Line[a].code); } @@ -503,7 +503,7 @@ int CWizard::click(int button, int x, int y, int mod) if(menuList && (menuList != Py_None)) { int my = rect.top - (cWizardTopMargin + a * LineHeight) - 2; - PopUpNew(G, x, my, x, y, false, menuList, NULL); + PopUpNew(G, x, my, x, y, false, menuList, nullptr); } Py_XDECREF(menuList); } diff --git a/layer2/AtomInfo.cpp b/layer2/AtomInfo.cpp index b13beb97d..0005a531f 100644 --- a/layer2/AtomInfo.cpp +++ b/layer2/AtomInfo.cpp @@ -71,7 +71,7 @@ void AtomInfoCleanAtomName(char *name) #ifndef _PYMOL_NOPY int AtomInfoSetSettingFromPyObject(PyMOLGlobals * G, AtomInfoType *ai, int setting_id, PyObject * val){ if (val == Py_None) - val = NULL; + val = nullptr; if (!val) { if (!ai->has_setting) @@ -89,7 +89,7 @@ PyObject *SettingGetIfDefinedPyObject(PyMOLGlobals * G, AtomInfoType * ai, int s if(ai->has_setting) { return SettingUniqueGetPyObject(G, ai->unique_id, setting_id); } - return NULL; + return nullptr; } int AtomInfoReserveUniqueID(PyMOLGlobals* G, int unique_id) @@ -791,7 +791,7 @@ bool AtomResiFromResv(char *resi, size_t size, int resv, char inscode) { /*========================================================================*/ PyObject *AtomInfoAsPyList(PyMOLGlobals * G, const AtomInfoType * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(48); @@ -1017,7 +1017,7 @@ void AtomInfoCopy(PyMOLGlobals * G, const AtomInfoType * src, AtomInfoType * dst #ifdef _PYMOL_IP_EXTRAS #endif if (src->anisou) { - dst->anisou = NULL; + dst->anisou = nullptr; memcpy(dst->get_anisou(), src->anisou, 6 * sizeof(float)); } } @@ -1128,7 +1128,7 @@ void AtomInfoCombine(PyMOLGlobals * G, AtomInfoType * dst, AtomInfoType&& src_, * @param atInfo0 List of reference atoms * @param n0 Size of atInfo0 list * @param atInfo1 List of atoms which need to be made unique - * @param flag1 Optional whitelist mask for `atInfo1` or NULL + * @param flag1 Optional whitelist mask for `atInfo1` or nullptr * @param n1 Size of atInfo1 list * @param mol Optional reference molecule to limit to atoms with coordinates * @return Number of renamed atoms @@ -1151,8 +1151,8 @@ int AtomInfoUniquefyNames(PyMOLGlobals * G, const AtomInfoType * atInfo0, int n0 WordType name; ai1 = atInfo1; - lai0 = NULL; /* last atom compared against in each object */ - lai1 = NULL; + lai0 = nullptr; /* last atom compared against in each object */ + lai1 = nullptr; st0 = 0; nd0 = 0; st1 = 0; @@ -1869,7 +1869,7 @@ const ElementTableItemType ElementTable[] = { {"livermorium", "Lv", 1.80, 293.000000}, {"tennessine", "Ts", 1.80, 294.000000}, {"oganesson", "Og", 1.80, 294.000000}, - {NULL, NULL, 0.00, 0.000000} + {NULL, nullptr, 0.00, 0.000000} }; const int ElementTableSize = sizeof(ElementTable) / sizeof(ElementTable[0]) - 1; @@ -2349,8 +2349,8 @@ static void set_protons(PyMOLGlobals * G, AtomInfoType * I) */ void AtomInfoAssignParameters(PyMOLGlobals * G, AtomInfoType * I) { - const char *n = NULL; - char *e = NULL; + const char *n = nullptr; + char *e = nullptr; int pri; e = I->elem; diff --git a/layer2/AtomInfoHistory.h b/layer2/AtomInfoHistory.h index 45b61cb0c..36f717c9f 100644 --- a/layer2/AtomInfoHistory.h +++ b/layer2/AtomInfoHistory.h @@ -163,8 +163,8 @@ typedef struct AtomInfoType_1_7_7 { // no anisou support in 1.8.0 bool has_anisou() const { return false; } - const float * get_anisou() const { return NULL; } - float * get_anisou() { return NULL; } + const float * get_anisou() const { return nullptr; } + float * get_anisou() { return nullptr; } inline void setResi(int resv_, char inscode_) { resv = resv_; diff --git a/layer2/CifBondDict.h b/layer2/CifBondDict.h index beee39948..ffecddc37 100644 --- a/layer2/CifBondDict.h +++ b/layer2/CifBondDict.h @@ -154,7 +154,7 @@ class bond_dict_t { const res_bond_dict_t * get(const char * resn) const { auto it = m_data.find(resn); if (it == m_data.end()) - return NULL; + return nullptr; return &it->second; } diff --git a/layer2/CifFile.cpp b/layer2/CifFile.cpp index 4ef48e5f9..3e3a0234d 100644 --- a/layer2/CifFile.cpp +++ b/layer2/CifFile.cpp @@ -116,7 +116,7 @@ class cif_loop { const char * get_value_raw(int row, int col) const; }; -// get table value, return NULL if indices out of bounds +// get table value, return nullptr if indices out of bounds const char * cif_loop::get_value_raw(int row, int col) const { if (row >= nrows) return nullptr; @@ -128,7 +128,7 @@ unsigned cif_array::size() const { return (col == NOT_IN_LOOP) ? 1 : pointer.loop->nrows; } -/// Get array value, return NULL if `pos >= size()` or value in ['.', '?'] +/// Get array value, return nullptr if `pos >= size()` or value in ['.', '?'] const char* cif_array::get_value_raw(unsigned pos) const { if (col == NOT_IN_LOOP) @@ -147,7 +147,7 @@ bool cif_array::is_missing_all() const { } /** - * Get a pointer to array or NULL if not found + * Get a pointer to array or nullptr if not found * * Can lookup different aliases, the first one found is returned. * Also supports an alias shortcut for the trivial case where mmCIF uses @@ -260,7 +260,7 @@ bool cif_file::parse(char*&& p) { if (*p == '#') { while (!(islinefeed0(*++p))); prev = *p; - } else if (isquote(*p)) { // will NULL the closing quote + } else if (isquote(*p)) { // will nullptr the closing quote quote = *p; keypossible.push_back(false); tokens.push_back(p + 1); diff --git a/layer2/CifFile.h b/layer2/CifFile.h index cbd79976e..3d18784a2 100644 --- a/layer2/CifFile.h +++ b/layer2/CifFile.h @@ -61,7 +61,7 @@ class cif_array; // data_ const char* code = block->code(); - // get data item pointer, or NULL if name not found + // get data item pointer, or nullptr if name not found auto* dataitem1 = block->get_arr("_some.name1"); auto* dataitem2 = block->get_arr("_some.name2", "_alternate.name"); @@ -135,7 +135,7 @@ class cif_array { const char * value; } pointer; - // Raw data value or NULL for unknown/inapplicable and `pos >= size()` + // Raw data value or nullptr for unknown/inapplicable and `pos >= size()` const char* get_value_raw(unsigned pos = 0) const; // point this array to a loop (only for parsing) @@ -178,7 +178,7 @@ class cif_array { /** * Get element as null-terminated string. The default value is the empty - * string, unlike as() which returns NULL as the default value. + * string, unlike as() which returns nullptr as the default value. * If `pos >= size()` then return `d`. * @param pos element index (= row index in loop) * @param d default value for unknown/inapplicable elements @@ -233,10 +233,10 @@ class cif_data { cif_data& operator=(const cif_data&) = delete; cif_data& operator=(cif_data&&) = default; - /// Block code (never NULL) + /// Block code (never nullptr) const char* code() const { return m_code ? m_code : ""; } - // Get a pointer to array or NULL if not found + // Get a pointer to array or nullptr if not found const cif_array* get_arr(const char* key) const; template const cif_array* get_arr(const char* key, Args... aliases) const @@ -245,14 +245,14 @@ class cif_data { return arr ? arr : get_arr(aliases...); } - /// Like get_arr() but return a default value instead of NULL if not found + /// Like get_arr() but return a default value instead of nullptr if not found template const cif_array* get_opt(Args... keys) const { auto arr = get_arr(keys...); return arr ? arr : empty_array(); } - /// Get a pointer to a save frame or NULL if not found + /// Get a pointer to a save frame or nullptr if not found const cif_data* get_saveframe(const char* code) const; }; diff --git a/layer2/CifMoleculeReader.cpp b/layer2/CifMoleculeReader.cpp index 84194d5a4..29a303b06 100644 --- a/layer2/CifMoleculeReader.cpp +++ b/layer2/CifMoleculeReader.cpp @@ -63,7 +63,7 @@ const char * aa_three_letter[] = { "GLY", // G "HIS", // H "ILE", // I - NULL, // J + nullptr, // J "LYS", // K "LEU", // L "MET", // M @@ -74,10 +74,10 @@ const char * aa_three_letter[] = { "ARG", // R "SER", // S "THR", // T - NULL, // U + nullptr, // U "VAL", // V "TRP", // W - NULL, // X for other + nullptr, // X for other "TYR", // Y "GLX", // Z for ambiguous glutamine/glutamic acid }; @@ -214,7 +214,7 @@ static T VLAGetFirstNonNULL(T * vla) { for (int i = 0; i < n; ++i) if (vla[i]) return vla[i]; - return NULL; + return nullptr; } /** @@ -672,7 +672,7 @@ static oper_collection_t parse_oper_expression(const std::string &expr) { * Get chains which are part of the assembly * * assembly_chains: output set - * assembly_id: ID of the assembly or NULL to use first assembly + * assembly_id: ID of the assembly or nullptr to use first assembly */ static bool get_assembly_chains(PyMOLGlobals * G, const cif_data * data, @@ -1105,12 +1105,12 @@ static CoordSet** read_atom_site(PyMOLGlobals* G, const cif_data* data, arr_group_pdb = data->get_opt("_atom_site.group_pdb"); arr_alt = data->get_opt("_atom_site.label_alt_id"); arr_b = data->get_opt("_atom_site?b_iso_or_equiv"); - arr_u = data->get_arr("_atom_site?u_iso_or_equiv"); // NULL + arr_u = data->get_arr("_atom_site?u_iso_or_equiv"); // nullptr arr_q = data->get_opt("_atom_site?occupancy"); arr_ID = data->get_opt("_atom_site.id", "_atom_site_label"); arr_mod_num = data->get_opt("_atom_site.pdbx_pdb_model_num"); - arr_entity_id = data->get_arr("_atom_site.label_entity_id"); // NULL + arr_entity_id = data->get_arr("_atom_site.label_entity_id"); // nullptr const cif_array * arr_color = data->get_arr("_atom_site.pymol_color"); const cif_array * arr_reps = data->get_arr("_atom_site.pymol_reps"); @@ -2242,7 +2242,7 @@ static ObjectMolecule *ObjectMoleculeReadCifData(PyMOLGlobals * G, /** * Read one or multiple object-molecules from a CIF file. If there is only one * or multiplex=0, then return the object-molecule. Otherwise, create each - * object - named by its data block name - and return NULL. + * object - named by its data block name - and return nullptr. */ pymol::Result ObjectMoleculeReadCifStr(PyMOLGlobals * G, ObjectMolecule * I, const char *st, int frame, diff --git a/layer2/CoordSet.cpp b/layer2/CoordSet.cpp index 7eab88129..6c670f9ef 100644 --- a/layer2/CoordSet.cpp +++ b/layer2/CoordSet.cpp @@ -62,7 +62,7 @@ Z* ------------------------------------------------------------------- * * @param v_out Buffer for return value, may or may not be used. * @param inv If true, apply the inverse of symop - * @return Coordinate pointer, or NULL if symmetry operation was invalid. + * @return Coordinate pointer, or nullptr if symmetry operation was invalid. */ float const* CoordSet::coordPtrSym( int idx, pymol::SymOp const& symop, float* v_out, bool inv) const @@ -208,25 +208,25 @@ int BondInOrder(BondType const* a, int b1, int b2) int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) { - CoordSet *I = NULL; + CoordSet *I = nullptr; int ok = true; int ll = 0; if(*cs) { delete *cs; - *cs = NULL; + *cs = nullptr; } if(list == Py_None) { /* allow None for CSet */ - *cs = NULL; + *cs = nullptr; } else { if(ok) I = CoordSetNew(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -261,7 +261,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) if (!CPythonVal_IsNone(val)) I->SculptCGO = CGONewFromPyList(G, val, 0, 1); else { - I->SculptShaderCGO = I->SculptCGO = NULL; + I->SculptShaderCGO = I->SculptCGO = nullptr; } CPythonVal_Free(val); } @@ -283,7 +283,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) CPythonVal_Free(val2); } } else { - I->atom_state_setting_id = NULL; + I->atom_state_setting_id = nullptr; } CPythonVal_Free(val); } else { @@ -311,7 +311,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) if(!ok) { delete I; - *cs = NULL; + *cs = nullptr; } else { *cs = I; } @@ -327,10 +327,10 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) #ifndef _PYMOL_NUMPY PRINTFB(cs->G, FB_CoordSet, FB_Errors) "No numpy support\n" ENDFB(cs->G); - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; const int base_size = sizeof(float); int typenum = -1; npy_intp dims[2] = {0, 3}; @@ -344,7 +344,7 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) if(typenum == -1) { printf("error: no typenum for float size %d\n", base_size); - return NULL; + return nullptr; } dims[0] = cs->NIndex; @@ -362,7 +362,7 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) PyObject *CoordSetAsPyList(CoordSet * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { auto G = I->G; @@ -396,7 +396,7 @@ PyObject *CoordSetAsPyList(CoordSet * I) } if (I->has_any_atom_state_settings()) { int a; - PyObject *settings_list = NULL; + PyObject *settings_list = nullptr; settings_list = PyList_New(I->NIndex); for (a=0; aNIndex; a++){ if (I->has_atom_state_settings(a)) { @@ -645,7 +645,7 @@ void CoordSet::setTitle(pymol::zstring_view title) /** * Get the transformation matrix which is pre-multiplied to the coordiantes, or - * NULL if there is either no matrix set, or it's not pre-multiplied + * nullptr if there is either no matrix set, or it's not pre-multiplied * (matrix_mode=1). */ double const* CoordSet::getPremultipliedMatrix() const { @@ -1058,7 +1058,7 @@ PyObject *CoordSetAtomToChemPyAtom(PyMOLGlobals * G, AtomInfoType * ai, const fl const float *ref, int index, const double *matrix) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else PyObject *atom = PYOBJECT_CALLMETHOD(P_chempy, "Atom", ""); if(!atom) @@ -1318,13 +1318,13 @@ void CoordSetUpdateCoord2IdxMap(CoordSet * I, float cutoff) if((I->Coord2IdxDiv < cutoff) || (((cutoff - I->Coord2IdxReq) / I->Coord2IdxReq) < -0.5F)) { MapFree(I->Coord2Idx); - I->Coord2Idx = NULL; + I->Coord2Idx = nullptr; } } if(I->NIndex && (!I->Coord2Idx)) { /* NOTE: map based on stored coords */ I->Coord2IdxReq = cutoff; I->Coord2IdxDiv = cutoff * 1.25F; - I->Coord2Idx = MapNew(I->G, I->Coord2IdxDiv, I->Coord, I->NIndex, NULL); + I->Coord2Idx = MapNew(I->G, I->Coord2IdxDiv, I->Coord, I->NIndex, nullptr); if(I->Coord2IdxDiv < I->Coord2Idx->Div) I->Coord2IdxDiv = I->Coord2Idx->Div; } @@ -1658,7 +1658,7 @@ void RefPosTypeCopy(const RefPosType * src, RefPosType * dst){ #ifndef _PYMOL_NOPY int CoordSetSetSettingFromPyObject(PyMOLGlobals * G, CoordSet *cs, int at, int setting_id, PyObject *val){ if (val == Py_None) - val = NULL; + val = nullptr; if (!val && !cs->has_atom_state_settings(at)) { return true; @@ -1682,7 +1682,7 @@ PyObject *SettingGetIfDefinedPyObject(PyMOLGlobals * G, CoordSet *cs, int at, in if (cs->has_atom_state_settings(at)) { return SettingUniqueGetPyObject(G, cs->atom_state_setting_id[at], setting_id); } - return NULL; + return nullptr; } int CoordSetCheckUniqueID(PyMOLGlobals * G, CoordSet *I, int at){ diff --git a/layer2/DistSet.cpp b/layer2/DistSet.cpp index 5f6f726f8..2cf5cc2e2 100644 --- a/layer2/DistSet.cpp +++ b/layer2/DistSet.cpp @@ -102,7 +102,7 @@ int DistSetMoveLabel(DistSet * I, int a1, float *v, int mode) auto& lp = I->LabPos[a1]; if(!lp.mode) { auto obj = I->Obj; - const float *lab_pos = SettingGet_3fv(obj->G, NULL, obj->Setting.get(), + const float *lab_pos = SettingGet_3fv(obj->G, nullptr, obj->Setting.get(), cSetting_label_position); copy3f(lab_pos, lp.pos); } @@ -118,8 +118,8 @@ int DistSetMoveLabel(DistSet * I, int a1, float *v, int mode) /** - * @param I measurement set, must not be NULL - * @param obj object molecule, can be NULL so then all items in I will be updated + * @param I measurement set, must not be nullptr + * @param obj object molecule, can be nullptr so then all items in I will be updated * @return number of updated coordinates */ int DistSetMoveWithObject(DistSet * I, struct ObjectMolecule *obj) @@ -134,7 +134,7 @@ int DistSetMoveWithObject(DistSet * I, struct ObjectMolecule *obj) for (auto& listitem : I->MeasureInfo) { auto* memb = &listitem; - varDst = NULL; + varDst = nullptr; switch(memb->measureType) { case cRepDash: @@ -253,7 +253,7 @@ static PyObject* MeasureInfoListAsPyList( DistSet* DistSetFromPyList(PyMOLGlobals * G, PyObject * list) { - DistSet *I = NULL; + DistSet *I = nullptr; int ll = 0; CPythonVal *val; @@ -311,7 +311,7 @@ DistSet* DistSetFromPyList(PyMOLGlobals * G, PyObject * list) PyObject *DistSetAsPyList(DistSet * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(10); diff --git a/layer2/GadgetSet.cpp b/layer2/GadgetSet.cpp index e12967f21..1517f895d 100644 --- a/layer2/GadgetSet.cpp +++ b/layer2/GadgetSet.cpp @@ -88,24 +88,24 @@ int GadgetSetSetVertex(GadgetSet * I, int index, int base, const float *v) int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int version) { int ok = true; - GadgetSet *I = NULL; - PyObject *tmp = NULL; + GadgetSet *I = nullptr; + PyObject *tmp = nullptr; if(*gs) { delete *gs; - *gs = NULL; + *gs = nullptr; } if(list == Py_None) { /* allow None for GSet */ - *gs = NULL; + *gs = nullptr; } else { if(ok) I = GadgetSetNew(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -127,14 +127,14 @@ int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int ok = PConvPyListToFloatVLA(PyList_GetItem(list, 5), &I->Color); if(ok) - ok = ((tmp = PyList_GetItem(list, 6)) != NULL); + ok = ((tmp = PyList_GetItem(list, 6)) != nullptr); if(ok && (tmp != Py_None)) - ok = ((I->ShapeCGO = CGONewFromPyList(I->G, tmp, version)) != NULL); + ok = ((I->ShapeCGO = CGONewFromPyList(I->G, tmp, version)) != nullptr); if(ok) - ok = ((tmp = PyList_GetItem(list, 7)) != NULL); + ok = ((tmp = PyList_GetItem(list, 7)) != nullptr); if(ok && (tmp != Py_None)) - ok = ((I->PickShapeCGO = CGONewFromPyList(I->G, tmp, version)) != NULL); + ok = ((I->PickShapeCGO = CGONewFromPyList(I->G, tmp, version)) != nullptr); if(ok && I->ShapeCGO) if(CGOCheckForText(I->ShapeCGO)) { @@ -154,7 +154,7 @@ int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int PyObject *GadgetSetAsPyList(GadgetSet * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(8); @@ -228,12 +228,12 @@ void GadgetSet::update() if(I->StdCGO) { CGOFree(I->StdCGO); I->offsetPtOP = 0; - I->StdCGO = NULL; + I->StdCGO = nullptr; } if(I->PickCGO) { CGOFree(I->PickCGO); I->offsetPtOPick = 0; - I->PickCGO = NULL; + I->PickCGO = nullptr; } } @@ -265,7 +265,7 @@ void GadgetSet::render(RenderInfo * info) RayPushTTT(ray); RaySetTTT(ray, true, mat); /* Used to set the ray-tracing matrix, this works, but is there another way to do this? */ - CGORenderRay(I->ShapeCGO, ray, info, color, NULL, I->Obj->Setting.get(), NULL); + CGORenderRay(I->ShapeCGO, ray, info, color, nullptr, I->Obj->Setting.get(), nullptr); RayPopTTT(ray); } } else if(G->HaveGUI && G->ValidContext) { @@ -300,12 +300,12 @@ void GadgetSet::render(RenderInfo * info) } if(I->PickCGO) { if (use_shader){ - CGORenderPicking(I->PickCGO, info, &context, I->Obj->Setting.get(), NULL); + CGORenderPicking(I->PickCGO, info, &context, I->Obj->Setting.get(), nullptr); #ifndef PURE_OPENGL_ES_2 } else { glDisable(GL_DEPTH_TEST); glTranslatef(I->Coord[0],I->Coord[1],I->Coord[2]); - CGORenderPicking(I->PickShapeCGO, info, &context, I->Obj->Setting.get(), NULL); + CGORenderPicking(I->PickShapeCGO, info, &context, I->Obj->Setting.get(), nullptr); glTranslatef(-I->Coord[0],-I->Coord[1],-I->Coord[2]); glEnable(GL_DEPTH_TEST); #endif @@ -333,12 +333,12 @@ void GadgetSet::render(RenderInfo * info) if(I->StdCGO) { if (use_shader){ if (color) - CGORender(I->StdCGO, NULL, I->Obj->Setting.get(), NULL, info, NULL); + CGORender(I->StdCGO, nullptr, I->Obj->Setting.get(), nullptr, info, nullptr); #ifndef PURE_OPENGL_ES_2 } else { glDisable(GL_DEPTH_TEST); glTranslatef(I->Coord[0],I->Coord[1],I->Coord[2]); - CGORender(I->ShapeCGO, NULL, I->Obj->Setting.get(), NULL, info, NULL); + CGORender(I->ShapeCGO, nullptr, I->Obj->Setting.get(), nullptr, info, nullptr); glTranslatef(-I->Coord[0],-I->Coord[1],-I->Coord[2]); glEnable(GL_DEPTH_TEST); #endif diff --git a/layer2/MmtfMoleculeReader.cpp b/layer2/MmtfMoleculeReader.cpp index c8357eb5e..4e7e11f5e 100644 --- a/layer2/MmtfMoleculeReader.cpp +++ b/layer2/MmtfMoleculeReader.cpp @@ -108,7 +108,7 @@ ObjectMolecule * ObjectMoleculeReadMmtfStr(PyMOLGlobals * G, ObjectMolecule * I, #ifdef _PYMOL_NO_MSGPACKC PRINTFB(G, FB_ObjectMolecule, FB_Errors) " Error: This build has no fast MMTF support.\n" ENDFB(G); - return NULL; + return nullptr; #else if (I) { diff --git a/layer2/MolV3000.cpp b/layer2/MolV3000.cpp index 970dbfe18..09bef21ef 100644 --- a/layer2/MolV3000.cpp +++ b/layer2/MolV3000.cpp @@ -103,7 +103,7 @@ bool MOLV3000ReadKeyValue(const char *& p, /** * Parse the "Extended Connection Table" (V3000) from a MOL/SDF file. * - * Returns a pointer to the end of the parsed content on success, or NULL on + * Returns a pointer to the end of the parsed content on success, or nullptr on * failure. * * buffer: input buffer, should begin with "M V30 " diff --git a/layer2/ObjectAlignment.cpp b/layer2/ObjectAlignment.cpp index 71d75dc0b..783d893d8 100644 --- a/layer2/ObjectAlignment.cpp +++ b/layer2/ObjectAlignment.cpp @@ -180,9 +180,9 @@ int ObjectAlignmentAsStrVLA(PyMOLGlobals * G, ObjectAlignment * I, int state, in if(align_sele >= 0) { int nRow = 0; ov_size nCol = 0; - CSeqRow *row_vla = NULL, *row; - char *cons_str = NULL; - void *hidden = NULL; + CSeqRow *row_vla = nullptr, *row; + char *cons_str = nullptr; + void *hidden = nullptr; ObjectMolecule *obj; @@ -292,7 +292,7 @@ int ObjectAlignmentAsStrVLA(PyMOLGlobals * G, ObjectAlignment * I, int state, in row = row_vla + a; row->txt = pymol::vla(nCol + 1); row->len = 0; - row->last_ai = NULL; + row->last_ai = nullptr; row->cCol = 0; } } @@ -471,7 +471,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, ObjectMolecule * guide, ObjectMolecule * flush) { /* curVLA and newVLA must be properly sized and zero terminated... */ - int *result = NULL; + int *result = nullptr; int n_result = 0; { @@ -618,7 +618,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, if(!GroupOrderKnown(G, curVLA, newVLA, cur_start, new_start, guide, &action)) { int c, id; - ObjectMolecule *obj, *last_obj = NULL; + ObjectMolecule *obj, *last_obj = nullptr; c = cur_start; while((id = curVLA[c++])) { auto eoo = ExecutiveUniqueIDAtomDictGet(G, id); @@ -737,7 +737,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, static PyObject *ObjectAlignmentStateAsPyList(ObjectAlignmentState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(2); if(I->alignVLA) { @@ -752,7 +752,7 @@ static PyObject *ObjectAlignmentStateAsPyList(ObjectAlignmentState * I) static PyObject *ObjectAlignmentAllStatesAsPyList(ObjectAlignment * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->getNFrame()); for(a = 0; a < I->getNFrame(); a++) { @@ -768,7 +768,7 @@ static int ObjectAlignmentStateFromPyList(PyMOLGlobals * G, ObjectAlignmentState int ok = true; int ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -814,16 +814,16 @@ int ObjectAlignmentNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectAlignment ** result, int version) { int ok = true; - ObjectAlignment *I = NULL; - (*result) = NULL; + ObjectAlignment *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectAlignment(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -842,7 +842,7 @@ int ObjectAlignmentNewFromPyList(PyMOLGlobals * G, PyObject * list, PyObject *ObjectAlignmentAsPyList(ObjectAlignment * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -897,7 +897,7 @@ void ObjectAlignment::update() for(a = 0; a < getNFrame(); a++) { ObjectAlignmentState *oas = I->State.data() + a; if(!oas->valid){ - ObjectMolecule *guide_obj = NULL; + ObjectMolecule *guide_obj = nullptr; if(oas->guide[0]) { guide_obj = ExecutiveFindObjectMoleculeByName(G, oas->guide); } @@ -1058,7 +1058,7 @@ void ObjectAlignment::render(RenderInfo * info) CRay *ray = info->ray; auto pick = info->pick; const RenderPass pass = info->pass; - ObjectAlignmentState *sobj = NULL; + ObjectAlignmentState *sobj = nullptr; const float *color; ObjectPrepareContext(I, info); @@ -1078,7 +1078,7 @@ void ObjectAlignment::render(RenderInfo * info) continue; if(ray) { - CGORenderRay(sobj->primitiveCGO.get(), ray, info, color, NULL, I->Setting.get(), NULL); + CGORenderRay(sobj->primitiveCGO.get(), ray, info, color, nullptr, I->Setting.get(), nullptr); } else if(G->HaveGUI && G->ValidContext) { #ifndef PURE_OPENGL_ES_2 if(!info->line_lighting) @@ -1087,7 +1087,7 @@ void ObjectAlignment::render(RenderInfo * info) SceneResetNormal(G, true); bool use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); - CGO * cgo = NULL; + CGO * cgo = nullptr; if (use_shader) { bool as_cylinders = @@ -1107,7 +1107,7 @@ void ObjectAlignment::render(RenderInfo * info) as_cylinders ? GL_CYLINDER_SHADER : trilines ? GL_TRILINES_SHADER : GL_LINE_SHADER; - CGO *tmpCGO = CGONew(G), *tmp2CGO = NULL; + CGO *tmpCGO = CGONew(G), *tmp2CGO = nullptr; CGOEnable(tmpCGO, shader); CGOSpecial(tmpCGO, SET_ALIGNMENT_UNIFORMS_ATTRIBS); @@ -1134,7 +1134,7 @@ void ObjectAlignment::render(RenderInfo * info) } if (cgo) { - CGORender(cgo, color, I->Setting.get(), NULL, info, NULL); + CGORender(cgo, color, I->Setting.get(), nullptr, info, nullptr); } #ifndef PURE_OPENGL_ES_2 @@ -1173,11 +1173,11 @@ ObjectAlignment *ObjectAlignmentDefine(PyMOLGlobals * G, int merge, ObjectMolecule * guide, ObjectMolecule * flush) { - ObjectAlignment *I = NULL; + ObjectAlignment *I = nullptr; if(obj) { if(obj->type != cObjectAlignment) /* TODO: handle this */ - obj = NULL; + obj = nullptr; } if(!obj) { I = new ObjectAlignment(G); diff --git a/layer2/ObjectCGO.cpp b/layer2/ObjectCGO.cpp index 070e1941d..7585482ef 100644 --- a/layer2/ObjectCGO.cpp +++ b/layer2/ObjectCGO.cpp @@ -36,7 +36,7 @@ Z* ------------------------------------------------------------------- static PyObject *ObjectCGOStateAsPyList(ObjectCGOState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(1); if(I->origCGO) @@ -48,7 +48,7 @@ static PyObject *ObjectCGOStateAsPyList(ObjectCGOState * I) static PyObject *ObjectCGOAllStatesAsPyList(ObjectCGO * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -64,7 +64,7 @@ static int ObjectCGOStateFromPyList(PyMOLGlobals * G, ObjectCGOState * I, PyObje int ll, pl = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -118,16 +118,16 @@ int ObjectCGONewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCGO ** resul int version) { int ok = true; - ObjectCGO *I = NULL; - (*result) = NULL; + ObjectCGO *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectCGO(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -149,7 +149,7 @@ int ObjectCGONewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCGO ** resul PyObject *ObjectCGOAsPyList(ObjectCGO * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -235,11 +235,11 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, if(ray) { if(sobj) { if(sobj->origCGO){ - CGO *cgo = sobj->origCGO.get(), *cgo_copy = NULL; + CGO *cgo = sobj->origCGO.get(), *cgo_copy = nullptr; if (cgo_lighting && CGOHasAnyTriangleVerticesWithoutNormals(cgo)) { cgo = cgo_copy = CGOGenerateNormalsForTriangles(cgo); } - CGORenderRay(cgo, ray, info, color, ramp, I->Setting.get(), NULL); + CGORenderRay(cgo, ray, info, color, ramp, I->Setting.get(), nullptr); CGOFree(cgo_copy); } } @@ -254,8 +254,8 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, if(sobj && ((sobj->hasTransparency ^ pass_is_opaque) || (sobj->hasOpaque == pass_is_opaque))){ { CShaderPrg *shaderPrg; - int two_sided_lighting = SettingGet_i(G, I->Setting.get(), NULL, cSetting_two_sided_lighting); - bool backface_cull = SettingGet_i(G, I->Setting.get(), NULL, cSetting_backface_cull); + int two_sided_lighting = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_two_sided_lighting); + bool backface_cull = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_backface_cull); if (two_sided_lighting<0){ two_sided_lighting = !cgo_lighting; } @@ -288,12 +288,12 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, shaderPrg->Set1i("two_sided_lighting_enabled", two_sided_lighting); sobj->renderCGO->use_shader = use_shader; sobj->renderCGO->debug = SettingGetGlobal_i(G, cSetting_cgo_debug); - CGORender(sobj->renderCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(sobj->renderCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); shaderPrg->Disable(); } else { sobj->renderCGO->use_shader = use_shader; sobj->renderCGO->debug = SettingGetGlobal_i(G, cSetting_cgo_debug); - CGORender(sobj->renderCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(sobj->renderCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); } if (backface_cull){ glDisable(GL_CULL_FACE); @@ -330,13 +330,13 @@ static void ObjectCGOGenerateCGO(PyMOLGlobals * G, ObjectCGO * I, ObjectCGOState } else { colorWithA[0] = 1.f; colorWithA[1] = 1.f; colorWithA[2] = 1.f; } - colorWithA[3] = 1.f - SettingGet_f(G, I->Setting.get(), NULL, cSetting_cgo_transparency); + colorWithA[3] = 1.f - SettingGet_f(G, I->Setting.get(), nullptr, cSetting_cgo_transparency); bool hasTransparency = (colorWithA[3] < 1.f || CGOHasTransparency(sobj->origCGO.get())); bool hasOpaque = (colorWithA[3] == 1.f || CGOHasOpaque(sobj->origCGO.get())); - CGO *allCylinders = NULL; - CGO *allSpheres = NULL; + CGO *allCylinders = nullptr; + CGO *allSpheres = nullptr; CGO* allBeziers = nullptr; pymol::cache_ptr preOpt; @@ -478,14 +478,14 @@ void ObjectCGO::render(RenderInfo * info) int state = info->state; CRay *ray = info->ray; const RenderPass pass = info->pass; - ObjectCGOState *sobj = NULL; - const float *color = NULL; + ObjectCGOState *sobj = nullptr; + const float *color = nullptr; bool use_shader = false, cgo_lighting = false; - ObjectGadgetRamp *ramp = NULL; + ObjectGadgetRamp *ramp = nullptr; use_shader = SettingGetGlobal_b(G, cSetting_cgo_use_shader) & SettingGetGlobal_b(G, cSetting_use_shaders); - cgo_lighting = SettingGet_i(G, I->Setting.get(), NULL, cSetting_cgo_lighting); + cgo_lighting = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_cgo_lighting); ObjectPrepareContext(I, info); ramp = ColorGetRamp(G, I->Color); @@ -547,11 +547,11 @@ ObjectCGOState::ObjectCGOState(const ObjectCGOState& other) static CGO *ObjectCGOPyListFloatToCGO(PyMOLGlobals * G, PyObject * list) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int len; int ok = true; int result; - float *raw = NULL; + float *raw = nullptr; if(PyList_Check(list)) { len = PConvPyListToFloatArray(list, &raw); @@ -578,7 +578,7 @@ static CGO *ObjectCGOPyListFloatToCGO(PyMOLGlobals * G, PyObject * list) static CGO *ObjectCGOFloatArrayToCGO(PyMOLGlobals * G, float *raw, int len, int quiet) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int ok = true; int result; @@ -601,7 +601,7 @@ static CGO *ObjectCGOFloatArrayToCGO(PyMOLGlobals * G, float *raw, int len, int ObjectCGO *ObjectCGOFromCGO(PyMOLGlobals * G, ObjectCGO * obj, CGO * cgo, int state) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; int size_n; @@ -635,15 +635,15 @@ ObjectCGO *ObjectCGOFromCGO(PyMOLGlobals * G, ObjectCGO * obj, CGO * cgo, int st ObjectCGO *ObjectCGONewVFontTest(PyMOLGlobals * G, const char *text, float *pos) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; int font_id; - CGO *cgo = NULL; + CGO *cgo = nullptr; float scale[2] = { 1.0, 1.0 }; font_id = VFontLoad(G, 1, 1, 1, true); cgo = CGONew(G); - VFontWriteToCGO(G, font_id, cgo, text, pos, scale, NULL, NULL); - I = ObjectCGOFromCGO(G, NULL, cgo, 0); + VFontWriteToCGO(G, font_id, cgo, text, pos, scale, nullptr, nullptr); + I = ObjectCGOFromCGO(G, nullptr, cgo, 0); return (I); } @@ -657,7 +657,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, { assert(PyGILState_Check()); - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; CGO *cgo, *font_cgo; int est; @@ -666,7 +666,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, if(obj) { if(obj->type != cObjectCGO){ /* TODO: handle this */ - obj = NULL; + obj = nullptr; } size_n = obj->State.size(); } @@ -693,7 +693,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, est = CGOCheckForText(cgo); if(est) { CGOPreloadFonts(cgo); - font_cgo = CGODrawText(cgo, est, NULL); + font_cgo = CGODrawText(cgo, est, nullptr); CGOFree(cgo); cgo = font_cgo; } @@ -716,7 +716,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, float *array, int size, int state, int quiet) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; CGO *cgo, *font_cgo; int est; @@ -725,7 +725,7 @@ ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, if(obj) { if(obj->type != cObjectCGO){ /* TODO: handle this */ - obj = NULL; + obj = nullptr; } size_n = obj->State.size(); } @@ -749,7 +749,7 @@ ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, est = CGOCheckForText(cgo); if(est) { CGOPreloadFonts(cgo); - font_cgo = CGODrawText(cgo, est, NULL); + font_cgo = CGODrawText(cgo, est, nullptr); CGOFree(cgo); cgo = font_cgo; } diff --git a/layer2/ObjectCallback.cpp b/layer2/ObjectCallback.cpp index 929d667ae..51ac10838 100644 --- a/layer2/ObjectCallback.cpp +++ b/layer2/ObjectCallback.cpp @@ -42,7 +42,7 @@ ObjectCallback::~ObjectCallback() for(int a = 0; a < I->NState; a++) { if(I->State[a].PObj) { Py_DECREF(I->State[a].PObj); - I->State[a].PObj = NULL; + I->State[a].PObj = nullptr; } } PAutoUnblock(G, blocked); @@ -70,7 +70,7 @@ void ObjectCallback::render(RenderInfo * info) auto pick = info->pick; const RenderPass pass = info->pass; PyMOLGlobals *G = I->G; - ObjectCallbackState *sobj = NULL; + ObjectCallbackState *sobj = nullptr; if(pass != RenderPass::Opaque) /* for now, the callback should be called during the first pass (opaque), so that it is possible to set positions for any object that is rendered in the @@ -102,7 +102,7 @@ void ObjectCallback::render(RenderInfo * info) if(!sobj->is_callable) continue; - Py_DecRef(PyObject_CallObject(sobj->PObj, NULL)); + Py_DecRef(PyObject_CallObject(sobj->PObj, nullptr)); if(PyErr_Occurred()) PyErr_Print(); } @@ -132,9 +132,9 @@ ObjectCallback *ObjectCallbackDefine(PyMOLGlobals * G, ObjectCallback * obj, PyObject * pobj, int state) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - ObjectCallback *I = NULL; + ObjectCallback *I = nullptr; if(!obj) { I = new ObjectCallback(G); @@ -222,7 +222,7 @@ static int ObjectCallbackStateFromPyObject(PyMOLGlobals * G, ObjectCallbackState static int ObjectCallbackAllStatesFromPyObject(ObjectCallback * I, PyObject * obj) { int result = false; - PyObject *list = NULL; + PyObject *list = nullptr; if(PyList_Check(obj)) { list = obj; @@ -260,7 +260,7 @@ int ObjectCallbackNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCallbac ObjectCallback *I; PyObject *val; - ok_assert(1, list != NULL); + ok_assert(1, list != nullptr); ok_assert(1, PyList_Check(list)); ok_assert(1, I = new ObjectCallback(G)); @@ -278,7 +278,7 @@ int ObjectCallbackNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCallbac ok_except2: DeleteP(I); ok_except1: - *result = NULL; + *result = nullptr; return false; } @@ -293,7 +293,7 @@ static PyObject *ObjectCallbackStateAsPyObject(ObjectCallbackState * I) static PyObject *ObjectCallbackAllStatesAsPyObject(ObjectCallback * I) { int a; - PyObject *result = NULL; + PyObject *result = nullptr; PyObject *list = PyList_New(I->NState); for(a = 0; a < I->NState; a++) { @@ -318,7 +318,7 @@ static PyObject *ObjectCallbackAllStatesAsPyObject(ObjectCallback * I) PyObject *ObjectCallbackAsPyList(ObjectCallback * I) { - PyObject *result = NULL, *states; + PyObject *result = nullptr, *states; ok_assert(1, states = ObjectCallbackAllStatesAsPyObject(I)); diff --git a/layer2/ObjectDist.cpp b/layer2/ObjectDist.cpp index b7a7c7d1b..741d03dd8 100644 --- a/layer2/ObjectDist.cpp +++ b/layer2/ObjectDist.cpp @@ -44,7 +44,7 @@ int ObjectDistGetLabelTxfVertex(ObjectDist * I, int state, int index, float *v) int result = 0; if(!I->DSet.empty()) { if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->DSet.size() == 1) @@ -52,7 +52,7 @@ int ObjectDistGetLabelTxfVertex(ObjectDist * I, int state, int index, float *v) state = state % I->DSet.size(); { DistSet *ds = I->DSet[state].get(); - if((!ds) && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) { + if((!ds) && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) { state = 0; ds = I->DSet[state].get(); } @@ -74,7 +74,7 @@ int ObjectDistMoveLabel(ObjectDist * I, int state, int index, float *v, int mode state = 0; state = state % I->DSet.size(); if((!I->DSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; /* find the corresponding distance set, for this state */ auto ds = I->DSet[state].get(); @@ -178,7 +178,7 @@ static int ObjectDistDSetFromPyList(ObjectDist * I, PyObject * list) /*========================================================================*/ PyObject *ObjectDistAsPyList(ObjectDist * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -195,15 +195,15 @@ PyObject *ObjectDistAsPyList(ObjectDist * I) int ObjectDistNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectDist ** result) { int ok = true; - ObjectDist *I = NULL; - (*result) = NULL; + ObjectDist *I = nullptr; + (*result) = nullptr; if(ok) ok = PyList_Check(list); I = new ObjectDist(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); diff --git a/layer2/ObjectGadget.cpp b/layer2/ObjectGadget.cpp index ff3825ad6..ed2f90757 100644 --- a/layer2/ObjectGadget.cpp +++ b/layer2/ObjectGadget.cpp @@ -67,9 +67,9 @@ int ObjectGadgetSetVertex(ObjectGadget * I, int index, int base, const float *v) /* in current state */ ObjectGadget *ObjectGadgetTest(PyMOLGlobals * G) { - ObjectGadget *I = NULL; - GadgetSet *gs = NULL; - CGO *cgo = NULL; + ObjectGadget *I = nullptr; + GadgetSet *gs = nullptr; + CGO *cgo = nullptr; int a; float coord[] = { @@ -255,7 +255,7 @@ void ObjectGadgetUpdateExtents(ObjectGadget * I) static PyObject *ObjectGadgetGSetAsPyList(ObjectGadget * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NGSet); for(a = 0; a < I->NGSet; a++) { @@ -297,7 +297,7 @@ int ObjectGadgetInitFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget * { int ok = true; if(ok) - ok = (I != NULL) && (list != NULL); + ok = (I != nullptr) && (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -328,13 +328,13 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** int version) { int ok = true; - ObjectGadget *I = NULL; + ObjectGadget *I = nullptr; int gadget_type = -1; PyObject *plain; - (*result) = NULL; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); @@ -342,7 +342,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** we've got to maintain backward compat...ugh */ if(ok) - ok = ((plain = PyList_GetItem(list, 0)) != NULL); + ok = ((plain = PyList_GetItem(list, 0)) != nullptr); if(ok) ok = PyList_Check(plain); if(ok) @@ -355,7 +355,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** case cGadgetPlain: I = new ObjectGadget(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = ObjectGadgetInitFromPyList(G, list, I, version); if(ok) @@ -370,7 +370,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** PyObject *ObjectGadgetPlainAsPyList(ObjectGadget * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -385,7 +385,7 @@ PyObject *ObjectGadgetPlainAsPyList(ObjectGadget * I, bool incl_cgos) PyObject *ObjectGadgetAsPyList(ObjectGadget * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -406,7 +406,7 @@ ObjectGadget::~ObjectGadget() for(int a = 0; a < I->NGSet; a++) if(I->GSet[a]) { delete I->GSet[a]; - I->GSet[a] = NULL; + I->GSet[a] = nullptr; } } diff --git a/layer2/ObjectGadgetRamp.cpp b/layer2/ObjectGadgetRamp.cpp index b24fc87e2..737d4f6f3 100644 --- a/layer2/ObjectGadgetRamp.cpp +++ b/layer2/ObjectGadgetRamp.cpp @@ -347,7 +347,7 @@ int ObjectGadgetRampInterpolate(ObjectGadgetRamp * I, float level, float *color) PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(11); @@ -371,7 +371,7 @@ PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) // I->Special, removed in PyMOL 1.8 bool any = false; - int* special = NULL; + int* special = nullptr; int pse_export_version = SettingGetGlobal_f(I->G, cSetting_pse_export_version) * 1000; if (I->Color && pse_export_version < 1800) { int n_color = VLAGetSize(I->Color) / 3; @@ -390,16 +390,16 @@ PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) int ObjectGadgetRampNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadgetRamp ** result, int version) { - ObjectGadgetRamp *I = NULL; + ObjectGadgetRamp *I = nullptr; int ok = true; int ll = 0; if(ok) I = new ObjectGadgetRamp(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -436,7 +436,7 @@ int ObjectGadgetRampNewFromPyList(PyMOLGlobals * G, PyObject * list, // ObjectGadgetRamp::Extreme removed in PyMOL 1.8 // Copy extreme colors to the beginning and end of the Color array // and repeat the first and last level value - float *extreme = NULL; + float *extreme = nullptr; PConvPyListToFloatVLA(item, &extreme); if (extreme) { I->NLevel += 2; @@ -486,9 +486,9 @@ int ObjectGadgetRampInterVertex(ObjectGadgetRamp * I, const float *pos, float *c if(src_state < 0) src_state = SceneGetState(I->G); if(ok) - ok = (I->Map != NULL); + ok = (I->Map != nullptr); if(ok) - ok = ObjectMapInterpolate(I->Map, src_state, pos, &level, NULL, 1); + ok = ObjectMapInterpolate(I->Map, src_state, pos, &level, nullptr, 1); if(ok) ok = ObjectGadgetRampInterpolate(I, level, color); } @@ -512,12 +512,12 @@ int ObjectGadgetRampInterVertex(ObjectGadgetRamp * I, const float *pos, float *c } } if(ok) - ok = (I->Mol != NULL); + ok = (I->Mol != nullptr); if(ok) { if (I->Mol->NCSet==1) // if only one state, then set state to 0 state = 0; if(SettingGet_b - (I->G, I->Setting.get(), NULL, + (I->G, I->Setting.get(), nullptr, cSetting_ramp_blend_nearby_colors)) { float atomic[3]; int index = @@ -809,7 +809,7 @@ static void ObjectGadgetRampUpdateCGO(ObjectGadgetRamp * I, GadgetSet * gs) static void ObjectGadgetRampBuild(ObjectGadgetRamp * I) { - GadgetSet *gs = NULL; + GadgetSet *gs = nullptr; ObjectGadget *og; OrthoBusyPrime(I->G); @@ -826,12 +826,12 @@ static void ObjectGadgetRampBuild(ObjectGadgetRamp * I) gs->Coord[2] = .3f; gs->Coord[3] = gs->Coord[4] = gs->Coord[5] = 0.f; gs->NNormal = 0; - gs->Normal = NULL; + gs->Normal = nullptr; // was a memory leak in < 1.8.3.1 for (int i = 0; i < og->NGSet; ++i) { delete og->GSet[i]; - og->GSet[i] = NULL; + og->GSet[i] = nullptr; } og->GSet[0] = gs; diff --git a/layer2/ObjectGroup.cpp b/layer2/ObjectGroup.cpp index ad5032fd3..2e5b593e8 100644 --- a/layer2/ObjectGroup.cpp +++ b/layer2/ObjectGroup.cpp @@ -29,8 +29,8 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r int version) { int ok = true, ll = 0; - ObjectGroup *I = NULL; - (*result) = NULL; + ObjectGroup *I = nullptr; + (*result) = nullptr; if(ok) ok = (list != Py_None); if(ok) @@ -39,7 +39,7 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r ll = PyList_Size(list); I = new ObjectGroup(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); ok = ObjectFromPyList(G, val, I); @@ -59,7 +59,7 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r PyObject *ObjectGroupAsPyList(ObjectGroup * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); diff --git a/layer2/ObjectMap.cpp b/layer2/ObjectMap.cpp index 8c192e8a1..5dd018ec1 100644 --- a/layer2/ObjectMap.cpp +++ b/layer2/ObjectMap.cpp @@ -158,7 +158,7 @@ int ObjectMapStateGetExcludedStats(PyMOLGlobals * G, ObjectMapState * ms, float int cnt = 0; int list_size; float cutoff = beyond; - MapType *voxelmap = NULL; + MapType *voxelmap = nullptr; /* size of the VLA */ if(vert_vla) { @@ -171,7 +171,7 @@ int ObjectMapStateGetExcludedStats(PyMOLGlobals * G, ObjectMapState * ms, float /* make a new map from the VLA .............. */ if(list_size) - voxelmap = MapNew(G, -cutoff, vert_vla, list_size, NULL); + voxelmap = MapNew(G, -cutoff, vert_vla, list_size, nullptr); if(voxelmap || (!list_size)) { int a, b, c; @@ -1009,7 +1009,7 @@ int ObjectMapStateContainsPoint(ObjectMapState * ms, float *point) * @param[out] result Array of length `n` which will be populated with map * values at coorinate positions (linear interpolated between grid points) * @param[out] flag Array of length `n` which will be populated with booleans - * indicating if points were within map bounds (optional, can be NULL) + * indicating if points were within map bounds (optional, can be nullptr) * @return False if any coordinate was out of bounds */ int ObjectMapStateInterpolate(ObjectMapState * ms, const float *array, float *result, int *flag, @@ -1228,7 +1228,7 @@ void ObjectMapStateRegeneratePoints(ObjectMapState * ms) static PyObject *ObjectMapStateAsPyList(ObjectMapState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(16); PyList_SetItem(result, 0, PyInt_FromLong(I->Active)); @@ -1274,7 +1274,7 @@ static PyObject *ObjectMapStateAsPyList(ObjectMapState * I) static PyObject *ObjectMapAllStatesAsPyList(ObjectMap * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -1337,7 +1337,7 @@ static int ObjectMapStateFromPyList(PyMOLGlobals * G, ObjectMapState * I, PyObje int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; @@ -1354,7 +1354,7 @@ static int ObjectMapStateFromPyList(PyMOLGlobals * G, ObjectMapState * I, PyObje if(ok) { tmp = PyList_GetItem(list, 1); if(tmp == Py_None) - I->Symmetry = NULL; + I->Symmetry = nullptr; else { I->Symmetry.reset(SymmetryNewFromPyList(G, tmp)); ok = I->Symmetry != nullptr; @@ -1448,7 +1448,7 @@ static int ObjectMapAllStatesFromPyList(ObjectMap * I, PyObject * list) PyObject *ObjectMapAsPyList(ObjectMap * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -1461,18 +1461,18 @@ PyObject *ObjectMapAsPyList(ObjectMap * I) int ObjectMapNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMap ** result) { int ok = true; - ObjectMap *I = NULL; - (*result) = NULL; + ObjectMap *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... Always check ll when adding new PyList_GetItem's */ I = new ObjectMap(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -1497,10 +1497,10 @@ int ObjectMapNewCopy(PyMOLGlobals * G, const ObjectMap * src, ObjectMap ** resul int source_state, int target_state) { int ok = true; - ObjectMap *I = NULL; + ObjectMap *I = nullptr; I = new ObjectMap(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = ObjectCopyHeader(I, src); if(ok) { @@ -1738,7 +1738,7 @@ void ObjectMap::render(RenderInfo * info) CRay *ray = info->ray; auto pick = info->pick; const RenderPass pass = info->pass; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; if(pass != RenderPass::Antialias) return; @@ -1839,7 +1839,7 @@ void ObjectMap::render(RenderInfo * info) shaderPrg->SetLightingEnabled(0); CGORender(ms->shaderCGO.get(), ColorGet(G, I->Color), - NULL, NULL, info, NULL); + nullptr, nullptr, info, nullptr); shaderPrg->Disable(); } } @@ -1868,7 +1868,7 @@ void ObjectMap::render(RenderInfo * info) ms->have_range = true; } } - if(ms->have_range && SettingGet_b(G, NULL, I->Setting.get(), cSetting_dot_normals)) { + if(ms->have_range && SettingGet_b(G, nullptr, I->Setting.get(), cSetting_dot_normals)) { IsofieldComputeGradients(G, ms->Field.get()); } if(ms->have_range) { @@ -1876,9 +1876,9 @@ void ObjectMap::render(RenderInfo * info) CField *data = ms->Field->data.get(); int cnt = data->dim[0] * data->dim[1] * data->dim[2]; CField *points = ms->Field->points.get(); - CField *gradients = NULL; + CField *gradients = nullptr; - if(SettingGet_b(G, NULL, I->Setting.get(), cSetting_dot_normals)) { + if(SettingGet_b(G, nullptr, I->Setting.get(), cSetting_dot_normals)) { gradients = ms->Field->gradients.get(); } if(data && points) { @@ -1893,10 +1893,10 @@ void ObjectMap::render(RenderInfo * info) ptr += 3; \ } - float *raw_gradient = NULL; + float *raw_gradient = nullptr; float high_cut = ms->high_cutoff, low_cut = ms->low_cutoff; float width = - SettingGet_f(G, NULL, I->Setting.get(), cSetting_dot_width); + SettingGet_f(G, nullptr, I->Setting.get(), cSetting_dot_width); if(ray) { float radius = ray->PixelRadius * width / 1.4142F; @@ -1985,7 +1985,7 @@ ObjectMapState::ObjectMapState(PyMOLGlobals* G) ObjectMapStatePurge(G, I); ObjectStateInit(G, I); I->Symmetry.reset(new CSymmetry(G)); - I->Field = NULL; + I->Field = nullptr; I->Origin.clear(); I->Dim.clear(); I->Range.clear(); @@ -2057,7 +2057,7 @@ ObjectMapState *ObjectMapNewStateFromDesc(PyMOLGlobals * G, ObjectMap * I, float v[3]; int a, b, c, d; float *fp; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; ObjectMapDesc _md, *md; ms = ObjectMapStatePrime(I, state); @@ -4143,7 +4143,7 @@ static int ObjectMapGRDStrToMap(ObjectMap * I, char *GRDStr, int bytes, int stat char *p; float dens; - float *f = NULL; + float *f = nullptr; int a, b, c, d, e; float v[3], vr[3], maxd, mind; int ok = true; @@ -4665,7 +4665,7 @@ ObjectMap *ObjectMapLoadCCP4(PyMOLGlobals * G, ObjectMap * obj, const char *fnam int is_string, int bytes, int quiet, int format) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; char *buffer; long size; @@ -4814,7 +4814,7 @@ ObjectMap *ObjectMapLoadPHI(PyMOLGlobals * G, ObjectMap * obj, const char *fname int is_string, int bytes, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5198,7 +5198,7 @@ ObjectMap* ObjectMapReadDXStr(PyMOLGlobals* G, ObjectMap* I, const char* MapStr, ObjectMap *ObjectMapLoadDXFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5418,7 +5418,7 @@ static ObjectMap *ObjectMapReadACNTStr(PyMOLGlobals * G, ObjectMap * I, ObjectMap *ObjectMapLoadACNTFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5446,7 +5446,7 @@ ObjectMap *ObjectMapLoadACNTFile(PyMOLGlobals * G, ObjectMap * obj, const char * ObjectMap *ObjectMapLoadFLDFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5472,7 +5472,7 @@ ObjectMap *ObjectMapLoadFLDFile(PyMOLGlobals * G, ObjectMap * obj, const char *f ObjectMap *ObjectMapLoadBRIXFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5498,7 +5498,7 @@ ObjectMap *ObjectMapLoadBRIXFile(PyMOLGlobals * G, ObjectMap * obj, const char * ObjectMap *ObjectMapLoadGRDFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5524,7 +5524,7 @@ ObjectMap *ObjectMapLoadGRDFile(PyMOLGlobals * G, ObjectMap * obj, const char *f ObjectMap *ObjectMapLoadXPLOR(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int is_file, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5681,11 +5681,11 @@ ObjectMap *ObjectMapLoadChemPyBrick(PyMOLGlobals * G, ObjectMap * I, PyObject * { #ifndef _PYMOL_NUMPY ErrMessage(G, "ObjectMap", "missing numpy support, required for chempy.brick"); - return NULL; + return nullptr; #endif #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int ok = true; @@ -5778,7 +5778,7 @@ ObjectMap *ObjectMapLoadChemPyMap(PyMOLGlobals * G, ObjectMap * I, PyObject * Ma int state, int discrete, int quiet) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int ok = true; int isNew = true; diff --git a/layer2/ObjectMesh.cpp b/layer2/ObjectMesh.cpp index 4f4996073..afc8d5fd4 100644 --- a/layer2/ObjectMesh.cpp +++ b/layer2/ObjectMesh.cpp @@ -44,7 +44,7 @@ static void ObjectMeshRecomputeExtent(ObjectMesh * I); static PyObject *ObjectMeshStateAsPyList(ObjectMeshState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(17); @@ -96,7 +96,7 @@ int ObjectMeshAllMapsInStatesExist(ObjectMesh * I) static PyObject *ObjectMeshAllStatesAsPyList(ObjectMesh * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NState); for(a = 0; a < I->NState; a++) { @@ -116,14 +116,14 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { *I = ObjectMeshState(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -158,7 +158,7 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -181,7 +181,7 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, if(ok && (ll > 16)) { tmp = PyList_GetItem(list, 16); if(tmp == Py_None) - I->Field = NULL; + I->Field = nullptr; else { I->Field.reset(IsosurfNewFromPyList(G, tmp)); ok = I->Field != nullptr; @@ -215,11 +215,11 @@ static int ObjectMeshAllStatesFromPyList(ObjectMesh * I, PyObject * list) int ObjectMeshNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMesh ** result) { int ok = true; - ObjectMesh *I = NULL; - (*result) = NULL; + ObjectMesh *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -239,7 +239,7 @@ int ObjectMeshNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMesh ** res ObjectMeshRecomputeExtent(I); } else { DeleteP(I); - (*result) = NULL; + (*result) = nullptr; } return (ok); } @@ -248,7 +248,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG PyObject *ObjectMeshAsPyList(ObjectMesh * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int allMapsExist = ObjectMeshAllMapsInStatesExist(I); @@ -340,7 +340,7 @@ void ObjectMesh::invalidate(cRep_t rep, cRepInv_t level, int state) } if((rep == cRepMesh) || (rep == cRepAll) || (rep == cRepCell)) { - for(StateIterator iter(I->G, NULL, state, I->NState); iter.next();) { + for(StateIterator iter(I->G, nullptr, state, I->NState); iter.next();) { ObjectMeshState *ms = &I->State[iter.state]; ms->shaderCGO.reset(); @@ -383,7 +383,7 @@ int ObjectMeshSetLevel(ObjectMesh * I, float level, int state, int quiet) if(state >= I->NState) { ok = false; } else { - for(StateIterator iter(I->G, NULL, state, I->NState); iter.next();) { + for(StateIterator iter(I->G, nullptr, state, I->NState); iter.next();) { ObjectMeshState *ms = &I->State[iter.state]; if(ms->Active) { ms->ResurfaceFlag = true; @@ -402,9 +402,9 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) int cur_color = -1; if(ms->MeshMode == cIsomeshMode::isomesh) { - cur_color = SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_mesh_color); + cur_color = SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_mesh_color); } else if(ms->MeshMode == cIsomeshMode::isodot) { - cur_color = SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_dot_color); + cur_color = SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_dot_color); } if(cur_color == -1) @@ -442,7 +442,7 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_mesh_negative_color); + nullptr, cSetting_mesh_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) { @@ -469,7 +469,7 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) ms->RC.clear(); } else if((!ramped_flag) || - (!SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_ray_color_ramps))) { + (!SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_ray_color_ramps))) { ms->RC.clear(); } } @@ -481,8 +481,8 @@ void ObjectMesh::update() int a; int c; ObjectMeshState *ms; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; int *n; float *v; @@ -491,7 +491,7 @@ void ObjectMesh::update() int n_line; int flag; int last_flag = 0; - int mesh_skip = SettingGet_i(G, I->Setting.get(), NULL, cSetting_mesh_skip); + int mesh_skip = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_mesh_skip); for(a = 0; a < I->NState; a++) { ms = &I->State[a]; @@ -528,7 +528,7 @@ void ObjectMesh::update() if(map && oms && ms->N && ms->V && (I->visRep & cRepMeshBit)) { if(ms->ResurfaceFlag) { - Isofield *field = NULL; + Isofield *field = nullptr; ms->RecolorFlag = true; ms->ResurfaceFlag = false; if(!ms->quiet) { @@ -565,14 +565,14 @@ void ObjectMesh::update() ms->Range[3], ms->Range[4], ms->Range[5]); */ - IsosurfVolume(I->G, I->Setting.get(), NULL, + IsosurfVolume(I->G, I->Setting.get(), nullptr, field, ms->Level, ms->N, ms->V, ms->Range, ms->MeshMode, mesh_skip, ms->AltLevel); if(!SettingGet_b - (I->G, I->Setting.get(), NULL, cSetting_mesh_negative_visible)) { + (I->G, I->Setting.get(), nullptr, cSetting_mesh_negative_visible)) { ms->base_n_V = VLAGetSize(ms->V); } else if(ms->MeshMode != cIsomeshMode::gradient) { /* do we want the negative surface too? */ @@ -580,7 +580,7 @@ void ObjectMesh::update() pymol::vla N2(10000); pymol::vla V2(10000); - IsosurfVolume(I->G, I->Setting.get(), NULL, + IsosurfVolume(I->G, I->Setting.get(), nullptr, field, -ms->Level, N2, V2, ms->Range, ms->MeshMode, mesh_skip, ms->AltLevel); @@ -722,7 +722,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, SceneGetTwoSidedLighting(G)); } - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); if (shaderPrg) { shaderPrg->Disable(); @@ -731,7 +731,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, if (ms->shaderUnitCellCGO){ shaderPrg = G->ShaderMgr->Enable_DefaultShader(info->pass); shaderPrg->SetLightingEnabled(0); - CGORender(ms->shaderUnitCellCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderUnitCellCGO.get(), nullptr, nullptr, nullptr, info, nullptr); shaderPrg->Disable(); } @@ -741,7 +741,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCGO, int stateArg) { PyMOLGlobals *G = I->G; - float *v = NULL; + float *v = nullptr; float *vc; int *rc; float radius; @@ -749,10 +749,10 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG CRay *ray = 0; bool pick = false; RenderPass pass = RenderPass::Antialias; - int *n = NULL; + int *n = nullptr; int c; - float line_width, mesh_width = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_width); - ObjectMeshState *ms = NULL; + float line_width, mesh_width = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_width); + ObjectMeshState *ms = nullptr; int ok = true; if (info){ @@ -782,23 +782,23 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(ok && ray) { if(ms->UnitCellCGO && (I->visRep & cRepCellBit)){ ok &= CGORenderRay(ms->UnitCellCGO.get(), ray, info, ColorGet(I->G, I->Color), - NULL, I->Setting.get(), NULL); + nullptr, I->Setting.get(), nullptr); if (!ok){ ms->UnitCellCGO.reset(); break; } } if(ms->MeshMode != cIsomeshMode::isodot) { - radius = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_radius); + radius = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_radius); if(radius == 0.0F) { radius = ray->PixelRadius * line_width / 2.0F; } } else { - radius = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_dot_radius); + radius = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_dot_radius); if(radius == 0.0F) { radius = - ray->PixelRadius * SettingGet_f(I->G, I->Setting.get(), NULL, + ray->PixelRadius * SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_dot_width) / 1.4142F; } } @@ -868,7 +868,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(!pick && pass == RenderPass::Antialias) { short use_shader; short mesh_as_cylinders ; - CGO *shaderCGO = NULL; + CGO *shaderCGO = nullptr; use_shader = ( SettingGetGlobal_b(G, cSetting_mesh_use_shader) & SettingGetGlobal_b(G, cSetting_use_shaders)) | returnCGO; mesh_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && @@ -898,7 +898,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(ms->UnitCellCGO && (I->visRep & cRepCellBit)) { const float *color = ColorGet(I->G, I->Color); if (!use_shader) { - CGORender(ms->UnitCellCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(ms->UnitCellCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); } else if(!ms->shaderUnitCellCGO) { CGO *newUnitCellCGO = CGONewSized(G, 0); CGOColorv(newUnitCellCGO, color); @@ -934,7 +934,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if (!mesh_as_cylinders){ if(ms->MeshMode == cIsomeshMode::isodot){ ok &= CGODotwidth(shaderCGO, SettingGet_f - (I->G, I->Setting.get(), NULL, cSetting_dot_width)); + (I->G, I->Setting.get(), nullptr, cSetting_dot_width)); } else { ok &= CGOSpecial(shaderCGO, LINEWIDTH_DYNAMIC_MESH); } @@ -1002,7 +1002,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG glColor3fv(ColorGet(I->G, ms->OneColor)); if(ms->MeshMode == cIsomeshMode::isodot){ glPointSize(SettingGet_f - (I->G, I->Setting.get(), NULL, cSetting_dot_width)); + (I->G, I->Setting.get(), nullptr, cSetting_dot_width)); } else { glLineWidth(line_width); } @@ -1035,7 +1035,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if (use_shader) { if (ok){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; if (ok) ok &= CGOStop(shaderCGO); if (ok) @@ -1061,7 +1061,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG convertcgo = tmpCGO; convertcgo->use_shader = convertcgo->has_draw_cylinder_buffers = true; } else { - convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(ms->shaderCGO.get(), 0, false, NULL); + convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(ms->shaderCGO.get(), 0, false, nullptr); } CHECKOK(ok, convertcgo); } @@ -1084,7 +1084,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG ObjectSetRepVisMask(I, 0, cVis_AS); } - return NULL; + return nullptr; } @@ -1123,9 +1123,9 @@ ObjectMesh *ObjectMeshFromXtalSym(PyMOLGlobals * G, ObjectMesh * obj, ObjectMap float alt_level, int quiet) { int ok = true; - ObjectMesh *I = NULL; - ObjectMeshState *ms = NULL; - ObjectMapState *oms = NULL; + ObjectMesh *I = nullptr; + ObjectMeshState *ms = nullptr; + ObjectMapState *oms = nullptr; int created = !obj; if(created) { @@ -1271,7 +1271,7 @@ ObjectMesh *ObjectMeshFromBox(PyMOLGlobals * G, ObjectMesh * obj, ObjectMap * ma float level, cIsomeshMode meshMode, float carve, float *vert_vla, float alt_level, int quiet) { - return ObjectMeshFromXtalSym(G, obj, map, NULL, map_state, state, mn, mx, + return ObjectMeshFromXtalSym(G, obj, map, nullptr, map_state, state, mn, mx, level, meshMode, carve, vert_vla, alt_level, quiet); } diff --git a/layer2/ObjectMolecule.cpp b/layer2/ObjectMolecule.cpp index 1f6f23bc4..1e6f3b9ec 100644 --- a/layer2/ObjectMolecule.cpp +++ b/layer2/ObjectMolecule.cpp @@ -225,8 +225,8 @@ int ObjectMoleculeSetDiscrete(PyMOLGlobals * G, ObjectMolecule * I, int discrete { int state, idx, ao, an, ao1, ao2, an1, an2; int maxnatom, natom = I->NAtom, nbond = I->NBond; - int *aostate2an = NULL; - char *bondseen = NULL; + int *aostate2an = nullptr; + char *bondseen = nullptr; BondType *bond; CoordSet *cs; @@ -390,7 +390,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const const char *frozen_str = ""; int state = ObjectGetCurrentState(I, false); - int counter_mode = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_state_counter_mode); + int counter_mode = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_state_counter_mode); int frozen = SettingGetIfDefined_i(I->G, I->Setting.get(), cSetting_state, &objState); /* if frozen print (blue) STATE / NSTATES @@ -425,7 +425,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const /* bail on null string or no room */ if (!ch || len==0) - return NULL; + return nullptr; ch[0] = 0; @@ -471,7 +471,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const } if (n > len) - return NULL; + return nullptr; return ch; } @@ -648,7 +648,7 @@ int ObjectMoleculeXferValences(ObjectMolecule * Ia, int sele1, int sele2, int target_state, ObjectMolecule * Ib, int sele3, int source_state, int quiet) { - int *matched = NULL; + int *matched = nullptr; int match_found = false; PyMOLGlobals *G = Ia->G; if(Ia == Ib) @@ -742,7 +742,7 @@ void ObjectMoleculeTransformState44f(ObjectMolecule * I, int state, const float int a; float tmp_matrix[16]; CoordSet *cs; - int use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + int use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if(!use_matrices) { ObjectMoleculeTransformSelection(I, state, -1, matrix, log_trans, I->Name, @@ -772,7 +772,7 @@ void ObjectMoleculeTransformState44f(ObjectMolecule * I, int state, const float ObjectStateLeftCombineMatrixR44d(cs, dbl_matrix); } else if(I->NCSet == 1) { /* static singleton state */ cs = I->CSet[0]; - if(cs && SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_static_singletons)) { + if(cs && SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_static_singletons)) { ObjectStateLeftCombineMatrixR44d(cs, dbl_matrix); } } @@ -906,7 +906,7 @@ int ObjectMoleculeGetTopNeighbor(PyMOLGlobals * G, * @param[in] obj Object Molecule for evaluation of the selection * @param[in,out] cs Candidate coordinate set (with valid index arrays) * @param[in] selection Named selection - * @return index mapping, or NULL if `selection` is not valid + * @return index mapping, or nullptr if `selection` is not valid */ std::unique_ptr LoadTrajSeleHelper( const ObjectMolecule* obj, CoordSet* cs, const char* selection) @@ -962,7 +962,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, float box[3], angle[3]; float r_cent[3], r_trans[3]; int r_act, r_val, r_cnt; - float *r_fp_start = NULL, *r_fp_stop = NULL; + float *r_fp_start = nullptr, *r_fp_stop = nullptr; int a, b, c, i; int zoom_flag = false; int cnt = 0; @@ -970,7 +970,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, int icnt; int ncnt = 0; float zerovector[3] = { 0.0, 0.0, 0.0 }; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if (I->DiscreteFlag) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) @@ -1049,7 +1049,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, if(xref[a] >= 0) fp = cs->coordPtr(xref[a]); else - fp = NULL; + fp = nullptr; } else { fp = cs->coordPtr(a); } @@ -1169,7 +1169,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, if(xref[i] >= 0) fp = cs->coordPtr(xref[i]); else - fp = NULL; + fp = nullptr; } else { fp = cs->coordPtr(i); } @@ -1306,7 +1306,7 @@ ObjectMolecule *ObjectMoleculeLoadRSTFile(PyMOLGlobals * G, ObjectMolecule * I, float f0, f1, f2, *fp; int a, b, c; int zoom_flag = false; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; char ncolumn = 6; // number of coordinates per line char nbyte = 12; // width of one coordinate @@ -1332,7 +1332,7 @@ ObjectMolecule *ObjectMoleculeLoadRSTFile(PyMOLGlobals * G, ObjectMolecule * I, if (ok){ PRINTFB(G, FB_ObjectMolecule, FB_Blather) " ObjMolLoadRSTFile: Loading from \"%s\".\n", fname ENDFB(G); - p = buffer = FileGetContents(fname, NULL); + p = buffer = FileGetContents(fname, nullptr); if(!buffer) ok = ErrMessage(G, __func__, "Unable to open file!"); } @@ -1473,11 +1473,11 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p; int nAtom; int a, b, c, bi, last_i, at_i, aa, rc; - float *coord = NULL; + float *coord = nullptr; float *f; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; - BondType *bond = NULL, *bd; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; + BondType *bond = nullptr, *bd; int nBond = 0; int auto_show = RepGetAutoShowMask(G); int amber7 = false; @@ -2315,7 +2315,7 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf } else { ok_except1: delete cset; - cset = NULL; + cset = nullptr; ErrMessage(G, __func__, "failed"); } if(atInfoPtr) @@ -2329,7 +2329,7 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf static ObjectMolecule *ObjectMoleculeReadTOPStr(PyMOLGlobals * G, ObjectMolecule * I, char *TOPStr, int frame, int discrete) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo(1); int ok = true; int isNew = true; @@ -2416,10 +2416,10 @@ static ObjectMolecule *ObjectMoleculeReadTOPStr(PyMOLGlobals * G, ObjectMolecule ObjectMolecule *ObjectMoleculeLoadTOPFile(PyMOLGlobals * G, ObjectMolecule * obj, const char *fname, int frame, int discrete) { - ObjectMolecule *I = NULL; + ObjectMolecule *I = nullptr; char *buffer; - buffer = FileGetContents(fname, NULL); + buffer = FileGetContents(fname, nullptr); if(!buffer) ErrMessage(G, __func__, "Unable to open file!"); @@ -2724,14 +2724,14 @@ void ObjectMoleculeRenderSele(ObjectMolecule * I, int curState, int sele, int vi int flag = true; int all_vis = !vis_only; int visRep; - float tmp_matrix[16], v_tmp[3], *matrix = NULL; + float tmp_matrix[16], v_tmp[3], *matrix = nullptr; int use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if (SettingGetIfDefined_i(G, I->Setting.get(), cSetting_all_states, &a)) { - curState = a ? -1 : SettingGet_i(G, I->Setting.get(), NULL, cSetting_state); + curState = a ? -1 : SettingGet_i(G, I->Setting.get(), nullptr, cSetting_state); } else if (SettingGetIfDefined_i(G, I->Setting.get(), cSetting_state, &a)) { curState = a - 1; } @@ -2749,7 +2749,7 @@ void ObjectMoleculeRenderSele(ObjectMolecule * I, int curState, int sele, int vi copy44d44f(cs->Matrix.data(), tmp_matrix); matrix = tmp_matrix; } else - matrix = NULL; + matrix = nullptr; if(I->TTTFlag) { if(!matrix) { @@ -2805,12 +2805,12 @@ static CoordSet *ObjectMoleculeXYZStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p, *p_store; int nAtom; int a, c; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; char cc[MAXLINELEN]; int atomCount; - BondType *bond = NULL; + BondType *bond = nullptr; int nBond = 0; int b1, b2; WordType tmp_name; @@ -3108,7 +3108,7 @@ int ObjectMoleculeRenameAtoms(ObjectMolecule * I, int *flag, int force) } } } - result = AtomInfoUniquefyNames(I->G, NULL, 0, I->AtomInfo.data(), flag, I->NAtom); + result = AtomInfoUniquefyNames(I->G, nullptr, 0, I->AtomInfo.data(), flag, I->NAtom); return result; } @@ -3120,7 +3120,7 @@ int ObjectMoleculeRenameAtoms(ObjectMolecule * I, int *flag, int force) * @param coord_orig Original cs coordinates * @param at0 Anchor atom index * @param mat1_inv Source coordinate system - * @param valence_vec Valence vector. If NULL, don't move. If null-vector, don't merge. + * @param valence_vec Valence vector. If nullptr, don't move. If null-vector, don't merge. */ static bool AddCoordinateIntoCoordSet(CoordSet* tcs, CoordSet* cs, const float* coord_orig, int at0, const float* mat1_inv, @@ -3491,7 +3491,7 @@ int ObjectMoleculeAttach(ObjectMolecule * I, int index, AtomInfoType *ai; BondType* bond; float v[3], v0[3], d; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; int ok = false; ai = I->AtomInfo + index; @@ -3542,7 +3542,7 @@ int ObjectMoleculeFillOpenValences(ObjectMolecule * I, int index) int result = 0; int flag = true; float v[3], v0[3], d; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; int ok = true; if((index >= 0) && (index <= I->NAtom)) { @@ -3671,7 +3671,7 @@ static bool get_planer_normal(const CoordSet* cs, int const atm, float* normal) /** * @param atm Atom index * @param[out] v (3x1) Normalized open valence vector - * @param seek (3x1) Primer for the direction, or NULL for random priming. + * @param seek (3x1) Primer for the direction, or nullptr for random priming. * @param ignore_index Atom index of neighbor to ignore * @return True if valid open valence vector found */ @@ -3855,16 +3855,16 @@ void ObjectMoleculeCreateSpheroid(ObjectMolecule * I, int average) SphereRec *sp; float *v, *v0, *s, *f, ang, min_dist, *max_sq; int *i; - float *center = NULL; + float *center = nullptr; float d0[3], n0[3], d1[3], d2[3]; float p0[3], p1[3], p2[3]; int t0, t1, t2, bt0, bt1, bt2; - float dp, l, *fsum = NULL; + float dp, l, *fsum = nullptr; float spheroid_smooth; float spheroid_fill; float spheroid_ratio = 0.1F; /* minimum ratio of width over length */ float spheroid_minimum = 0.02F; /* minimum size - to insure valid normals */ - int row, *count = NULL, base; + int row, *count = nullptr, base; int nRow; int first = 0; int last = 0; @@ -4068,12 +4068,12 @@ void ObjectMoleculeCreateSpheroid(ObjectMolecule * I, int average) for(b = first + 1; b < last; b++) { delete I->CSet[b]; - I->CSet[b] = NULL; + I->CSet[b] = nullptr; } if(n_state != first) { I->CSet[n_state] = I->CSet[first]; - I->CSet[first] = NULL; + I->CSet[first] = nullptr; } n_state++; @@ -4134,7 +4134,7 @@ int ObjectMoleculePrepareAtom(ObjectMolecule * I, int index, AtomInfoType * ai, AtomInfoAssignParameters(I->G, ai); if (uniquefy) { - AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, NULL, 1); + AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, nullptr, 1); } if((ai->elem[0] == ai0->elem[0]) && (ai->elem[1] == ai0->elem[1])) @@ -4409,7 +4409,7 @@ int ObjectMoleculeAdjustBonds(ObjectMolecule * I, int sele0, int sele1, int mode cnt++; switch (mode) { case 0: /* cycle */ - switch(SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_editor_bond_cycle_mode)) { + switch(SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_editor_bond_cycle_mode)) { case 1: /* 1 arom 2 3 */ switch(b0->order) { case 1: @@ -4810,10 +4810,10 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int better than nothing! */ const float planer_cutoff = 0.96F; - CoordSet *cs = NULL; - ObservedInfo *obs_atom = NULL; - ObservedInfo *obs_bond = NULL; - int *flag = NULL; + CoordSet *cs = nullptr; + ObservedInfo *obs_atom = nullptr; + ObservedInfo *obs_bond = nullptr; + int *flag = nullptr; int warning1 = 0, warning2 = 0; /* WORKAROUND of a possible -funroll-loops inlining optimizer bug in gcc 3.3.3 */ @@ -5032,7 +5032,7 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int float n1_len = 0.0F, n2_len = 0.0F, n3_len = 0.0F; int c1_at = -1, c2_at = -1; float c1_v[3] = { 0.0F, 0.0F, 0.0F }; - float *v0 = NULL; + float *v0 = nullptr; { int idx0 = cs->atmToIdx(a); @@ -5042,7 +5042,7 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int { int i; for(i = 1; i <= nn; i++) { - float *v1 = NULL; + float *v1 = nullptr; { int idx1 = cs->atmToIdx(atm[i]); @@ -5963,7 +5963,7 @@ void ObjectMoleculeInferChemFromBonds(ObjectMolecule * I, int state) int a, b; const BondType *b0; - AtomInfoType *ai, *ai0, *ai1 = NULL; + AtomInfoType *ai, *ai0, *ai1 = nullptr; int a0, a1; int expect, order; int changedFlag; @@ -6264,7 +6264,7 @@ int ObjectMoleculeTransformSelection(ObjectMolecule * I, int state, cs = I->CSet[state]; if(cs) { int use_matrices = SettingGet_i(G, I->Setting.get(), - NULL, cSetting_matrix_mode); + nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if(global &&!homogenous) { /* convert matrix to homogenous */ @@ -6449,7 +6449,7 @@ void ObjectMoleculeUpdateNonbonded(ObjectMolecule * I) * * Changed in PyMOL 2.1.1: Ignore zero-order bonds (PYMOL-3025) * - * @return Pointer to cached array, or NULL if memory allocation failed + * @return Pointer to cached array, or nullptr if memory allocation failed * * @verbatim 0 list offset for atom 0 = n @@ -6568,22 +6568,22 @@ static CoordSet *ObjectMoleculeChemPyModel2CoordSet(PyMOLGlobals * G, { int nAtom, nBond; int a, c; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; float *f; - BondType *ii, *bond = NULL; + BondType *ii, *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); int hetatm; int ignore_ids; - PyObject *atomList = NULL; - PyObject *bondList = NULL; - PyObject *atom = NULL; - PyObject *bnd = NULL; - PyObject *index = NULL; - PyObject *crd = NULL; - PyObject *tmp = NULL; + PyObject *atomList = nullptr; + PyObject *bondList = nullptr; + PyObject *atom = nullptr; + PyObject *bnd = nullptr; + PyObject *index = nullptr; + PyObject *crd = nullptr; + PyObject *tmp = nullptr; ignore_ids = !SettingGetGlobal_b(G, cSetting_preserve_chempy_ids); @@ -7209,9 +7209,9 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, PyObject * model, int frame, int discrete) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - CoordSet *cset = NULL; + CoordSet *cset = nullptr; auto atInfo = pymol::vla(10); int ok = true; int isNew = true; @@ -7277,7 +7277,7 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, if(symmetry) { tmp = PyObject_GetAttrString(model, "spacegroup"); if(tmp) { - const char *tmp_str = NULL; + const char *tmp_str = nullptr; if(PConvPyStrToStrPtr(tmp, &tmp_str)) { symmetry->setSpaceGroup(tmp_str); } @@ -7383,7 +7383,7 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, const float * coords, int coords_len, int frame) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; int a; bool is_new = false; @@ -7435,7 +7435,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, if(is_new && cset) delete cset; ErrMessage(G, "LoadCoords", "failed"); - return NULL; + return nullptr; } /*========================================================================*/ @@ -7448,7 +7448,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, const char * name, if(!cobj || cobj->type != cObjectMolecule) { ErrMessage(G, "LoadCoords", "named object molecule not found."); - return NULL; + return nullptr; } return ObjectMoleculeLoadCoords(G, (ObjectMolecule *) cobj, @@ -7465,9 +7465,9 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, PyObject * coords, int frame) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - CoordSet *cset = NULL; + CoordSet *cset = nullptr; int a, b, l; PyObject *v, *w; float *f; @@ -7541,7 +7541,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, if(is_new && cset) delete cset; ErrMessage(G, "LoadCoords", "failed"); - return NULL; + return nullptr; #endif } @@ -7581,13 +7581,13 @@ static CoordSet *ObjectMoleculeMOLStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p; int nAtom, nBond; int a, cnt, atm, chg; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr; char cc[MAXLINELEN], cc1[MAXLINELEN], resn[MAXLINELEN] = "UNK"; float *f; BondType *ii; - BondType *bond = NULL; + BondType *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); WordType nameTmp; @@ -7767,7 +7767,7 @@ static CoordSet *ObjectMoleculeMOLStr2CoordSet(PyMOLGlobals * G, const char *buf } else { VLAFreeP(bond); VLAFreeP(coord); - (*restart) = NULL; + (*restart) = nullptr; } if(atInfoPtr) *atInfoPtr = atInfo; @@ -7783,7 +7783,7 @@ static CoordSet *ObjectMoleculeSDF2Str2CoordSet(PyMOLGlobals * G, const char *bu { char cc[MAXLINELEN]; const char *p; - CoordSet *result = NULL; + CoordSet *result = nullptr; result = ObjectMoleculeMOLStr2CoordSet(G, buffer, atInfoPtr, next_mol); p = *next_mol; if(p) { @@ -7795,7 +7795,7 @@ static CoordSet *ObjectMoleculeSDF2Str2CoordSet(PyMOLGlobals * G, const char *bu } } if(!*p) - p = NULL; + p = nullptr; } *next_mol = p; return result; @@ -7926,14 +7926,14 @@ static CoordSet *ObjectMoleculeMOL2Str2CoordSet(PyMOLGlobals * G, const char *p; int nAtom, nBond, nSubst, nFeat, nSet; int a; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr; char cc[MAXLINELEN]; float *f; const char *last_p; BondType *ii; - BondType *bond = NULL; + BondType *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); int have_molecule = false; @@ -8517,11 +8517,11 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, short loadpropertiesall, OVLexicon *loadproplex) { int ok = true; - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo; int isNew; int nAtom; - const char *restart = NULL, *start = *next_entry; + const char *restart = nullptr, *start = *next_entry; int repeatFlag = true; int successCnt = 0; char tmpName[WordLength]; @@ -8529,7 +8529,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, int skip_out; int connect = false; int set_formal_charges = false; - *next_entry = NULL; + *next_entry = nullptr; int aic_mask = cAIC_MOLMask; while(repeatFlag) { @@ -8552,7 +8552,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, I->Color = AtomInfoUpdateAutoColor(G); } - restart = NULL; + restart = nullptr; switch (content_format) { case cLoadTypeMOL2: case cLoadTypeMOL2Str: @@ -8564,7 +8564,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, case cLoadTypeMOL: case cLoadTypeMOLStr: cset = ObjectMoleculeMOLStr2CoordSet(G, start, &atInfo, &restart); - restart = NULL; + restart = nullptr; break; case cLoadTypeSDF2: case cLoadTypeSDF2Str: @@ -8938,7 +8938,7 @@ int ObjectMoleculeMerge(ObjectMolecule * I, pymol::vla&& ai, /*========================================================================*/ /** * @param state Object state or -2 for current state - * @return NULL if there is no CoordSet for the given state + * @return nullptr if there is no CoordSet for the given state */ CoordSet* ObjectMolecule::getCoordSet(int state) { @@ -9015,7 +9015,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op if (op->s1 && op->s1[0]){ #ifndef _PYMOL_NOPY expr_co = Py_CompileString(op->s1, "", compileType); - if(expr_co == NULL) { + if(expr_co == nullptr) { ok = ErrMessage(G, errstr, "failed to compile expression"); } #else @@ -9183,7 +9183,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } for(a = 0; a < I->NAtom; a++) { @@ -9308,9 +9308,9 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } if(op->nvv1) { if(op->i1 != 0) /* fitting flag */ - rms = MatrixFitRMSTTTf(G, op->nvv1, op->vv1, vt, NULL, op->ttt); + rms = MatrixFitRMSTTTf(G, op->nvv1, op->vv1, vt, nullptr, op->ttt); else - rms = MatrixGetRMS(G, op->nvv1, op->vv1, vt, NULL); + rms = MatrixGetRMS(G, op->nvv1, op->vv1, vt, nullptr); if(op->i1 == 2) { ObjectMoleculeTransformTTTf(I, op->ttt, b); @@ -9520,7 +9520,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case OMOP_Spectrum: ai = I->AtomInfo.data(); - ai0 = NULL; + ai0 = nullptr; for(a = 0; a < I->NAtom; a++) { s = ai->selEntry; if(SelectorIsMember(G, s, sele)) { @@ -9663,7 +9663,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op CoordSet* const* i_CSet = I->CSet.data(); if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } ai = I->AtomInfo.data(); @@ -9723,7 +9723,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op CoordSet* const* i_CSet = I->CSet.data(); if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } ai = I->AtomInfo.data(); @@ -9801,7 +9801,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } break; } - use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; ai = I->AtomInfo.data(); @@ -9898,7 +9898,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case cExecutiveLabelEvalOn: { /* python label expression evaluation */ - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(I->DiscreteFlag && I->DiscreteCSet) { cs = I->DiscreteCSet[a]; } else if (I->NCSet == 1){ @@ -9946,7 +9946,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op break; case OMOP_ALTR: if(ok) { - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(I->DiscreteFlag && I->DiscreteCSet) { cs = I->DiscreteCSet[a]; } else if (I->NCSet == 1){ @@ -9998,12 +9998,12 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case OMOP_CSetSumSqDistToPt: case OMOP_CSetSumVertices: case OMOP_CSetMoment: - cs = NULL; + cs = nullptr; if((op->cs1 >= 0) && (op->cs1 < I->NCSet)) { cs = I->CSet[op->cs1]; } else if(op->include_static_singletons) { if((I->NCSet == 1) - && (SettingGet_b(G, NULL, I->Setting.get(), cSetting_static_singletons))) { + && (SettingGet_b(G, nullptr, I->Setting.get(), cSetting_static_singletons))) { cs = I->CSet[0]; /*treat static singletons as present in each state */ } } @@ -10578,7 +10578,7 @@ void ObjectMolecule::update() /* set start and stop given an object */ ObjectAdjustStateRebuildRange(I, &start, &stop); if((I->NCSet == 1) - && (SettingGet_b(G, I->Setting.get(), NULL, cSetting_static_singletons))) { + && (SettingGet_b(G, I->Setting.get(), nullptr, cSetting_static_singletons))) { start = 0; stop = 1; } @@ -10739,7 +10739,7 @@ int ObjectMoleculeMoveAtom(ObjectMolecule * I, int state, int index, const float if(I->NCSet == 1) state = 0; state = state % I->NCSet; - if((!I->CSet[state]) && (SettingGet_b(G, I->Setting.get(), NULL, cSetting_all_states))) + if((!I->CSet[state]) && (SettingGet_b(G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; cs = I->CSet[state]; if(cs) { @@ -10773,7 +10773,7 @@ int ObjectMoleculeMoveAtomLabel(ObjectMolecule * I, int state, int index, float state = 0; state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; cs = I->CSet[state]; if(cs) { @@ -10812,7 +10812,7 @@ int ObjectMoleculeGetBondPaths(ObjectMolecule * I, int atom, int max, ObjectMoleculeBPRec * bp) { /* returns list of bond counts from atom to all others - dist and list must be vla array pointers or NULL */ + dist and list must be vla array pointers or nullptr */ int b_cnt = 0; @@ -10860,7 +10860,7 @@ int ***ObjectMoleculeGetBondPrint(ObjectMolecule * I, int max_bond, int max_type { int a, b, i, c; int at1, at2; - int ***result = NULL; + int ***result = nullptr; ObjectMoleculeBPRec bp; dim[0] = max_type + 1; @@ -10964,14 +10964,14 @@ int ObjectMoleculeGetAtomVertex(const ObjectMolecule * I, int state, int index, { int result = 0; if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->NCSet == 1) state = 0; /* static singletons always active here it seems */ state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; if(I->CSet[state]) result = CoordSetGetAtomVertex(I->CSet[state], index, v); @@ -10989,7 +10989,7 @@ int ObjectMoleculeGetAtomTxfVertex(const ObjectMolecule * I, int state, int inde cs = I->DiscreteCSet[index]; } if(state < 0){ - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; } if(state < 0) state = SceneGetState(I->G); @@ -10999,7 +10999,7 @@ int ObjectMoleculeGetAtomTxfVertex(const ObjectMolecule * I, int state, int inde { if (!cs) cs = I->CSet[state]; - if((!cs) && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) { + if((!cs) && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) { state = 0; cs = I->CSet[state]; } @@ -11015,14 +11015,14 @@ int ObjectMoleculeSetAtomVertex(ObjectMolecule * I, int state, int index, float { int result = 0; if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->NCSet == 1) state = 0; state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; if(I->CSet[state]) result = CoordSetSetAtomVertex(I->CSet[state], index, v); @@ -11038,7 +11038,7 @@ void ObjectMolecule::render(RenderInfo * info) const RenderPass pass = info->pass; CoordSet *cs; int pop_matrix = false; - int use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + int use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; PRINTFD(I->G, FB_ObjectMolecule) " ObjectMolecule: rendering %s pass %d...\n", I->Name, static_cast(pass) ENDFD; @@ -11105,12 +11105,12 @@ ObjectMolecule::ObjectMolecule(PyMOLGlobals * G, int discreteFlag) : pymol::CObj I->DiscreteAtmToIdx = pymol::vla(0); I->DiscreteCSet = pymol::vla(0); } else { - I->DiscreteAtmToIdx = NULL; - I->DiscreteCSet = NULL; + I->DiscreteAtmToIdx = nullptr; + I->DiscreteCSet = nullptr; } I->AtomInfo = pymol::vla(10); for(a = 0; a <= cUndoMask; a++) { - I->UndoCoord[a] = NULL; + I->UndoCoord[a] = nullptr; I->UndoState[a] = -1; } I->UndoIter = 0; @@ -11126,14 +11126,14 @@ void ObjectMoleculeCopyNoAlloc(const ObjectMolecule* obj, ObjectMolecule* I) BondType *i0; const BondType *i1; (*I) = (*obj); - I->Sculpt = NULL; + I->Sculpt = nullptr; I->Setting.reset(SettingCopyAll(G, obj->Setting.get(), nullptr)); - I->ViewElem = NULL; - I->gridSlotSelIndicatorsCGO = NULL; + I->ViewElem = nullptr; + I->gridSlotSelIndicatorsCGO = nullptr; for(a = 0; a <= cUndoMask; a++) - I->UndoCoord[a] = NULL; + I->UndoCoord[a] = nullptr; I->CSet = pymol::vla(I->NCSet); /* auto-zero */ for(a = 0; a < I->NCSet; a++) { I->CSet[a] = CoordSetCopy(obj->CSet[a]); @@ -11217,7 +11217,7 @@ ObjectMolecule::~ObjectMolecule() for(a = 0; a < I->NCSet; a++){ if(I->CSet[a]) { delete I->CSet[a]; - I->CSet[a] = NULL; + I->CSet[a] = nullptr; } } VLAFreeP(I->DiscreteAtmToIdx); @@ -11259,12 +11259,12 @@ ObjectMolecule *ObjectMoleculeReadPDBStr(PyMOLGlobals * G, ObjectMolecule * I, const char **next_pdb, PDBInfoRec * pdb_info, int quiet, int *model_number) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo; int ok = true; int isNew = true; unsigned int nAtom = 0; - const char *start, *restart = NULL; + const char *start, *restart = nullptr; int repeatFlag = true; int successCnt = 0; unsigned int aic_mask = cAIC_PDBMask; @@ -11379,7 +11379,7 @@ ObjectMolecule *ObjectMoleculeReadPDBStr(PyMOLGlobals * G, ObjectMolecule * I, ObjectMoleculeAutoDisableAtomNameWildcard(I); } if(SettingGetGlobal_b(G, cSetting_pdb_hetatm_guess_valences)) { - ObjectMoleculeGuessValences(I, state, NULL, NULL, false); + ObjectMoleculeGuessValences(I, state, nullptr, nullptr, false); } successCnt++; @@ -11415,14 +11415,14 @@ CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer, const char *p; int nAtom, nBond; int a, c, bPart, bOrder; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; char cc[MAXLINELEN]; WordType title; float *f; - BondType *ii, *bond = NULL; + BondType *ii, *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); @@ -11602,7 +11602,7 @@ CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer, } if(atInfoPtr) *atInfoPtr = atInfo; - *restart = *p ? p : NULL; + *restart = *p ? p : nullptr; return (cset); } @@ -11660,9 +11660,9 @@ int *AtomInfoGetSortedIndex(PyMOLGlobals * G, setting = obj->Setting.get(); UtilSortIndexGlobals(G, n, rec, index, (UtilOrderFnGlobals *) ( - SettingGet_b(G, setting, NULL, cSetting_retain_order) ? + SettingGet_b(G, setting, nullptr, cSetting_retain_order) ? AtomInfoInOrigOrder : - SettingGet_b(G, setting, NULL, cSetting_pdb_hetatm_sort) ? + SettingGet_b(G, setting, nullptr, cSetting_pdb_hetatm_sort) ? AtomInfoInOrder : AtomInfoInOrderIgnoreHet)); } @@ -11674,7 +11674,7 @@ int *AtomInfoGetSortedIndex(PyMOLGlobals * G, ok_except1: FreeP(index); - return NULL; + return nullptr; } /** @@ -11695,7 +11695,7 @@ bool ObjectMolecule::setNDiscrete(int natom) { for (int i = n; i < natom; ++i) { DiscreteAtmToIdx[i] = -1; - DiscreteCSet[i] = NULL; + DiscreteCSet[i] = nullptr; } return true; diff --git a/layer2/ObjectMolecule2.cpp b/layer2/ObjectMolecule2.cpp index 857876a92..db53946e4 100644 --- a/layer2/ObjectMolecule2.cpp +++ b/layer2/ObjectMolecule2.cpp @@ -97,7 +97,7 @@ static void AddOrthoOutputIfMatchesTags(PyMOLGlobals * G, int n_tags, continue; ParseNTrimRight(cc, p, MAXLINELEN - 1); OrthoAddOutput(G, cc); - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); break; } } @@ -329,7 +329,7 @@ int ObjectMoleculeAddPseudoatom(ObjectMolecule * I, int sele_index, const char * ai->color = color; } AtomInfoAssignParameters(I->G, ai); - AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, NULL, 1); + AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, nullptr, 1); if(!quiet) { PRINTFB(G, FB_ObjectMolecule, FB_Actions) " ObjMol: created %s/%s/%s/%s`%d%c/%s\n", @@ -390,7 +390,7 @@ int ObjectMoleculeAddPseudoatom(ObjectMolecule * I, int sele_index, const char * ai->vdw = vdw; /* NOTE: only uses vdw from first state selection... */ } } else { - pos = NULL; /* skip this state */ + pos = nullptr; /* skip this state */ } } else if(!pos) { SceneGetCenter(I->G, pos_array); @@ -446,7 +446,7 @@ int *ObjectMoleculeGetPrioritizedOtherIndexList(ObjectMolecule * I, CoordSet * c int b1, b2, a1, a2, a3; OtherRec *o; OtherRec *other = pymol::calloc(cs->NIndex); - int *result = NULL; + int *result = nullptr; int offset; int n_alloc = 0; const BondType *bd; @@ -1448,7 +1448,7 @@ int ObjectMoleculeConvertIDsToIndices(ObjectMolecule * I, int *id, int n_id) { /* return true if all IDs are unique, false if otherwise */ - int min_id, max_id, range, *lookup = NULL; + int min_id, max_id, range, *lookup = nullptr; int unique = true; /* this routine only works if IDs cover a reasonable range -- @@ -1529,7 +1529,7 @@ static const char *check_next_pdb_object(const char *p, int skip_to_next) } p = nextline(p); } - return NULL; + return nullptr; } static int get_multi_object_status(const char *p) @@ -1563,11 +1563,11 @@ int ObjectMoleculeAutoDisableAtomNameWildcard(ObjectMolecule * I) int found_wildcard = false; { - const char *tmp = SettingGet_s(G, NULL, I->Setting.get(), cSetting_atom_name_wildcard); + const char *tmp = SettingGet_s(G, nullptr, I->Setting.get(), cSetting_atom_name_wildcard); if(tmp && tmp[0]) { wildcard = *tmp; } else { - tmp = SettingGet_s(G, NULL, I->Setting.get(), cSetting_wildcard); + tmp = SettingGet_s(G, nullptr, I->Setting.get(), cSetting_wildcard); if(tmp) { wildcard = *tmp; } @@ -1611,7 +1611,7 @@ static void ObjectMoleculePDBStr2CoordSetPASS1(PyMOLGlobals * G, int *ok, int *ssFlag, const char **next_pdb, PDBInfoRec *info, int only_read_one_model, int *ignore_conect, int *bondFlag, int *have_bond_order) { int seen_end_of_atoms = false; - *restart_model = NULL; + *restart_model = nullptr; while(*ok && *p) { AddOrthoOutputIfMatchesTags(G, n_tags, *nAtom, tag_start, p, cc, quiet); if((strstartswith(p, "ATOM ") || @@ -1700,7 +1700,7 @@ static SSHash * sshash_new() { return hash; ok_except1: sshash_free(hash); - return NULL; + return nullptr; } /** @@ -1728,14 +1728,14 @@ static int sshash_register_rec(SSHash * hash, ok_assert(1, hash->ss[chain] = pymol::calloc(cResvMask + 1)); } - sst = NULL; + sst = nullptr; // iterate over all residues indicated for(b = ss_resv1; b <= ss_resv2; b++) { index = b & cResvMask; if(hash->ss[chain][index]) { // make a unique copy in the event of multiple entries for one resv - sst = NULL; + sst = nullptr; } if(!sst) { @@ -1755,7 +1755,7 @@ static int sshash_register_rec(SSHash * hash, sst->next = hash->ss[chain][index]; hash->ss[chain][index] = ssi; if(sst->next) - sst = NULL; /* force another unique copy */ + sst = nullptr; /* force another unique copy */ } } return ss_found; @@ -1768,7 +1768,7 @@ static int sshash_register_rec(SSHash * hash, */ static void sshash_lookup(SSHash *hash, AtomInfoType *ai, unsigned char ss_chain1) { int index, ssi; - SSEntry *sst = NULL; + SSEntry *sst = nullptr; index = ai->resv & cResvMask; if(hash->ss[ss_chain1]) { @@ -1874,14 +1874,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, const char *p; int nAtom; int a; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; int AFlag; char SSCode; int atomCount; int bondFlag = false; - BondType *bond = NULL, *ii1, *ii2; + BondType *bond = nullptr, *ii1, *ii2; int *idx; int nBond = 0; int b1, b2, nReal, maxAt; @@ -1896,7 +1896,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, int ss_resv1 = 0, ss_resv2 = 0; char ss_inscode1 = '\0', ss_inscode2 = '\0'; unsigned char ss_chain1 = 0, ss_chain2 = 0; - SSHash *ss_hash = NULL; + SSHash *ss_hash = nullptr; char cc[MAXLINELEN], tags[MAXLINELEN]; int ignore_pdb_segi = 0; int ss_valid, ss_found = false; @@ -1975,7 +1975,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, END PASS 1 */ - *restart_model = NULL; + *restart_model = nullptr; if (ok){ coord = VLAlloc(float, 3 * nAtom); CHECKOK(ok, coord); @@ -2120,7 +2120,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, if(info && (info->multiplex == 0)) { /* multiplex == 0: FORCED multimodel behavior with concatenated PDB files */ (*restart_model) = (*next_pdb); - (*next_pdb) = NULL; + (*next_pdb) = nullptr; foundNextModelFlag = true; info->multi_object_status = -1; } else { @@ -2129,14 +2129,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, } else if(strstartswith(pp, "MODEL")) { /* not a new object...just a new state (model) */ if(info && (info->multiplex > 0)) { /* end object if we're multiplexing */ (*next_pdb) = check_next_pdb_object(pp, true); - (*restart_model) = NULL; + (*restart_model) = nullptr; } else is_end_of_object = false; } else { if(pp[0] > 32) /* more content follows... */ (*next_pdb) = check_next_pdb_object(pp, true); else - (*next_pdb) = NULL; /* at end of file */ + (*next_pdb) = nullptr; /* at end of file */ } break; } @@ -2154,7 +2154,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, if((*next_pdb) && info && (!info->multiplex) && !(*restart_model)) { /* multiplex == 0: FORCED multimodel behavior with concatenated PDB files */ (*restart_model) = (*next_pdb); - (*next_pdb) = NULL; + (*next_pdb) = nullptr; foundNextModelFlag = true; info->multi_object_status = -1; is_end_of_object = false; @@ -2725,14 +2725,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, p = nextline(p); } if(!foundNextModelFlag) { - *restart_model = NULL; + *restart_model = nullptr; } } } if (!ok){ if (cset){ delete cset; - cset = NULL; + cset = nullptr; } else { VLAFreeP(coord); VLAFreeP(bond); @@ -2748,9 +2748,9 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, trajectories, then enforce sanity by reading the models first... */ if(is_end_of_object) - (*restart_model) = NULL; + (*restart_model) = nullptr; else if((*next_pdb) < (*restart_model)) - (*next_pdb) = NULL; + (*next_pdb) = nullptr; } } @@ -2763,13 +2763,13 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, void ObjectMoleculeInitHBondCriteria(PyMOLGlobals * G, HBondCriteria * hbc) { - hbc->maxAngle = SettingGet_f(G, NULL, NULL, cSetting_h_bond_max_angle); - hbc->maxDistAtMaxAngle = SettingGet_f(G, NULL, NULL, cSetting_h_bond_cutoff_edge); - hbc->maxDistAtZero = SettingGet_f(G, NULL, NULL, cSetting_h_bond_cutoff_center); - hbc->power_a = SettingGet_f(G, NULL, NULL, cSetting_h_bond_power_a); - hbc->power_b = SettingGet_f(G, NULL, NULL, cSetting_h_bond_power_b); + hbc->maxAngle = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_max_angle); + hbc->maxDistAtMaxAngle = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cutoff_edge); + hbc->maxDistAtZero = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cutoff_center); + hbc->power_a = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_power_a); + hbc->power_b = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_power_b); hbc->cone_dangle = - (float) cos(PI * 0.5 * SettingGet_f(G, NULL, NULL, cSetting_h_bond_cone) / 180.0F); + (float) cos(PI * 0.5 * SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cone) / 180.0F); if(hbc->maxDistAtMaxAngle != 0.0F) { hbc->factor_a = (float) (0.5 / pow(hbc->maxAngle, hbc->power_a)); hbc->factor_b = (float) (0.5 / pow(hbc->maxAngle, hbc->power_b)); @@ -2867,7 +2867,7 @@ static int ObjectMoleculeFindBestDonorH(ObjectMolecule * I, best_dot = dot_product3f(best, dir); add3f(orig, best, best); if(h_real) - *h_real = NULL; + *h_real = nullptr; } } /* iterate through real hydrogens looking for best match @@ -2923,7 +2923,7 @@ int ObjectMoleculeGetCheckHBond(AtomInfoType **h_real, float donToH[3]; float bestH[3]; float hToAcc[3]; - float accPlane[3], *vAccPlane = NULL; + float accPlane[3], *vAccPlane = nullptr; /* first, check for existence of coordinate sets */ @@ -2993,7 +2993,7 @@ float ObjectMoleculeGetMaxVDW(ObjectMolecule * I) /*========================================================================*/ static PyObject *ObjectMoleculeCSetAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NCSet); for(a = 0; a < I->NCSet; a++) { @@ -3009,7 +3009,7 @@ static PyObject *ObjectMoleculeCSetAsPyList(ObjectMolecule * I) /*static PyObject *ObjectMoleculeDiscreteCSetAsPyList(ObjectMolecule *I) { - PyObject *result = NULL; + PyObject *result = nullptr; return(PConvAutoNone(result)); }*/ static int ObjectMoleculeCSetFromPyList(ObjectMolecule * I, PyObject * list) @@ -3036,7 +3036,7 @@ static int ObjectMoleculeCSetFromPyList(ObjectMolecule * I, PyObject * list) static PyObject *ObjectMoleculeBondAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; PyObject *bond_list; const BondType *bond; int a; @@ -3093,7 +3093,7 @@ static int ObjectMoleculeBondFromPyList(ObjectMolecule * I, PyObject * list) int ok = true; int a; int stereo, ll = 0; - PyObject *bond_list = NULL; + PyObject *bond_list = nullptr; BondType *bond; if(ok) @@ -3130,7 +3130,7 @@ static int ObjectMoleculeBondFromPyList(ObjectMolecule * I, PyObject * list) ok = bool((I->Bond = pymol::vla(I->NBond))); bond = I->Bond.data(); for(a = 0; a < I->NBond; a++) { - bond_list = NULL; + bond_list = nullptr; if(ok) bond_list = PyList_GetItem(list, a); if(ok) @@ -3248,7 +3248,7 @@ static void AtomColumnFromPyList(ObjectMolecule& mol, PyObject* list, static PyObject *ObjectMoleculeAtomAsPyList(ObjectMolecule * I) { PyMOLGlobals *G = I->G; - PyObject *result = NULL; + PyObject *result = nullptr; const AtomInfoType *ai; int a; #ifndef PICKLETOOLS @@ -3447,9 +3447,9 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMolecule ** result) { int ok = true; - ObjectMolecule *I = NULL; + ObjectMolecule *I = nullptr; int discrete_flag = 0; - (*result) = NULL; + (*result) = nullptr; if(ok) ok = PyList_Check(list); @@ -3514,7 +3514,7 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, /* cleanup */ if (I) DeleteP(I); - (*result) = NULL; + (*result) = nullptr; } return (ok); } @@ -3523,7 +3523,7 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, /*========================================================================*/ PyObject *ObjectMoleculeAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -4041,7 +4041,7 @@ void ObjectMoleculeConnectDiscrete(ObjectMolecule* I, int searchFlag, int ObjectMoleculeSort(ObjectMolecule * I) { /* sorts atoms and bonds */ int *index; - int *outdex = NULL; + int *outdex = nullptr; int a, b; int ok = true; if(!I->DiscreteFlag) { /* currently, discrete objects are never sorted */ diff --git a/layer2/ObjectSlice.cpp b/layer2/ObjectSlice.cpp index 388cf2351..8a0a66545 100644 --- a/layer2/ObjectSlice.cpp +++ b/layer2/ObjectSlice.cpp @@ -51,7 +51,7 @@ static void ObjectSliceRecomputeExtent(ObjectSlice * I); static PyObject *ObjectSliceStateAsPyList(ObjectSliceState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(10); @@ -72,7 +72,7 @@ static PyObject *ObjectSliceStateAsPyList(ObjectSliceState * I) static PyObject *ObjectSliceAllStatesAsPyList(ObjectSlice * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -92,13 +92,13 @@ static int ObjectSliceStateFromPyList(PyMOLGlobals * G, ObjectSliceState * I, int ok = true; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -155,11 +155,11 @@ static int ObjectSliceAllStatesFromPyList(ObjectSlice * I, PyObject * list, int int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** result) { int ok = true; - ObjectSlice *I = NULL; - (*result) = NULL; + ObjectSlice *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -167,7 +167,7 @@ int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** r I = new ObjectSlice(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ CPythonVal *val = CPythonVal_PyList_GetItem(G, list, 0); @@ -193,7 +193,7 @@ int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** r PyObject *ObjectSliceAsPyList(ObjectSlice * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -250,12 +250,12 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, int min[2] = { 0, 0 }, max[2] = { 0, 0}; /* limits of the rectangle */ int need_normals = false; - int track_camera = SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_track_camera); - float grid = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_slice_grid); + int track_camera = SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_track_camera); + float grid = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_grid); int min_expand = 1; - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_dynamic_grid)) { - float resol = SettingGet_f(I->G, NULL, I->Setting.get(), + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid)) { + float resol = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid_resolution); float scale = SceneGetScreenVertexScale(I->G, oss->origin); oss->last_scale = scale; @@ -422,9 +422,9 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, if(ok) { - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_height_map)) { + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_height_map)) { float height_scale = - SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_slice_height_scale); + SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_height_scale); float *value = oss->values.data(); float up[3], scaled[3], factor; int x, y; @@ -545,7 +545,7 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, if(!need_normals) { VLAFreeP(oss->normals); } else { - int *cnt = NULL; + int *cnt = nullptr; oss->normals.reserve(oss->n_points * 3); cnt = pymol::calloc(oss->n_points); @@ -625,9 +625,9 @@ void ObjectSlice::update() auto I = this; ObjectSliceState *oss; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; - ObjectGadgetRamp *ogr = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; + ObjectGadgetRamp *ogr = nullptr; int a; for(a = 0; a < I->State.size(); a++) { @@ -673,7 +673,7 @@ void ObjectSlice::update() void ObjectSliceDrag(ObjectSlice * I, int state, int mode, float *pt, float *mov, float *z_dir) { - ObjectSliceState *oss = NULL; + ObjectSliceState *oss = nullptr; if(state >= 0) if(state < I->State.size()) @@ -744,7 +744,7 @@ int ObjectSliceGetVertex(ObjectSlice * I, int index, int base, float *v) int offset = base - 1; int result = false; - ObjectSliceState *oss = NULL; + ObjectSliceState *oss = nullptr; if(state >= 0) if(state < I->State.size()) @@ -911,10 +911,10 @@ void ObjectSlice::render(RenderInfo * info) const RenderPass pass = info->pass; int cur_state = 0; float alpha; - int track_camera = SettingGet_b(G, NULL, I->Setting.get(), cSetting_slice_track_camera); - int dynamic_grid = SettingGet_b(G, NULL, I->Setting.get(), cSetting_slice_dynamic_grid); - ObjectSliceState *oss = NULL; - int use_shaders = !track_camera && SettingGet_b(G, NULL, I->Setting.get(), cSetting_use_shaders); + int track_camera = SettingGet_b(G, nullptr, I->Setting.get(), cSetting_slice_track_camera); + int dynamic_grid = SettingGet_b(G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid); + ObjectSliceState *oss = nullptr; + int use_shaders = !track_camera && SettingGet_b(G, nullptr, I->Setting.get(), cSetting_use_shaders); // just in case, since slice uses immediate mode, but this should never happen G->ShaderMgr->Disable_Current_Shader(); @@ -972,7 +972,7 @@ void ObjectSlice::render(RenderInfo * info) } ObjectPrepareContext(I, info); - alpha = SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + alpha = SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); alpha = 1.0F - alpha; if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -1067,7 +1067,7 @@ void ObjectSlice::render(RenderInfo * info) } else if(G->HaveGUI && G->ValidContext) { if(pick) { if (oss->shaderCGO && (I->visRep & cRepSliceBit)){ - CGORenderPicking(oss->shaderCGO.get(), info, &I->context, I->Setting.get(), NULL); + CGORenderPicking(oss->shaderCGO.get(), info, &I->context, I->Setting.get(), nullptr); } else { #ifndef PURE_OPENGL_ES_2 Picking p; @@ -1145,7 +1145,7 @@ void ObjectSlice::render(RenderInfo * info) int already_rendered = false; if (oss->shaderCGO){ - CGORender(oss->shaderCGO.get(), NULL, NULL, I->Setting.get(), info, NULL); + CGORender(oss->shaderCGO.get(), nullptr, nullptr, I->Setting.get(), info, nullptr); already_rendered = true; } else { oss->shaderCGO.reset(CGONew(G)); @@ -1211,7 +1211,7 @@ void ObjectSlice::render(RenderInfo * info) oss->shaderCGO.reset(CGOOptimizeToVBONotIndexed(oss->shaderCGO.get())); assert(oss->shaderCGO->use_shader); } - CGORender(oss->shaderCGO.get(), NULL, NULL, I->Setting.get(), info, NULL); + CGORender(oss->shaderCGO.get(), nullptr, nullptr, I->Setting.get(), info, nullptr); SceneInvalidatePicking(G); // any time cgo is re-generated, needs to invalidate so // pick colors can be re-assigned } @@ -1239,12 +1239,12 @@ int ObjectSlice::getNFrame() const ObjectSliceState *ObjectSliceStateGetActive(ObjectSlice * I, int state) { - ObjectSliceState *ms = NULL; + ObjectSliceState *ms = nullptr; if(state >= 0) { if(state < I->State.size()) { ms = &I->State[state]; if(!ms->Active) - ms = NULL; + ms = nullptr; } } return (ms); @@ -1303,7 +1303,7 @@ ObjectSlice *ObjectSliceFromMap(PyMOLGlobals * G, ObjectSlice * obj, ObjectMap * { float tmp[3]; - if(ObjectMapStateGetExcludedStats(G, oms, NULL, 0.0F, 0.0F, tmp)) { + if(ObjectMapStateGetExcludedStats(G, oms, nullptr, 0.0F, 0.0F, tmp)) { oss->MapMean = tmp[1]; oss->MapStdev = tmp[2] - tmp[1]; } else { diff --git a/layer2/ObjectSurface.cpp b/layer2/ObjectSurface.cpp index 5080ba886..169e651cd 100644 --- a/layer2/ObjectSurface.cpp +++ b/layer2/ObjectSurface.cpp @@ -48,7 +48,7 @@ static void ObjectSurfaceRecomputeExtent(ObjectSurface * I); static PyObject *ObjectSurfaceStateAsPyList(ObjectSurfaceState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(17); @@ -99,7 +99,7 @@ static int ObjectSurfaceStateFromPyList(PyMOLGlobals * G, ObjectSurfaceState * I int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; @@ -136,7 +136,7 @@ static int ObjectSurfaceStateFromPyList(PyMOLGlobals * G, ObjectSurfaceState * I if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -183,17 +183,17 @@ static int ObjectSurfaceAllStatesFromPyList(ObjectSurface * I, PyObject * list, int ObjectSurfaceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSurface ** result) { int ok = true; - ObjectSurface *I = NULL; - (*result) = NULL; + ObjectSurface *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectSurface(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -218,7 +218,7 @@ int ObjectSurfaceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSurface PyObject *ObjectSurfaceAsPyList(ObjectSurface * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -327,7 +327,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState { int one_color_flag = true; int cur_color = - SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_surface_color); + SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_surface_color); if(cur_color == -1) cur_color = I->Color; @@ -369,7 +369,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_surface_negative_color); + nullptr, cSetting_surface_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) { @@ -413,7 +413,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_surface_negative_color); + nullptr, cSetting_surface_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) @@ -443,7 +443,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState ms->RC.clear(); } else if((!ramped_flag) || - (!SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_ray_color_ramps))) { + (!SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_ray_color_ramps))) { ms->RC.clear(); } } @@ -454,8 +454,8 @@ void ObjectSurface::update() auto I = this; for(auto& msref : I->State) { ObjectSurfaceState *ms = &msref; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; if(ms->Active) { map = ExecutiveFindObjectMapByName(I->G, ms->MapName); @@ -530,7 +530,7 @@ void ObjectSurface::update() ms->Side); if(!SettingGet_b - (I->G, I->Setting.get(), NULL, cSetting_surface_negative_visible)) { + (I->G, I->Setting.get(), nullptr, cSetting_surface_negative_visible)) { ms->base_n_V = VLAGetSize(ms->V); } else { /* do we want the negative surface too? */ @@ -762,7 +762,7 @@ static void ObjectSurfaceRenderRay(PyMOLGlobals * G, ObjectSurface *I, float *v = ms->V.data(); int c; int* n = ms->N.data(); - float alpha = 1.0F - SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + float alpha = 1.0F - SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -770,17 +770,17 @@ static void ObjectSurfaceRenderRay(PyMOLGlobals * G, ObjectSurface *I, CRay *ray = info->ray; if(ms->UnitCellCGO && (I->visRep & cRepCellBit)){ int rayok = CGORenderRay(ms->UnitCellCGO.get(), ray, info, ColorGet(G, I->Color), - NULL, I->Setting.get(), NULL); + nullptr, I->Setting.get(), nullptr); if (!rayok){ ms->UnitCellCGO.reset(); } } ray->transparentf(1.0F - alpha); - ms->Radius = SettingGet_f(G, I->Setting.get(), NULL, cSetting_mesh_radius); + ms->Radius = SettingGet_f(G, I->Setting.get(), nullptr, cSetting_mesh_radius); if(ms->Radius == 0.0F) { ms->Radius = ray->PixelRadius * - SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_width) / 2.0F; + SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_width) / 2.0F; } if(n && v && (I->visRep & cRepSurfaceBit)) { @@ -900,11 +900,11 @@ void ObjectSurface::render(RenderInfo * info) auto pick = info->pick; const RenderPass pass = info->pass; const float *col; - ObjectSurfaceState *ms = NULL; + ObjectSurfaceState *ms = nullptr; float alpha; ObjectPrepareContext(I, info); - alpha = 1.0F - SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + alpha = 1.0F - SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -940,7 +940,7 @@ void ObjectSurface::render(RenderInfo * info) } if (ms->shaderCGO){ - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); continue; } @@ -977,7 +977,7 @@ void ObjectSurface::render(RenderInfo * info) ms->shaderCGO.reset(convertcgo); } ms->shaderCGO->use_shader = true; - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); } else { if (alpha != 1.0){ // use_shader = 0 @@ -986,7 +986,7 @@ void ObjectSurface::render(RenderInfo * info) ms->shaderCGO->render_alpha = 1; } ms->shaderCGO->use_shader = false; - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); } } } diff --git a/layer2/ObjectVolume.cpp b/layer2/ObjectVolume.cpp index 8a88ffa78..cd7b30240 100644 --- a/layer2/ObjectVolume.cpp +++ b/layer2/ObjectVolume.cpp @@ -70,7 +70,7 @@ CObjectState* ObjectVolume::_getObjectState(int state) } static ObjectMapState * ObjectVolumeStateGetMapState(ObjectVolumeState * vs) { - ObjectMap *map = NULL; + ObjectMap *map = nullptr; PyMOLGlobals * G = vs->G; @@ -79,7 +79,7 @@ static ObjectMapState * ObjectVolumeStateGetMapState(ObjectVolumeState * vs) { PRINTFB(G, FB_ObjectVolume, FB_Errors) "ObjectVolume-Error: map '%s' has been deleted.\n", vs->MapName ENDFB(G); - return NULL; + return nullptr; } return ObjectMapGetState(map, vs->MapState); @@ -89,12 +89,12 @@ ObjectMapState * ObjectVolumeGetMapState(ObjectVolume * I) { ObjectVolumeState * ovs = ObjectVolumeGetActiveState(I); if(ovs) return ObjectVolumeStateGetMapState(ovs); - return NULL; + return nullptr; } static PyObject *ObjectVolumeStateAsPyList(ObjectVolumeState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(19); PyList_SetItem(result, 0, PyInt_FromLong(I->Active)); PyList_SetItem(result, 1, PyString_FromString(I->MapName)); @@ -106,7 +106,7 @@ static PyObject *ObjectVolumeStateAsPyList(ObjectVolumeState * I) PyList_SetItem(result, 7, PConvAutoNone(NULL) /* PConvIntArrayToPyList(I->Range, 6) */); PyList_SetItem(result, 8, PyFloat_FromDouble(0.0 /* I->Level */)); PyList_SetItem(result, 9, PyFloat_FromDouble(0.0 /* I->Radius */)); - PyList_SetItem(result, 10, PyInt_FromLong(/* I->CarveFlag */ I->AtomVertex.data() != NULL)); + PyList_SetItem(result, 10, PyInt_FromLong(/* I->CarveFlag */ I->AtomVertex.data() != nullptr)); PyList_SetItem(result, 11, PyFloat_FromDouble(I->CarveBuffer)); PyList_SetItem(result, 12, I->AtomVertex ? PConvFloatVLAToPyList(I->AtomVertex) : PConvAutoNone(NULL)); @@ -147,14 +147,14 @@ static int ObjectVolumeStateFromPyList(PyMOLGlobals * G, ObjectVolumeState * I, int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { *I = ObjectVolumeState(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -192,7 +192,7 @@ static int ObjectVolumeStateFromPyList(PyMOLGlobals * G, ObjectVolumeState * I, if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -265,17 +265,17 @@ static int ObjectVolumeAllStatesFromPyList(ObjectVolume * I, PyObject * list) int ObjectVolumeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectVolume ** result) { int ok = true; - ObjectVolume *I = NULL; - (*result) = NULL; + ObjectVolume *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... Always check ll when adding new PyList_GetItem's */ I = new ObjectVolume(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); ok = ObjectFromPyList(G, val, I); @@ -369,7 +369,7 @@ void ObjectVolume::invalidate(cRep_t rep, cRepInv_t level, int state) */ static CField * ObjectVolumeStateGetField(ObjectVolumeState * vs) { if (!vs) - return NULL; + return nullptr; if(vs->Field) return vs->Field->data.get(); return ObjectVolumeStateGetMapState(vs)->Field->data.get(); @@ -396,7 +396,7 @@ static void get44FracToRealFromCorner(const float * corner, float * frac2real) void ObjectVolume::update() { auto I = this; - ObjectMapState *oms = NULL; + ObjectMapState *oms = nullptr; float carve_buffer; int avoid_flag = false; int flag; @@ -429,7 +429,7 @@ void ObjectVolume::update() } // data min/max/mean/stdev - range = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_volume_data_range); + range = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_volume_data_range); ObjectMapStateGetHistogram(I->G, oms, 0, range, vs->min_max_mean_stdev, 0.f, 0.f); } @@ -463,14 +463,14 @@ void ObjectVolume::update() } if((I->visRep & cRepVolumeBit) && vs->ResurfaceFlag) { - Isofield *field = NULL; + Isofield *field = nullptr; vs->ResurfaceFlag = false; if(vs->Field) { field = vs->Field.get(); } else if(oms->Field) { field = oms->Field.get(); } else { - field = NULL; + field = nullptr; } if(field) { @@ -498,7 +498,7 @@ void ObjectVolume::update() // cull my friend, cull */ voxelmap = MapNew(I->G, -carve_buffer, vs->AtomVertex, - vs->AtomVertex.size() / 3, NULL); + vs->AtomVertex.size() / 3, nullptr); if(voxelmap) { int x, y, z; @@ -611,7 +611,7 @@ static float * ObjectVolumeStateGetColors(PyMOLGlobals * G, ObjectVolumeState * ok_except1: PRINTFB(G, FB_ObjectVolume, FB_Blather) "ObjectVolumeStateGetColors failed\n" ENDFB(G); - return NULL; + return nullptr; } /** @@ -725,8 +725,8 @@ void ObjectVolume::render(RenderInfo * info) int state = info->state; const RenderPass pass = info->pass; int a = 0; - ObjectVolumeState *vs = NULL; - float volume_layers = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_volume_layers); + ObjectVolumeState *vs = nullptr; + float volume_layers = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_volume_layers); #ifdef _PYMOL_IP_EXTRAS short volume_mode = SettingGetGlobal_i(G, cSetting_volume_mode); short ortho = SettingGetGlobal_i(G, cSetting_ortho); @@ -833,7 +833,7 @@ void ObjectVolume::render(RenderInfo * info) return; } - int volume_bit_val = SettingGet_i(G, I->Setting.get(), NULL, cSetting_volume_bit_depth); + int volume_bit_val = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_volume_bit_depth); volume_bit_depth = (volume_bit_val < 17) ? tex::data_type::HALF_FLOAT : tex::data_type::FLOAT; /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ @@ -1224,7 +1224,7 @@ ObjectVolume *ObjectVolumeFromBox(PyMOLGlobals * G, ObjectVolume * obj, ObjectMa float level, int meshMode, float carve, float *vert_vla, int quiet) { - return ObjectVolumeFromXtalSym(G, obj, map, NULL, map_state, state, mn, mx, + return ObjectVolumeFromXtalSym(G, obj, map, nullptr, map_state, state, mn, mx, level, meshMode, carve, vert_vla, quiet); } diff --git a/layer2/RepAngle.cpp b/layer2/RepAngle.cpp index 99250dedc..b30e7a9f1 100644 --- a/layer2/RepAngle.cpp +++ b/layer2/RepAngle.cpp @@ -61,14 +61,14 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) PyMOLGlobals *G = I->G; float line_width; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; int dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_angle_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_angle_color); I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); line_width = SceneGetDynamicLineWidth(info, line_width); ok &= CGOSpecial(I->shaderCGO, LINEWIDTH_DYNAMIC_WITH_SCALE_DASH); if (ok) @@ -115,7 +115,7 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dash_as_cylinders){ CGO *tmpCGO = CGONew(G); @@ -148,7 +148,7 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) if (convertcgo){ CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } return ok; } @@ -162,9 +162,9 @@ static void RepAngleRenderImmediate(RepAngle * I, RenderInfo * info, int color, int c = I->N; float line_width; bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); line_width = SceneGetDynamicLineWidth(info, line_width); if(info->width_scale_flag) { @@ -213,18 +213,18 @@ void RepAngle::render(RenderInfo* info) float dash_transparency; short dash_transparency_enabled; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_angle_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_angle_color); if(color < 0) color = getObj()->Color; I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); dash_transparency_enabled = (dash_transparency > 0.f); @@ -283,7 +283,7 @@ void RepAngle::render(RenderInfo* info) } ok &= RepAngleCGOGenerate(I, info); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -291,13 +291,13 @@ void RepAngle::render(RenderInfo* info) if (!generate_shader_cgo) { RepAngleRenderImmediate(I, info, color, dash_transparency_enabled, dash_transparency); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepAngle] = NULL; + I->ds->Rep[cRepAngle] = nullptr; delete I; } } @@ -313,7 +313,7 @@ Rep *RepAngleNew(DistSet * ds, int state) int ok = true; float dash_transparency; dash_transparency = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_transparency); dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); PRINTFD(G, FB_RepAngle) @@ -324,8 +324,8 @@ Rep *RepAngleNew(DistSet * ds, int state) auto I = new RepAngle(ds->Obj, state); - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.1F; @@ -351,7 +351,7 @@ Rep *RepAngleNew(DistSet * ds, int state) radius = l2; else radius = l1; - radius *= SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_angle_size); + radius *= SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_angle_size); angle = get_angle3f(d1, d2); @@ -455,7 +455,7 @@ Rep *RepAngleNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepCartoon.cpp b/layer2/RepCartoon.cpp index 813d3af3c..2467f0105 100644 --- a/layer2/RepCartoon.cpp +++ b/layer2/RepCartoon.cpp @@ -74,7 +74,7 @@ struct RepCartoon : Rep { /** * Free the preshader CGO or move to another owner. - * @post preshader == NULL + * @post preshader == nullptr */ void disposePreshaderCGO() { if (!ray) { @@ -276,7 +276,7 @@ void RepCartoon::render(RenderInfo* info) CGORenderPicking(I->std, info, &I->context, I->cs->Setting.get(), I->obj->Setting.get()); } else { - CGORender(I->std, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->std, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -300,7 +300,7 @@ typedef struct nuc_acid_data { int *nuc_flag; // whether atom is part of nucleotide int a2; // defaults to -1 int nSeg; // defaults to 0 - const float *v_o_last; // defaults to NULL + const float *v_o_last; // defaults to nullptr int *sptr; int *iptr; CCInOut * cc; @@ -1145,7 +1145,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, int i; float up[3], upi[3]; float vc0[3], vc1[3]; - const float *color = NULL; + const float *color = nullptr; /* compute average coordinate and mark atoms so that ring is only drawn once */ zero3f(avg); zero3f(avg_col); @@ -1382,7 +1382,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, if(ndata->a2 < 0) { ndata->nSeg++; - ndata->v_o_last = NULL; + ndata->v_o_last = nullptr; } *(ndata->sptr++) = ndata->nSeg; *(ndata->iptr++) = a; @@ -1402,7 +1402,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, if(ndata->a2 >= 0) { if(set_flags) { if((obj->AtomInfo[ndata->a2].protons == cAN_P) && (!nuc_flag[ndata->a2])) { - int *nf = NULL; + int *nf = nullptr; AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, ndata->a2, &st, &nd); nf = nuc_flag + st; @@ -1421,13 +1421,13 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, ndata->ss++; - v_c = NULL; - v_o = NULL; + v_c = nullptr; + v_o = nullptr; AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, a1, &st, &nd); { - int *nf = NULL; + int *nf = nullptr; if(set_flags && ndata->v_o_last) nf = nuc_flag + st; for(a3 = st; a3 <= nd; a3++) { @@ -1451,7 +1451,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, } if(!(v_c && v_o)) { zero3f(ndata->voptr); - ndata->v_o_last = NULL; + ndata->v_o_last = nullptr; } else { if(ndata->v_o_last) { float t0[3]; @@ -1479,10 +1479,10 @@ void GenerateRepCartoonDrawDebugLineAlongPath(CGO *cgo, int nAt, float *pv){ #ifndef PURE_OPENGL_ES_2 CGODisable(cgo, GL_LIGHTING); #endif - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; v = pv; if(nAt > 1) { CGOBegin(cgo, GL_LINE_STRIP); @@ -1590,7 +1590,7 @@ int GenerateRepCartoonProcessCylindricalHelices(PyMOLGlobals * G, ObjectMolecule const float *v0; float *v, *v1, *v2, *vo, *d; float *valpha; - float *vc = NULL; + float *vc = nullptr; int atom_index1, atom_index2, *s, *atp, a, cur_car; unsigned *vi; @@ -1598,7 +1598,7 @@ int GenerateRepCartoonProcessCylindricalHelices(PyMOLGlobals * G, ObjectMolecule bool hasAtomLevelTrans = false; int contFlag, extrudeFlag; int b, c1, c2; - float *h_start = NULL, *h_end = NULL; + float *h_start = nullptr, *h_end = nullptr; float t0[3], t1[3], t2[3], t3[3]; float t4[3]; float helix_radius; @@ -2210,7 +2210,7 @@ int CartoonExtrudeTube(short use_cylinders_for_strands, CExtrude *ex, CGO *cgo, if (ok) ExtrudeBuildNormals1f(ex); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, tube_cap, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, tube_cap, nullptr, use_cylinders_for_strands); } return ok; } @@ -2244,7 +2244,7 @@ int CartoonExtrudeCircle(CExtrude *ex, CGO *cgo, short use_cylinders_for_strands if (ok) ExtrudeBuildNormals1f(ex); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, loop_cap, NULL, use_cylinders_for_strands, dash); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, loop_cap, nullptr, use_cylinders_for_strands, dash); return ok; } @@ -2273,13 +2273,13 @@ int CartoonExtrudeRect(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, float width, flo if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::Flat, NULL); + ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::Flat, nullptr); } else { ok = ExtrudeRectangle(ex, width, length, 1); if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::None, NULL); + ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::None, nullptr); if (ok){ ok &= ExtrudeRectangle(ex, width, length, 2); if (ok) @@ -2299,7 +2299,7 @@ int CartoonExtrudeOval(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, short use_cylind ExtrudeBuildNormals2f(ex); if (ok){ if(highlight_color < 0) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); else ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, ColorGet(G, highlight_color), use_cylinders_for_strands); } @@ -2314,7 +2314,7 @@ int CartoonExtrudeArrow(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling, f ExtrudeBuildNormals2f(ex); if (ok){ if(highlight_color < 0) - ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, nullptr); else ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, ColorGet(G, highlight_color)); } @@ -2335,13 +2335,13 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, nullptr); } else { ok = ExtrudeDumbbell1(ex, dumbbell_width, dumbbell_length, 1); if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, nullptr); if (ok) ok &= ExtrudeDumbbell1(ex, dumbbell_width, dumbbell_length, 2); if (ok) @@ -2367,7 +2367,7 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling ExtrudeBuildNormals1f(ex1); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); if (ok){ ExtrudeFree(ex1); ex1 = ExtrudeCopyPointsNormalsColors(ex); @@ -2381,7 +2381,7 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling if (ok) ExtrudeBuildNormals1f(ex1); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); } if (ex1) ExtrudeFree(ex1); @@ -2418,12 +2418,12 @@ CGO *GenerateRepCartoonCGO(CoordSet *cs, ObjectMolecule *obj, nuc_acid_data *nda int ok = true; CGO *cgo; int contigFlag, contFlag, extrudeFlag, n_p; - CExtrude *ex = NULL; + CExtrude *ex = nullptr; float dev; unsigned int *vi; int atom_index1, atom_index2; float *v, *v1, *v2, *vo; - float *d, *vc = NULL, *vn; + float *d, *vc = nullptr, *vn; float *valpha = nullptr; int *atp; int c1, c2; @@ -2772,7 +2772,7 @@ class nuc_acid_cap { return false; nuc_acid(G, ndata, idx, atm, ai, cs, cs->Obj, false); - set(-1, -1, NULL); + set(-1, -1, nullptr); return true; } }; @@ -2790,7 +2790,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj int a, a1, a3, a4 = 0; char *lv = I->LastVisib; int trace, trace_mode; - AtomInfoType *ai, *last_ai = NULL; + AtomInfoType *ai, *last_ai = nullptr; int cartoon_side_chain_helper; int cylindrical_helices; int fancy_helices; @@ -2997,9 +2997,9 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj } // pointers to C+N+O coordinates - v_c = NULL; - v_n = NULL; - v_o = NULL; + v_c = nullptr; + v_n = nullptr; + v_o = nullptr; // get start (st) and end (nd) indices of residue atoms AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, a1, &st, &nd); @@ -3058,7 +3058,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj } last_ai = ai; - trailing_O3p.set(-1, -1, NULL); + trailing_O3p.set(-1, -1, nullptr); /* 5' cap */ if(leading_O5p.active() @@ -3068,7 +3068,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj leading_O5p.cap(); } - leading_O5p.set(-1, -1, NULL); + leading_O5p.set(-1, -1, nullptr); /* this is the main nucleic acid cartoon section... */ nuc_acid(G, ndata, a, a1, ai, cs, obj, true); @@ -3224,11 +3224,11 @@ void RepCartoonComputeRoundHelices(nuc_acid_data *ndata, const int nAt, for(a = 0; a < nAt; a++) { if(a) { if(*sptr != *(sptr - 1)) { /* contiguous helices in disconnected segments */ - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; - v5 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; + v5 = nullptr; last = 0; } } @@ -3278,11 +3278,11 @@ void RepCartoonComputeRoundHelices(nuc_acid_data *ndata, const int nAt, } } } - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; - v5 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; + v5 = nullptr; last = 0; } if(v1 && v2 && v3 && v4) { @@ -3672,21 +3672,21 @@ Rep *RepCartoonNew(CoordSet * cs, int state) ObjectMolecule *obj; int *i, *sptr, *at, *seg, nAt; CCInOut *car, *cc; - float *pv = NULL; - float *pvo = NULL, *pva = NULL; - float *dv = NULL; - float *nv = NULL; - float *tv = NULL; - float *tmp = NULL; - float *dl = NULL; + float *pv = nullptr; + float *pvo = nullptr, *pva = nullptr; + float *dv = nullptr; + float *nv = nullptr; + float *tv = nullptr; + float *tmp = nullptr; + float *dl = nullptr; int ladder_mode; int round_helices; int na_mode; int *flag_tmp; float putty_vals[4] = { 10.0F, 0.0F, FLT_MAX, -FLT_MAX }; // putty_mean, putty_stdev, putty_min, putty_max - int *ring_anchor = NULL; - int *nuc_flag = NULL; + int *ring_anchor = nullptr; + int *nuc_flag = nullptr; float alpha; int ok = true; nuc_acid_data ndata; @@ -3697,7 +3697,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) // skip if not visible if(!cs->hasRep(cRepCartoonBit)) - return NULL; + return nullptr; /* THIS IS BY FAR THE WORST ROUTINE IN PYMOL! * DEVELOP ON IT ONLY AT EXTREME RISK TO YOUR MENTAL HEALTH */ @@ -3758,7 +3758,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) ndata.nuc_flag = nuc_flag; ndata.a2 = -1; ndata.nSeg = 0; - ndata.v_o_last = NULL; + ndata.v_o_last = nullptr; ndata.sptr = sptr; ndata.iptr = i; ndata.cc = cc; @@ -3851,7 +3851,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) if (!ok || !CGOHasOperations(I->preshader)) { /* cannot generate RepCartoon */ delete I; - I = NULL; + I = nullptr; } FreeP(dv); FreeP(dl); diff --git a/layer2/RepCylBond.cpp b/layer2/RepCylBond.cpp index 3a9a988b8..96abcf76f 100644 --- a/layer2/RepCylBond.cpp +++ b/layer2/RepCylBond.cpp @@ -179,7 +179,7 @@ void RepCylBond::render(RenderInfo * info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { @@ -205,7 +205,7 @@ void RepCylBond::render(RenderInfo * info) } const float *color = ColorGet(G, I->obj->Color); I->renderCGO->debug = SettingGetGlobal_i(G, cSetting_stick_debug); - CGORender(I->renderCGO, color, NULL, NULL, info, I); + CGORender(I->renderCGO, color, nullptr, nullptr, info, I); } } } @@ -301,7 +301,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, const float *color1, const float *color2, int ord, float tube_size, bool fixed_r, float scale_r, - Pickable pickdata[] = NULL) + Pickable pickdata[] = nullptr) { float d[3], t[3], p0[3], p1[3], p2[3]; const float* vv; @@ -374,7 +374,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, ok &= CGOColorv(cgo, color1); if (ok && pickdata) ok &= CGOPickColor(cgo, pickdata[0].index, pickdata[0].bond); - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (pickdata) pickdataptr = &pickdata[1]; if (ok) @@ -408,7 +408,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, copy3f(v1, v1t); copy3f(v2, v2t); - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (pickdata) pickdataptr = &pickdata[1]; if (ok) @@ -506,7 +506,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, ok &= RepCylinder(cgo, s1, s2, isRamped, v1tt, v2tt, true, true, radius2); } - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (ok) ok &= CGOColorv(cgo, color1); if (ok && pickdata){ @@ -532,7 +532,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) const BondType *b; float radius; float valence; - int half_bonds, *other = NULL; + int half_bonds, *other = nullptr; int visFlag; int ord; int stick_ball, stick_ball_color = -1; @@ -545,8 +545,8 @@ Rep *RepCylBondNew(CoordSet * cs, int state) int cartoon_side_chain_helper = 0; int ribbon_side_chain_helper = 1; int na_mode; - bool *marked = NULL; - float *capdrawn = NULL; + bool *marked = nullptr; + float *capdrawn = nullptr; float scale_r = 1.0F; float transp, h_scale; float prev_transp = -1; @@ -579,7 +579,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) marked = pymol::calloc(obj->NAtom); CHECKOK(ok, marked); if (!ok){ - return NULL; + return nullptr; } valence = SettingGet_b(G, cs->Setting.get(), obj->Setting.get(), cSetting_valence); @@ -907,7 +907,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) CGOStop(I->primitiveCGO); if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; @@ -1137,10 +1137,10 @@ void RepCylBondRenderImmediate(CoordSet * cs, RenderInfo * info) } /* overlap is half since it is one cylinder representing both halfs of a bond */ - RepCylinderImmediate(v1, v2, nEdge, 1, 1, overlap_r, nub_r, radius, NULL); + RepCylinderImmediate(v1, v2, nEdge, 1, 1, overlap_r, nub_r, radius, nullptr); } else { /* different colors -> two cylinders, no interior */ - float avg[3], *dir = NULL; + float avg[3], *dir = nullptr; avg[0] = (v1[0] + v2[0]) * _pt5; avg[1] = (v1[1] + v2[1]) * _pt5; diff --git a/layer2/RepDihedral.cpp b/layer2/RepDihedral.cpp index a48f2b85c..7f1a5f934 100644 --- a/layer2/RepDihedral.cpp +++ b/layer2/RepDihedral.cpp @@ -66,14 +66,14 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) int c = I->N; float line_width; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; short dash_as_cylinders = 0; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dihedral_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dihedral_color); I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); line_width = SceneGetDynamicLineWidth(info, line_width); @@ -96,7 +96,7 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) v = I->V; c = I->N; if (dash_as_cylinders){ - float *origin = NULL, axis[3]; + float *origin = nullptr, axis[3]; while(ok && c > 0) { origin = v; v += 3; @@ -129,7 +129,7 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dash_as_cylinders){ CGO *tmpCGO = CGONew(G); @@ -177,11 +177,11 @@ void RepDihedral::render(RenderInfo * info) int round_ends; int ok = true; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dihedral_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dihedral_color); float dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; short dash_transparency_enabled; if(color < 0) color = getObj()->Color; @@ -192,11 +192,11 @@ void RepDihedral::render(RenderInfo * info) return; I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); @@ -253,7 +253,7 @@ void RepDihedral::render(RenderInfo * info) } ok &= RepDihedralCGOGenerate(I, info); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -299,14 +299,14 @@ void RepDihedral::render(RenderInfo * info) if (use_shader) { if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepDihedral] = NULL; + I->ds->Rep[cRepDihedral] = nullptr; delete I; } } @@ -329,8 +329,8 @@ Rep *RepDihedralNew(DistSet * ds, int state) if (ds && ds->getNRep() > cRepDihedral && ds->Rep[cRepDihedral]) I->cs = ds->Rep[cRepDihedral]->cs; - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.5; @@ -351,7 +351,7 @@ Rep *RepDihedralNew(DistSet * ds, int state) float d3[3], n1[3], n3[3], x[3], y[3]; float radius, length, angle, phase, pos; float dihedral_size = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dihedral_size); + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_size); I->V = VLAlloc(float, ds->NDihedralIndex * 10); CHECKOK(ok, I->V); @@ -529,7 +529,7 @@ Rep *RepDihedralNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDistDash.cpp b/layer2/RepDistDash.cpp index 92fb788cc..9ed52c586 100644 --- a/layer2/RepDistDash.cpp +++ b/layer2/RepDistDash.cpp @@ -68,7 +68,7 @@ static void RepDistDashCGOGenerate(RepDistDash * I) float *v = I->V; int c = I->N; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_color); short dash_as_cylinders = 0; dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); @@ -88,7 +88,7 @@ static void RepDistDashCGOGenerate(RepDistDash * I) v = I->V; c = I->N; if (dash_as_cylinders){ - float *origin = NULL, axis[3]; + float *origin = nullptr, axis[3]; while(ok && c > 0) { origin = v; v += 3; @@ -125,13 +125,13 @@ void RepDistDash::render(RenderInfo* info) int round_ends; int ok = true; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_color); float line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); float dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; short dash_transparency_enabled; dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); dash_transparency_enabled = (dash_transparency > 0.f); @@ -143,9 +143,9 @@ void RepDistDash::render(RenderInfo* info) color = getObj()->Color; I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); if(ray) { @@ -208,7 +208,7 @@ void RepDistDash::render(RenderInfo* info) } RepDistDashCGOGenerate(I); } else if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -253,7 +253,7 @@ void RepDistDash::render(RenderInfo* info) #endif if (use_shader) { if (generate_shader_cgo){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; if (ok) ok &= CGOStop(I->shaderCGO); { @@ -264,7 +264,7 @@ void RepDistDash::render(RenderInfo* info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } if (ok){ if (dash_as_cylinders){ @@ -308,19 +308,19 @@ void RepDistDash::render(RenderInfo* info) if (convertcgo){ CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } } if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepDash] = NULL; + I->ds->Rep[cRepDash] = nullptr; delete I; } } @@ -341,8 +341,8 @@ Rep *RepDistDashNew(DistSet * ds, int state) auto I = new RepDistDash(ds->Obj, state); - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.5; @@ -420,7 +420,7 @@ Rep *RepDistDashNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDistLabel.cpp b/layer2/RepDistLabel.cpp index 9b5ee943f..1d43f5d3a 100644 --- a/layer2/RepDistLabel.cpp +++ b/layer2/RepDistLabel.cpp @@ -79,14 +79,14 @@ void RepDistLabel::render(RenderInfo* info) int c = I->N; DistLabel *l = I->L; int n = 0; - int font_id = SettingGet_i(G, NULL, obj->Setting.get(), cSetting_label_font_id); - float font_size = SettingGet_f(G, NULL, obj->Setting.get(), cSetting_label_size); - int float_text = SettingGet_i(G, NULL, obj->Setting.get(), cSetting_float_labels); + int font_id = SettingGet_i(G, nullptr, obj->Setting.get(), cSetting_label_font_id); + float font_size = SettingGet_f(G, nullptr, obj->Setting.get(), cSetting_label_size); + int float_text = SettingGet_i(G, nullptr, obj->Setting.get(), cSetting_float_labels); int ok = true; short use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); if (I->MaxInvalid >= cRepInvRep) return; - font_id = SettingCheckFontID(G, NULL, obj->Setting.get(), font_id); + font_id = SettingCheckFontID(G, nullptr, obj->Setting.get(), font_id); if (I->shaderCGO && font_size < 0.f){ int size; @@ -118,7 +118,7 @@ void RepDistLabel::render(RenderInfo* info) if (I->shaderCGO){ if(float_text) glDisable(GL_DEPTH_TEST); - CGORenderPicking(I->shaderCGO, info, &I->context, NULL, NULL); + CGORenderPicking(I->shaderCGO, info, &I->context, nullptr, nullptr); if(float_text) glEnable(GL_DEPTH_TEST); return; @@ -137,7 +137,7 @@ void RepDistLabel::render(RenderInfo* info) AssignNewPickColor(nullptr, pick, TextGetColorUChar4uv(G), &I->context, p->index, p->bond); TextSetColorFromUColor(G); - TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL); + TextSetLabelBkgrdInfo(G, 1.f, 1.2f, nullptr); TextSetLabelPosIsSet(G, 0); if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, false, 0, 1, 0)){ TextSetIsPicking(G, false); @@ -164,7 +164,7 @@ void RepDistLabel::render(RenderInfo* info) } } else { info->texture_font_size = I->texture_font_size; - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } else if (I->shaderCGO){ @@ -180,7 +180,7 @@ void RepDistLabel::render(RenderInfo* info) if (ok && I->shaderCGO) ok &= CGOPickColor(I->shaderCGO, p->index, p->bond); TextSetPos(G, v); - TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL); + TextSetLabelBkgrdInfo(G, 1.f, 1.2f, nullptr); TextSetLabelPosIsSet(G, 0); if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, false, 0, 1, SHADERCGO)) return; @@ -209,7 +209,7 @@ void RepDistLabel::render(RenderInfo* info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } if (ok && I->shaderCGO){ I->shaderCGO->use_shader = true; @@ -223,7 +223,7 @@ void RepDistLabel::render(RenderInfo* info) } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepLabel] = NULL; + I->ds->Rep[cRepLabel] = nullptr; delete I; } } @@ -236,10 +236,10 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float *v, *v1, *v2, *v3, d[3], di; char buffer[255]; const float *lab_pos = - SettingGet_3fv(G, NULL, ds->Obj->Setting.get(), cSetting_label_position); + SettingGet_3fv(G, nullptr, ds->Obj->Setting.get(), cSetting_label_position); int default_digits = - SettingGet_i(G, NULL, ds->Obj->Setting.get(), cSetting_label_digits); - Pickable *rp = NULL; + SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_digits); + Pickable *rp = nullptr; if(!(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex)) { ds->LabCoord.clear(); @@ -254,7 +254,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) I->ds = ds; I->OutlineColor = - SettingGet_i(G, NULL, ds->Obj->Setting.get(), cSetting_label_outline_color); + SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_outline_color); int nLabel = 0; int ok = true; @@ -264,7 +264,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) ds->LabCoord.resize(nLabel); ds->LabPos.resize(nLabel); - if(SettingGet_b(G, NULL, ds->Obj->Setting.get(), cSetting_pickable)) { + if(SettingGet_b(G, nullptr, ds->Obj->Setting.get(), cSetting_pickable)) { I->P = pymol::malloc(nLabel + 1); CHECKOK(ok, I->P); if (ok) @@ -282,7 +282,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) auto* lc = ds->LabCoord.data(); if(ds->NIndex) { - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_distance_digits); WordType format; if(digits < 0) @@ -342,7 +342,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float l1, l2; float radius; - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_angle_digits); WordType format; if(digits < 0) @@ -371,8 +371,8 @@ Rep *RepDistLabelNew(DistSet * ds, int state) else radius = l1; radius *= - SettingGet_f(G, NULL, ds->Obj->Setting.get(), - cSetting_angle_size) * SettingGet_f(G, NULL, + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), + cSetting_angle_size) * SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_angle_label_position); @@ -430,13 +430,13 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float l1, l2; float radius; float dihedral_size = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dihedral_size); - float dihedral_label_position = SettingGet_f(G, NULL, ds->Obj->Setting.get(), + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_size); + float dihedral_label_position = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_label_position); float *v4; float avg[3]; - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_dihedral_digits); WordType format; if(digits < 0) @@ -531,7 +531,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDot.cpp b/layer2/RepDot.cpp index 38a4d1e23..d096e1582 100644 --- a/layer2/RepDot.cpp +++ b/layer2/RepDot.cpp @@ -58,7 +58,7 @@ static int RepDotCGOGenerate(RepDot * I) int c = I->N; int cc = 0; int ok = true; - CGO *cgo = NULL; + CGO *cgo = nullptr; int normals = SettingGet_i(G, I->cs->Setting.get(), I->obj->Setting.get(), cSetting_dot_normals); @@ -197,7 +197,7 @@ void RepDot::render(RenderInfo * info) if (ok) { const float *color; color = ColorGet(G, I->obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); return; /* should not do any other rendering after shaderCGO has been rendered */ } @@ -261,10 +261,10 @@ Rep *RepDotDoNew(CoordSet * cs, cRepDot_t mode, int state) { PyMOLGlobals *G = cs->G; float *v, *vn; - float *aa = NULL; - int *tp = NULL; - int *tf = NULL; - float *countPtr = NULL; + float *aa = nullptr; + int *tp = nullptr; + int *tf = nullptr; + float *countPtr = nullptr; int* ati = nullptr; auto obj = cs->Obj; diff --git a/layer2/RepEllipsoid.cpp b/layer2/RepEllipsoid.cpp index 8f10422d1..b27946db0 100644 --- a/layer2/RepEllipsoid.cpp +++ b/layer2/RepEllipsoid.cpp @@ -67,7 +67,7 @@ void RepEllipsoid::render(RenderInfo* info) " RepEllipsoidRender: rendering ray...\n" ENDFD; if(I->ray){ - int rayok = CGORenderRay(I->ray, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + int rayok = CGORenderRay(I->ray, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); if (!rayok){ CGOFree(I->ray); try_std = true; @@ -76,7 +76,7 @@ void RepEllipsoid::render(RenderInfo* info) try_std = true; } if(try_std && I->std){ - ok &= CGORenderRay(I->std, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + ok &= CGORenderRay(I->std, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); if (!ok){ CGOFree(I->std); } @@ -108,9 +108,9 @@ void RepEllipsoid::render(RenderInfo* info) CGOFree(I->shaderCGO); } if (I->shaderCGO){ - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } else if(I->std){ - CGORender(I->std, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->std, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -155,12 +155,12 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) // skip if no dots are visible if(!cs->hasRep(cRepEllipsoidBit)) - return NULL; + return nullptr; auto I = new RepEllipsoid(cs, state); CHECKOK(ok, I); if (!ok) - return NULL; + return nullptr; obj = cs->Obj; @@ -206,7 +206,7 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) float last_alpha = 1.0F; double *csmatrix = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), - cSetting_matrix_mode) > 0 ? NULL : cs->Matrix.data(); + cSetting_matrix_mode) > 0 ? nullptr : cs->Matrix.data(); for(a = 0; a < cs->NIndex; a++) { a1 = cs->IdxToAtm[a]; @@ -339,7 +339,7 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepLabel.cpp b/layer2/RepLabel.cpp index 9f89765a3..158de0661 100644 --- a/layer2/RepLabel.cpp +++ b/layer2/RepLabel.cpp @@ -106,7 +106,7 @@ short InvalidateShaderCGOIfTextureNeedsUpdate(PyMOLGlobals *G, float font_size, float v_scale, perc = 0.f; int size, diff; short inv = false; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); size = (int) (0.5F - font_size / v_scale); if (size <= 0) size = 1; @@ -457,7 +457,7 @@ void RepLabelRenderBackgroundInImmediate(PyMOLGlobals *G, RepLabel *I, float *v, {// taking into account screen adjustments : indent and screen world offset to the label point float v_scale, xn[3], yn[3]; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); SceneGetScaledAxesAtPoint(G, labelpos, xn, yn); addXYtoVertex(indentFactorT[0] + screenWorldOffset[0]/v_scale, indentFactorT[1] + screenWorldOffset[1]/v_scale, xn, yn, labelpos, pos); } @@ -469,7 +469,7 @@ void RepLabelRenderBackgroundInImmediate(PyMOLGlobals *G, RepLabel *I, float *v, float dVectorInPixels[2], dVector[2]; float v_scale; short visible; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); copy3f(v+6, tCenter); tCenter[3] = 1.f; @@ -1280,8 +1280,8 @@ void RepLabel::render(RenderInfo* info) if(c) { const char *st; short use_shader, has_connector = 0; - CGO *connectorCGO = NULL; - float *PmvMatrix = NULL; + CGO *connectorCGO = nullptr; + float *PmvMatrix = nullptr; int screenwidth, screenheight; float xn[3] = { 1.0F, 0.0F, 0.0F }; float yn[3] = { 0.0F, 1.0F, 0.0F }; @@ -1303,7 +1303,7 @@ void RepLabel::render(RenderInfo* info) info->texture_font_size = I->texture_font_size; if(float_text) glDisable(GL_DEPTH_TEST); - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); if(float_text) glEnable(GL_DEPTH_TEST); return; @@ -1388,7 +1388,7 @@ void RepLabel::render(RenderInfo* info) } if (draw_var){ - float *RotMatrix = NULL; + float *RotMatrix = nullptr; float *screenWorldOffset = TextGetScreenWorldOffset(G); float text_width = TextGetWidth(G), text_height = TextGetHeight(G); float *indentFactor = TextGetIndentFactor(G); @@ -1437,8 +1437,8 @@ void RepLabel::render(RenderInfo* info) } if (I->shaderCGO){ - CGO *totalCGO = NULL; - CGO *labelCGO = NULL; + CGO *totalCGO = nullptr; + CGO *labelCGO = nullptr; CGOStop(I->shaderCGO); CGO * tmpCGO = CGONew(G); CGOEnable(tmpCGO, GL_LABEL_SHADER); @@ -1450,7 +1450,7 @@ void RepLabel::render(RenderInfo* info) if (!labelCGO) return; CGOFree(I->shaderCGO); if (connectorCGO){ - CGO *tmpCGO = NULL; + CGO *tmpCGO = nullptr; tmpCGO = CGOOptimizeConnectors(connectorCGO, 0); CGOFree(connectorCGO); connectorCGO = tmpCGO; @@ -1507,12 +1507,12 @@ Rep *RepLabelNew(CoordSet * cs, int state) const float *vc; lexidx_t *l; int label_color; - Pickable *rp = NULL; + Pickable *rp = nullptr; AtomInfoType *ai; // skip if no labels are visible if(!cs->hasRep(cRepLabelBit)) - return NULL; + return nullptr; auto I = new RepLabel(cs, state); obj = cs->Obj; diff --git a/layer2/RepMesh.cpp b/layer2/RepMesh.cpp index 154ab31d1..e8bcbfce9 100644 --- a/layer2/RepMesh.cpp +++ b/layer2/RepMesh.cpp @@ -246,14 +246,14 @@ static int RepMeshCGOGenerate(RepMesh * I, RenderInfo * info) if (use_shader) { if (ok){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; ok &= CGOStop(I->shaderCGO); if (ok) convertcgo = CGOCombineBeginEnd(I->shaderCGO, 0); CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dot_as_spheres){ CGO *tmpCGO = CGONew(G); @@ -296,7 +296,7 @@ static int RepMeshCGOGenerate(RepMesh * I, RenderInfo * info) convertcgo->use_shader = true; CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } } } @@ -312,7 +312,7 @@ void RepMesh::render(RenderInfo* info) float *vc = I->VC; int *n = I->N.data(); int c; - const float *col = NULL; + const float *col = nullptr; float line_width = SceneGetDynamicLineWidth(info, I->Width); bool const dot_as_spheres = I->mesh_type == cIsomeshMode::isodot && SettingGet(*cs, cSetting_dot_as_spheres); @@ -410,7 +410,7 @@ void RepMesh::render(RenderInfo* info) I->shaderCGO->use_shader = true; generate_shader_cgo = 1; } else if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -527,7 +527,7 @@ void RepMesh::render(RenderInfo* info) { const float *color; color = ColorGet(G, I->obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); } } } @@ -619,11 +619,11 @@ Rep* RepMesh::recolor() I->VC = pymol::malloc(3 * I->NTot); vc = I->VC; /* now, assign colors to each point */ - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); if(map) { MapSetupExpress(map); for(a = 0; a < I->NTot; a++) { - AtomInfoType *ai0 = NULL; + AtomInfoType *ai0 = nullptr; c1 = 1; minDist = FLT_MAX; i0 = -1; @@ -707,7 +707,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) ObjectMolecule *obj; CoordSet *ccs; int a, b, c, d, h, k, l, *n; - MapType *map = NULL, *smap = NULL; + MapType *map = nullptr, *smap = nullptr; /* grid */ Vector3f minE, maxE, sizeE; float size; @@ -772,14 +772,14 @@ Rep *RepMeshNew(CoordSet * cs, int state) min_spacing = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_min_mesh_spacing); - I->N = NULL; + I->N = nullptr; I->NTot = 0; - I->V = NULL; - I->VC = NULL; + I->V = nullptr; + I->VC = nullptr; I->NDot = 0; - I->Dot = NULL; - I->LastVisib = NULL; - I->LastColor = NULL; + I->Dot = nullptr; + I->LastVisib = nullptr; + I->LastColor = nullptr; I->mesh_type = mesh_type; I->Radius = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_radius); I->shaderCGO = 0; @@ -790,24 +790,24 @@ Rep *RepMeshNew(CoordSet * cs, int state) float trim_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_cutoff); int trim_flag = false; - float *trim_vla = NULL; - MapType *trim_map = NULL; + float *trim_vla = nullptr; + MapType *trim_map = nullptr; int carve_state = 0; int carve_flag = false; float carve_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_carve_cutoff); - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; int clear_state = 0; int clear_flag = false; float clear_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_clear_cutoff); - const char *clear_selection = NULL; - float *clear_vla = NULL; - MapType *clear_map = NULL; + const char *clear_selection = nullptr; + float *clear_vla = nullptr; + MapType *clear_map = nullptr; int mesh_max = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_grid_max); if(mesh_max < 1) @@ -840,7 +840,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) } } if(ok && nc) { - trim_map = MapNew(G, trim_cutoff, trim_vla, nc, NULL); + trim_map = MapNew(G, trim_cutoff, trim_vla, nc, nullptr); CHECKOK(ok, trim_map); if(ok) { ok &= MapSetupExpress(trim_map); @@ -951,8 +951,8 @@ Rep *RepMeshNew(CoordSet * cs, int state) if(ok && !solv_acc) ok &= RepMeshGetSolventDots(I, cs, minE, maxE, probe_radius); if(ok) { - smap = MapNew(G, probe_radius, I->Dot, I->NDot, NULL); - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + smap = MapNew(G, probe_radius, I->Dot, I->NDot, nullptr); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); } if(ok && map && smap) { ok &= MapSetupExpress(smap); @@ -1048,7 +1048,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) FreeP(I->Dot); OrthoBusyFast(G, 2, 3); if(ok) { - ok &= IsosurfVolume(G, NULL, NULL, field, 1.0, I->N, I->V, NULL, mesh_type, mesh_skip, + ok &= IsosurfVolume(G, nullptr, nullptr, field, 1.0, I->N, I->V, nullptr, mesh_type, mesh_skip, 1.0F); } DeleteP(field); @@ -1063,7 +1063,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) CHECKOK(ok, new_n); while(ok && (c = *(n++))) { int new_c = 0; - float *last_v = NULL; + float *last_v = nullptr; while(c--) { int a_keeper = false; if(trim_map) { @@ -1127,14 +1127,14 @@ Rep *RepMeshNew(CoordSet * cs, int state) *(new_v++) = *(v++); *(new_v++) = *(v++); *(new_v++) = *(v++); - last_v = NULL; + last_v = nullptr; } else { last_v = v; v += 3; } } } else { - last_v = NULL; + last_v = nullptr; v += 3; if(new_c) { VLACheck(new_n, int, new_size + 1); /* extends the zero count sentinel */ @@ -1176,7 +1176,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) OrthoBusyFast(G, 4, 4); if(!ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } @@ -1218,7 +1218,7 @@ int RepMeshGetSolventDots(RepMesh * I, CoordSet * cs, float *min, float *max, probe_radius_plus = probe_radius * 1.5F; I->NDot = 0; - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); if(map) { MapSetupExpress(map); maxCnt = 0; @@ -1297,7 +1297,7 @@ int RepMeshGetSolventDots(RepMesh * I, CoordSet * cs, float *min, float *max, } dot_flag[maxDot] = 1; /* this guarantees that we have a valid dot */ - map = MapNew(G, probe_radius_plus, I->Dot, I->NDot, NULL); + map = MapNew(G, probe_radius_plus, I->Dot, I->NDot, nullptr); if(map) { MapSetupExpress(map); diff --git a/layer2/RepNonbonded.cpp b/layer2/RepNonbonded.cpp index 7cfe21afc..520bb29e5 100644 --- a/layer2/RepNonbonded.cpp +++ b/layer2/RepNonbonded.cpp @@ -121,7 +121,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) PyMOLGlobals *G = I->G; float alpha; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; short nonbonded_as_cylinders ; short use_shader; float nonbonded_size = @@ -180,7 +180,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; I->shaderCGO->use_shader = use_shader; - convertcgo = NULL; + convertcgo = nullptr; } } else { // no shaders @@ -188,7 +188,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; I->shaderCGO->use_shader = use_shader; - convertcgo = NULL; + convertcgo = nullptr; } return ok; } @@ -206,7 +206,7 @@ void RepNonbonded::render(RenderInfo* info) alpha = 1.0F; if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->cs->Obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->cs->Obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { @@ -216,7 +216,7 @@ void RepNonbonded::render(RenderInfo* info) /* not pick, but render */ bool use_shader = SettingGetGlobal_b(G, cSetting_nonbonded_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); if (!use_shader){ - CGORender(I->primitiveCGO, NULL, NULL, NULL, info, I); + CGORender(I->primitiveCGO, nullptr, nullptr, nullptr, info, I); return; } bool nonbonded_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_nonbonded_as_cylinders); @@ -238,7 +238,7 @@ void RepNonbonded::render(RenderInfo* info) } ok &= RepNonbondedCGOGenerate(I, info); } - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -265,7 +265,7 @@ Rep *RepNonbondedNew(CoordSet * cs, int state) auto I = new RepNonbonded(cs, state); - I->shaderCGO = NULL; + I->shaderCGO = nullptr; I->primitiveCGO = CGONew(G); diff --git a/layer2/RepNonbondedSphere.cpp b/layer2/RepNonbondedSphere.cpp index 8f40656bb..978f4ce00 100644 --- a/layer2/RepNonbondedSphere.cpp +++ b/layer2/RepNonbondedSphere.cpp @@ -59,7 +59,7 @@ void RepNonbondedSphere::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); #endif } else if(G->HaveGUI && G->ValidContext) { if(pick) { @@ -91,9 +91,9 @@ void RepNonbondedSphere::render(RenderInfo* info) } I->shaderCGO->use_shader = true; } - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } else { - CGORender(I->primitiveCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->primitiveCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -109,7 +109,7 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) PyMOLGlobals *G = cs->G; ObjectMolecule *obj = cs->Obj; - unsigned char *active = NULL; + unsigned char *active = nullptr; int nSphere = 0; float prev_transp = -1; @@ -138,8 +138,8 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_nb_spheres_size); auto I = new RepNonbondedSphere(cs, state); - I->shaderCGO = NULL; - I->primitiveCGO = NULL; + I->shaderCGO = nullptr; + I->primitiveCGO = nullptr; /* Generate primitiveCGO */ int NP = 0; @@ -181,7 +181,7 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) FreeP(active); if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepRibbon.cpp b/layer2/RepRibbon.cpp index 7e90ab9e6..2bbf6dcb7 100644 --- a/layer2/RepRibbon.cpp +++ b/layer2/RepRibbon.cpp @@ -72,7 +72,7 @@ void RepRibbon::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); #endif } else if(G->HaveGUI && G->ValidContext) { if(pick) { @@ -89,7 +89,7 @@ void RepRibbon::render(RenderInfo* info) if (use_shader){ if (!I->shaderCGO){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; I->shaderCGO = CGONew(G); CHECKOK(ok, I->shaderCGO); if (ok) @@ -123,10 +123,10 @@ void RepRibbon::render(RenderInfo* info) CGOFreeWithoutVBOs(convertcgo); I->shaderCGO->use_shader = true; } - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); return; } else { - CGORender(I->primitiveCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->primitiveCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); return; } } @@ -144,14 +144,14 @@ Rep *RepRibbonNew(CoordSet * cs, int state) ObjectMolecule *obj; int a, b, a1, a2, *i, *s, *at, *seg, nAt, *atp; float *v, *v1, *v2, *v3; - float *pv = NULL; - float *dv = NULL; - float *nv = NULL; - float *tv = NULL; + float *pv = nullptr; + float *dv = nullptr; + float *nv = nullptr; + float *tv = nullptr; float f0, f1, f2, f3, f4; float *d; - float *dl = NULL; + float *dl = nullptr; int nSeg; int sampling; float power_a = 5; @@ -161,13 +161,13 @@ Rep *RepRibbonNew(CoordSet * cs, int state) int trace, trace_mode; int ribbon_color; int na_mode; - AtomInfoType *ai, *last_ai = NULL; - AtomInfoType *trailing_O3p_ai = NULL, *leading_O5p_ai = NULL; + AtomInfoType *ai, *last_ai = nullptr; + AtomInfoType *trailing_O3p_ai = nullptr, *leading_O5p_ai = nullptr; int trailing_O3p_a = 0, leading_O5p_a = 0, leading_O5p_a1 = 0; // skip if not visible if(!cs->hasRep(cRepRibbonBit)) - return NULL; + return nullptr; auto I = new RepRibbon(cs, state); @@ -269,7 +269,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) } } - trailing_O3p_ai = NULL; + trailing_O3p_ai = nullptr; if(leading_O5p_ai && (a2 < 0) && ((na_mode == 3) || (na_mode == 4))) { if((!AtomInfoSameResidueP(G, ai, leading_O5p_ai)) && @@ -285,7 +285,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) a2 = leading_O5p_a1; } } - leading_O5p_ai = NULL; + leading_O5p_ai = nullptr; last_ai = ai; if(a2 < 0) nSeg++; @@ -421,7 +421,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) I->primitiveCGO = CGONew(G); CGOSpecialWithArg(I->primitiveCGO, LINE_LIGHTING, 0.f); - float alpha = 1.f - SettingGet_f(G, NULL, I->obj->Setting.get(), cSetting_ribbon_transparency); + float alpha = 1.f - SettingGet_f(G, nullptr, I->obj->Setting.get(), cSetting_ribbon_transparency); if(fabs(alpha-1.0) < R_SMALL4) alpha = 1.0F; CGOAlpha(I->primitiveCGO, alpha); // would be good to set these at render time instead @@ -538,7 +538,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) FreeP(nv); } else { delete I; - I = NULL; + I = nullptr; } FreeP(at); @@ -561,7 +561,7 @@ void RepRibbonRenderImmediate(CoordSet * cs, RenderInfo * info) int active = false; int nAtIndex = obj->NAtom; const AtomInfoType *obj_AtomInfo = obj->AtomInfo.data(); - const AtomInfoType *ai, *last_ai = NULL; + const AtomInfoType *ai, *last_ai = nullptr; int trace, trace_ostate = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_ribbon_trace_atoms); int trace_mode = diff --git a/layer2/RepSphere.cpp b/layer2/RepSphere.cpp index 51dbdc21c..2fa55a7b6 100644 --- a/layer2/RepSphere.cpp +++ b/layer2/RepSphere.cpp @@ -104,9 +104,9 @@ static int RepSphereRenderRay(PyMOLGlobals *G, RepSphere * I, RenderInfo * info) alpha = 1.0F; ray->transparentf(1.0 - alpha); if (I->spheroidCGO){ - CGORenderRay(I->spheroidCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->spheroidCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); } else { - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); } ray->transparentf(0.0); return true; @@ -167,7 +167,7 @@ void RepSphere::render(RenderInfo* info) RepSphereRenderPick(I, info, sphere_mode); } else { /* not pick, render! */ if (I->spheroidCGO) { - CGORender(I->spheroidCGO, NULL, NULL, NULL, info, I); + CGORender(I->spheroidCGO, nullptr, nullptr, nullptr, info, I); return; } @@ -176,7 +176,7 @@ void RepSphere::render(RenderInfo* info) CGOFree(I->renderCGO); I->renderCGO = 0; } else { - CGORender(I->renderCGO, NULL, NULL, NULL, info, I); + CGORender(I->renderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -204,7 +204,7 @@ void RepSphere::render(RenderInfo* info) } if (I->renderCGO) - CGORender(I->renderCGO, NULL, NULL, NULL, info, I); + CGORender(I->renderCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -481,19 +481,19 @@ Rep *RepSphereNew(CoordSet * cs, int state) int ribbon_side_chain_helper = 0; AtomInfoType *ati1; int sphere_mode = 0; - bool *marked = NULL; + bool *marked = nullptr; float transp; int variable_alpha = false; short use_shader = SettingGetGlobal_b(G, cSetting_sphere_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); // skip if not visible if(!cs->hasRep(cRepSphereBit)) - return NULL; + return nullptr; obj = cs->Obj; marked = pymol::calloc(obj->NAtom); if (!marked) - return NULL; + return nullptr; auto I = new RepSphere(cs, state); if (!cs->Spheroid.empty()) @@ -541,7 +541,7 @@ Rep *RepSphereNew(CoordSet * cs, int state) } ok &= !G->Interrupt; } - MapType *map = MapNew(G, SPHERE_NORMAL_RANGE, v_tmp, nspheres, NULL); + MapType *map = MapNew(G, SPHERE_NORMAL_RANGE, v_tmp, nspheres, nullptr); float cut_mult = SphereComputeCutMultiplier(G->Sphere->Sphere[1]); float *dot = G->Sphere->Sphere[1]->dot[0]; int n_dot = G->Sphere->Sphere[1]->nDot; @@ -611,7 +611,7 @@ Rep *RepSphereNew(CoordSet * cs, int state) FreeP(marked); if(nspheres == 0 || !ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepSphereGenerate.cpp b/layer2/RepSphereGenerate.cpp index 189d6d98a..e4c376f97 100644 --- a/layer2/RepSphereGenerate.cpp +++ b/layer2/RepSphereGenerate.cpp @@ -57,7 +57,7 @@ void RepSphere_Generate_Triangles(PyMOLGlobals *G, RepSphere *I, void RepSphere_Generate_Impostor_Spheres(PyMOLGlobals *G, RepSphere *I, RenderInfo *info) { if (!I->renderCGO) { - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; convertcgo = CGOOptimizeSpheresToVBONonIndexed(I->primitiveCGO, 0, true); if (convertcgo) { I->renderCGO = convertcgo; diff --git a/layer2/RepSurface.cpp b/layer2/RepSurface.cpp index 5873489fa..e91013918 100644 --- a/layer2/RepSurface.cpp +++ b/layer2/RepSurface.cpp @@ -112,8 +112,8 @@ RepSurface::~RepSurface() auto I = this; VLAFreeP(I->V); VLAFreeP(I->VN); - setPickingCGO(I, NULL); - setShaderCGO(I, NULL); + setPickingCGO(I, nullptr); + setShaderCGO(I, nullptr); FreeP(I->VC); FreeP(I->VA); if (I->VAO){ @@ -201,7 +201,7 @@ static void immediate_draw_indexed_vertices_alpha( const float * vc, // colors const float * va, // alpha array - float alpha, // alpha value if va is NULL + float alpha, // alpha value if va is nullptr const float * vn, // normals const float * v, // vertices const int * indices, // indices @@ -288,7 +288,7 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) int ok = true; float alpha; int t_mode; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; auto* const cs = I->cs; auto* const obj = I->cs->Obj; @@ -578,9 +578,9 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) if(t_mode) { - float **t_buf = NULL, **tb; - float *z_value = NULL, *zv; - int *ix = NULL; + float **t_buf = nullptr, **tb; + float *z_value = nullptr, *zv; + int *ix = nullptr; int n_tri = 0; float sum[3]; float matrix[16]; @@ -1368,13 +1368,13 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) #endif } else { if (ok) - convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(I->shaderCGO, 0, false, NULL); + convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(I->shaderCGO, 0, false, nullptr); CHECKOK(ok, convertcgo); } if (ok) convertcgo->use_shader = true; { - CGO *tmpCGO = NULL; + CGO *tmpCGO = nullptr; tmpCGO = CGONew(G); CGOEnable(tmpCGO, GL_SURFACE_SHADER); //CGOEnable(tmpCGO, CGO_GL_LIGHTING); // do we need this? @@ -1401,11 +1401,11 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) if (ok) ok &= CGODisable(I->shaderCGO, GL_SURFACE_SHADER); if (ok) ok &= CGOStop(I->shaderCGO); CGOFreeWithoutVBOs(convertcgo); - convertcgo = NULL; + convertcgo = nullptr; } } else { setShaderCGO(I, convertcgo); - convertcgo = NULL; + convertcgo = nullptr; } if (I->shaderCGO) { @@ -1656,7 +1656,7 @@ void RepSurface::render(RenderInfo* info) if (ok && I->shaderCGO) { const float *color = ColorGet(G, obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); return; } @@ -1664,7 +1664,7 @@ void RepSurface::render(RenderInfo* info) " RepSurfaceCGOGenerate failed\n" ENDFB(G); } - setShaderCGO(I, NULL); + setShaderCGO(I, nullptr); #ifndef PURE_OPENGL_ES_2 bool two_sided_lighting = @@ -1684,7 +1684,7 @@ void RepSurface::render(RenderInfo* info) if(!normals){ SceneResetNormal(G, true); - vn = NULL; + vn = nullptr; } if(!lighting) @@ -1696,7 +1696,7 @@ void RepSurface::render(RenderInfo* info) glBegin(GL_POINTS); if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } else { glColor3f(1.0, 0.0, 0.0); } @@ -1720,7 +1720,7 @@ void RepSurface::render(RenderInfo* info) if(!normals){ SceneResetNormal(G, true); - vn = NULL; + vn = nullptr; } if(!lighting) @@ -1732,7 +1732,7 @@ void RepSurface::render(RenderInfo* info) if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } glBegin(GL_LINES); @@ -1763,9 +1763,9 @@ void RepSurface::render(RenderInfo* info) if(t_mode) { - float **t_buf = NULL, **tb; - float *z_value = NULL, *zv; - int *ix = NULL; + float **t_buf = nullptr, **tb; + float *z_value = nullptr, *zv; + int *ix = nullptr; int n_tri = 0; float sum[3]; float matrix[16]; @@ -2019,7 +2019,7 @@ void RepSurface::render(RenderInfo* info) float col[3]; ColorGetEncoded(G, I->oneColor, col); glColor4f(col[0], col[1], col[2], alpha); - vc = NULL; + vc = nullptr; } if(I->allVisibleFlag) { @@ -2045,7 +2045,7 @@ void RepSurface::render(RenderInfo* info) } else if (ok) { /* opaque */ if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } if(I->allVisibleFlag) { @@ -2173,7 +2173,7 @@ Rep* RepSurface::recolor() auto const I = this; assert(cs == this->cs); - MapType *map = NULL, *ambient_occlusion_map = NULL; + MapType *map = nullptr, *ambient_occlusion_map = nullptr; int a, i0, i, j, c1; float *v0, *vc, *va; const float *c0; @@ -2192,7 +2192,7 @@ Rep* RepSurface::recolor() int cullByFlag = false; int surface_mode, ambient_occlusion_mode; int surface_color; - int *present = NULL; + int *present = nullptr; int *rc; int ramped_flag = false; @@ -2201,24 +2201,24 @@ Rep* RepSurface::recolor() float carve_cutoff; float carve_normal_cutoff; int carve_normal_flag; - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; int clear_state = 0; int clear_flag = false; float clear_cutoff; - const char *clear_selection = NULL; - float *clear_vla = NULL; + const char *clear_selection = nullptr; + float *clear_vla = nullptr; int state = getState(); float transp; int variable_alpha = false; - MapType *clear_map = NULL; + MapType *clear_map = nullptr; - AtomInfoType *ai2 = NULL, *ai1; + AtomInfoType *ai2 = nullptr, *ai1; obj = cs->Obj; ambient_occlusion_mode = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_ambient_occlusion_mode); @@ -2327,7 +2327,7 @@ Rep* RepSurface::recolor() if(inclInvis) { float probe_radiusX2 = probe_radius * 2; map = - MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL, + MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr, present); MapSetupExpress(map); /* add in nearby invisibles */ @@ -2355,7 +2355,7 @@ Rep* RepSurface::recolor() } } MapFree(map); - map = NULL; + map = nullptr; } /** @@ -2390,9 +2390,9 @@ Rep* RepSurface::recolor() start_time = UtilGetSeconds(G); if (vertex_map){ - ambient_occlusion_map = MapNewFlagged(G, map_cutoff, I->V, I->N, NULL, NULL); + ambient_occlusion_map = MapNewFlagged(G, map_cutoff, I->V, I->N, nullptr, nullptr); } else { - ambient_occlusion_map = MapNewFlagged(G, map_cutoff, cs->Coord, cs->NIndex, NULL, present); + ambient_occlusion_map = MapNewFlagged(G, map_cutoff, cs->Coord, cs->NIndex, nullptr, present); } MapSetupExpress(ambient_occlusion_map); @@ -2616,12 +2616,12 @@ Rep* RepSurface::recolor() cur_time = UtilGetSeconds(G); PRINTFB(G, FB_RepSurface, FB_Debugging) "RepSurfaceColor(): Ambient Occlusion computed #atoms=%d #vertices=%d time=%lf seconds\n", cs->NIndex, I->N, (cur_time-start_time) ENDFB(G); - ambient_occlusion_map = NULL; + ambient_occlusion_map = nullptr; }; // update_VAO /* now, assign colors to each point */ - map = MapNewFlagged(G, cutoff, cs->Coord, cs->NIndex, NULL, present); + map = MapNewFlagged(G, cutoff, cs->Coord, cs->NIndex, nullptr, present); if(map) { short color_smoothing = SettingGetGlobal_i(G, cSetting_surface_color_smoothing); float color_smoothing_threshold = SettingGetGlobal_f(G, cSetting_surface_color_smoothing_threshold); @@ -2633,10 +2633,10 @@ Rep* RepSurface::recolor() for(a = 0; ok && a < I->N; a++) { float at_transp = transp; - AtomInfoType *ai0 = NULL; + AtomInfoType *ai0 = nullptr; float minDist = FLT_MAX, minDist2 = FLT_MAX, distDiff = FLT_MAX; int pi = -1, catm = -1; /* variables for color smoothing */ - AtomInfoType *pai = NULL, *pai2 = NULL; /* variables for color smoothing */ + AtomInfoType *pai = nullptr, *pai2 = nullptr; /* variables for color smoothing */ c1 = 1; i0 = -1; v0 = I->V + 3 * a; @@ -2844,12 +2844,12 @@ Rep* RepSurface::recolor() */ if(G->HaveGUI) { - setShaderCGO(I, NULL); + setShaderCGO(I, nullptr); } if(I->VA && (!variable_alpha)) { FreeP(I->VA); - I->VA = NULL; + I->VA = nullptr; } if(carve_map) @@ -2912,19 +2912,19 @@ static void SurfaceJobPurgeResult(PyMOLGlobals * G, SurfaceJob * I) I->N = 0; I->NT = 0; VLAFreeP(I->V); - I->V = NULL; + I->V = nullptr; VLAFreeP(I->VN); - I->VN = NULL; + I->VN = nullptr; VLAFreeP(I->T); - I->T = NULL; + I->T = nullptr; VLAFreeP(I->S); - I->S = NULL; + I->S = nullptr; } #ifndef _PYMOL_NOPY OV_INLINE PyObject *SurfaceJobAtomInfoAsPyTuple(SurfaceJobAtomInfo * atom_info) { - PyObject *result = NULL; + PyObject *result = nullptr; if(atom_info) { ov_size size = 2 * VLAGetSize(atom_info) + 1; result = PyTuple_New(size); @@ -2944,7 +2944,7 @@ OV_INLINE PyObject *SurfaceJobAtomInfoAsPyTuple(SurfaceJobAtomInfo * atom_info) #if 0 OV_INLINE SurfaceJobAtomInfo *SurfaceJobAtomInfoVLAFromPyTuple(PyObject * tuple) { - SurfaceJobAtomInfo *result = NULL; + SurfaceJobAtomInfo *result = nullptr; if(tuple && PyTuple_Check(tuple)) { ov_size size = PyTuple_Size(tuple); if(size) { @@ -3075,7 +3075,7 @@ static int SurfaceJobEliminateCloseDotsType3orMore(PyMOLGlobals * G, dot_flag[a] = 1; } { - MapType *map = MapNew(G, point_sep + 0.05F, I->V, I->N, NULL); + MapType *map = MapNew(G, point_sep + 0.05F, I->V, I->N, nullptr); int a; float *v = I->V; float *vn = I->VN; @@ -3135,7 +3135,7 @@ static int SurfaceJobEliminateCloseDotsTypeLessThan3(PyMOLGlobals * G, int ok = true; int a; float point_sep = I->pointSep; - MapType *map = MapNew(G, -point_sep, I->V, I->N, NULL); + MapType *map = MapNew(G, -point_sep, I->V, I->N, nullptr); float *v = I->V; float *vn = I->VN; @@ -3288,7 +3288,7 @@ static int SurfaceJobEliminateTroublesomeVertices(PyMOLGlobals * G, SurfaceJob * trim_cutoff *= 1.5; } while(ok && repeat_flag) { - MapType *map = MapNew(G, neighborhood, I->V, I->N, NULL); + MapType *map = MapNew(G, neighborhood, I->V, I->N, nullptr); CHECKOK(ok, map); if (ok){ int a; @@ -3318,7 +3318,7 @@ static int SurfaceJobAtomProximityCleanupPass(PyMOLGlobals * G, SurfaceJob * I, SurfaceJobAtomInfo *I_atom_info = I->atomInfo; int n_index = VLAGetSize(I->atomInfo); MapType *map = - MapNewFlagged(G, I->maxVdw + probe_radius, I_coord, n_index, NULL, + MapNewFlagged(G, I->maxVdw + probe_radius, I_coord, n_index, nullptr, present_vla); int a; float *v; @@ -3439,9 +3439,9 @@ static int SurfaceJobRefineAddNewVertices(PyMOLGlobals * G, SurfaceJob * I){ map_cutoff = 2.9 * point_sep; } { - MapType *map = NULL; + MapType *map = nullptr; int a; - map = MapNew(G, map_cutoff, I->V, I->N, NULL); + map = MapNew(G, map_cutoff, I->V, I->N, nullptr); CHECKOK(ok, map); if (ok) ok &= MapSetupExpress(map); @@ -3600,15 +3600,15 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) "Error-RepSurface: insufficient memory to calculate surface at this quality.\n" ENDFB(G); VLAFreeP(I->V); - I->V = NULL; + I->V = nullptr; VLAFreeP(I->VN); - I->VN = NULL; + I->VN = nullptr; ok = false; } else { - SolventDot *sol_dot = NULL; + SolventDot *sol_dot = nullptr; float *v = I->V; float *vn = I->VN; - MapType *carve_map = NULL; + MapType *carve_map = nullptr; float probe_radius = I->probeRadius; int circumscribe = I->circumscribe; int surface_type = I->surfaceType; @@ -3649,12 +3649,12 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) } ok &= !G->Interrupt; if(ok) { - MapType *map, *solv_map = NULL; + MapType *map, *solv_map = nullptr; map = MapNewFlagged(G, I->maxVdw + probe_rad_more, - I->coord, VLAGetSize(I->coord) / 3, NULL, NULL); + I->coord, VLAGetSize(I->coord) / 3, nullptr, nullptr); CHECKOK(ok, map); if (ok) - solv_map = MapNew(G, probe_rad_less, sol_dot->dot, sol_dot->nDot, NULL); + solv_map = MapNew(G, probe_rad_less, sol_dot->dot, sol_dot->nDot, nullptr); CHECKOK(ok, solv_map); if(ok) { ok &= MapSetupExpress(solv_map); @@ -3743,7 +3743,7 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) } } SolventDotFree(sol_dot); - sol_dot = NULL; + sol_dot = nullptr; ok &= !G->Interrupt; if(ok) { int refine, ref_count = 1; @@ -3797,7 +3797,7 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) float cutoff = point_sep * 5.0F; if((cutoff > probe_radius) && (!I->surfaceSolvent)) cutoff = probe_radius; - I->T = TrianglePointsToSurface(G, I->V, I->VN, I->N, cutoff, &I->NT, &I->S, NULL, + I->T = TrianglePointsToSurface(G, I->V, I->VN, I->N, cutoff, &I->NT, &I->S, nullptr, I->cavityMode); CHECKOK(ok, I->T); PRINTFB(G, FB_RepSurface, FB_Blather) @@ -3903,7 +3903,7 @@ static int RepSurfacePrepareSurfaceJob(PyMOLGlobals * G, SurfaceJob *surf_job, surf_job->allVisibleFlag = I->allVisibleFlag; surf_job->atomInfo = *atom_info; - (*atom_info) = NULL; + (*atom_info) = nullptr; surf_job->nPresent = n_present; if(present_vla && optimize) { @@ -3935,7 +3935,7 @@ static int RepSurfacePrepareSurfaceJob(PyMOLGlobals * G, SurfaceJob *surf_job, CHECKOK(ok, surf_job->atomInfo); } else { surf_job->presentVla = present_vla; - present_vla = NULL; + present_vla = nullptr; surf_job->coord = VLAlloc(float, cs->NIndex * 3); CHECKOK(ok, surf_job->coord); if(ok) @@ -3980,12 +3980,12 @@ void RepSurfaceConvertSurfaceJobToPyObject(PyMOLGlobals *G, SurfaceJob *surf_job if(OV_OK(SurfaceJobResultFromTuple(G, surf_job, *output))) { *found = true; PXDecRef(*input); - *input = NULL; + *input = nullptr; PXDecRef(*entry); - *entry = NULL; + *entry = nullptr; } PXDecRef(*output); - *output = NULL; + *output = nullptr; } if(PyErr_Occurred()) PyErr_Print(); @@ -4143,16 +4143,16 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) int optimize = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_optimize_subsets); int circumscribe = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_circumscribe); int sphere_idx = 0, solv_sph_idx = 0; - MapType *map = NULL; + MapType *map = nullptr; float point_sep; - int *present_vla = NULL; + int *present_vla = nullptr; int n_present = 0; int carve_state = 0; int carve_flag = false; float carve_cutoff; - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; bool smooth_edges = SettingGet_b(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_smooth_edges); I->Type = surface_type; @@ -4241,7 +4241,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if (ok) map = - MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL, + MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr, present_vla); CHECKOK(ok, map); if (ok) @@ -4257,7 +4257,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) ok &= RepSurfaceRemoveAtomsNotWithinCutoff(G, carve_map, carve_vla, cs, present_vla, carve_cutoff); } MapFree(map); - map = NULL; + map = nullptr; /* now count how many atoms we actually need to think about */ n_present = 0; @@ -4281,9 +4281,9 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if(ok) { int found = false; #ifndef _PYMOL_NOPY - PyObject *entry = NULL; - PyObject *output = NULL; - PyObject *input = NULL; + PyObject *entry = nullptr; + PyObject *output = nullptr; + PyObject *input = nullptr; int cache_mode = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_cache_mode); RepSurfaceConvertSurfaceJobToPyObject(G, surf_job, cs, obj, &entry, &input, &output, &found); #endif @@ -4296,9 +4296,9 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) int blocked = PAutoBlock(G); output = SurfaceJobResultAsTuple(G, surf_job); PCacheSet(G, entry, output); - PXDecRef(entry); entry = NULL; - PXDecRef(output); output = NULL; - PXDecRef(input); input = NULL; + PXDecRef(entry); entry = nullptr; + PXDecRef(output); output = nullptr; + PXDecRef(input); input = nullptr; PAutoUnblock(G, blocked); } #endif @@ -4318,15 +4318,15 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) I->N = surf_job->N; surf_job->N = 0; I->V = surf_job->V; - surf_job->V = NULL; + surf_job->V = nullptr; I->VN = surf_job->VN; - surf_job->VN = NULL; + surf_job->VN = nullptr; I->NT = surf_job->NT; surf_job->NT = 0; I->T = surf_job->T; - surf_job->T = NULL; + surf_job->T = nullptr; I->S = surf_job->S; - surf_job->S = NULL; + surf_job->S = nullptr; } SurfaceJobPurgeResult(G, surf_job); SurfaceJobFree(G, surf_job); @@ -4349,7 +4349,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if(!ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } @@ -4499,7 +4499,7 @@ static int SolventDotGetDotsAroundVertexInSphere(PyMOLGlobals * G, SolventDot *I float *v0 = coord + 3 * a; int b, ok = true; float *v = dotPtr + (*nDot) * 3; - float *n = NULL; + float *n = nullptr; Vector3f *sp_dot = sp->dot; if (dotNormal){ n = dotNormal + (*nDot) * 3; @@ -4776,7 +4776,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, I->nDot = 0; if (ok) { int dotCnt = 0; - MapType *map = MapNewFlagged(G, max_vdw + probe_radius, coord, n_coord, NULL, present); + MapType *map = MapNewFlagged(G, max_vdw + probe_radius, coord, n_coord, nullptr, present); CHECKOK(ok, map); ok &= !G->Interrupt; if(map && ok) { @@ -4800,9 +4800,9 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, /* for each pair of proximal atoms, circumscribe a circle for their intersection */ if (ok) { - MapType *map2 = NULL; + MapType *map2 = nullptr; if(circumscribe && (!surface_solvent)){ - map2 = MapNewFlagged(G, 2 * (max_vdw + probe_radius), coord, n_coord, NULL, present); + map2 = MapNewFlagged(G, 2 * (max_vdw + probe_radius), coord, n_coord, nullptr, present); CHECKOK(ok, map2); } ok &= !G->Interrupt; @@ -4866,7 +4866,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, cavity_cutoff = cavity_radius - cavity_cutoff * probe_radius; } { - MapType *map = MapNewFlagged(G, max_vdw + cavity_radius, coord, n_coord, NULL, present); + MapType *map = MapNewFlagged(G, max_vdw + cavity_radius, coord, n_coord, nullptr, present); CHECKOK(ok, map); if(G->Interrupt) ok = false; @@ -4881,7 +4881,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, skip_flag = false; ok = SolventDotFilterOutSameXYZ(G, map, atom_info, a_atom_info, coord, a, present, &skip_flag); if(ok && !skip_flag) { - ok = SolventDotGetDotsAroundVertexInSphere(G, I, map, atom_info, a_atom_info, coord, a, present, sp, cavity_radius, &dotCnt, stopDot, cavityDot, NULL, &nCavityDot); + ok = SolventDotGetDotsAroundVertexInSphere(G, I, map, atom_info, a_atom_info, coord, a, present, sp, cavity_radius, &dotCnt, stopDot, cavityDot, nullptr, &nCavityDot); } } a_atom_info++; @@ -4894,7 +4894,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, int *dot_flag = pymol::calloc(I->nDot); ErrChkPtr(G, dot_flag); { - MapType *map = MapNew(G, cavity_cutoff, cavityDot, nCavityDot, NULL); + MapType *map = MapNew(G, cavity_cutoff, cavityDot, nCavityDot, nullptr); if(map) { MapSetupExpress(map); ok = SolventDotMarkDotsWithinCutoff(G, I, map, I->dot, I->nDot, cavityDot, dot_flag, cavity_cutoff); @@ -4916,7 +4916,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, ErrChkPtr(G, dot_flag); { - MapType *map = MapNew(G, probe_radius_plus, I->dot, I->nDot, NULL); + MapType *map = MapNew(G, probe_radius_plus, I->dot, I->nDot, nullptr); if(map) { int flag = true; MapSetupExpress(map); @@ -4936,7 +4936,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, } if(!ok) { SolventDotFree(I); - I = NULL; + I = nullptr; } return I; } diff --git a/layer2/RepWireBond.cpp b/layer2/RepWireBond.cpp index 9de0c2fe1..aab9eb994 100644 --- a/layer2/RepWireBond.cpp +++ b/layer2/RepWireBond.cpp @@ -108,7 +108,7 @@ static void RepValence(CGO *cgo, bool s1, bool s2, bool isRamped, copy3f(p0, d); normalize3f(p0); /* need a prioritized third atom to get planarity */ - a3 = ObjectMoleculeGetPrioritizedOther(other, a1, a2, NULL); + a3 = ObjectMoleculeGetPrioritizedOther(other, a1, a2, nullptr); if(a3 < 0) { t[0] = p0[0]; t[1] = p0[1]; @@ -361,7 +361,7 @@ void RepWireBondRenderImmediate(CoordSet * cs, RenderInfo * info) static int RepWireBondCGOGenerate(RepWireBond * I, RenderInfo * info) { PyMOLGlobals *G = I->G; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; int ok = true; short line_as_cylinders = 0; line_as_cylinders = SettingGetGlobal_b(G, cSetting_use_shaders) && SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_line_as_cylinders); @@ -419,14 +419,14 @@ void RepWireBond::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(primitiveCGO, ray, info, NULL, NULL, cs->Setting.get(), cs->Obj->Setting.get()); + CGORenderRay(primitiveCGO, ray, info, nullptr, nullptr, cs->Setting.get(), cs->Obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { bool use_shader = SettingGetGlobal_b(G, cSetting_line_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); if(pick) { - CGORenderPicking(use_shader ? I->shaderCGO : I->primitiveCGO, info, &I->context, NULL, NULL, I); + CGORenderPicking(use_shader ? I->shaderCGO : I->primitiveCGO, info, &I->context, nullptr, nullptr, I); } else { /* else not pick i.e., when rendering */ short line_as_cylinders ; line_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_line_as_cylinders); @@ -438,9 +438,9 @@ void RepWireBond::render(RenderInfo* info) if (use_shader) { if (!I->shaderCGO) ok &= RepWireBondCGOGenerate(I, info); - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } else { - CGORender(I->primitiveCGO, NULL, NULL, NULL, info, I); + CGORender(I->primitiveCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -580,7 +580,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) int a, c1, c2, ord; bool s1, s2; const BondType *b; - int half_bonds, *other = NULL; + int half_bonds, *other = nullptr; float valence; const float *v1, *v2; int visFlag; @@ -591,7 +591,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) int ribbon_side_chain_helper = 0; int line_stick_helper = 0; int na_mode; - bool *marked = NULL; + bool *marked = nullptr; int valence_found = false; int variable_width = false; float last_line_width = -1.f; @@ -860,7 +860,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) FreeP(other); if (!ok || !line_counter){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/Sculpt.cpp b/layer2/Sculpt.cpp index 4ee4b2d79..ebf302003 100644 --- a/layer2/Sculpt.cpp +++ b/layer2/Sculpt.cpp @@ -385,10 +385,10 @@ void SculptMeasureObject(CSculpt * I, ObjectMolecule * obj, int state, int match float *v0, *v1, *v2, *v3, d, dummy; CoordSet *cs; int n0, n1, n2, n3; - int *planar = NULL; - int *linear = NULL; - int *single = NULL; - int *crdidx = NULL; + int *planar = nullptr; + int *linear = nullptr; + int *single = nullptr; + int *crdidx = nullptr; int nex = 1; int *j, *k, xhash; int ex_type; @@ -646,7 +646,7 @@ void SculptMeasureObject(CSculpt * I, ObjectMolecule * obj, int state, int match atl.discCSet = obj->DiscreteCSet; } else { atl.atm2idx = cs->AtmToIdx.data(); - atl.discCSet = NULL; + atl.discCSet = nullptr; } atl.coord = cs->Coord; atl.neighbor = neighbor; @@ -1612,11 +1612,11 @@ float SculptIterateObject(CSculpt * I, ObjectMolecule * obj, CShaker *shk; int a0, a1, a2, a3, b0, b3; int aa; - float *disp = NULL; + float *disp = nullptr; float *v, *v0, *v1, *v2, *v3; float diff[3], len; - int *atm2idx = NULL; - int *cnt = NULL; + int *atm2idx = nullptr; + int *cnt = nullptr; int *i; int hash; int nb_next; @@ -1648,7 +1648,7 @@ float SculptIterateObject(CSculpt * I, ObjectMolecule * obj, int nb_skip, nb_skip_count; float total_strain = 0.0F, strain; int total_count = 1; - CGO *cgo = NULL; + CGO *cgo = nullptr; float good_color[3] = { 0.2, 1.0, 0.2 }; float bad_color[3] = { 1.0, 0.2, 0.2 }; int vdw_vis_mode; diff --git a/layer2/VFont.cpp b/layer2/VFont.cpp index ec5f26ac5..e33b0f9f2 100644 --- a/layer2/VFont.cpp +++ b/layer2/VFont.cpp @@ -58,7 +58,7 @@ int VFontWriteToCGO(PyMOLGlobals * G, int font_id, CGO * cgo, const char *text, float *pos, float *scale, float *matrix, float *color) { CVFont *I = G->VFont; - VFontRec *fr = NULL; + VFontRec *fr = nullptr; int ok = true; float base[3], pen[3]; float *pc; @@ -141,7 +141,7 @@ int VFontIndent(PyMOLGlobals * G, int font_id, const char *text, float *pos, flo float *matrix, float dir) { CVFont *I = G->VFont; - VFontRec *fr = NULL; + VFontRec *fr = nullptr; int ok = true; float pen[3]; unsigned char c; @@ -183,7 +183,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) ov_diff used = 0; int ok = true; PyObject *key, *char_list; - PyObject *stroke_list = NULL; + PyObject *stroke_list = nullptr; Py_ssize_t pos = 0; unsigned char code[2]; float adv; @@ -195,7 +195,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) ok = false; } else { if(ok) - ok = (char_list != NULL); + ok = (char_list != nullptr); if(ok) ok = PyList_Check(char_list); if(ok) @@ -205,7 +205,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) if(ok) { stroke_list = PyList_GetItem(char_list, 1); if(ok) - ok = (stroke_list != NULL); + ok = (stroke_list != nullptr); if(ok) ok = PyList_Check(stroke_list); if(ok) { @@ -267,7 +267,7 @@ static void VFontRecFree(PyMOLGlobals * G, VFontRec * I) int VFontInit(PyMOLGlobals * G) { - CVFont *I = NULL; + CVFont *I = nullptr; if((I = (G->VFont = pymol::calloc(1)))) { CVFont *I = G->VFont; @@ -297,7 +297,7 @@ int VFontLoad(PyMOLGlobals * G, float size, int face, int style, int can_load_ne int a; int result = 0; #ifndef _PYMOL_NOPY - PyObject *vfont = NULL; + PyObject *vfont = nullptr; #endif PRINTFD(G, FB_VFont) diff --git a/layer3/Editor.cpp b/layer3/Editor.cpp index 3bc3c48fe..46e22a2cf 100644 --- a/layer3/Editor.cpp +++ b/layer3/Editor.cpp @@ -312,7 +312,7 @@ static int EditorGetEffectiveState(PyMOLGlobals * G, pymol::CObject * obj, int s if(objMol) { if((objMol->NCSet == 1) && (state > 0)) - if(SettingGet_i(G, NULL, objMol->Setting.get(), cSetting_static_singletons)) + if(SettingGet_i(G, nullptr, objMol->Setting.get(), cSetting_static_singletons)) return 0; } } @@ -335,11 +335,11 @@ void EditorDefineExtraPks(PyMOLGlobals * G) if(EditorGetSinglePicked(G, name)) { sprintf(buffer, "(byres %s)", name); - SelectorCreate(G, cEditorRes, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorRes, buffer, nullptr, true, nullptr); sprintf(buffer, "(bychain %s)", name); - SelectorCreate(G, cEditorChain, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorChain, buffer, nullptr, true, nullptr); sprintf(buffer, "(byobject %s)", name); - SelectorCreate(G, cEditorObject, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorObject, buffer, nullptr, true, nullptr); if(SettingGetGlobal_b(G, cSetting_auto_hide_selections)) ExecutiveHideSelections(G); @@ -392,7 +392,7 @@ int EditorIsBondMode(PyMOLGlobals * G) PyObject *EditorAsPyList(PyMOLGlobals * G) { - PyObject *result = NULL; + PyObject *result = nullptr; CEditor *I = G->Editor; if(!EditorActive(G)) { @@ -416,7 +416,7 @@ int EditorFromPyList(PyMOLGlobals * G, PyObject * list) int bond_mode = true; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -543,7 +543,7 @@ int EditorLogState(PyMOLGlobals * G, int pkresi) PLog(G, "edit", cPLog_pml); } else { int sele1, sele2, sele3, sele4; - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1, index2, index3, index4; sele1 = SelectorIndexByName(G, cEditorSele1); @@ -657,7 +657,7 @@ EditorInvert(PyMOLGlobals * G, int quiet) (!ObjectMoleculeIsAtomBondedToSele(obj0, ia0, sele2)) && (!ObjectMoleculeIsAtomBondedToSele(obj0, ia1, sele2))) { found = true; - ObjectMoleculeTransformSelection(obj0, state, sele2, m, false, NULL, false, + ObjectMoleculeTransformSelection(obj0, state, sele2, m, false, nullptr, false, false); } } @@ -673,7 +673,7 @@ EditorInvert(PyMOLGlobals * G, int quiet) SceneInvalidate(G); I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; } } } @@ -695,7 +695,7 @@ pymol::Result<> EditorTorsion(PyMOLGlobals * G, float angle) int vf1, vf2; int ok = false; WordType sele; - ObjectMolecule *obj0 = NULL, *obj1 = NULL, *obj2 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr, *obj2 = nullptr; if(!EditorActive(G)) { ErrMessage(G, "Editor", "Must specify a bond first."); @@ -735,16 +735,16 @@ pymol::Result<> EditorTorsion(PyMOLGlobals * G, float angle) theta = (float) (cPI * angle / 180.0); get_rotation_about3f3fTTTf(theta, n0, v1, m); ok = - ObjectMoleculeTransformSelection(obj2, state, sele2, m, false, NULL, false, + ObjectMoleculeTransformSelection(obj2, state, sele2, m, false, nullptr, false, false); SceneInvalidate(G); I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); } } } @@ -777,20 +777,20 @@ pymol::Result<> EditorSelect(PyMOLGlobals* G, const char* str0, int i3 = -1; int result = false; int ok = true; - ObjectMolecule *obj0 = NULL, *obj1 = NULL, *obj2 = NULL, *obj3 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; if(s0) if(!*s0) - s0 = NULL; + s0 = nullptr; if(s1) if(!*s1) - s1 = NULL; + s1 = nullptr; if(s2) if(!*s2) - s2 = NULL; + s2 = nullptr; if(s3) if(!*s3) - s3 = NULL; + s3 = nullptr; if(s0) { obj0 = SelectorGetFastSingleAtomObjectIndex(G, tmp0.getIndex(), &i0); @@ -826,13 +826,13 @@ pymol::Result<> EditorSelect(PyMOLGlobals* G, const char* str0, ObjectMoleculeVerifyChemistry(obj3, -1); if(i0 >= 0) - SelectorCreate(G, cEditorSele1, s0, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele1, s0, nullptr, quiet, nullptr); if(i1 >= 0) - SelectorCreate(G, cEditorSele2, s1, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele2, s1, nullptr, quiet, nullptr); if(i2 >= 0) - SelectorCreate(G, cEditorSele3, s2, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele3, s2, nullptr, quiet, nullptr); if(i3 >= 0) - SelectorCreate(G, cEditorSele4, s3, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele4, s3, nullptr, quiet, nullptr); EditorActivate(G, SceneGetState(G), pkbond); @@ -1003,7 +1003,7 @@ pymol::Result<> EditorRemove(PyMOLGlobals * G, int hydrogen, int quiet) if(hydrogen) { auto buf = pymol::string_format("((neighbor %s) and hydro)", cEditorSele1); - h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), NULL, false, NULL).result(); + h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), nullptr, false, nullptr).result(); } if(SelectorGetFastSingleAtomObjectIndex(G, sele0, &i0)) { @@ -1016,7 +1016,7 @@ pymol::Result<> EditorRemove(PyMOLGlobals * G, int hydrogen, int quiet) if(hydrogen) { auto buf = pymol::string_format("((neighbor %s) and hydro)", cEditorSet); - h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), NULL, false, NULL).result(); + h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), nullptr, false, nullptr).result(); } ExecutiveRemoveAtoms(G, cEditorSet, quiet); } @@ -1037,7 +1037,7 @@ pymol::Result<> EditorHFill(PyMOLGlobals * G, int quiet) { int sele0, sele1; int i0; - ObjectMolecule *obj0 = NULL, *obj1 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr; if(EditorActive(G)) { sele0 = SelectorIndexByName(G, cEditorSele1); @@ -1114,7 +1114,7 @@ pymol::Result<> EditorReplace(PyMOLGlobals* G, const char* elem, int geom, int i0; int sele0; AtomInfoType ai; - ObjectMolecule *obj0 = NULL; + ObjectMolecule *obj0 = nullptr; int ok = true; UtilZeroMem(&ai, sizeof(AtomInfoType)); if(EditorActive(G)) { @@ -1585,10 +1585,10 @@ void EditorRender(PyMOLGlobals * G, int state) float v0[3], v1[3]; float vp[12], *vv; /* int v_cnt; */ - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1, index2, index3, index4; int st, frozen; - CGO *shaderCGO = NULL; + CGO *shaderCGO = nullptr; if(EditorActive(G)) { int use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); @@ -1596,7 +1596,7 @@ void EditorRender(PyMOLGlobals * G, int state) if (!I->shaderCGO){ shaderCGO = CGONew(G); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, nullptr, nullptr); return; } } else { @@ -1692,7 +1692,7 @@ void EditorRender(PyMOLGlobals * G, int state) } CGOFree(shaderCGO); if (ok){ - CGORender(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } } } @@ -1712,8 +1712,8 @@ void EditorInactivate(PyMOLGlobals * G) OrthoInvalidateDoDraw(G); } - I->DihedObject = NULL; - I->DragObject = NULL; + I->DihedObject = nullptr; + I->DragObject = nullptr; I->BondMode = false; I->ShowFrags = false; I->NFrag = 0; @@ -1802,7 +1802,7 @@ void EditorActivate(PyMOLGlobals * G, int state, int enable_bond) sele3, sele4, cEditorBasePref, cEditorComp, &I->BondMode); /* just returns 'state' */ - state = EditorGetEffectiveState(G, NULL, state); + state = EditorGetEffectiveState(G, nullptr, state); I->ActiveState = state; I->ShowFrags = false; @@ -1810,7 +1810,7 @@ void EditorActivate(PyMOLGlobals * G, int state, int enable_bond) ExecutiveHideSelections(G); if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); if (!I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_measure)) EditorAutoMeasure(G, sele1, sele2, sele3, sele4, state); @@ -1830,7 +1830,7 @@ void EditorSetDrag(PyMOLGlobals * G, pymol::CObject * obj, int sele, int quiet, if(obj->type == cObjectMolecule) { ObjectMolecule *objMol = (ObjectMolecule*)(void*)obj; if(ObjectMoleculeCheckFullStateSelection(objMol, sele, state)) { - int matrix_mode = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_matrix_mode); + int matrix_mode = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_matrix_mode); if(matrix_mode>=1) { /* force / coerce object matrix drags? */ sele = -1; @@ -1862,7 +1862,7 @@ void EditorPrepareDrag(PyMOLGlobals * G, pymol::CObject * obj, CEditor *I = G->Editor; int log_trans = SettingGetGlobal_b(G, cSetting_log_conformations); int drag_sele = -1; - ObjectMolecule *objMol = NULL; + ObjectMolecule *objMol = nullptr; PRINTFD(G, FB_Editor) " EditorPrepareDrag-Debug: entered. obj %p index %d\n", (void *) obj, index ENDFD; @@ -2103,7 +2103,7 @@ void EditorPrepareDrag(PyMOLGlobals * G, pymol::CObject * obj, if(!seleFlag) { I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; } } if(I->DragObject) { @@ -2155,7 +2155,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int obj = I->DragObject; if(obj) { - ObjectMolecule *objMol = NULL; + ObjectMolecule *objMol = nullptr; if(obj->type == cObjectMolecule) objMol = (ObjectMolecule*)(void*)obj; @@ -2164,7 +2164,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int if((index == I->DragIndex) && (obj == I->DragObject)) { if(!EditorActive(G)) { int matrix_mode = SettingGet_i(G, I->DragObject->Setting.get(), - NULL, cSetting_matrix_mode); + nullptr, cSetting_matrix_mode); if(matrix_mode<0) matrix_mode = EditorDraggingObjectMatrix(G) ? 1 : 0; @@ -2350,7 +2350,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int log_trans, I->DragSeleName, false, true); } else { - if(z_dir) { /* NULL-safety */ + if(z_dir) { /* nullptr-safety */ cross_product3f(I->Axis, z_dir, d0); theta = -dot_product3f(d0, mov); get_rotation_about3f3fTTTf(theta, n0, v1, m); @@ -2361,7 +2361,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int } if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); } SceneInvalidate(G); @@ -2410,13 +2410,13 @@ void EditorRemoveStale(PyMOLGlobals* G) /*========================================================================*/ int EditorInit(PyMOLGlobals * G) { - CEditor *I = NULL; + CEditor *I = nullptr; if((I = (G->Editor = pymol::calloc(1)))) { - I->DihedObject = NULL; + I->DihedObject = nullptr; I->NFrag = 0; I->Active = false; - I->DragObject = NULL; + I->DragObject = nullptr; I->DragIndex = -1; I->DragSelection = -1; I->NextPickSele = 0; @@ -2425,7 +2425,7 @@ int EditorInit(PyMOLGlobals * G) I->DihedralInvalid = false; I->MouseInvalid = false; I->FavorOrigin = false; - I->shaderCGO = NULL; + I->shaderCGO = nullptr; return 1; } else return 0; diff --git a/layer3/Executive.cpp b/layer3/Executive.cpp index 22d0d4e93..c36affd58 100644 --- a/layer3/Executive.cpp +++ b/layer3/Executive.cpp @@ -256,7 +256,7 @@ pymol::CObject * ObjectIterator::getObject() { * Find object of given type, or delete object if it exists but has the wrong * type. * @param name Object name - * @return NULL if object can't be found or has the wrong type + * @return nullptr if object can't be found or has the wrong type */ template ObjectT* ExecutiveFindOrDeleteObject(PyMOLGlobals* G, pymol::zstring_view name) @@ -427,16 +427,16 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, if(name && name[0] && strcmp(name, cKeywordNone)) { /* also do all other objects */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: if(autogen) { - power = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_power); - bias = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_bias); - simple = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_simple); - linear = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_linear); - hand = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_hand); + power = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_power); + bias = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_bias); + simple = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_simple); + linear = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_linear); + hand = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_hand); } if((ObjectGetSpecLevel(rec->obj,0)>=0)||(!strcmp(name,cKeywordAll))) { ok = ObjectMotion(rec->obj, action, first, last, power, bias, @@ -449,7 +449,7 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, } } else { /* pattern */ CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -458,11 +458,11 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, switch (rec->type) { case cExecObject: if(autogen) { - power = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_power); - bias = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_bias); - simple = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_simple); - linear = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_linear); - hand = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_hand); + power = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_power); + bias = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_bias); + simple = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_simple); + linear = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_linear); + hand = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_hand); } ok = ObjectMotion(rec->obj, action, first, last, power, bias, @@ -496,7 +496,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, } if((!name) || strcmp(name, cKeywordNone)) { /* also do all other objects */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: @@ -516,7 +516,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, } } else { /* pattern */ CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -541,7 +541,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, void ExecutiveMotionReinterpolate(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecAll: @@ -562,7 +562,7 @@ void ExecutiveMotionTrim(PyMOLGlobals * G) { int n_frame = MovieGetLength(G); CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: @@ -579,7 +579,7 @@ void ExecutiveMotionExtend(PyMOLGlobals * G, int freeze) int n_frame = 0; int max_length = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; if(MovieGetSpecLevel(G,-1)>0) n_frame = MovieGetLength(G); while(ListIterate(I->Spec, rec, next)) { @@ -617,7 +617,7 @@ int ExecutiveCountMotions(PyMOLGlobals * G) int count = 0; CExecutive *I = G->Executive; if(MovieGetLength(G)) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecAll: @@ -648,7 +648,7 @@ int ExecutiveCountMotions(PyMOLGlobals * G) void ExecutiveMotionDraw(PyMOLGlobals * G, BlockRect *rect, int expected , CGO *orthoCGO) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int frames = MovieGetLength(G); BlockRect draw_rect = *rect; int count = 0; @@ -689,7 +689,7 @@ void ExecutiveMotionMenuActivate(PyMOLGlobals * G, BlockRect *rect, int expected int x, int y, int same) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; BlockRect draw_rect = *rect; int count = 0; int height = rect->top - rect->bottom; @@ -751,7 +751,7 @@ void ExecutiveMotionMenuActivate(PyMOLGlobals * G, BlockRect *rect, int expected void ExecutiveMotionClick(PyMOLGlobals * G, BlockRect *rect,int mode, int expected, int x, int y, int nearest) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; BlockRect draw_rect = *rect; int count = 0; int height = rect->top - rect->bottom; @@ -1006,10 +1006,10 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, ObjectMap *mapObj; float mn[3] = { 0, 0, 0 }; float mx[3] = { 15, 15, 15 }; - float *vert_vla = NULL; + float *vert_vla = nullptr; int multi = false; ObjectMapState *ms; - ObjectMolecule *sele_obj = NULL; + ObjectMolecule *sele_obj = nullptr; CSymmetry *symm; auto res0 = EtcHelper( @@ -1076,13 +1076,13 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, PRINTFB(G, FB_CCmd, FB_Blather) " Isomesh: buffer %8.3f carve %8.3f \n", fbuf, carve ENDFB(G); - symm = NULL; + symm = nullptr; if(sele_obj && ObjectMapValidXtal(mapObj, state)) { - if(SettingGet_b(G, NULL, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) + if(SettingGet_b(G, nullptr, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) && (sele_obj->Symmetry)) { // legacy default: take symmetry from molecular object symm = sele_obj->Symmetry.get(); - } else if(SettingGet_b(G, NULL, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { + } else if(SettingGet_b(G, nullptr, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { // fallback: take symmetry from map state symm = ms->Symmetry.get(); } @@ -1095,7 +1095,7 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, mesh_mode, carve, vert_vla, alt_lvl, quiet); } else { - obj = NULL; + obj = nullptr; } if(!obj) { obj = ObjectMeshFromBox(G, origObj, mapObj, @@ -1151,10 +1151,10 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, ObjectMap *mapObj; float mn[3] = { 0, 0, 0 }; float mx[3] = { 15, 15, 15 }; - float *vert_vla = NULL; + float *vert_vla = nullptr; int multi = false; ObjectMapState *ms; - ObjectMolecule *sele_obj = NULL; + ObjectMolecule *sele_obj = nullptr; CSymmetry *symm; /* Goal: make a new volume map from the object or selection @@ -1252,13 +1252,13 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, PRINTFB(G, FB_CCmd, FB_Blather) " Volume: buffer %8.3f carve %8.3f \n", fbuf, carve ENDFB(G); - symm = NULL; + symm = nullptr; if(sele_obj && ObjectMapValidXtal(mapObj, state)) { - if(SettingGet_b(G, NULL, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) + if(SettingGet_b(G, nullptr, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) && (sele_obj->Symmetry)) { // legacy default: take symmetry from molecular object symm = sele_obj->Symmetry.get(); - } else if(SettingGet_b(G, NULL, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { + } else if(SettingGet_b(G, nullptr, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { // fallback: take symmetry from map state symm = ms->Symmetry.get(); } @@ -1271,7 +1271,7 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, box_mode, carve, vert_vla, quiet); } else { - obj = NULL; + obj = nullptr; } if(!obj) { @@ -1388,7 +1388,7 @@ static void ExecutiveInvalidateGridSlots(PyMOLGlobals * G) static void ExecutiveSetGridSlot(SpecRec *rec, int new_grid_slot){ if (rec->grid_slot != new_grid_slot){ CGOFree(rec->gridSlotSelIndicatorsCGO); - rec->gridSlotSelIndicatorsCGO = NULL; + rec->gridSlotSelIndicatorsCGO = nullptr; rec->grid_slot = new_grid_slot; } } @@ -1403,7 +1403,7 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) CTracker *I_Tracker = I->Tracker; I->ValidGridSlots = true; { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { ExecutiveSetGridSlot(rec, 0); if(rec->type == cExecObject) { @@ -1428,7 +1428,7 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) } if(grid_by_group) { - SpecRec *rec = NULL, *group_rec = NULL; + SpecRec *rec = nullptr, *group_rec = nullptr; while(ListIterate(I->Spec, rec, next)) { OVreturn_word result; if(OVreturn_IS_OK @@ -1458,10 +1458,10 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) } { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { - int obj_slot = SettingGet_i(G, rec->obj->Setting.get(), NULL, cSetting_grid_slot); + int obj_slot = SettingGet_i(G, rec->obj->Setting.get(), nullptr, cSetting_grid_slot); if(obj_slot == -1) { rec->obj->grid_slot = rec->grid_slot; } else @@ -1542,7 +1542,7 @@ void ExecutiveUpdateSceneMembers(PyMOLGlobals * G) ExecutiveUpdateGroups(G, false); ExecutiveUpdateGridSlots(G, false); if(!I->ValidSceneMembers) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { int visible = rec->visible; @@ -1655,9 +1655,9 @@ static int ExecutiveGetObjectParentList(PyMOLGlobals * G, SpecRec * child) CTracker *I_Tracker = I->Tracker; int priority = 1; /* generations removed from child */ int repeat_flag = true; - SpecRec *group_rec = NULL; + SpecRec *group_rec = nullptr; - list_id = TrackerNewList(I_Tracker, NULL); + list_id = TrackerNewList(I_Tracker, nullptr); while(child && child->group && repeat_flag) { OVreturn_word result; repeat_flag = false; @@ -1745,8 +1745,8 @@ static int ExecutiveDelKey(CExecutive * I, SpecRec * rec) static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name) { CExecutive *I = G->Executive; - SpecRec *result = NULL; - SpecRec *rec = NULL; + SpecRec *result = nullptr; + SpecRec *rec = nullptr; int best = 0; int wm; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); @@ -1761,7 +1761,7 @@ static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name result = rec; best = wm; } else if((wm > 0) && (best == wm)) { /* ambiguous match... no good */ - result = NULL; + result = nullptr; } } return (result); @@ -1770,8 +1770,8 @@ static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name static SpecRec *ExecutiveAnyCaseNameMatch(PyMOLGlobals * G, const char *name) { CExecutive *I = G->Executive; - SpecRec *result = NULL; - SpecRec *rec = NULL; + SpecRec *result = nullptr; + SpecRec *rec = nullptr; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); while(ListIterate(I->Spec, rec, next)) { @@ -1795,7 +1795,7 @@ int ExecutiveScrollTo(PyMOLGlobals * G, const char * name, int i) { CExecutive *I = G->Executive; int pos = 0, numhits = 0; ObjectGroup *group; - SpecRec *tmp, *spec = NULL, *first = NULL; + SpecRec *tmp, *spec = nullptr, *first = nullptr; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); int j, lendiff, plen = strlen(name); @@ -1855,7 +1855,7 @@ int ExecutiveScrollTo(PyMOLGlobals * G, const char * name, int i) { void ExecutiveUpdateColorDepends(PyMOLGlobals * G, ObjectMolecule * mol) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { @@ -1879,10 +1879,10 @@ void ExecutiveUpdateCoordDepends(PyMOLGlobals * G, ObjectMolecule * mol) { /* nasty, ugly, inefficient hack */ CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectGadget *gadget; int done_inv_all = false; - int dynamic_measures = SettingGet_b(G, mol ? mol->Setting.get() : NULL, NULL, + int dynamic_measures = SettingGet_b(G, mol ? mol->Setting.get() : nullptr, nullptr, cSetting_dynamic_measures); while(ListIterate(I->Spec, rec, next)) { @@ -2052,7 +2052,7 @@ int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name, if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; if(!result) - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); if(result) { TrackerLink(I_Tracker, cand_id, result, 1); } @@ -2063,12 +2063,12 @@ int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name, } else if((rec = ExecutiveFindSpec(G, name))) { /* only one name in list */ if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } else if(allow_partial && (rec = ExecutiveUnambiguousNameMatch(G, name))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } if(matcher) @@ -2104,7 +2104,7 @@ static void ExecutiveGroupPurge(PyMOLGlobals* G, SpecRec* rec, std::vector recs; auto ignore_case = SettingGet(G, cSetting_ignore_case); - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while (ListIterate(G->Executive->Spec, rec2, next)) { if ((rec2->group == rec) || WordMatchExact(G, rec2->group_name, rec->name, ignore_case)) { @@ -2169,7 +2169,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { if(rec) { - ObjectGroup *objGroup = NULL; + ObjectGroup *objGroup = nullptr; if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { objGroup = (ObjectGroup *) rec->obj; } @@ -2189,11 +2189,11 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, break; case cExecutiveGroupEmpty: if(objGroup) { - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatchExact(G, rec2->group_name, rec->name, ignore_case)) { - rec2->group = NULL; + rec2->group = nullptr; rec2->group_name[0] = 0; } } @@ -2209,7 +2209,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, if(rec->group_name[0]) { /* cascade group members up to the surrounding group */ - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatch(G, rec->name, rec2->group_name, ignore_case)) { @@ -2219,7 +2219,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, } } else if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { /* and/or delete their group membership */ - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatch(G, rec->name, rec2->group_name, ignore_case)) { @@ -2328,7 +2328,7 @@ int ExecutiveDrawCmd(PyMOLGlobals * G, int width, int height, int antialias, ExecutiveSetSettingFromString(G, cSetting_draw_mode, "-2", "", -1, true, true); SceneUpdate(G, false); } - SceneDeferImage(G, width, height, NULL, antialias, -1.0, cMyPNG_FormatPNG, quiet, nullptr); + SceneDeferImage(G, width, height, nullptr, antialias, -1.0, cMyPNG_FormatPNG, quiet, nullptr); } return 1; } @@ -2360,7 +2360,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, switch (source_mode) { case 0: /* txf history is the source matrix */ { - double *history = NULL; + double *history = nullptr; int found = ExecutiveGetObjectMatrix2(G, source_obj, source_state, &history, false); if(found) { switch (target_mode) { @@ -2368,7 +2368,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix2(G, source_obj, target_state, &target_history, @@ -2409,7 +2409,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ObjectSetTTT(target_obj, tttf, -1, -1); } else { - ObjectSetTTT(target_obj, NULL, -1, -1); + ObjectSetTTT(target_obj, nullptr, -1, -1); } target_obj->invalidate(cRepNone, cRepInvExtents, -1); break; @@ -2444,7 +2444,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, convertTTTfR44d(tttf, homo); ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, homo); } else { - ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, NULL); + ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, nullptr); } break; } @@ -2467,7 +2467,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, ObjectSetTTT(target_obj, tttf, -1, -1); target_obj->invalidate(cRepNone, cRepInvExtents, -1); } else { - ObjectSetTTT(target_obj, NULL, -1, -1); + ObjectSetTTT(target_obj, nullptr, -1, -1); target_obj->invalidate(cRepNone, cRepInvExtents, -1); } break; @@ -2504,7 +2504,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - SpecRec *src_rec = NULL; + SpecRec *src_rec = nullptr; int ok = true; int copy_ttt_too = false; int matrix_mode = SettingGetGlobal_i(G, cSetting_matrix_mode); @@ -2542,7 +2542,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, switch (source_mode) { case 0: /* txf history is the source matrix */ { - double *history = NULL; + double *history = nullptr; int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &history, false); if(found) { @@ -2560,7 +2560,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix(G, rec->name, target_state, &target_history, @@ -2600,7 +2600,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } /* to do: logging, return values, etc. */ break; @@ -2649,7 +2649,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertTTTfR44d(tttf, homo); ok = ExecutiveSetObjectMatrix(G, rec->name, -1, homo); } else { - ok = ExecutiveSetObjectMatrix(G, rec->name, -1, NULL); + ok = ExecutiveSetObjectMatrix(G, rec->name, -1, nullptr); } break; } @@ -2686,7 +2686,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(homo, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } break; case 2: /* State */ @@ -2741,7 +2741,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix(G, rec->name, target_state, &target_history, @@ -2774,7 +2774,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } /* to do: logging, return values, etc. */ break; @@ -2801,7 +2801,7 @@ void ExecutiveInvalidateMapDependents( PyMOLGlobals* G, const char* map_name, const char* new_name) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { switch (rec->obj->type) { @@ -2847,7 +2847,7 @@ pymol::Result<> ExecutiveResetMatrix( switch (mode) { case 0: /* transformations already applied to the coordinates */ for (StateIterator iter(rec->obj, state); iter.next();) { - double *history = NULL; + double *history = nullptr; bool found = ExecutiveGetObjectMatrix2(G, rec->obj, iter.state, &history, false); if(found && history) { double temp_inverse[16]; @@ -2968,7 +2968,7 @@ static int ExecutiveCountNames(PyMOLGlobals * G) { int count = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) count++; @@ -3012,7 +3012,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int if(n_names) { SpecRec **list, **subset, **sorted; - int *index = NULL; + int *index = nullptr; int n_sel; int source_row = -1; int min_row = -1; @@ -3036,7 +3036,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int assert(list_size == n_names); /* unlink them */ for(a = 0; a < n_names; a++) { - list[a]->next = NULL; + list[a]->next = nullptr; } } /* transfer matching names to the subset array */ @@ -3044,11 +3044,11 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int int a; int entry; int min_entry = word_list->n_word; - const char *word = NULL; + const char *word = nullptr; int word_iter = 0; while(WordListIterate(G, word_list, &word, &word_iter)) { int list_id = ExecutiveGetNamesListFromPattern(G, word, true, false); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; entry = word_iter - 1; for(a = n_names - 1; a > 0; a--) { /* skipping zeroth */ int iter_id = TrackerNewIter(I_Tracker, 0, list_id); @@ -3064,7 +3064,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int /* ensure that each record appears only once */ rec->next = subset[entry]; subset[entry] = rec; - list[a] = NULL; + list[a] = nullptr; } } TrackerDelIter(I_Tracker, iter_id); @@ -3085,7 +3085,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int sorted[n_sel++] = rec; last = rec; rec = rec->next; - last->next = NULL; + last->next = nullptr; } } } @@ -3103,8 +3103,8 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int } /* reassemble the list using the new order */ { - SpecRec *spec = NULL; - SpecRec *last = NULL; + SpecRec *spec = nullptr; + SpecRec *last = nullptr; int a, b; int flag; for(a = 0; a < n_names; a++) { @@ -3179,7 +3179,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int pymol::vla ExecutiveGetObjectMoleculeVLA(PyMOLGlobals * G, const char *sele) { - ObjectMolecule **result = NULL; + ObjectMolecule **result = nullptr; int s1 = SelectorIndexByName(G, sele); if(s1 >= 0) { ObjectMoleculeOpRec op; @@ -3220,7 +3220,7 @@ int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode) SpecRec *rec = ExecutiveFindSpec(G, name); if(rec) { if(rec->type == cExecSelection) { - SelectorCreate(G, drag_name, name, NULL, true, NULL); + SelectorCreate(G, drag_name, name, nullptr, true, nullptr); need_sele = false; { int sele = SelectorIndexByName(G, drag_name); @@ -3253,9 +3253,9 @@ int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode) PRINTFB(G, FB_Executive, FB_Errors) " Drag-Error: invalid or empty selection." ENDFB(G); } else if(EditorDraggingObjectMatrix(G)) { - SelectorCreate(G, drag_name, "none", NULL, true, NULL); + SelectorCreate(G, drag_name, "none", nullptr, true, nullptr); } else if(need_sele && (obj->type == cObjectMolecule) && (!EditorDraggingObjectMatrix(G))) { - SelectorCreate(G, drag_name, obj->Name, (ObjectMolecule*)(void*)obj, true, NULL); /* for indication only */ + SelectorCreate(G, drag_name, obj->Name, (ObjectMolecule*)(void*)obj, true, nullptr); /* for indication only */ } } else { EditorInactivate(G); @@ -3320,7 +3320,7 @@ int ExecutiveGetActiveAlignmentSele(PyMOLGlobals * G) * * 1) The "seq_view_alignment" setting if it's set * 2) or the name of the first enabled alignment object - * 3) or NULL + * 3) or nullptr */ const char* ExecutiveGetActiveAlignment(PyMOLGlobals* G) { @@ -3328,7 +3328,7 @@ const char* ExecutiveGetActiveAlignment(PyMOLGlobals* G) if(alignment && alignment[0]) { /* explicit alignment setting name */ return alignment; } else { /* otherwise, use the first active alignment */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)) { if(rec->visible) { @@ -3357,7 +3357,7 @@ int ExecutiveGetActiveSeleName(PyMOLGlobals * G, char *name, int create_new, int /* TODO: cache/optimize to avoid table scan */ int result = false; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)){ if(rec->type == cExecSelection){ @@ -3407,7 +3407,7 @@ pymol::Result<> ExecutiveFixChemistry(PyMOLGlobals * G, const char *s1, const ch SETUP_SELE_DEFAULT_PREFIXED(1, cSelectionInvalid); SETUP_SELE_DEFAULT_PREFIXED(2, sele1); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; assert((sele1 >= 0) && (sele2 >= 0)); @@ -3438,7 +3438,7 @@ pymol::Result<> ExecutiveSetObjectColor(PyMOLGlobals * G, const char *name, cons int ExecutiveGetObjectColorIndex(PyMOLGlobals * G, const char *name) { int result = -1; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; obj = ExecutiveFindObjectByName(G, name); if(obj) { result = obj->Color; @@ -3508,7 +3508,7 @@ pymol::Result> ExecutiveSetName( PyMOLGlobals * G, pymol::zstring_view old_name_view, pymol::zstring_view new_name_view, bool save) { std::vector discarded; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int found = false; auto ignore_case = SettingGet(G, cSetting_ignore_case); @@ -3577,7 +3577,7 @@ pymol::Result> ExecutiveSetName( if(!found) return pymol::make_error("Could not find object named ", name); else { - rec = NULL; + rec = nullptr; int old_name_len = strlen(old_name); int new_name_len = strlen(name); ObjectNameType childname; @@ -3604,8 +3604,8 @@ pymol::Result> ExecutiveSetName( * Load any file type which is implemented in C. * * fname: File name, can be empty if content is provided - * content: File contents, if not NULL - * content_length: Length of "content", if not NULL + * content: File contents, if not nullptr + * content_length: Length of "content", if not nullptr * content_format: File type code * object_name: New object name * state: Object state to start loading new coordsets in @@ -3694,7 +3694,7 @@ ExecutiveLoadPrepareArgs(PyMOLGlobals * G, case cLoadTypeXYZStr: case cLoadTypeDXStr: if (!content) { - return pymol::Error("content is NULL"); + return pymol::Error("content is nullptr"); } fname_null_ok = true; break; @@ -3857,7 +3857,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) int ok = true; OrthoLineType buf = ""; int pdb_variant = PDB_VARIANT_DEFAULT; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; // downstream file type reading functions switch (content_format) { @@ -3901,14 +3901,14 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) if(origObj) { /* always reinitialize topology objects from scratch */ ExecutiveDelete(G, origObj->Name); - origObj = NULL; + origObj = nullptr; } - obj = ObjectMoleculeLoadTOPFile(G, NULL, fname, state, discrete); + obj = ObjectMoleculeLoadTOPFile(G, nullptr, fname, state, discrete); break; case cLoadTypeTRJ: if(origObj) { ObjectMoleculeLoadTRJFile(G, (ObjectMolecule *) origObj, fname, state, - 1, 1, 1, -1, -1, NULL, 1, NULL, quiet); + 1, 1, 1, -1, -1, nullptr, 1, nullptr, quiet); } else { return pymol::Error("must load object topology before loading trajectory!"); } @@ -3991,7 +3991,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) const char * next_entry = content; char new_name[WordLength] = ""; - OVLexicon *loadproplex = NULL; + OVLexicon *loadproplex = nullptr; bool loadpropertiesall = false; // (some of) these file types support multiple molecules per file, @@ -4009,7 +4009,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) ExecutiveDelete(G, obj->Name); // just in case there is a collision ExecutiveManageObject(G, obj, zoom, true); new_name[0] = 0; - obj = NULL; + obj = nullptr; } } while(next_entry); @@ -4018,7 +4018,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) break; default: if(plugin[0]) { - obj = PlugIOManagerLoad(G, origObj ? &origObj : NULL, fname, state, quiet, + obj = PlugIOManagerLoad(G, origObj ? &origObj : nullptr, fname, state, quiet, plugin, args.plugin_mask); } else { return pymol::make_error("Unable to read that file type from C (", @@ -4068,7 +4068,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) */ pymol::CObject* ExecutiveGetExistingCompatible(PyMOLGlobals * G, const char* oname, cLoadType_t type) { - pymol::CObject *origObj = NULL; + pymol::CObject *origObj = nullptr; origObj = ExecutiveFindObjectByName(G, oname); /* check for existing object of right type, delete if not */ if(origObj) { @@ -4137,7 +4137,7 @@ pymol::CObject* ExecutiveGetExistingCompatible(PyMOLGlobals * G, const char* ona } if(new_type == -1 || new_type != origObj->type) { ExecutiveDelete(G, origObj->Name); - origObj = NULL; + origObj = nullptr; } } return origObj; @@ -4153,12 +4153,12 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, pymol::CObject *obj; char pdb_name[WordLength] = ""; char cur_name[WordLength] = ""; - const char *next_pdb = NULL; + const char *next_pdb = nullptr; int repeat_flag = true; int n_processed = 0; - PDBInfoRec pdb_info_rec, *pdb_info = NULL; + PDBInfoRec pdb_info_rec, *pdb_info = nullptr; int model_number; - pymol::CObject *deferred_zoom_obj = NULL; + pymol::CObject *deferred_zoom_obj = nullptr; UtilZeroMem(&pdb_info_rec, sizeof(PDBInfoRec)); pdb_info = &pdb_info_rec; @@ -4177,7 +4177,7 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, } repeat_flag = false; - next_pdb = NULL; + next_pdb = nullptr; if(!origObj) { is_new = true; @@ -4274,7 +4274,7 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, if(do_zoom != zoom) deferred_zoom_obj = obj; else - deferred_zoom_obj = NULL; + deferred_zoom_obj = nullptr; ExecutiveManageObject(G, obj, do_zoom, true); if(eff_frame < 0) eff_frame = ((ObjectMolecule *) obj)->NCSet - 1; @@ -4349,9 +4349,9 @@ PyObject *ExecutiveGetVisAsPyDict(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL, *list; + PyObject *result = nullptr, *list; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; result = PyDict_New(); while(ListIterate(I->Spec, rec, next)) { if(rec->name[0] != '_') { @@ -4416,7 +4416,7 @@ int *ExecutiveGetRepsForObject(PyMOLGlobals *G, const char *name){ if(rec) return getRepArrayFromBitmask(rec->obj->visRep); - return NULL; + return nullptr; } #endif @@ -4430,20 +4430,20 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) int ok = true; WordType name; PyObject *key, *list, *col; - PyObject *vis_list = NULL; + PyObject *vis_list = nullptr; Py_ssize_t pos = 0; - SpecRec *rec, *grec, **recstack = NULL; + SpecRec *rec, *grec, **recstack = nullptr; int n_vis; int rep; int a; int ll = 0; if(ok) - ok = (dict != NULL); + ok = (dict != nullptr); if(ok) ok = PyDict_Check(dict); if(ok) { - SceneObjectDel(G, NULL, true); /* remove all objects from scene */ + SceneObjectDel(G, nullptr, true); /* remove all objects from scene */ ExecutiveInvalidateSceneMembers(G); // stack for putative visible records @@ -4456,7 +4456,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) rec = ExecutiveFindSpec(G, name); if(rec) { if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -4473,7 +4473,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) if(ll > 2) { /* object visibility */ vis_list = PyList_GetItem(list, 2); if(ok) - ok = (vis_list != NULL); + ok = (vis_list != nullptr); if(ok) { if(PyList_Check(vis_list)) { n_vis = PyList_Size(vis_list); @@ -4492,7 +4492,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) if(ll > 3) { /* object color */ col = PyList_GetItem(list, 3); if(ok) - ok = (col != NULL); + ok = (col != nullptr); if(ok) if(PyInt_Check(col)) { ok = PConvPyObjectToInt(col, &rec->obj->Color); @@ -4543,7 +4543,7 @@ CField * ExecutiveGetVolumeField(PyMOLGlobals * G, const char * objName, int sta } ok_except1: - return NULL; + return nullptr; } /** @@ -4552,7 +4552,7 @@ CField * ExecutiveGetVolumeField(PyMOLGlobals * G, const char * objName, int sta pymol::Result> ExecutiveGetHistogram(PyMOLGlobals * G, const char * objName, int n_points, float min_val, float max_val) { pymol::CObject *obj; - ObjectMapState *oms = NULL; + ObjectMapState *oms = nullptr; obj = ExecutiveFindObjectByName(G, objName); @@ -4573,7 +4573,7 @@ ExecutiveGetHistogram(PyMOLGlobals * G, const char * objName, int n_points, floa if(oms) { auto hist = std::vector(n_points + 4); - float range = SettingGet_f(G, obj->Setting.get(), NULL, cSetting_volume_data_range); + float range = SettingGet_f(G, obj->Setting.get(), nullptr, cSetting_volume_data_range); ObjectMapStateGetHistogram( G, oms, n_points, range, hist.data(), min_val, max_val); return hist; @@ -4868,7 +4868,7 @@ int ExecutiveValidateObjectPtr(PyMOLGlobals * G, pymol::CObject * ptr, int objec CExecutive *I = G->Executive; int ok = false; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->obj == ptr) { @@ -4888,11 +4888,11 @@ pymol::Result<> ExecutiveRampNew(PyMOLGlobals* G, const char* name, int src_state, const char* sele, float beyond, float within, float sigma, int zero, int calc_mode, int quiet) { - ObjectGadgetRamp *obj = NULL; - ObjectGadgetRamp *origRamp = NULL; - pymol::CObject *src_obj = NULL; + ObjectGadgetRamp *obj = nullptr; + ObjectGadgetRamp *origRamp = nullptr; + pymol::CObject *src_obj = nullptr; pymol::CObject *origObj = ExecutiveFindObjectByName(G, name); - float *vert_vla = NULL; + float *vert_vla = nullptr; int rampType = -1; if (origObj && @@ -4975,13 +4975,13 @@ static int ExecutiveSetNamedEntries(PyMOLGlobals * G, PyObject * names, int vers int skip = false; int a = 0, l = 0, ll = 0; PyObject *cur, *el; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int extra_int; int incomplete = false; ObjectNameType new_name; if(ok) - ok = (names != NULL); + ok = (names != nullptr); if(ok) ok = PyList_Check(names); if(ok) @@ -4991,9 +4991,9 @@ static int ExecutiveSetNamedEntries(PyMOLGlobals * G, PyObject * names, int vers cur = PyList_GetItem(names, a); if(cur != Py_None) { /* skip over None w/o aborting */ skip = false; - rec = NULL; + rec = nullptr; ListElemCalloc(G, rec, SpecRec); - rec->next = NULL; + rec->next = nullptr; rec->name[0] = 0; if(ok) ok = PyList_Check(cur); @@ -5159,12 +5159,12 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) int ok = true; int a = 0, l = 0; PyObject *cur; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int extra; int incomplete = false; if(ok) - ok = (names != NULL); + ok = (names != nullptr); if(ok) ok = PyList_Check(names); if(ok) @@ -5172,9 +5172,9 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) while(ok && (a < l)) { cur = PyList_GetItem(names, a); if(cur != Py_None) { /* skip over None w/o aborting */ - rec = NULL; + rec = nullptr; ListElemCalloc(G, rec, SpecRec); - rec->next = NULL; + rec->next = nullptr; if(ok) ok = PyList_Check(cur); @@ -5205,7 +5205,7 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) static PyObject *ExecutiveGetExecObjectAsPyList(PyMOLGlobals * G, SpecRec * rec) { - PyObject *result = NULL; + PyObject *result = nullptr; int recobjtype = rec->obj->type; switch (recobjtype){ case cObjectMesh: @@ -5274,7 +5274,7 @@ static PyObject *ExecutiveGetExecObjectAsPyList(PyMOLGlobals * G, SpecRec * rec) static PyObject *ExecutiveGetExecSeleAsPyList(PyMOLGlobals * G, SpecRec * rec) { - PyObject *result = NULL; + PyObject *result = nullptr; int sele; sele = SelectorIndexByName(G, rec->name); @@ -5297,10 +5297,10 @@ static PyObject *ExecutiveGetNamedEntries(PyMOLGlobals * G, int list_id, int par { CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - PyObject *result = NULL; + PyObject *result = nullptr; int count = 0, total_count = 0; int iter_id = 0; - SpecRec *rec = NULL, *list_rec = NULL; + SpecRec *rec = nullptr, *list_rec = nullptr; SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); @@ -6283,7 +6283,7 @@ int ExecutiveDebug(PyMOLGlobals * G, const char *name) int ***ExecutiveGetBondPrint(PyMOLGlobals * G, const char *name, int max_bond, int max_type, int *dim) { - int ***result = NULL; + int ***result = nullptr; pymol::CObject *obj; ObjectMolecule *objMol; @@ -6313,7 +6313,7 @@ pymol::Result<> ExecutiveMapSet(PyMOLGlobals* G, const char* name, CTracker *I_Tracker = I->Tracker; int isNew = false; ObjectMap *target = ExecutiveFindObjectMapByName(G, name); - ObjectMap *first_operand = NULL; + ObjectMap *first_operand = nullptr; int src_state_start = 0, src_state_stop = 0; int list_id = ExecutiveGetNamesListFromPattern(G, operands, true, true); @@ -6737,7 +6737,7 @@ const char * ExecutiveMapGenerate(PyMOLGlobals * G, const char * name, const cha #endif if (!ok) - return NULL; + return nullptr; else return (const char*) tempFile; @@ -6751,9 +6751,9 @@ ExecutiveMapNew(PyMOLGlobals * G, const char *name, int type, float grid_spacing int quiet, int zoom, int normalize, float clamp_floor, float clamp_ceiling, float resolution) { - pymol::CObject *origObj = NULL; + pymol::CObject *origObj = nullptr; ObjectMap *objMap; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; int a; float v[3]; ObjectMapDesc _md, *md; @@ -6789,7 +6789,7 @@ ExecutiveMapNew(PyMOLGlobals * G, const char *name, int type, float grid_spacing } } - n_st = ExecutiveCountStates(G, NULL); + n_st = ExecutiveCountStates(G, nullptr); for(st = 0; st < n_st; st++) { if(state == -1) @@ -6913,22 +6913,22 @@ int ExecutiveSculptIterateAll(PyMOLGlobals * G) float center_array[8] = { 0.0F, 0.0F, 0.0F, 0.0F }; float *center = center_array; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CGOReset(G->DebugCGO); if(SettingGetGlobal_b(G, cSetting_sculpting)) { if(!SettingGetGlobal_b(G, cSetting_sculpt_auto_center)) - center = NULL; + center = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(rec->obj->type == cObjectMolecule) { objMol = (ObjectMolecule *) rec->obj; - if(SettingGet_b(G, NULL, objMol->Setting.get(), cSetting_sculpting)) { + if(SettingGet_b(G, nullptr, objMol->Setting.get(), cSetting_sculpting)) { constexpr int state = -2; // current state ObjectMoleculeSculptIterate(objMol, state, - SettingGet_i(G, NULL, objMol->Setting.get(), + SettingGet_i(G, nullptr, objMol->Setting.get(), cSetting_sculpting_cycles), center); active = true; } @@ -6944,7 +6944,7 @@ int ExecutiveSculptIterateAll(PyMOLGlobals * G) scale3f(center + 4, center[7], center + 4); subtract3f(center, center + 4, center); add3f(pos, center, center); - ExecutiveCenter(G, NULL, -1, true, false, center, true); + ExecutiveCenter(G, nullptr, -1, true, false, center, true); } } if (active){ @@ -6959,7 +6959,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; float total_strain = 0.0F; @@ -6968,7 +6968,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int if(rec->type == cExecObject) { if(rec->obj->type == cObjectMolecule) { objMol = (ObjectMolecule *) rec->obj; - total_strain += ObjectMoleculeSculptIterate(objMol, state, n_cycle, NULL); + total_strain += ObjectMoleculeSculptIterate(objMol, state, n_cycle, nullptr); } } } @@ -6980,7 +6980,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int "Executive-Error: object %s is not a molecular object.\n", name ENDFB(G); } else { total_strain = - ObjectMoleculeSculptIterate((ObjectMolecule *) obj, state, n_cycle, NULL); + ObjectMoleculeSculptIterate((ObjectMolecule *) obj, state, n_cycle, nullptr); } return (total_strain); } @@ -6991,7 +6991,7 @@ int ExecutiveSculptActivate(PyMOLGlobals * G, const char *name, int state, int m int match_by_segment) { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CExecutive *I = G->Executive; int ok = true; @@ -7027,7 +7027,7 @@ int ExecutiveSculptActivate(PyMOLGlobals * G, const char *name, int state, int m int ExecutiveSculptDeactivate(PyMOLGlobals * G, const char *name) { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CExecutive *I = G->Executive; @@ -7578,10 +7578,10 @@ int ExecutivePhiPsi(PyMOLGlobals * G, const char *s1, ObjectMolecule *** objVLA, *phiVLA = op1.f1VLA; *psiVLA = op1.f2VLA; } else { - *objVLA = NULL; - *iVLA = NULL; - *phiVLA = NULL; - *psiVLA = NULL; + *objVLA = nullptr; + *iVLA = nullptr; + *phiVLA = nullptr; + *psiVLA = nullptr; } return (result); } @@ -7595,15 +7595,15 @@ int ExecutiveAlign(PyMOLGlobals * G, const char *s1, const char *s2, const char { int sele1 = SelectorIndexByName(G, s1); int sele2 = SelectorIndexByName(G, s2); - int *vla1 = NULL; - int *vla2 = NULL; + int *vla1 = nullptr; + int *vla2 = nullptr; int na, nb; int c; int ok = true; int use_sequence = (mat_file && mat_file[0] && (seq_wt != 0.0F)); int use_structure = (seq_wt >= 0.0F); /* negative seq_wt means sequence only! */ - ObjectMolecule *mobile_obj = NULL; - CMatch *match = NULL; + ObjectMolecule *mobile_obj = nullptr; + CMatch *match = nullptr; if(!use_structure) window = 0; @@ -7623,7 +7623,7 @@ int ExecutiveAlign(PyMOLGlobals * G, const char *s1, const char *s2, const char } } if(ok && (sele1 >= 0) && (sele2 >= 0) && rms_info) { - vla1 = SelectorGetResidueVLA(G, sele1, use_structure, NULL); + vla1 = SelectorGetResidueVLA(G, sele1, use_structure, nullptr); vla2 = SelectorGetResidueVLA(G, sele2, use_structure, mobile_obj); if(vla1 && vla2) { na = VLAGetSize(vla1) / 3; @@ -7758,9 +7758,9 @@ pymol::Result ExecutiveCartoon(PyMOLGlobals* G, int type, const char* s1) /*========================================================================*/ float *ExecutiveGetVertexVLA(PyMOLGlobals * G, const char *s1, int state) { - /* returns NULL if none found */ + /* returns nullptr if none found */ - float *result = NULL; + float *result = nullptr; ObjectMoleculeOpRec op1; int sele1; sele1 = SelectorIndexByName(G, s1); @@ -7792,9 +7792,9 @@ PyObject *ExecutiveGetSettingOfType(PyMOLGlobals * G, int index, { assert(PyGILState_Check()); - PyObject *result = NULL; - pymol::CObject *obj = NULL; - CSetting *set_ptr1 = NULL, *set_ptr2 = NULL; + PyObject *result = nullptr; + pymol::CObject *obj = nullptr; + CSetting *set_ptr1 = nullptr, *set_ptr2 = nullptr; pymol::copyable_ptr* handle = nullptr; if(object && object[0]) { @@ -7933,7 +7933,7 @@ const char *ExecutiveGetTitle(PyMOLGlobals * G, const char *name, int state) if(!obj) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) "Error: object %s not found.\n", name ENDFB(G); - return NULL; + return nullptr; } return ObjectMoleculeGetStateTitle(obj, state); } @@ -7943,7 +7943,7 @@ const char *ExecutiveGetTitle(PyMOLGlobals * G, const char *name, int state) void ExecutiveHideSelections(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecSelection) { @@ -7965,7 +7965,7 @@ void ExecutiveInvalidateSelectionIndicators(PyMOLGlobals *G){ void ExecutiveInvalidateSelectionIndicatorsCGO(PyMOLGlobals *G){ CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; if (I){ if (I->selIndicatorsCGO){ CGOFree(I->selIndicatorsCGO); @@ -8082,7 +8082,7 @@ static void ExecutiveRenderIndicatorCGO(PyMOLGlobals * G, CGO *selIndicatorsCGO) shaderPrg->Set4f("viewport", v[0], v[1], v[2], v[3]); if(no_depth) glDisable(GL_DEPTH_TEST); - CGORender(selIndicatorsCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(selIndicatorsCGO, nullptr, nullptr, nullptr, nullptr, nullptr); if(no_depth) glEnable(GL_DEPTH_TEST); glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); @@ -8140,7 +8140,7 @@ static void ExecutiveSetupIndicatorPassGLImmediate(PyMOLGlobals * G, SpecRec *re void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInfo *grid) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int any_active = false; int no_depth = (int) SettingGetGlobal_f(G, cSetting_selection_overlay); short use_shader = (short) SettingGetGlobal_b(G, cSetting_use_shaders); @@ -8155,7 +8155,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf if(width_scale >= 0.0F) { width = (int) ((width_scale * fabs(SettingGetGlobal_f(G, cSetting_stick_radius)) / - SceneGetScreenVertexScale(G, NULL))); + SceneGetScreenVertexScale(G, nullptr))); if(width < min_width) width = (int) min_width; else if(width > max_width) @@ -8187,7 +8187,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf } } } - rec = NULL; + rec = nullptr; } else if (I->selIndicatorsCGO){ ExecutiveRenderIndicatorCGO(G, I->selIndicatorsCGO); return; @@ -8225,7 +8225,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf (void)fog; - rec = NULL; + rec = nullptr; if(round_points) { glEnable(GL_POINT_SMOOTH); @@ -8308,7 +8308,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf ExecutiveSetupIndicatorPassGLImmediate(G, rec, pass, gl_width, width); glBegin(GL_POINTS); } - rec1 = NULL; + rec1 = nullptr; while(ListIterate(I->Spec, rec1, next)) { if(rec1->type == cExecObject) { if(rec1->obj->type == cObjectMolecule) { @@ -8319,7 +8319,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf } else if (!rec1->gridSlotSelIndicatorsCGO){ if (!use_shader){ ObjectMoleculeRenderSele((ObjectMolecule *) rec1->obj, curState, sele, - vis_only, NULL); + vis_only, nullptr); } else { rec1->gridSlotSelIndicatorsCGO = CGONew(G); CGODotwidth(rec1->gridSlotSelIndicatorsCGO, gl_width); @@ -8581,7 +8581,7 @@ pymol::Result> ExecutiveGetNames( mode >= cGetNames_public && mode <= cGetNames_public_group_objects; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; std::vector result; pymol::Result tmpsele0; SelectorID_t sele0 = cSelectionInvalid; @@ -8769,7 +8769,7 @@ pymol::Result<> ExecutiveFuse(PyMOLGlobals* G, const char* s0, const char* s1, ObjectMoleculeVerifyChemistry(obj0, -1); ObjectMoleculeVerifyChemistry(obj1, -1); - SelectorCreate(G, tmp_fuse_sele, NULL, obj0, 1, NULL); + SelectorCreate(G, tmp_fuse_sele, nullptr, obj0, 1, nullptr); sele2 = SelectorIndexByName(G, tmp_fuse_sele); if(mode) { ObjectMoleculeOpRecInit(&op); @@ -8797,7 +8797,7 @@ pymol::Result<> ExecutiveFuse(PyMOLGlobals* G, const char* s0, const char* s1, pymol::Result<> ExecutiveSpheroid(PyMOLGlobals * G, const char *name, int average) { /* EXPERIMENTAL */ CExecutive *I = G->Executive; - pymol::CObject *os = NULL; + pymol::CObject *os = nullptr; if(strlen(name)) { os = ExecutiveFindObjectByName(G, name); @@ -8829,7 +8829,7 @@ pymol::Result<> ExecutiveSpheroid(PyMOLGlobals * G, const char *name, int averag void ExecutiveRebuildAll(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; PRINTFD(G, FB_Executive) " ExecutiveRebuildAll: entered.\n" ENDFD; auto defer_builds_mode = SettingGet(G, cSetting_defer_builds_mode); @@ -8861,7 +8861,7 @@ void ExecutiveRebuildAll(PyMOLGlobals * G) void ExecutiveRebuildAllObjectDist(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(rec->obj->type == cObjectMeasurement) { @@ -8877,8 +8877,8 @@ void ExecutiveRebuildAllObjectDist(PyMOLGlobals * G) void ExecutiveUndo(PyMOLGlobals * G, int dir) { CExecutive *I = G->Executive; - ObjectMolecule *obj = NULL, *compObj; - SpecRec *rec = NULL; + ObjectMolecule *obj = nullptr, *compObj; + SpecRec *rec = nullptr; auto o = ExecutiveGetLastObjectEdited(G); PRINTFB(G, FB_Executive, FB_Debugging) @@ -8908,7 +8908,7 @@ pymol::Result<> ExecutiveSort(PyMOLGlobals* G, const char* name) { CExecutive *I = G->Executive; ObjectMolecule *obj; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMoleculeOpRec op; int sele; int ok = true; @@ -8924,7 +8924,7 @@ pymol::Result<> ExecutiveSort(PyMOLGlobals* G, const char* name) if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -8991,8 +8991,8 @@ pymol::Result<> ExecutiveRemoveAtoms(PyMOLGlobals * G, const char *s1, int quiet SETUP_SELE_DEFAULT(1); CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; ObjectMoleculeOpRec op; { @@ -9131,7 +9131,7 @@ pymol::Result<> ExecutiveFlag(PyMOLGlobals * G, int flag, const char* sele, int } if(SettingGetGlobal_b(G, cSetting_auto_indicate_flags)) { auto buffer = pymol::string_format("(flag %d)", flag); - SelectorCreate(G, cIndicateSele, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cIndicateSele, buffer.c_str(), nullptr, true, nullptr); ExecutiveSetObjVisib(G, cIndicateSele, true, false); SceneInvalidate(G); } @@ -9340,7 +9340,7 @@ pymol::Result<> ExecutiveBond(PyMOLGlobals* G, const char* s1, const char* s2, { int cnt; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int flag = false; SETUP_SELE_DEFAULT_PREFIXED(1, cSelectionInvalid); @@ -9569,12 +9569,12 @@ pymol::Result ExecutiveDistance(PyMOLGlobals* G, const char* nam, char *ExecutiveNameToSeqAlignStrVLA(PyMOLGlobals * G, const char *name, int state, int format, int quiet) { - char *result = NULL; + char *result = nullptr; if((!name) || (!name[0]) || (strcmp(name, "(all)") == 0)) { /* use current alignment as the default */ name = SettingGetGlobal_s(G, cSetting_seq_view_alignment); if(name[0] == 0) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)) { if(rec->visible) { @@ -9621,7 +9621,7 @@ pymol::Result<> ExecutiveSeleToObject(PyMOLGlobals* G, const char* name, name = valid_name; } { - int exists = (ExecutiveFindObjectMoleculeByName(G, name) != NULL); + int exists = (ExecutiveFindObjectMoleculeByName(G, name) != nullptr); if(sele1 >= 0) { ok = SelectorCreateObjectMolecule(G, sele1, name, target, @@ -10061,8 +10061,8 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, int n_eval = 0; SelectorTmp s1(G, str1); int sele0 = s1.getIndex(); - PyObject *entry = NULL; - ObjectMolecule *obj = NULL; + PyObject *entry = nullptr; + ObjectMolecule *obj = nullptr; if(sele0 >= 0) obj = SelectorGetSingleObjectMolecule(G, sele0); if(obj) { @@ -10070,7 +10070,7 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, int list_len = 0; int a; int index = 0; - const char *expr = NULL; + const char *expr = nullptr; if(ok) ok = PyList_Check(list); if(ok) { @@ -10090,7 +10090,7 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, ok = ((index <= n_atom) && (index > 0)); if(ok) { - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(obj->DiscreteFlag && obj->DiscreteCSet) { cs = obj->DiscreteCSet[index - 1]; } else if (obj->NCSet == 1){ @@ -10179,7 +10179,7 @@ pymol::Result ExecutiveIterateState(PyMOLGlobals* G, int state, } if(!read_only) { // for dynamic_measures - ExecutiveUpdateCoordDepends(G, NULL); + ExecutiveUpdateCoordDepends(G, nullptr); SeqChanged(G); } if(!quiet) { @@ -10264,7 +10264,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo int ok = true; int repeat; float v1[3], *v2; - ObjectAlignment *align_to_update = NULL; + ObjectAlignment *align_to_update = nullptr; bool ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); bool ignore_case_chain = SettingGetGlobal_b(G, cSetting_ignore_case_chain); @@ -10340,7 +10340,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo if(op1.vv1 && op2.vv1) { if(op1.nvv1 && op2.nvv1) { - ObjectMolecule *mobile_obj = NULL; + ObjectMolecule *mobile_obj = nullptr; int n_pair = 0; @@ -10664,7 +10664,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo } if(mode != 0) { - rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, nullptr, op2.ttt); if(rms_info) { rms_info->initial_rms = rms; rms_info->final_rms = rms; @@ -10718,7 +10718,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo n_pair = n_next; FreeP(flag); if(n_pair) { - rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, nullptr, op2.ttt); if(rms_info) { rms_info->n_cycles_run = b; rms_info->final_n_atom = n_pair; @@ -10730,7 +10730,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo } } } else { /* mode == 0 -- simple RMS, with no coordinate movement */ - rms = MatrixGetRMS(G, n_pair, op1.vv1, op2.vv1, NULL); + rms = MatrixGetRMS(G, n_pair, op1.vv1, op2.vv1, nullptr); if(rms_info) { rms_info->initial_rms = rms; rms_info->final_rms = rms; @@ -10774,7 +10774,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo VLASize(align_vla, int, n_pair * 3); } { - ObjectAlignment *obj = NULL; + ObjectAlignment *obj = nullptr; /* does object already exist? */ { @@ -10945,13 +10945,13 @@ pymol::Result> ExecutiveRMSStates( ObjectMoleculeOpRec op1; ObjectMoleculeOpRec op2; - float *result = NULL; + float *result = nullptr; int ok = true; ObjectMoleculeOpRecInit(&op1); ObjectMoleculeOpRecInit(&op2); - op1.vv1 = NULL; - op2.vv1 = NULL; + op1.vv1 = nullptr; + op2.vv1 = nullptr; ObjectMolecule* obj = SelectorGetSingleObjectMolecule(G, sele1); @@ -11089,9 +11089,9 @@ float ExecutiveRMSPairs(PyMOLGlobals* G, const std::vector& sele, ErrMessage(G, __func__, buffer); } else if(op1.nvv1) { if(mode != 0) - rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, nullptr, op2.ttt); else - rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, NULL); + rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, nullptr); if (!quiet) PRINTFB(G, FB_Executive, FB_Results) @@ -11308,7 +11308,7 @@ int ExecutiveRay(PyMOLGlobals * G, int width, int height, int mode, if(defer && (mode == 0)) { SceneDeferRay(G, width, height, mode, angle, shift, quiet, true, antialias); } else { - SceneRay(G, width, height, mode, NULL, NULL, angle, shift, quiet, NULL, true, + SceneRay(G, width, height, mode, nullptr, nullptr, angle, shift, quiet, nullptr, true, antialias); } return 1; @@ -11318,8 +11318,8 @@ int ExecutiveRay(PyMOLGlobals * G, int width, int height, int mode, /*========================================================================*/ int *ExecutiveGetG3d(PyMOLGlobals * G) { - int *result = NULL; - SceneRay(G, 0, 0, 3, NULL, NULL, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, + int *result = nullptr; + SceneRay(G, 0, 0, 3, nullptr, nullptr, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, false, -1); return result; } @@ -11330,8 +11330,8 @@ int ExecutiveSetBondSettingFromString(PyMOLGlobals * G, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name; int ok = true; @@ -11407,7 +11407,7 @@ int ExecutiveSetBondSettingFromString(PyMOLGlobals * G, } if(ok && have_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11464,8 +11464,8 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, assert(PyGILState_Check()); CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name; PyObject *result = PyList_New(0); @@ -11483,8 +11483,8 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, const BondType *bi = obj->Bond.data(); const AtomInfoType *ai1, *ai2, *ai = obj->AtomInfo.data(); - PyObject *pyObjList = NULL; - PyObject *pyBondList = NULL; + PyObject *pyObjList = nullptr; + PyObject *pyBondList = nullptr; for(a = 0; a < nBond; a++) { ai1 = ai + bi->index[0]; @@ -11494,7 +11494,7 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, (SelectorIsMember(G, ai2->selEntry, sele1) && SelectorIsMember(G, ai1->selEntry, sele2))) { PyObject *pyBondInfo = PyList_New(3); - PyObject *bond_setting_value = NULL; + PyObject *bond_setting_value = nullptr; if (!pyObjList){ pyObjList = PyList_New(2); pyBondList = PyList_New(0); @@ -11537,8 +11537,8 @@ int ExecutiveSetBondSetting(PyMOLGlobals * G, int index, PyObject * tuple, #else CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name = ""; int unblock; @@ -11589,7 +11589,7 @@ int ExecutiveSetBondSetting(PyMOLGlobals * G, int index, PyObject * tuple, break; } if(have_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11655,8 +11655,8 @@ int ExecutiveUnsetBondSetting(PyMOLGlobals * G, int index, const char *s1, const int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; SettingName name; /* int unblock; */ int ok = true; @@ -11668,7 +11668,7 @@ int ExecutiveUnsetBondSetting(PyMOLGlobals * G, int index, const char *s1, const sele1 = SelectorIndexByName(G, s1); sele2 = SelectorIndexByName(G, s2); if((sele1 >= 0) && (sele2 >= 0)) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11722,8 +11722,8 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl #else CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; OrthoLineType value; @@ -11752,16 +11752,16 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl pymol::pautoblock unblock(G); if((!sele) || (sele[0] == 0)) { /* global setting */ - ok = SettingSetFromTuple(G, NULL, index, tuple); + ok = SettingSetFromTuple(G, nullptr, index, tuple); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value); + SettingGetTextValue(G, nullptr, nullptr, index, value); PRINTF " Setting: %s set to %s.\n", name, value ENDF(G); } } if(updates) { - SettingGenerateSideEffects(G, index, NULL, state, quiet); + SettingGenerateSideEffects(G, index, nullptr, state, quiet); } } } @@ -11777,7 +11777,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl switch (rec->type) { case cExecAll: levelmask |= SettingLevelInfo[state < 0 ? cSettingLevel_object : cSettingLevel_ostate].mask; - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -11794,7 +11794,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl } if(Feedback(G, FB_Setting, FB_Actions)) { if(nObj && handle) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); if(!quiet) { if(state < 0) { PRINTF @@ -11879,7 +11879,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl break; } if(have_atomic_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11913,14 +11913,14 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); PRINTF " Setting: %s set to %s in object \"%s\".\n", name, value, rec->obj->Name ENDF(G); } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", name, value, rec->obj->Name, state + 1 ENDF(G); @@ -11961,8 +11961,8 @@ int ExecutiveGetSettingFromString(PyMOLGlobals * G, PyMOLreturn_value *result, int index, const char *sele, int state, int quiet) { - pymol::CObject *obj = NULL; - CSetting *set_ptr1 = NULL, *set_ptr2 = NULL; + pymol::CObject *obj = nullptr; + CSetting *set_ptr1 = nullptr, *set_ptr2 = nullptr; pymol::copyable_ptr* handle = nullptr; int ok = true; int type; @@ -12051,8 +12051,8 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; OrthoLineType value2; @@ -12064,11 +12064,11 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, PRINTFD(G, FB_Executive) " %s: entered. sele \"%s\"\n", __func__, sele ENDFD; if(sele[0] == 0) { /* global setting */ - ok = SettingSetFromString(G, NULL, index, value); + ok = SettingSetFromString(G, nullptr, index, value); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value2); + SettingGetTextValue(G, nullptr, nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s.\n", name, value2 ENDF(G); } @@ -12085,7 +12085,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -12102,7 +12102,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, } if(Feedback(G, FB_Setting, FB_Actions)) { if(nObj && handle) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); if(!quiet) { if(state < 0) { @@ -12130,7 +12130,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, op.i1 = index; op.i2 = type; op.ii1 = &value_store; - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -12163,7 +12163,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\".\n", @@ -12171,7 +12171,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", @@ -12204,11 +12204,11 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, PRINTFD(G, FB_Executive) " ExecutiveSetObjSettingFromString: entered \n" ENDFD; if(!obj) { /* global */ - ok = SettingSetFromString(G, NULL, index, value); + ok = SettingSetFromString(G, nullptr, index, value); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value2); + SettingGetTextValue(G, nullptr, nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s.\n", name, value2 ENDF(G); } @@ -12228,7 +12228,7 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\".\n", @@ -12236,7 +12236,7 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", @@ -12266,8 +12266,8 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; pymol::copyable_ptr* handle = nullptr; @@ -12301,7 +12301,7 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -12340,9 +12340,9 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin op.code = OMOP_SetAtomicSetting; op.i1 = index; op.i2 = cSetting_blank; - op.ii1 = NULL; + op.ii1 = nullptr; - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -12422,7 +12422,7 @@ pymol::Result<> ExecutiveColor( return pymol::Error("Unknown color."); } else { CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int n_atm = 0; int n_obj = 0; @@ -12468,7 +12468,7 @@ pymol::Result<> ExecutiveColor( SceneInvalidate(G); break; case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { rec->obj->Color = col_ind; @@ -12517,7 +12517,7 @@ const char *ExecutiveFindBestNameMatch(PyMOLGlobals * G, const char *name) { const char *result; CExecutive *I = G->Executive; - SpecRec *rec = NULL, *best_rec = NULL; + SpecRec *rec = nullptr, *best_rec = nullptr; int best; int wm; auto ignore_case = SettingGet(G, cSetting_ignore_case); @@ -12547,7 +12547,7 @@ static int count_objects(PyMOLGlobals * G, int public_only) { int count = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(!public_only) @@ -12562,7 +12562,7 @@ static int count_objects(PyMOLGlobals * G, int public_only) SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; const char* name = name_view.c_str(); // ignore % prefix if(name[0] && name[0] == '%') @@ -12574,7 +12574,7 @@ SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) if (keyRes != I->Key.end()) { if (!TrackerGetCandRef( I->Tracker, keyRes->second, (TrackerRef**) (void*) &rec)) { - rec = NULL; + rec = nullptr; } } } @@ -12590,8 +12590,8 @@ SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) bool ExecutiveObjMolSeleOp(PyMOLGlobals * G, int sele, ObjectMoleculeOpRec * op) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int update_table = true; /* if we're given a valid selection */ @@ -12800,7 +12800,7 @@ int ExecutiveGetExtent(PyMOLGlobals * G, const char *name, float *mn, float *mx, auto* rec = &recref; switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { obj = rec->obj; @@ -12979,7 +12979,7 @@ static int ExecutiveGetMaxDistance(PyMOLGlobals * G, const char *name, float *po auto* rec = &recref; switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { obj = rec->obj; @@ -13175,7 +13175,7 @@ pymol::Result<> ExecutiveOrigin(PyMOLGlobals* G, const char* sele, int preserve, float center[3]; float mn[3], mx[3]; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; int have_center = false; if(oname && oname[0]) { obj = ExecutiveFindObjectByName(G, oname); @@ -13302,7 +13302,7 @@ ExecutiveSetObjVisib(PyMOLGlobals * G, pymol::zstring_view name, int onoff, int SettingGet(G, cSetting_hide_underscore_names); if (suppress_hidden && hide_underscore) ExecutiveUpdateGroups(G, false); - SpecRec *tRec = NULL; + SpecRec *tRec = nullptr; while(ListIterate(I->Spec, tRec, next)) { if(onoff != tRec->visible) { if(tRec->type == cExecObject) { @@ -13556,7 +13556,7 @@ ExecutiveSetRepVisMask(PyMOLGlobals * G, pymol::zstring_view name, int repmask, { CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name.data(), true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -13650,7 +13650,7 @@ static void ExecutiveSetAllRepVisMask(PyMOLGlobals * G, int repmask, int state) int sele; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; PRINTFD(G, FB_Executive) " ExecutiveSetAllRepVisib: entered.\n" ENDFD; while(ListIterate(I->Spec, rec, next)) { @@ -13693,7 +13693,7 @@ pymol::Result<> ExecutiveInvalidateRep( { CExecutive *I = G->Executive; ObjectMoleculeOpRec op; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; const char* name = ""; SelectorTmp2 s1; @@ -13730,7 +13730,7 @@ pymol::Result<> ExecutiveInvalidateRep( } break; case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { rec->obj->invalidate(rep, level, -1); @@ -13754,7 +13754,7 @@ int ExecutiveCheckGroupMembership(PyMOLGlobals * G, int list_id, pymol::CObject CTracker *I_Tracker = I->Tracker; int iter_id = TrackerNewIter(I_Tracker, 0, list_id); if(iter_id) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { if(rec && (rec->type == cExecObject) && (rec->obj == obj)) { result = true; @@ -13789,7 +13789,7 @@ int ExecutiveGetExpandedGroupListFromPattern(PyMOLGlobals * G, const char *name) if(WordMatcherMatchAlpha(matcher, rec->name)) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { if(!result) - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); if(result) { TrackerLink(I_Tracker, cand_id, result, 1); } @@ -13800,12 +13800,12 @@ int ExecutiveGetExpandedGroupListFromPattern(PyMOLGlobals * G, const char *name) } } else if((rec = ExecutiveFindSpec(G, name))) { /* only one name in list */ if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } } else if((rec = ExecutiveUnambiguousNameMatch(G, name))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } } @@ -13830,7 +13830,7 @@ int ExecutiveGetExpandedGroupList(PyMOLGlobals * G, const char *name) list_id = rec->group_member_list_id; } if(list_id) { - result = TrackerNewListCopy(I->Tracker, list_id, NULL); + result = TrackerNewListCopy(I->Tracker, list_id, nullptr); ExecutiveExpandGroupsInList(G, result, cExecExpandGroups); } return result; @@ -13846,7 +13846,7 @@ void ExecutiveFreeGroupList(PyMOLGlobals * G, int list_id) /*========================================================================*/ pymol::CObject *ExecutiveFindObjectByName(PyMOLGlobals * G, pymol::zstring_view name) { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; SpecRec *rec = ExecutiveFindSpec(G, name.c_str()); if(rec && (rec->type == cExecObject)) { obj = rec->obj; @@ -13855,10 +13855,10 @@ pymol::CObject *ExecutiveFindObjectByName(PyMOLGlobals * G, pymol::zstring_view } /*========================================================================*/ -/* returns NULL if none found */ +/* returns nullptr if none found */ pymol::CObject ** ExecutiveFindObjectsByType(PyMOLGlobals * G, int objType) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int n = 0; pymol::CObject** rVal = VLAlloc(pymol::CObject*, 1); @@ -13877,7 +13877,7 @@ pymol::CObject ** ExecutiveFindObjectsByType(PyMOLGlobals * G, int objType) { VLASize(rVal, pymol::CObject*, n); if (n==0) { VLAFree(rVal); - return NULL; + return nullptr; } else return rVal; @@ -14011,9 +14011,9 @@ void ExecutiveSymExp(PyMOLGlobals * G, const char *name, } auto map = - std::unique_ptr(MapNew(G, -cutoff, vv1.data(), op.nvv1, NULL)); + std::unique_ptr(MapNew(G, -cutoff, vv1.data(), op.nvv1, nullptr)); if (!map) { - ErrMessage(G, __func__, "map is NULL"); + ErrMessage(G, __func__, "map is nullptr"); return; } @@ -14145,7 +14145,7 @@ void ExecutivePurgeSpec(PyMOLGlobals * G, SpecRec * rec, bool save) switch (rec->type) { case cExecObject: if(I->LastEdited == rec->obj) - I->LastEdited = NULL; + I->LastEdited = nullptr; if(rec->obj->type == cObjectMolecule) if(EditorIsAnActiveObject(G, (ObjectMolecule *) rec->obj)) EditorInactivate(G); @@ -14225,7 +14225,7 @@ pymol::Result> ExecutiveDelete(PyMOLGlobals * G, pymol } }; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CTracker *I_Tracker = I->Tracker; int list_id = ExecutiveGetNamesListFromPattern(G, name, false, false); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); @@ -14293,7 +14293,7 @@ void ExecutiveReAddSpec(PyMOLGlobals* G, std::vector& specs) /*========================================================================*/ void ExecutiveDump(PyMOLGlobals * G, const char *fname, const char *obj, int state, int quiet) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; SceneUpdate(G, false); @@ -14381,7 +14381,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) if(auto_mode && (rec->name[0] != '_')) { auto ignore_case = SettingGet(G, cSetting_ignore_case); char *period = rec->name + strlen(rec->name); - SpecRec *found_group = NULL; + SpecRec *found_group = nullptr; WordType seek_group_name; UtilNCopy(seek_group_name, rec->name, sizeof(WordType)); @@ -14390,7 +14390,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) if(*period == '.') { seek_group_name[period - rec->name] = 0; { - SpecRec *group_rec = NULL; + SpecRec *group_rec = nullptr; while(ListIterate(I->Spec, group_rec, next)) { if((group_rec->type == cExecObject) && (group_rec->obj->type == cObjectGroup)) { if(WordMatchExact(G, group_rec->name, seek_group_name, ignore_case)) { @@ -14441,7 +14441,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) */ void ExecutiveManageObject(PyMOLGlobals * G, pymol::CObject * obj, int zoom, int quiet) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int exists = false; int previousVisible; @@ -14529,7 +14529,7 @@ void ExecutiveManageObject(PyMOLGlobals * G, pymol::CObject * obj, int zoom, int if(obj->type == cObjectMolecule) { ObjectMolecule *objMol = (ObjectMolecule *) obj; if(objMol->NCSet == 1) { - ExecutiveAssignSS(G, obj->Name, 0, NULL, true, objMol, true); + ExecutiveAssignSS(G, obj->Name, 0, nullptr, true, objMol, true); } } } @@ -14576,7 +14576,7 @@ void ExecutiveManageSelection(PyMOLGlobals * G, const char *name) ListElemCalloc(G, rec, SpecRec); strcpy(rec->name, name); rec->type = cExecSelection; - rec->next = NULL; + rec->next = nullptr; rec->sele_color = -1; assert(!rec->visible); rec->cand_id = TrackerNewCand(I->Tracker, (TrackerRef *) (void *) rec); @@ -14606,7 +14606,7 @@ int CExecutive::click(int button, int x, int y, int mod) PyMOLGlobals *G = m_G; CExecutive *I = G->Executive; int n, a; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int t, xx; int pass = false; int skip; @@ -14643,7 +14643,7 @@ int CExecutive::click(int button, int x, int y, int mod) } skip = I->NSkip; if(!pass) { - I->RecoverPressed = NULL; + I->RecoverPressed = nullptr; /* while(ListIterate(I->Spec,rec,next)) { */ for (auto& panelitem : I->Panel) { auto* const panel = &panelitem; @@ -14903,8 +14903,8 @@ int CExecutive::click(int button, int x, int y, int mod) I->Over = n; I->DragMode = ExecutiveDragMode::Visibility; I->ToggleMode = ExecutiveToggleMode::DeferVisibility; - I->LastChanged = NULL; - I->LastZoomed = NULL; + I->LastChanged = nullptr; + I->LastZoomed = nullptr; if(mod == (cOrthoSHIFT | cOrthoCTRL)) { I->ToggleMode = ExecutiveToggleMode::HoverActivate; if(!rec->visible) { @@ -14938,7 +14938,7 @@ int CExecutive::click(int button, int x, int y, int mod) I->DragMode = ExecutiveDragMode::VisibilityWithCamera; I->ToggleMode = ExecutiveToggleMode::DeferVisibility; I->LastChanged = rec; - I->LastZoomed = NULL; + I->LastZoomed = nullptr; if(mod & cOrthoCTRL) { I->ToggleMode = ExecutiveToggleMode::ZoomActivateDeactivatePrevious; ExecutiveWindowZoom(G, rec->name, 0.0F, -1, false, -1.0F, true); @@ -14952,7 +14952,7 @@ int CExecutive::click(int button, int x, int y, int mod) } } else { I->ToggleMode = ExecutiveToggleMode::CenterActivateDeactivatePrevious; - ExecutiveCenter(G, rec->name, -1, true, -1.0F, NULL, true); + ExecutiveCenter(G, rec->name, -1, true, -1.0F, nullptr, true); } if(!rec->visible) { ExecutiveSpecSetVisibility(G, rec, !rec->visible, mod, false); @@ -15023,7 +15023,7 @@ static void ExecutiveSpecEnable(PyMOLGlobals * G, SpecRec * rec, int parents, in int list_id = ExecutiveGetObjectParentList(G, rec); if(list_id) { int iter_id = TrackerNewIter(I_Tracker, 0, list_id); - SpecRec *parent_rec = NULL; + SpecRec *parent_rec = nullptr; while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &parent_rec)) { @@ -15136,7 +15136,7 @@ int CExecutive::release(int button, int x, int y, int mod) { PyMOLGlobals *G = m_G; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int pass = false; int skip; int xx; @@ -15213,7 +15213,7 @@ int CExecutive::release(int button, int x, int y, int mod) } { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { rec->hilight = 0; } @@ -15265,14 +15265,14 @@ int CExecutive::drag(int x, int y, int mod) I->Over = -1; row_offset = -1; { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) rec->hilight = 0; } } if(I->RecoverPressed) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int skip = I->NSkip; int row = 0; for (auto& panelitem : I->Panel) { @@ -15286,7 +15286,7 @@ int CExecutive::drag(int x, int y, int mod) } else { if(rec == I->RecoverPressed) { I->Pressed = row; - I->RecoverPressed = NULL; + I->RecoverPressed = nullptr; } row++; } @@ -15298,7 +15298,7 @@ int CExecutive::drag(int x, int y, int mod) I->OverWhat = 0; } if(I->Over >= 0) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int skip = I->NSkip; int row = 0; switch (I->DragMode) { @@ -15375,8 +15375,8 @@ int CExecutive::drag(int x, int y, int mod) case ExecutiveDragMode::Reorder: /* right buttonBROKEN */ { if((I->Over != I->Pressed) && (I->LastOver != I->Over)) { - SpecRec *new_rec = NULL; - SpecRec *mov_rec = NULL; + SpecRec *new_rec = nullptr; + SpecRec *mov_rec = nullptr; for (auto& panelitem : I->Panel) { rec = panelitem.spec; @@ -15401,7 +15401,7 @@ int CExecutive::drag(int x, int y, int mod) int group_flag = false; int order_flag = false; int location = 0; - char *first = NULL, *second = NULL; + char *first = nullptr, *second = nullptr; int is_child = false; if(mov_rec && (!new_rec) && (I->Over > I->Pressed) && mov_rec->group) { @@ -15512,7 +15512,7 @@ int CExecutive::drag(int x, int y, int mod) if((row == I->Over) && row) { if(I->LastChanged != rec) { ExecutiveSpecSetVisibility(G, I->LastChanged, false, mod, false); - ExecutiveCenter(G, rec->name, -1, true, -1.0F, NULL, true); + ExecutiveCenter(G, rec->name, -1, true, -1.0F, nullptr, true); if(!rec->visible) ExecutiveSpecSetVisibility(G, rec, true, mod, false); I->LastChanged = rec; @@ -15655,7 +15655,7 @@ static void draw_button_char(PyMOLGlobals * G, int x2, int y2, char ch , CGO *or /** * Get the text color for the object name. - * @param obj Object pointer, may be NULL + * @param obj Object pointer, may be nullptr * @param mode 0: default, 1: first carbon atom color, 2: object color * @param bg_rgb Background color * @param default_rgb Default text color @@ -15716,7 +15716,7 @@ void CExecutive::draw(CGO* orthoCGO) PyMOLGlobals *G = m_G; int x, y, xx, x2, y2; WordType ch; - char *c = NULL; + char *c = nullptr; float enabledColor[3] = { 0.5F, 0.5F, 0.5F }; float cloakedColor[3] = { 0.35F, 0.35F, 0.35F }; float pressedColor[3] = { 0.7F, 0.7F, 0.7F }; @@ -15730,7 +15730,7 @@ void CExecutive::draw(CGO* orthoCGO) float toggleColor3[3] = { 0.6F, 0.6F, 0.8F }; #endif - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int n_ent; int n_disp; @@ -15902,7 +15902,7 @@ void CExecutive::draw(CGO* orthoCGO) break; case 4: draw_button(x2, y2, ExecToggleSize, (ExecLineHeight - 1), - toggleLightEdge, toggleDarkEdge, NULL, orthoCGO); + toggleLightEdge, toggleDarkEdge, nullptr, orthoCGO); draw_button_char(G, x2, y2 + text_lift, 'C', orthoCGO); break; case 5: @@ -16112,8 +16112,8 @@ int ExecutiveIterateObject(PyMOLGlobals * G, pymol::CObject ** obj, void **hidde if(*rec) (*obj) = (*rec)->obj; else - (*obj) = NULL; - return ((*rec) != NULL); + (*obj) = nullptr; + return ((*rec) != nullptr); } @@ -16128,8 +16128,8 @@ int ExecutiveIterateObjectMolecule(PyMOLGlobals * G, ObjectMolecule ** obj, void if(*rec) (*obj) = (ObjectMolecule *) (*rec)->obj; else - (*obj) = NULL; - return ((*rec) != NULL); + (*obj) = nullptr; + return ((*rec) != nullptr); } @@ -16157,10 +16157,10 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring /* reinitialize PyMOL */ const char* pattern = inPattern.data(); if(what == 2) - pattern = NULL; + pattern = nullptr; if(pattern && (!pattern[0])) - pattern = NULL; + pattern = nullptr; if(!pattern) { switch (what) { @@ -16179,7 +16179,7 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring blocked = PAutoBlock(G); PRunStringInstance(G, "cmd.view('*','clear')"); PRunStringInstance(G, "cmd.config_mouse(\"three_button\")"); - WizardSet(G, NULL, false); + WizardSet(G, nullptr, false); PAutoUnblock(G, blocked); #endif @@ -16206,8 +16206,8 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring case 5: case 6: if (G->Default){ - SettingSetGlobal_i(G, cSetting_internal_gui, SettingGet_i(G, G->Default, NULL, cSetting_internal_gui)); - SettingGenerateSideEffects(G, cSetting_internal_gui, NULL, -1, 0); + SettingSetGlobal_i(G, cSetting_internal_gui, SettingGet_i(G, G->Default, nullptr, cSetting_internal_gui)); + SettingGenerateSideEffects(G, cSetting_internal_gui, nullptr, -1, 0); } break; } @@ -16251,16 +16251,16 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring /*========================================================================*/ int ExecutiveInit(PyMOLGlobals * G) { - CExecutive *I = NULL; + CExecutive *I = nullptr; if((I = (G->Executive = new CExecutive(G)))) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ListInit(I->Spec); I->Tracker = TrackerNew(G); - I->all_names_list_id = TrackerNewList(I->Tracker, NULL); - I->all_obj_list_id = TrackerNewList(I->Tracker, NULL); - I->all_sel_list_id = TrackerNewList(I->Tracker, NULL); + I->all_names_list_id = TrackerNewList(I->Tracker, nullptr); + I->all_obj_list_id = TrackerNewList(I->Tracker, nullptr); + I->all_sel_list_id = TrackerNewList(I->Tracker, nullptr); I->active = true; OrthoAttach(G, I, cOrthoTool); #ifndef GLUT_FULL_SCREEN @@ -16277,7 +16277,7 @@ int ExecutiveInit(PyMOLGlobals * G) strcpy(rec->name, cKeywordAll); rec->type = cExecAll; rec->visible = true; - rec->next = NULL; + rec->next = nullptr; rec->cand_id = TrackerNewCand(I->Tracker, (TrackerRef *) (void *) rec); TrackerLink(I->Tracker, rec->cand_id, I->all_names_list_id, 1); ListAppend(I->Spec, rec, next, SpecRec); @@ -16294,7 +16294,7 @@ int ExecutiveInit(PyMOLGlobals * G) void ExecutiveFree(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CGOFree(I->selIndicatorsCGO); while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) @@ -16392,14 +16392,14 @@ printf("\n"); PyObject * ExecutiveCEAlign(PyMOLGlobals * G, PyObject * listA, PyObject * listB, int lenA, int lenB, float d0, float d1, int windowSize, int gapMax) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int i=0; int smaller; double **dmA ,**dmB, **S; int bufferSize; pcePoint coordsA, coordsB; - pathCache paths = NULL; + pathCache paths = nullptr; PyObject * result; smaller = lenA < lenB ? lenA : lenB; @@ -16482,7 +16482,7 @@ char *ExecutiveGetObjectNames(PyMOLGlobals * G, int mode, const char *name, int } if (!size){ VLAFreeP(res); - res = NULL; + res = nullptr; } else { VLASize(res, char, size); } @@ -16491,17 +16491,17 @@ char *ExecutiveGetObjectNames(PyMOLGlobals * G, int mode, const char *name, int /** * Get the coord set for the given object name and state index. If "omp" is - * not NULL, then also store a pointer to the object molecule. + * not nullptr, then also store a pointer to the object molecule. */ CoordSet * ExecutiveGetCoordSet(PyMOLGlobals * G, const char * name, int state, ObjectMolecule ** omp) { - ObjectMolecule * om = NULL; - CoordSet * cs = NULL; + ObjectMolecule * om = nullptr; + CoordSet * cs = nullptr; ok_assert(1, om = ExecutiveFindObject(G, name)); ok_assert(1, cs = om->getCoordSet(state)); ok_except1: - if (omp != NULL) + if (omp != nullptr) *omp = om; return cs; } @@ -16556,7 +16556,7 @@ pymol::Result<> ExecutiveSliceNew(PyMOLGlobals* G, const char* slice_name, const char* map_name, int state, int map_state) { int multi = false; - pymol::CObject *obj = NULL, *mObj, *origObj; + pymol::CObject *obj = nullptr, *mObj, *origObj; ObjectMap *mapObj; ObjectMapState *ms; @@ -16570,7 +16570,7 @@ pymol::Result<> ExecutiveSliceNew(PyMOLGlobals* G, const char* slice_name, mObj = ExecutiveFindObjectByName(G, map_name); if(mObj) { if(mObj->type != cObjectMap) - mObj = NULL; + mObj = nullptr; } if(mObj) { mapObj = (ObjectMap *) mObj; diff --git a/layer3/Executive.h b/layer3/Executive.h index 4491a47d7..9343bb8ce 100644 --- a/layer3/Executive.h +++ b/layer3/Executive.h @@ -325,7 +325,7 @@ pymol::CObject* ExecutiveFindObjectByName( /** * Typed version of `ExecutiveFindObjectByName` * @param name Object name - * @return NULL if object can't be found or has the wrong type + * @return nullptr if object can't be found or has the wrong type */ template T* ExecutiveFindObject(PyMOLGlobals* G, pymol::zstring_view name) { diff --git a/layer3/ExecutivePython.cpp b/layer3/ExecutivePython.cpp index 7ba970990..84df6d0d3 100644 --- a/layer3/ExecutivePython.cpp +++ b/layer3/ExecutivePython.cpp @@ -13,7 +13,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, int discrete, int quiet, int zoom) { ObjectNameType valid_name = ""; - pymol::CObject *origObj = NULL, *obj; + pymol::CObject *origObj = nullptr, *obj; OrthoLineType buf; buf[0] = 0; ExecutiveProcessObjectName(G, oname, valid_name); @@ -27,7 +27,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) { if (origObj->type != cObjectMolecule) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } } PBlock(G); /*PBlockAndUnlockAPI(); */ @@ -59,7 +59,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectMap) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectMapLoadChemPyBrick( @@ -81,7 +81,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectMap) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectMapLoadChemPyMap( @@ -103,7 +103,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectCallback) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectCallbackDefine( @@ -125,7 +125,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectCGO) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectCGODefine(G, (ObjectCGO*) origObj, model, frame); diff --git a/layer3/Interactions.cpp b/layer3/Interactions.cpp index b79d45585..9828c406d 100644 --- a/layer3/Interactions.cpp +++ b/layer3/Interactions.cpp @@ -254,7 +254,7 @@ namespace pymol /** * Find pi-pi and/or pi-cation interactions. * - * @param ds Measurement state to update, or NULL to create a new one. + * @param ds Measurement state to update, or nullptr to create a new one. * @param sele1 Selection index * @param state1 Object state * @param sele2 Selection index diff --git a/layer3/MoleculeExporter.cpp b/layer3/MoleculeExporter.cpp index 833a85920..fc9667287 100644 --- a/layer3/MoleculeExporter.cpp +++ b/layer3/MoleculeExporter.cpp @@ -477,7 +477,7 @@ struct MoleculeExporterPDB : public MoleculeExporter { /** * Write a TER record if the previous atom was polymer and `ai` - * is NULL, non-polymer, or has a different chain identifier. + * is nullptr, non-polymer, or has a different chain identifier. */ void writeTER(const AtomInfoType* ai) { if (!m_use_ter_records) @@ -1610,7 +1610,7 @@ class MoleculeExporterMMTF : public MoleculeExporter { /** * Export the given selection to a molecular file format. * - * @return File contents or NULL if the format is not known. + * @return File contents or nullptr if the format is not known. * * @param format pdb, sdf, ... * @param selection atom selection expression @@ -1765,7 +1765,7 @@ PyObject *MoleculeExporterGetPyBonds(PyMOLGlobals * G, * */ struct MoleculeExporterChemPy : public MoleculeExporter { - PyObject *m_model = nullptr; //!< Final result (never NULL) + PyObject *m_model = nullptr; //!< Final result (never nullptr) protected: int m_n_cs = 0; //!< Number of coordinate sets diff --git a/layer3/MovieScene.cpp b/layer3/MovieScene.cpp index 1504fd875..0d53d8ba7 100644 --- a/layer3/MovieScene.cpp +++ b/layer3/MovieScene.cpp @@ -520,7 +520,7 @@ pymol::Result<> MovieSceneRecall(PyMOLGlobals * G, const char * name, float anim * Rename or delete a scene * * @param name name to rename or delete, or "*" to delete all - * @param new_name new scene name to rename, or NULL to delete + * @param new_name new scene name to rename, or nullptr to delete */ pymol::Result<> MovieSceneRename(PyMOLGlobals * G, const char * name, const char * new_name) { @@ -818,7 +818,7 @@ static bool PConvFromPyObject(PyMOLGlobals * G, PyObject * obj, MovieScene &out) std::map atomdata_old_ids; if (!G) { - printf(" Error: G is NULL\n"); + printf(" Error: G is nullptr\n"); return false; } diff --git a/layer3/MovieScene.h b/layer3/MovieScene.h index 4af5d4fb3..6e0567dd7 100644 --- a/layer3/MovieScene.h +++ b/layer3/MovieScene.h @@ -138,7 +138,7 @@ pymol::Result<> MovieSceneDelete(PyMOLGlobals * G, const char * name, pymol::Result<> MovieSceneOrder(PyMOLGlobals * G, const char * names, bool sort = false, - const char * location = NULL /* "current" */); + const char * location = nullptr /* "current" */); pymol::Result<> MovieSceneOrder(PyMOLGlobals* G, std::vector names, bool sort = false, const char* location = nullptr); diff --git a/layer3/PlugIOManager.cpp b/layer3/PlugIOManager.cpp index ea8cc1d53..78b95a35b 100644 --- a/layer3/PlugIOManager.cpp +++ b/layer3/PlugIOManager.cpp @@ -74,7 +74,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, PRINTFB(G, FB_ObjectMolecule, FB_Errors) " ObjectMap-Error: sorry, VMD Molfile Plugins not compiled into this build.\n" ENDFB(G); - return NULL; + return nullptr; } ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, @@ -157,7 +157,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, const float *shift, int quiet, const char *plugin_type) { CPlugIOManager *I = G->PlugIOManager; - molfile_plugin_t *plugin = NULL; + molfile_plugin_t *plugin = nullptr; ok_assert(1, I && obj); plugin = find_plugin(I, plugin_type); @@ -168,7 +168,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, return false; } - if(plugin->read_next_timestep == NULL) { + if(plugin->read_next_timestep == nullptr) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: not a trajectory plugin '%s'\n", plugin_type ENDFB(G); return false; @@ -189,10 +189,10 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, int icnt = interval; int n_avg = 0; int ncnt = 0; - CoordSet *cs = obj->NCSet > 0 ? obj->CSet[0] : obj->CSTmpl ? obj->CSTmpl : NULL; + CoordSet *cs = obj->NCSet > 0 ? obj->CSet[0] : obj->CSTmpl ? obj->CSTmpl : nullptr; - timestep.coords = NULL; - timestep.velocities = NULL; + timestep.coords = nullptr; + timestep.velocities = nullptr; file_handle = plugin->open_file_read(fname, plugin_type, &natoms); @@ -299,7 +299,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, cs->Symmetry.reset(SymmetryNewFromTimestep(G, ×tep)); if((stop > 0 && cnt >= stop) || (max > 0 && ncnt >= max)) { - cs = NULL; + cs = nullptr; break; } @@ -343,12 +343,12 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, const char *plugin_type) { CPlugIOManager *I = G->PlugIOManager; - molfile_plugin_t *plugin = NULL; + molfile_plugin_t *plugin = nullptr; molfile_volumetric_t *metadata; int setsinfile = 0; int natoms; - void *file_handle = NULL; - float *datablock = NULL; + void *file_handle = nullptr; + float *datablock = nullptr; ok_assert(1, I); plugin = find_plugin(I, plugin_type); @@ -359,7 +359,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, ok_raise(1); } - if(plugin->read_volumetric_data == NULL || plugin->read_volumetric_metadata == NULL) { + if(plugin->read_volumetric_data == nullptr || plugin->read_volumetric_metadata == nullptr) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: not a map plugin '%s'\n", plugin_type ENDFB(G); ok_raise(1); @@ -394,14 +394,14 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, ok_assert(1, datablock = pymol::malloc(size)); - if(plugin->read_volumetric_data(file_handle, i, datablock, NULL) != MOLFILE_SUCCESS) { + if(plugin->read_volumetric_data(file_handle, i, datablock, nullptr) != MOLFILE_SUCCESS) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: read_volumetric_data failed\n" ENDFB(G); ok_raise(1); } { - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; if(!obj) ok_assert(1, obj = new ObjectMap(G)); @@ -561,7 +561,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, static CSymmetry * SymmetryNewFromTimestep(PyMOLGlobals * G, molfile_timestep_t * ts) { - CSymmetry * symm = NULL; + CSymmetry * symm = nullptr; ok_assert(1, ts->A > 0.f && ts->B > 0.f && ts->C > 0.f && ts->alpha > 0.f && ts->beta > 0.f && ts->gamma > 0.f); @@ -579,12 +579,12 @@ ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, int natoms, nbonds = 0, *from, *to; int optflags = 0; float *order; - void *file_handle = NULL; - molfile_plugin_t * plugin = NULL; + void *file_handle = nullptr; + molfile_plugin_t * plugin = nullptr; molfile_timestep_t timestep; - molfile_atom_t * atoms = NULL; - ObjectMolecule *I = NULL; - CoordSet * cs = NULL; + molfile_atom_t * atoms = nullptr; + ObjectMolecule *I = nullptr; + CoordSet * cs = nullptr; int *bondtype, nbondtypes; char **bondtypename; int auto_show = RepGetAutoShowMask(G); @@ -665,12 +665,12 @@ ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, } // read coordinates - while (/* true */ plugin->read_next_timestep != NULL) { + while (/* true */ plugin->read_next_timestep != nullptr) { ok_assert(1, cs = CoordSetNew(G)); ok_assert(1, cs->Coord = pymol::vla(3 * natoms)); timestep.coords = cs->Coord.data(); - timestep.velocities = NULL; + timestep.velocities = nullptr; if (plugin->read_next_timestep(file_handle, natoms, ×tep) != MOLFILE_SUCCESS) { delete cs; @@ -760,13 +760,13 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, const char *fname, int state, int quiet, const char *plugin_type) { CPlugIOManager *manager = G->PlugIOManager; - void *file_handle = NULL; - molfile_plugin_t * plugin = NULL; - const molfile_graphics_t * graphics = NULL; + void *file_handle = nullptr; + molfile_plugin_t * plugin = nullptr; + const molfile_graphics_t * graphics = nullptr; int nelem = 0; int beginend = 0; - CGO *cgo = NULL; - ObjectCGO *I = NULL; + CGO *cgo = nullptr; + ObjectCGO *I = nullptr; ok_assert(1, manager); plugin = find_plugin(manager, plugin_type); @@ -800,8 +800,8 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, // translate to CGO for (auto g = graphics, g_end = graphics + nelem; g != g_end; ++g) { auto g_current = g; - const float * tnormals = NULL; - const float * tcolors = NULL; + const float * tnormals = nullptr; + const float * tcolors = nullptr; switch (g->type) { case MOLFILE_POINT: @@ -863,7 +863,7 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, CGOStop(cgo); // Create ObjectCGO - ok_assert(1, I = ObjectCGOFromCGO(G, NULL, cgo, state)); + ok_assert(1, I = ObjectCGOFromCGO(G, nullptr, cgo, state)); // default is cgo_lighting=0 when loading CGOs without normals SettingSet(cSetting_cgo_lighting, 1, (pymol::CObject *)I); @@ -887,7 +887,7 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, const char *fname, int state, int quiet, const char *plugin_type, int mask) { - pymol::CObject *obj = obj_ptr ? *obj_ptr : NULL; + pymol::CObject *obj = obj_ptr ? *obj_ptr : nullptr; CPlugIOManager *manager = G->PlugIOManager; molfile_plugin_t *plugin; @@ -897,7 +897,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (!plugin) { PRINTFB(G, FB_ObjectMolecule, FB_Blather) " PlugIOManagerLoad: no plugin '%s'\n", plugin_type ENDFB(G); - return NULL; + return nullptr; } if (!mask) @@ -908,7 +908,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj && obj->type != cObjectMap) { ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadVol(G, (ObjectMap *) obj, @@ -925,7 +925,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, #endif ) { ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadMol(G, (ObjectMolecule *) obj, @@ -939,12 +939,12 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj && obj->type != cObjectMolecule) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManagerLoad: can't load trajectory into object '%s'\n", obj->Name ENDFB(G); - return NULL; + return nullptr; } PlugIOManagerLoadTraj(G, (ObjectMolecule *) obj, fname, state, 1, 1, 1, -1, -1, "all", 1, shift, quiet, plugin_type); - return NULL; + return nullptr; } else if ((mask & cPlugIOManager_graphics) && plugin->read_rawgraphics) { // geometry (CGO) @@ -952,7 +952,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj) { // no merge support ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadGraphics(G, (ObjectCGO *) obj, @@ -963,7 +963,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, " PlugIOManagerLoad: '%s' doesn't provide any read function\n", plugin_type ENDFB(G); ok_except1: - return NULL; + return nullptr; } #ifdef __cplusplus @@ -997,5 +997,5 @@ const char * PlugIOManagerFindPluginByExt(PyMOLGlobals * G, const char * ext, in } #endif - return NULL; + return nullptr; } diff --git a/layer3/Seeker.cpp b/layer3/Seeker.cpp index 326290969..defedc660 100644 --- a/layer3/Seeker.cpp +++ b/layer3/Seeker.cpp @@ -77,7 +77,7 @@ static void SeekerSelectionToggleRange(PyMOLGlobals * G, std::vector& r char prefix[3] = ""; int logging = SettingGetGlobal_i(G, cSetting_logging); int col_num; - int *atom_vla = NULL; + int *atom_vla = nullptr; int n_at = 0; int at_idx; int *atom_list; @@ -280,7 +280,7 @@ void SeekerSelectionCenter(PyMOLGlobals * G, int action) switch (action) { case 0: /* center cumulative */ - ExecutiveCenter(G, cTempCenterSele, -1, true, -1, NULL, true); + ExecutiveCenter(G, cTempCenterSele, -1, true, -1, nullptr, true); if(logging) { auto buf2 = pymol::string_format("%scmd.center(\"%s\")\n", prefix, cTempCenterSele); PLog(G, buf2, cPLog_no_flush); @@ -299,7 +299,7 @@ void SeekerSelectionCenter(PyMOLGlobals * G, int action) { char selName[WordLength]; if(ExecutiveGetActiveSeleName(G, selName, true, logging)) { - ExecutiveCenter(G, selName, -1, true, -1, NULL, true); + ExecutiveCenter(G, selName, -1, true, -1, nullptr, true); if(logging) { auto buf2 = pymol::string_format("%scmd.center(\"%s\")\n", prefix, selName); PLog(G, buf2, cPLog_no_flush); @@ -328,7 +328,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int if((UtilGetSeconds(G) - I->LastClickTime) < cDoubleTime) { char name[WordLength]; if(ExecutiveGetActiveSeleName(G, name, false, false)) { - SelectorCreate(G, name, "none", NULL, true, NULL); + SelectorCreate(G, name, "none", nullptr, true, nullptr); if(logging) { auto buf2 = pymol::string_format("cmd.select('%s','none', enable=1)", name); PLog(G, buf2, cPLog_no_flush); @@ -405,7 +405,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int SeekerSelectionCenter(G, action); I->box_active = true; if(col->state && (obj = ExecutiveFindObjectMoleculeByName(G, row->name))) { - SettingSetSmart_i(G, obj->Setting.get(), NULL, cSetting_state, col->state); + SettingSetSmart_i(G, obj->Setting.get(), nullptr, cSetting_state, col->state); SceneChanged(G); } } @@ -418,10 +418,10 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int if(mod & cOrthoCTRL) { center = 2; } - int codes = SettingGet_i(G, row->obj->Setting.get(), NULL, cSetting_seq_view_format); + int codes = SettingGet_i(G, row->obj->Setting.get(), nullptr, cSetting_seq_view_format); if(row->obj->DiscreteFlag && SettingGet_b(G, row->obj->Setting.get(), - NULL, cSetting_seq_view_discrete_by_state)) + nullptr, cSetting_seq_view_discrete_by_state)) codes = 4; if (codes != 4 || row->obj->DiscreteFlag) { // keep only non-discrete states selectable if(!continuation) { @@ -460,7 +460,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int SeekerSelectionCenter(G, 2); if(col->state && (obj = ExecutiveFindObjectMoleculeByName(G, row->name))) { - SettingSetSmart_i(G, obj->Setting.get(), NULL, cSetting_state, col->state); + SettingSetSmart_i(G, obj->Setting.get(), nullptr, cSetting_state, col->state); SceneChanged(G); } } @@ -468,7 +468,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int } } - return NULL; + return nullptr; } static void SeekerRefresh(PyMOLGlobals * G, std::vector& rowVLA) @@ -668,7 +668,7 @@ static CSeqRow *SeekerDrag(PyMOLGlobals * G, std::vector& rowVLA, int r break; } } - return NULL; + return nullptr; } static CSeqRow *SeekerRelease(PyMOLGlobals * G, std::vector& rowVLA, int button, @@ -678,7 +678,7 @@ static CSeqRow *SeekerRelease(PyMOLGlobals * G, std::vector& rowVLA, in I->dragging = false; I->box_active = false; - return NULL; + return nullptr; } char SeekerGetAbbr(PyMOLGlobals * G, const char *abbr, char water, char unknown) @@ -967,10 +967,10 @@ static int SeekerFindTag(PyMOLGlobals * G, const AtomInfoType * ai, int sele, in void SeekerUpdate(PyMOLGlobals * G) { - /* pymol::CObject *o = NULL; + /* pymol::CObject *o = nullptr; int s; */ - void *hidden = NULL; + void *hidden = nullptr; const AtomInfoType *ai; ObjectMolecule *obj; int nRow = 0; @@ -980,7 +980,7 @@ void SeekerUpdate(PyMOLGlobals * G) int default_color = 0; int align_sele = -1; /* alignment selection */ const int MAXCONSECUTIVEGAPS = 9; - CSeqRow *row, *lab = NULL; + CSeqRow *row, *lab = nullptr; std::vector row_vla; /* FIRST PASS: get all the residues represented properly */ label_mode = SettingGetGlobal_i(G, cSetting_seq_view_label_mode); @@ -991,8 +991,8 @@ void SeekerUpdate(PyMOLGlobals * G) bool isHidden = (SettingGet(G, cSetting_hide_underscore_names) && (obj->Name[0] == '_')); if (obj->Enabled && (SettingGet(*obj, cSetting_seq_view)) && !isHidden) { int a; - const AtomInfoType *last = NULL, *last_segi = NULL, *last_chain = NULL; - const CoordSet *last_disc = NULL; + const AtomInfoType *last = nullptr, *last_segi = nullptr, *last_chain = nullptr; + const CoordSet *last_disc = nullptr; int last_state; int last_abbr = true; int last_spacer = false; @@ -1001,23 +1001,23 @@ void SeekerUpdate(PyMOLGlobals * G) int est_col = obj->NAtom / 5 + 1; int est_char = obj->NAtom * 4; int first_atom_in_label; - int missing_color = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_fill_color); - const CoordSet *cs = obj->DiscreteFlag ? NULL : obj->getCoordSet(-2 /* current */); + int missing_color = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_fill_color); + const CoordSet *cs = obj->DiscreteFlag ? nullptr : obj->getCoordSet(-2 /* current */); bool atom_in_state; int gapMode = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_gap_mode); int min_pad = -1; - CSeqCol *r1 = NULL, *l1 = NULL; /* *col */ + CSeqCol *r1 = nullptr, *l1 = nullptr; /* *col */ if(nRow >= max_row) break; - codes = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_format); + codes = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_format); if(obj->DiscreteFlag && SettingGet_b(G, obj->Setting.get(), - NULL, cSetting_seq_view_discrete_by_state)) + nullptr, cSetting_seq_view_discrete_by_state)) codes = 4; - default_color = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_color); + default_color = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_color); /* allocate a row for labels, if present the text for the labels and the residues will line up exactly @@ -1030,7 +1030,7 @@ void SeekerUpdate(PyMOLGlobals * G) lab->col = pymol::vla(est_col); lab->label_flag = true; } else { - lab = NULL; + lab = nullptr; } VecCheck(row_vla, nRow); @@ -1802,7 +1802,7 @@ void SeekerUpdate(PyMOLGlobals * G) lab = row; else { for(b = 0; b < nCol; b++) { - CSeqCol *r1 = row->col + b, *l1 = NULL; + CSeqCol *r1 = row->col + b, *l1 = nullptr; if(lab) { l1 = lab->col + b; /* if a fixed label is present, get the final offset from the residue line */ @@ -1810,7 +1810,7 @@ void SeekerUpdate(PyMOLGlobals * G) l1->offset = r1->offset; } } - lab = NULL; + lab = nullptr; } } @@ -1832,20 +1832,20 @@ void SeekerUpdate(PyMOLGlobals * G) int draw_it; int n_skipped = 0; int last_resv = -1; - const AtomInfoType *last_ai = NULL; + const AtomInfoType *last_ai = nullptr; const ObjectMolecule *obj; const AtomInfoType *ai; row = lab + 1; nCol = row->nCol; obj = row->obj; - div = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_label_spacing); - sub = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_label_start); + div = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_label_spacing); + sub = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_label_start); for(b = 0; b < nCol; b++) { CSeqCol *r1 = row->col + b; CSeqCol *l1 = lab->col + b; - ai = NULL; + ai = nullptr; if(r1->atom_at) { atom_list = row->atom_lists + r1->atom_at; if(*atom_list >= 0) @@ -1949,7 +1949,7 @@ void SeekerUpdate(PyMOLGlobals * G) int SeekerInit(PyMOLGlobals * G) { - CSeeker *I = NULL; + CSeeker *I = nullptr; if((I = (G->Seeker = new CSeeker()))) { I->dragInfo.row = -1; I->LastClickTime = UtilGetSeconds(G) - 1.0F; diff --git a/layer3/Selector.cpp b/layer3/Selector.cpp index 432ed8bb6..4a9586b76 100644 --- a/layer3/Selector.cpp +++ b/layer3/Selector.cpp @@ -763,9 +763,9 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, for(pass = 0; pass < 2; pass++) { ObjectMolecule *obj; const CoordSet *cs; - const int *neighbor = NULL; - const AtomInfoType *atomInfo = NULL; - const ObjectMolecule *last_obj = NULL; + const int *neighbor = nullptr; + const AtomInfoType *atomInfo = nullptr; + const ObjectMolecule *last_obj = nullptr; float **dist_mat; float *inter; int state; @@ -801,7 +801,7 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs && neighbor && atomInfo) { int idx_ca1 = cs->atmToIdx(at_ca1); @@ -873,7 +873,7 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, } if(idx_cb2 >= 0) { - const float *v_cb2 = NULL; + const float *v_cb2 = nullptr; v_cb2 = cs->coordPtr(idx_cb2); { float angle = get_dihedral3f(v_cb1, v_ca1, v_ca2, v_cb2); @@ -1037,9 +1037,9 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, ObjectMolecule * only_object) { CSelector *I = G->Selector; - ObjectMolecule *obj, *obj0, *obj1 = NULL; + ObjectMolecule *obj, *obj0, *obj1 = nullptr; int a, aa, at, a0, a1; - AtomInfoType *ai, *last_ai = NULL, *ai0, *ai1; + AtomInfoType *ai, *last_ai = nullptr, *ai0, *ai1; unsigned int mask; int n_dummies = 0; @@ -1082,7 +1082,7 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, if(SelectorIsMember(G, ai->selEntry, sele) && ((!AtomInfoSameResidueP(G, ai, last_ai)))) { - AtomInfoType *guide_atom = NULL; + AtomInfoType *guide_atom = nullptr; /* delimit residue */ @@ -1350,12 +1350,12 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int state, float cutoff, float **coord_vla) { - int *index_vla = NULL; - float *coord = NULL; + int *index_vla = nullptr; + float *coord = nullptr; int n, nc = 0; - MapType *result = NULL; + MapType *result = nullptr; if(sele < 0) - return NULL; + return nullptr; else { auto ptr = std::make_unique(G, G->SelectorMgr); CSelector mapSele(G, G->SelectorMgr); @@ -1387,7 +1387,7 @@ MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int stat if(sta < obj->NCSet) cs = obj->CSet[sta]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); } else { @@ -1404,7 +1404,7 @@ MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int stat } } if(nc) { - result = MapNew(G, cutoff, coord, nc, NULL); + result = MapNew(G, cutoff, coord, nc, nullptr); } } } @@ -1625,7 +1625,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, state_stop = SelectorGetSeleNCSet(G, target); if (state_value == cStateCurrent) { - StateIterator iter(G, NULL, state_value, state_stop); + StateIterator iter(G, nullptr, state_value, state_stop); if (iter.next()) { state_start = iter.state; state_stop = iter.state + 1; @@ -1641,7 +1641,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, int aa, a0, a1, at, idx; AtomInfoType *ai, *ai0, *ai1; CoordSet *cs; - ObjectMolecule *last_obj = NULL; + ObjectMolecule *last_obj = nullptr; /* first, we need to count the number of residues under consideration */ if(first_pass) { @@ -1726,7 +1726,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, if(preserve) { /* if we're in preserve mode, then mark which objects don't get changed */ int a, b; char ss; - ObjectMolecule *p_obj = NULL; + ObjectMolecule *p_obj = nullptr; SSResi *r, *r2; for(a = 0; a < n_res; a++) { r = res + a; @@ -1814,7 +1814,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; for(b = 0; b < 4; b++) { if(cs) { switch (b) { @@ -1861,11 +1861,11 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, CoordSet *cs; float cutoff; HBondCriteria hbcRec, *hbc; - int *zero = NULL, *scratch = NULL; + int *zero = nullptr, *scratch = nullptr; { int max_n_atom = I->Table.size(); - ObjectMolecule *lastObj = NULL; + ObjectMolecule *lastObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { ObjectMolecule *obj = I->Obj[I->Table[a].model]; if(obj != lastObj) { @@ -1983,7 +1983,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, ); } */ - if((!exclude) && ObjectMoleculeGetCheckHBond(NULL, NULL, obj1, /* donor first */ + if((!exclude) && ObjectMoleculeGetCheckHBond(NULL, nullptr, obj1, /* donor first */ at1, state, obj0, /* then acceptor */ at0, state, hbc)) { @@ -2036,31 +2036,31 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, float helix_psi_delta, helix_phi_delta; float strand_psi_delta, strand_phi_delta; - float helix_psi_target = SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_target); + float helix_psi_target = SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_target); float helix_psi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_include); float helix_psi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_exclude); - float helix_phi_target = SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_target); + float helix_phi_target = SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_target); float helix_phi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_include); float helix_phi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_exclude); float strand_psi_target = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_target); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_target); float strand_psi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_include); float strand_psi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_exclude); float strand_phi_target = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_target); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_target); float strand_phi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_include); float strand_phi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_exclude); for(a = 0; a < n_res; a++) { r = res + a; @@ -2615,7 +2615,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, { int a, aa; - ObjectMolecule *obj = NULL, *last_obj = NULL; + ObjectMolecule *obj = nullptr, *last_obj = nullptr; AtomInfoType *ai; int changed_flag = false; @@ -2661,13 +2661,13 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, PyObject *SelectorColorectionGet(PyMOLGlobals * G, const char *prefix) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else auto I = G->Selector; auto IM = G->SelectorMgr; - PyObject *result = NULL; + PyObject *result = nullptr; int n_used = 0; - ColorectionRec *used = NULL, tmp; + ColorectionRec *used = nullptr, tmp; ov_size a, b; int found; int color; @@ -2735,20 +2735,20 @@ int SelectorColorectionApply(PyMOLGlobals * G, PyObject * list, const char *pref CSelector *I = G->Selector; int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; int a, b; AtomInfoType *ai; - ObjectMolecule *obj, *last = NULL; + ObjectMolecule *obj, *last = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2789,18 +2789,18 @@ int SelectorColorectionSetName(PyMOLGlobals * G, PyObject * list, const char *pr #else int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; ov_size b; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2823,18 +2823,18 @@ int SelectorColorectionFree(PyMOLGlobals * G, PyObject * list, const char *prefi #else int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; ov_size b; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2882,11 +2882,11 @@ int SelectorSecretsFromPyList(PyMOLGlobals * G, PyObject * list) int ok = true; ov_size n_secret = 0; ov_size a; - PyObject *entry = NULL; + PyObject *entry = nullptr; std::string name; ov_size ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -2896,7 +2896,7 @@ int SelectorSecretsFromPyList(PyMOLGlobals * G, PyObject * list) if(ok) entry = PyList_GetItem(list, a); if(ok) - ok = (entry != NULL); + ok = (entry != nullptr); if(ok) ok = PyList_Check(entry); if(ok) @@ -2929,13 +2929,13 @@ PyObject *SelectorAsPyList(PyMOLGlobals * G, SelectorID_t sele1) int a, b; int at; int s; - SelAtomTag **vla_list = NULL; + SelAtomTag **vla_list = nullptr; int n_obj = 0; int n_idx = 0; int cur = -1; - ObjectMolecule **obj_list = NULL; - ObjectMolecule *obj, *cur_obj = NULL; - PyObject *result = NULL; + ObjectMolecule **obj_list = nullptr; + ObjectMolecule *obj, *cur_obj = nullptr; + PyObject *result = nullptr; PyObject *obj_pyobj; PyObject *idx_pyobj; PyObject *tag_pyobj; @@ -3005,15 +3005,15 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) auto I = G->SelectorMgr; ov_size a, b; ov_size ll; - PyObject *obj_list = NULL; - PyObject *idx_list = NULL, *tag_list; + PyObject *obj_list = nullptr; + PyObject *idx_list = nullptr, *tag_list; ov_size n_obj = 0, n_idx = 0; int idx, tag; const char *oname; ObjectMolecule *obj; int singleAtomFlag = true; int singleObjectFlag = true; - ObjectMolecule *singleObject = NULL; + ObjectMolecule *singleObject = nullptr; int singleAtom = -1; if(ok) @@ -3037,7 +3037,7 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) ll = PyList_Size(obj_list); if(ok) ok = PConvPyStrToStrPtr(PyList_GetItem(obj_list, 0), &oname); - obj = NULL; + obj = nullptr; if(ok) obj = ExecutiveFindObjectMoleculeByName(G, oname); if(ok && obj) { @@ -3046,7 +3046,7 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) if(ll > 2) tag_list = PyList_GetItem(obj_list, 2); else - tag_list = NULL; + tag_list = nullptr; if(ok) ok = PyList_Check(idx_list); if(ok) @@ -3272,10 +3272,10 @@ int SelectorGetPairIndices(PyMOLGlobals * G, int sele1, int state1, int sele2, i if(dist < cutoff) { if(mode == 1) { /* coarse hydrogen bonding assessment */ flag = false; - if(ObjectMoleculeGetAvgHBondVector(obj1, at1, state1, v1, NULL) > 0.3) + if(ObjectMoleculeGetAvgHBondVector(obj1, at1, state1, v1, nullptr) > 0.3) if(dot_product3f(v1, dir) < -angle_cutoff) flag = true; - if(ObjectMoleculeGetAvgHBondVector(obj2, at2, state2, v2, NULL) > 0.3) + if(ObjectMoleculeGetAvgHBondVector(obj2, at2, state2, v2, nullptr) > 0.3) if(dot_product3f(v2, dir) > angle_cutoff) flag = true; } else @@ -3312,7 +3312,7 @@ int SelectorCreateAlignments(PyMOLGlobals * G, int identical, int atomic_input) { CSelector *I = G->Selector; - int *flag1 = NULL, *flag2 = NULL; + int *flag1 = nullptr, *flag2 = nullptr; int *p; int i, np; int cnt; @@ -3416,8 +3416,8 @@ int SelectorCreateAlignments(PyMOLGlobals * G, } } if(cnt) { - SelectorEmbedSelection(G, flag1, name1, NULL, false, -1); - SelectorEmbedSelection(G, flag2, name2, NULL, false, -1); + SelectorEmbedSelection(G, flag1, name1, nullptr, false, -1); + SelectorEmbedSelection(G, flag2, name2, nullptr, false, -1); } FreeP(flag1); FreeP(flag2); @@ -3435,7 +3435,7 @@ int SelectorCountStates(PyMOLGlobals * G, int sele) int result = 0; int n_frame; int at1; - ObjectMolecule *last = NULL; + ObjectMolecule *last = nullptr; ObjectMolecule *obj; SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); for(a = cNDummyAtoms; a < I->Table.size(); a++) { @@ -3515,8 +3515,8 @@ int *SelectorGetResidueVLA(PyMOLGlobals * G, SelectorID_t sele, int ca_only, The indices are the first and last residue in the selection... */ CSelector *I = G->Selector; - int *result = NULL, *r; - AtomInfoType *ai1 = NULL, *ai2; + int *result = nullptr, *r; + AtomInfoType *ai1 = nullptr, *ai2; /* update the selector's table */ SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); @@ -3576,7 +3576,7 @@ static int *SelectorGetIndexVLA(PyMOLGlobals * G, SelectorID_t sele) static int *SelectorGetIndexVLAImpl(PyMOLGlobals * G, CSelector *I, SelectorID_t sele) { /* assumes updated tables */ int a, c = 0; - int *result = NULL; + int *result = nullptr; ObjectMolecule *obj; int at1; @@ -3598,7 +3598,7 @@ static int *SelectorGetIndexVLAImpl(PyMOLGlobals * G, CSelector *I, SelectorID_t void SelectorUpdateObjectSele(PyMOLGlobals * G, ObjectMolecule * obj) { if(obj->Name[0]) { - SelectorCreate(G, obj->Name, NULL, obj, true, NULL); + SelectorCreate(G, obj->Name, nullptr, obj, true, nullptr); /* create a selection with same name */ if(SettingGetGlobal_b(G, cSetting_auto_classify_atoms)) { @@ -3738,7 +3738,7 @@ bool SelectorMoveMember(PyMOLGlobals * G, SelectorMemberOffset_t s, SelectorID_t ObjectMolecule *SelectorGetFastSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t sele) { auto I = G->SelectorMgr; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; auto it = std::find_if(I->Info.begin(), I->Info.end(), [sele](const SelectionInfoRec& rec) { return rec.ID == sele; }); if (it != I->Info.end()) { @@ -3759,7 +3759,7 @@ ObjectMolecule *SelectorGetFastSingleAtomObjectIndex(PyMOLGlobals * G, SelectorI int *index) { auto I = G->SelectorMgr; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; auto it = std::find_if(I->Info.begin(), I->Info.end(), [sele](const SelectionInfoRec& rec) { return rec.ID == sele; }); if (it != I->Info.end()) { @@ -3792,14 +3792,14 @@ ObjectMolecule *SelectorGetFastSingleAtomObjectIndex(PyMOLGlobals * G, SelectorI * PARAMS * (int) selection # * RETURNS - * (ptr) pts to the ObjectMolecule or NULL if not found + * (ptr) pts to the ObjectMolecule or nullptr if not found */ ObjectMolecule *SelectorGetSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t sele) { /* slow way */ int a; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; ObjectMolecule *obj; CSelector *I = G->Selector; int at1; @@ -3811,7 +3811,7 @@ ObjectMolecule *SelectorGetSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t s if(SelectorIsMember(G, obj->AtomInfo[at1].selEntry, sele)) { if(result) { if(result != obj) { - result = NULL; + result = nullptr; break; } } else { @@ -3829,7 +3829,7 @@ ObjectMolecule *SelectorGetFirstObjectMolecule(PyMOLGlobals * G, SelectorID_t se /* slow way */ int a; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; ObjectMolecule *obj; CSelector *I = G->Selector; int at1; @@ -3851,8 +3851,8 @@ ObjectMolecule *SelectorGetFirstObjectMolecule(PyMOLGlobals * G, SelectorID_t se ObjectMolecule **SelectorGetObjectMoleculeVLA(PyMOLGlobals * G, SelectorID_t sele) { int a; - ObjectMolecule *last = NULL; - ObjectMolecule *obj, **result = NULL; + ObjectMolecule *last = nullptr; + ObjectMolecule *obj, **result = nullptr; CSelector *I = G->Selector; int at1; int n = 0; @@ -3882,8 +3882,8 @@ pymol::Result> SelectorGetSingleAtomObjectIndex( /* slow way */ bool found_it = false; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; std::pair result; while(ExecutiveIterateObjectMolecule(G, &obj, &iterator)) { @@ -4180,25 +4180,25 @@ int SelectorSubdivide(PyMOLGlobals* G, // { CSelector *I = G->Selector; int a0 = 0, a1 = 0, a2; - int *atom = NULL; - int *toDo = NULL; - int *comp = NULL; - int *pkset = NULL; + int *atom = nullptr; + int *toDo = nullptr; + int *comp = nullptr; + int *pkset = nullptr; int set_cnt = 0; int nFrag = 0; int stkDepth; int c; int cycFlag = false; std::string name, link_sele; - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1 = 0, index2 = 0, index3 = 0, index4 = 0; /* this is seriously getting out of hand -- need to switch over to arrays soon */ - int *atom1_base = NULL, *atom2_base = NULL, *atom3_base = NULL, *atom4_base = NULL; - int *toDo1_base = NULL, *toDo2_base = NULL, *toDo3_base = NULL, *toDo4_base = NULL; - int *comp1_base = NULL, *comp2_base = NULL, *comp3_base = NULL, *comp4_base = NULL; - int *pkset1_base = NULL, *pkset2_base = NULL, *pkset3_base = NULL, *pkset4_base = NULL; + int *atom1_base = nullptr, *atom2_base = nullptr, *atom3_base = nullptr, *atom4_base = nullptr; + int *toDo1_base = nullptr, *toDo2_base = nullptr, *toDo3_base = nullptr, *toDo4_base = nullptr; + int *comp1_base = nullptr, *comp2_base = nullptr, *comp3_base = nullptr, *comp4_base = nullptr; + int *pkset1_base = nullptr, *pkset2_base = nullptr, *pkset3_base = nullptr, *pkset4_base = nullptr; PRINTFD(G, FB_Selector) " SelectorSubdivideObject: entered...\n" ENDFD; @@ -4291,7 +4291,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // pkset1_base[a0] = 1; pkset1_base[a1] = 1; - SelectorEmbedSelection(G, pkset, cEditorBond, NULL, false, -1); + SelectorEmbedSelection(G, pkset, cEditorBond, nullptr, false, -1); a0 = index1; if(a0 >= 0) { @@ -4305,7 +4305,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a0] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a0] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); c = SelectorWalkTree(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, -1, -1) + 1; @@ -4340,7 +4340,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // obj1, sele1, sele2, -1, -1) + 1; } } - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); nFrag++; } @@ -4358,12 +4358,12 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a0] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a0] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); c = SelectorWalkTree(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, -1, -1) + 1; name = pymol::string_format("%s%1d", pref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); nFrag++; } } @@ -4392,7 +4392,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom1_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, sele3, sele4, @@ -4400,7 +4400,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4425,7 +4425,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom2_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp2_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom2_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom2_base, comp2_base, toDo2_base, &stk, stkDepth, obj2, sele1, sele2, sele3, sele4, @@ -4433,7 +4433,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4458,7 +4458,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom3_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp3_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom3_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom3_base, comp3_base, toDo3_base, &stk, stkDepth, obj3, sele1, sele2, sele3, sele4, @@ -4466,7 +4466,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); @@ -4492,7 +4492,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom4_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp4_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom4_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom4_base, comp4_base, toDo4_base, &stk, stkDepth, obj4, sele1, sele2, sele3, sele4, @@ -4500,7 +4500,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4516,15 +4516,15 @@ int SelectorSubdivide(PyMOLGlobals* G, // } if(set_cnt > 1) { - SelectorEmbedSelection(G, pkset, cEditorSet, NULL, false, -1); + SelectorEmbedSelection(G, pkset, cEditorSet, nullptr, false, -1); } if(nFrag) { - SelectorEmbedSelection(G, comp, compName, NULL, false, -1); + SelectorEmbedSelection(G, comp, compName, nullptr, false, -1); } if(!link_sele.empty()) - SelectorCreate(G, cEditorLink, link_sele.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorLink, link_sele.c_str(), nullptr, true, nullptr); FreeP(toDo); FreeP(atom); @@ -4545,7 +4545,7 @@ int SelectorGetSeleNCSet(PyMOLGlobals * G, SelectorID_t sele) CSelector *I = G->Selector; int a, s, at = 0; - ObjectMolecule *obj, *last_obj = NULL; + ObjectMolecule *obj, *last_obj = nullptr; int result = 0; if((obj = SelectorGetFastSingleAtomObjectIndex(G, sele, &at))) { @@ -4762,7 +4762,7 @@ int SelectorMapMaskVDW(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, float if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -4847,17 +4847,17 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, ObjectMolecule *obj; CoordSet *cs; int state1, state2; - float *point = NULL, *fp; - int *sfidx = NULL, *ip; - float *b_factor = NULL, *bf, bfact; - float *occup = NULL, *oc; + float *point = nullptr, *fp; + int *sfidx = nullptr, *ip; + float *b_factor = nullptr, *bf, bfact; + float *occup = nullptr, *oc; int prot; int once_flag; float d, e_val; double sum, sumsq; float mean, stdev; double sf[256][11], *sfp; - AtomSF *atom_sf = NULL; + AtomSF *atom_sf = nullptr; double b_adjust = (double) SettingGetGlobal_f(G, cSetting_gaussian_b_adjust); double elim = 7.0; double rcut2; @@ -5122,7 +5122,7 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state2 < obj->NCSet) cs = obj->CSet[state2]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5167,7 +5167,7 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state2 < obj->NCSet) cs = obj->CSet[state2]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, fp)) { prot = ai->protons; @@ -5335,8 +5335,8 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, int once_flag; int n_at = 0; double tot_charge = 0.0; - float *point = NULL; - float *charge = NULL; + float *point = nullptr; + float *charge = nullptr; int n_point = 0; int n_occur; float *v0, *v1; @@ -5377,7 +5377,7 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5401,7 +5401,7 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5569,7 +5569,7 @@ int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in SelectorUpdateTable(G, state, -1); if(ok) { - ObjectMolecule *prevobj = NULL; + ObjectMolecule *prevobj = nullptr; int a; for(a = cNDummyAtoms; a < I->Table.size(); a++) { int at = I->Table[a].atom; @@ -5601,7 +5601,7 @@ int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in SelectorUpdateTable(G, state, -1); - ObjectMolecule *obj = NULL; + ObjectMolecule *obj = nullptr; for (SeleAtomIterator iter(G, sele); iter.next();) { if (obj != iter.obj) { @@ -5628,25 +5628,25 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) { #ifndef _PYMOL_NUMPY printf("No numpy support\n"); - return NULL; + return nullptr; #else double matrix[16]; - double *matrix_ptr = NULL; + double *matrix_ptr = nullptr; float *v_ptr, v_tmp[3], *dataptr; int i, nAtom = 0; int typenum = -1; const int base_size = sizeof(float); SeleCoordIterator iter(G, sele, state); - CoordSet *mat_cs = NULL; - PyObject *result = NULL; + CoordSet *mat_cs = nullptr; + PyObject *result = nullptr; npy_intp dims[2] = {0, 3}; for(iter.reset(); iter.next();) nAtom++; if(!nAtom) - return NULL; + return nullptr; dims[0] = nAtom; @@ -5659,7 +5659,7 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) if(typenum == -1) { printf("error: no typenum for float size %d\n", base_size); - return NULL; + return nullptr; } result = PyArray_SimpleNew(2, dims, typenum); @@ -5670,7 +5670,7 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) if(mat_cs != iter.cs) { /* compute the effective matrix for output coordinates */ - matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : NULL; + matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : nullptr; mat_cs = iter.cs; } @@ -5701,11 +5701,11 @@ pymol::Result<> SelectorLoadCoords(PyMOLGlobals * G, PyObject * coords, int sele #else double matrix[16]; - double *matrix_ptr = NULL; + double *matrix_ptr = nullptr; float v_xyz[3]; int a, b, nAtom = 0, itemsize; SeleCoordIterator iter(G, sele, state); - CoordSet *mat_cs = NULL; + CoordSet *mat_cs = nullptr; PyObject *v, *w; bool is_np_array = false; void * ptr; @@ -5786,7 +5786,7 @@ pymol::Result<> SelectorLoadCoords(PyMOLGlobals * G, PyObject * coords, int sele // coord set specific stuff if(mat_cs != iter.cs) { // update matrix - matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : NULL; + matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : nullptr; mat_cs = iter.cs; // invalidate reps @@ -5817,7 +5817,7 @@ pymol::Result<> SelectorUpdateCmd(PyMOLGlobals* G, // int at0 = 0, at1; int c0 = 0, c1 = 0; int i0 = 0, i1; - ObjectMolecule *obj0 = NULL, *obj1; + ObjectMolecule *obj0 = nullptr, *obj1; CoordSet *cs0; const CoordSet *cs1; int matched_flag; @@ -6000,7 +6000,7 @@ pymol::Result<> SelectorUpdateCmd(PyMOLGlobals* G, // } } } - obj0 = NULL; + obj0 = nullptr; { ObjectMolecule **objs = SelectorGetObjectMoleculeVLA(G, sele0); @@ -6035,12 +6035,12 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char int nBond = 0; int nCSet, nAtom, ts; int isNew; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; CoordSet *cs1, *cs2; ObjectMolecule *obj; pymol::CObject *ob; - ObjectMolecule *targ = NULL; - ObjectMolecule *info_src = NULL; + ObjectMolecule *targ = nullptr; + ObjectMolecule *info_src = nullptr; int static_singletons = SettingGetGlobal_b(G, cSetting_static_singletons); if(singletons < 0) @@ -6061,7 +6061,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char targ->Bond = pymol::vla(1); { /* copy object color of previous object (if any) */ - ObjectMolecule *singleObj = NULL; + ObjectMolecule *singleObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { at = I->Table[a].atom; I->Table[a].index = -1; @@ -6071,7 +6071,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char if(!singleObj) singleObj = obj; else if(singleObj && (obj != singleObj)) { - singleObj = NULL; + singleObj = nullptr; break; } } @@ -6203,7 +6203,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char ErrFatal(G, "SelectorCreate", "inconsistent selection."); /* cs->IdxToAtm now has the relevant indexes for the coordinate transfer */ - for(StateIterator iter(G, NULL, source, nCSet); iter.next();) { + for(StateIterator iter(G, nullptr, source, nCSet); iter.next();) { d = iter.state; { cs2 = CoordSetNew(G); @@ -6213,7 +6213,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char if(I->Table[a].index >= 0) { at = I->Table[a].atom; obj = I->Obj[I->Table[a].model]; - cs1 = NULL; + cs1 = nullptr; if(d < obj->NCSet) { cs1 = obj->CSet[d]; } else if(singletons && (obj->NCSet == 1)) { @@ -6326,8 +6326,8 @@ SelectorID_t SelectorIndexByName(PyMOLGlobals * G, const char *sname, int ignore static void SelectorPurgeMembers(PyMOLGlobals * G, SelectorID_t sele) { auto I = G->SelectorMgr; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; short changed = 0; if(!I->Member.empty()) { @@ -6524,7 +6524,7 @@ SelectorGetTmp2Result(PyMOLGlobals * G, const char *input, char *store, bool qui if(is_selection) { /* incur the computational expense of parsing the input as an atom selection */ SelectorGetUniqueTmpName(G, store); - auto res = SelectorCreate(G, store, input, NULL, quiet, NULL); + auto res = SelectorCreate(G, store, input, nullptr, quiet, nullptr); if (!res) { store[0] = 0; } @@ -6572,7 +6572,7 @@ SelectorGetTmpResult(PyMOLGlobals * G, const char *input, char *store, bool quie // evaluate expression and create a temp selection SelectorGetUniqueTmpName(G, store); - auto res = SelectorCreate(G, store, input, NULL, quiet, NULL); + auto res = SelectorCreate(G, store, input, nullptr, quiet, nullptr); if(!res) { store[0] = 0; @@ -6595,7 +6595,7 @@ void SelectorFreeTmp(PyMOLGlobals * G, const char *name) static int SelectorEmbedSelection(PyMOLGlobals * G, const int *atom, pymol::zstring_view name, ObjectMolecule * obj, int no_dummies, int exec_managed) { - /* either atom or obj should be NULL, not both and not neither */ + /* either atom or obj should be nullptr, not both and not neither */ CSelector *I = G->Selector; auto IM = I->mgr; @@ -6606,7 +6606,7 @@ static int SelectorEmbedSelection(PyMOLGlobals * G, const int *atom, pymol::zstr int start = 0; int singleAtomFlag = true; int singleObjectFlag = true; - ObjectMolecule *singleObject = NULL, *selObj; + ObjectMolecule *singleObject = nullptr, *selObj; int singleAtom = -1; int index; AtomInfoType *ai; @@ -6769,7 +6769,7 @@ _SelectorCreate(PyMOLGlobals * G, pymol::zstring_view sname, const char *sele, std::string name; int c = 0; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); - ObjectMolecule *embed_obj = NULL; + ObjectMolecule *embed_obj = nullptr; if (!SelectorIsTmp(sname)) { if (sname.starts_with('%')) { @@ -6831,40 +6831,40 @@ _SelectorCreate(PyMOLGlobals * G, pymol::zstring_view sname, const char *sele, SelectorCreateResult_t SelectorCreateFromTagDict(PyMOLGlobals * G, const char *sname, const std::unordered_map& id2tag, int exec_managed) { - return _SelectorCreate(G, sname, NULL, NULL, true, NULL, NULL, 0, NULL, NULL, 0, &id2tag, + return _SelectorCreate(G, sname, nullptr, nullptr, true, nullptr, nullptr, 0, nullptr, nullptr, 0, &id2tag, exec_managed, -1, -1); } SelectorCreateResult_t SelectorCreateEmpty(PyMOLGlobals * G, const char *name, int exec_managed) { - return _SelectorCreate(G, name, "none", NULL, 1, NULL, NULL, 0, NULL, 0, 0, NULL, + return _SelectorCreate(G, name, "none", nullptr, 1, nullptr, nullptr, 0, nullptr, 0, 0, nullptr, exec_managed, -1, -1); } SelectorCreateResult_t SelectorCreateSimple(PyMOLGlobals * G, const char *name, const char *sele) { - return _SelectorCreate(G, name, sele, NULL, 1, NULL, NULL, 0, NULL, 0, 0, NULL, -1, -1, + return _SelectorCreate(G, name, sele, nullptr, 1, nullptr, nullptr, 0, nullptr, 0, 0, nullptr, -1, -1, -1); } SelectorCreateResult_t SelectorCreateFromObjectIndices(PyMOLGlobals * G, const char *sname, ObjectMolecule * obj, int *idx, int n_idx) { - return _SelectorCreate(G, sname, NULL, &obj, true, NULL, NULL, 0, &idx, &n_idx, -1, NULL, -1, -1, -1); + return _SelectorCreate(G, sname, nullptr, &obj, true, nullptr, nullptr, 0, &idx, &n_idx, -1, nullptr, -1, -1, -1); /* n_obj = -1 disables numbered tags */ } SelectorCreateResult_t SelectorCreateOrderedFromObjectIndices(PyMOLGlobals * G, const char *sname, ObjectMolecule * obj, int *idx, int n_idx) { - return _SelectorCreate(G, sname, NULL, &obj, true, NULL, NULL, 0, &idx, &n_idx, 0, NULL, -1, -1, -1); + return _SelectorCreate(G, sname, nullptr, &obj, true, nullptr, nullptr, 0, &idx, &n_idx, 0, nullptr, -1, -1, -1); /* assigned numbered tags */ } SelectorCreateResult_t SelectorCreate(PyMOLGlobals * G, const char *sname, const char *sele, ObjectMolecule * obj, int quiet, Multipick * mp) { - return _SelectorCreate(G, sname, sele, &obj, quiet, mp, NULL, 0, NULL, 0, 0, NULL, -1, + return _SelectorCreate(G, sname, sele, &obj, quiet, mp, nullptr, 0, nullptr, 0, 0, nullptr, -1, -1, -1); } @@ -6892,7 +6892,7 @@ SelectorCreateResult_t SelectorCreateWithStateDomain(PyMOLGlobals * G, const cha } } } - return _SelectorCreate(G, sname, sele, &obj, quiet, mp, NULL, 0, NULL, 0, 0, NULL, -1, + return _SelectorCreate(G, sname, sele, &obj, quiet, mp, nullptr, 0, nullptr, 0, 0, nullptr, -1, state, domain_sele); } @@ -7040,8 +7040,8 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec ov_size c = 0; int modelCnt; int state = req_state; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; /* Origin and Center are dummy objects */ if(!I->Origin) @@ -7171,7 +7171,7 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(a); if(idx >= 0) { @@ -7188,7 +7188,7 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(a); if(idx >= 0) { @@ -7284,7 +7284,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if (CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -7308,7 +7308,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -7384,7 +7384,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, Vertex.data() + 3 * a)) { Flag1[a] = true; @@ -7408,7 +7408,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); @@ -7459,7 +7459,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) int a, b, flag; EvalElem *base = passed_base; int c = 0; - ObjectMolecule *obj, *cur_obj = NULL; + ObjectMolecule *obj, *cur_obj = nullptr; CoordSet *cs; base->type = STYP_LIST; @@ -7474,7 +7474,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) { /* first, verify chemistry for all atoms... */ - ObjectMolecule *lastObj = NULL, *obj; + ObjectMolecule *lastObj = nullptr, *obj; for(a = cNDummyAtoms; a < I->Table.size(); a++) { obj = I->Obj[I->Table[a].model]; if(obj != lastObj) { @@ -7594,7 +7594,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) break; case SELE_PREz: - cs = NULL; + cs = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { base[0].sele[a] = false; obj = I->Obj[I->Table[a].model]; @@ -7636,7 +7636,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) break; case SELE_VISz: { - ObjectMolecule *last_obj = NULL; + ObjectMolecule *last_obj = nullptr; AtomInfoType *ai; for(a = cNDummyAtoms; a < I->Table.size(); a++) { flag = false; @@ -7678,7 +7678,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu { CSelector *I = G->Selector; auto IM = I->mgr; - CWordMatcher *matcher = NULL; + CWordMatcher *matcher = nullptr; int a, b, c = 0, hit_flag; ObjectMolecule *obj, *last_obj; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); @@ -7692,8 +7692,8 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int rep_mask; const char *wildcard = SettingGetGlobal_s(G, cSetting_wildcard); - ObjectMolecule *cur_obj = NULL; - CoordSet *cs = NULL; + ObjectMolecule *cur_obj = nullptr; + CoordSet *cs = nullptr; base->type = STYP_LIST; base->sele_calloc(I_NAtom); /* starting with zeros */ @@ -7701,13 +7701,13 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu switch (base->code) { case SELE_PEPs: if(base[1].text()[0]) { - AtomInfoType *last_ai0 = NULL, *ai0; + AtomInfoType *last_ai0 = nullptr, *ai0; for(a = cNDummyAtoms; a < I_NAtom; a++) { ai0 = I->Obj[I->Table[a].model]->AtomInfo + I->Table[a].atom; if(!AtomInfoSameResidueP(G, ai0, last_ai0)) { /* new starting residue */ int match_found = false; const char *ch = base[1].text(); /* sequence argument */ - AtomInfoType *ai1, *last_ai1 = NULL; + AtomInfoType *ai1, *last_ai1 = nullptr; for(b = a; b < I_NAtom; b++) { ai1 = I->Obj[I->Table[b].model]->AtomInfo + I->Table[b].atom; if(!AtomInfoSameResidueP(G, ai1, last_ai1)) { @@ -7726,7 +7726,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu } if(match_found) { const char *ch = base[1].text(); /* sequence argument */ - AtomInfoType *ai1, *last_ai1 = NULL, *ai2; + AtomInfoType *ai1, *last_ai1 = nullptr, *ai2; for(b = a; b < I_NAtom; b++) { ai1 = I->Obj[I->Table[b].model]->AtomInfo + I->Table[b].atom; if(!AtomInfoSameResidueP(G, ai1, last_ai1)) { @@ -7832,7 +7832,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu matcher = WordMatcherNew(G, base[1].text(), &options, false); base_0_sele_a = &base[0].sele[cNDummyAtoms]; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { auto& table_a = I->Table[a]; obj = I->Obj[table_a.model]; @@ -7842,7 +7842,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu for handling nucleic acid structures that use "*" in atom names */ const char *atom_name_wildcard = - SettingGet_s(G, obj->Setting.get(), NULL, cSetting_atom_name_wildcard); + SettingGet_s(G, obj->Setting.get(), nullptr, cSetting_atom_name_wildcard); if(!atom_name_wildcard[0]) atom_name_wildcard = wildcard; @@ -8070,7 +8070,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu case SELE_STAs: sscanf(base[1].text(), "%d", &state); state = state - 1; - obj = NULL; + obj = nullptr; if (state < 0 && state != cSelectorUpdateTableCurrentState) { return pymol::make_error( @@ -8251,7 +8251,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int group_list_id; if((group_list_id = ExecutiveGetExpandedGroupListFromPattern(G, word))) { int last_was_member = false; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { if(last_obj != I->Obj[I->Table[a].model]) { last_obj = I->Obj[I->Table[a].model]; @@ -8287,7 +8287,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int group_list_id; if((group_list_id = ExecutiveGetExpandedGroupList(G, word))) { int last_was_member = false; - last_obj = NULL; + last_obj = nullptr; for(a = 0; a < I_NAtom; a++) /* zero out first before iterating through selections */ base[0].sele[a] = false; for(a = cNDummyAtoms; a < I_NAtom; a++) { @@ -8341,7 +8341,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu base[0].sele[a] = false; base_0_sele_a = &base[0].sele[cNDummyAtoms]; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { auto& table_a = I->Table[a]; obj = I->Obj[table_a.model]; @@ -8722,7 +8722,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) AtomInfoType *at1, *at2; int n_atom = I->Table.size(); int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); - ObjectMolecule *lastObj = NULL; + ObjectMolecule *lastObj = nullptr; base[0].sele = std::move(base[1].sele); base[0].type = STYP_LIST; @@ -9119,7 +9119,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { const auto* sym = cs->getSymmetry(); if (sym) { @@ -9149,7 +9149,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { const auto* sym = cs->getSymmetry(); if (sym) { @@ -9407,7 +9407,7 @@ int SelectorOperator22(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -9430,7 +9430,7 @@ int SelectorOperator22(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -9492,7 +9492,7 @@ static void remove_quotes(std::string& str) char *st = &str[0]; char *p, *q; - char *quote_start = NULL; + char *quote_start = nullptr; char active_quote = 0; p = st; q = st; @@ -9505,7 +9505,7 @@ static void remove_quotes(std::string& str) quote_start++; } q--; - quote_start = NULL; + quote_start = nullptr; p++; continue; } else if(quote_start) { @@ -10148,7 +10148,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, int dist_cnt = 0; int s; int a_keeper = false; - int *zero = NULL, *scratch = NULL; + int *zero = nullptr, *scratch = nullptr; std::vector coverage; HBondCriteria hbcRec, *hbc; int exclusion = 0; @@ -10197,7 +10197,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, /* find and prepare (neighbortables) in any participating Molecular objects */ if((mode == 1) || (mode == 2) || (mode == 3)) { /* fill in all the neighbor tables */ int max_n_atom = I->Table.size(); - lastObj = NULL; + lastObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { /* foreach atom in the session, get its identifier and ObjectMolecule to which it belongs */ at = I->Table[a].atom; /* grab the atom ID from the Selectors->Table */ @@ -10316,8 +10316,8 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, cs2 = obj2->CSet[state2]; if(cs1 && cs2) { /* for bonding */ - float *don_vv = NULL; - float *acc_vv = NULL; + float *don_vv = nullptr; + float *acc_vv = nullptr; /* grab the appropriate atom information for this object-local atom */ ai1 = obj1->AtomInfo + at1; @@ -10337,7 +10337,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, /* if we pass the boding cutoff */ if(dist < cutoff) { float h_crd[3]; - h_ai = NULL; + h_ai = nullptr; a_keeper = true; if(exclusion && (obj1 == obj2)) { @@ -10682,7 +10682,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, int nv = 0; std::vector coverage14; std::vector coverage23; - ObjectMolecule *just_one_object = NULL; + ObjectMolecule *just_one_object = nullptr; int just_one_atom[4] = { -1, -1, -1, -1 }; if(!ds) { @@ -10719,7 +10719,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, s = obj->AtomInfo[at].selEntry; if(SelectorIsMember(G, s, sele1)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[0] == -1) just_one_atom[0] = a; else @@ -10728,7 +10728,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele2)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[1] == -1) just_one_atom[1] = a; else @@ -10737,7 +10737,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele3)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[2] == -1) just_one_atom[2] = a; else @@ -10746,7 +10746,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele4)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[3] == -1) just_one_atom[3] = a; else diff --git a/layer4/Cmd.cpp b/layer4/Cmd.cpp index d110a2ca9..56fd0662d 100644 --- a/layer4/Cmd.cpp +++ b/layer4/Cmd.cpp @@ -154,7 +154,7 @@ static PyMOLGlobals * _api_get_pymol_globals(PyObject * self) { } \ } - return NULL; + return nullptr; } /** @@ -376,7 +376,7 @@ static PyObject *APIAutoNone(PyObject * result) { /* automatically owned Py_None */ if(result == Py_None) Py_INCREF(result); - else if(result == NULL) { + else if(result == nullptr) { result = Py_None; Py_INCREF(result); } @@ -385,13 +385,13 @@ static PyObject *APIAutoNone(PyObject * result) static PyObject *CmdGetModalDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int status = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -405,7 +405,7 @@ static PyObject *CmdGetModalDraw(PyObject * self, PyObject * args) static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *object_name, *sele, *label; char *name, *resn, *resi, *chain, *segi, *elem; float vdw; @@ -418,7 +418,7 @@ static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) &object_name, &sele, &name, &resn, &resi, &chain, &segi, &elem, &vdw, &hetatm, &b, &q, &label, &pos, &color, &state, &mode, &quiet); - float pos_array[3], *pos_ptr = NULL; + float pos_array[3], *pos_ptr = nullptr; if(pos && PyTuple_Check(pos) && (PyTuple_Size(pos) == 3)) if(PyArg_ParseTuple(pos, "fff", pos_array, pos_array + 1, pos_array + 2)) pos_ptr = pos_array; @@ -434,7 +434,7 @@ static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) static PyObject *CmdFixChemistry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str2, *str3; int quiet; int invalidate; @@ -447,7 +447,7 @@ static PyObject *CmdFixChemistry(PyObject * self, PyObject * args) static PyObject *CmdRayAntiThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -464,7 +464,7 @@ static PyObject *CmdRayAntiThread(PyObject * self, PyObject * args) static PyObject *CmdRayHashThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -481,7 +481,7 @@ static PyObject *CmdRayHashThread(PyObject * self, PyObject * args) static PyObject *CmdRayTraceThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -498,7 +498,7 @@ static PyObject *CmdRayTraceThread(PyObject * self, PyObject * args) static PyObject *CmdCoordSetUpdateThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -515,7 +515,7 @@ static PyObject *CmdCoordSetUpdateThread(PyObject * self, PyObject * args) static PyObject *CmdObjectUpdateThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -532,19 +532,19 @@ static PyObject *CmdObjectUpdateThread(PyObject * self, PyObject * args) static PyObject *CmdGetMovieLocked(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); return APIResultCode(MovieLocked(G)); } static PyObject *CmdFakeDrag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -556,7 +556,7 @@ static PyObject *CmdFakeDrag(PyObject * self, PyObject * args) static PyObject *CmdDelColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; PyObject *list; char *prefix; @@ -569,7 +569,7 @@ static PyObject *CmdDelColorection(PyObject * self, PyObject * args) static PyObject *CmdSetColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *prefix; PyObject *list; @@ -582,8 +582,8 @@ static PyObject *CmdSetColorection(PyObject * self, PyObject * args) static PyObject *CmdGetColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; const char* prefix; API_SETUP_ARGS(G, self, args, "Os", &self, &prefix); API_ASSERT(APIEnterBlockedNotModal(G)); @@ -611,7 +611,7 @@ static PyObject *CmdSetRawAlignment(PyObject * self, PyObject * args) static PyObject *CmdGetRawAlignment(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *name; int active_only; int state = 0; @@ -625,14 +625,14 @@ static PyObject *CmdGetRawAlignment(PyObject * self, PyObject * args) static PyObject *CmdGetOrigin(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; float origin[3]; char *object; ok = PyArg_ParseTuple(args, "Os", &self, &object); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -664,8 +664,8 @@ static PyObject *CmdGetOrigin(PyObject * self, PyObject * args) static PyObject * CmdFindMolfilePlugin(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; - const char * ext = NULL; + PyMOLGlobals * G = nullptr; + const char * ext = nullptr; int mask = 0; if (!PyArg_ParseTuple(args, "Os|i", &self, &ext, &mask)) { API_HANDLE_ERROR; @@ -683,8 +683,8 @@ static PyObject * CmdFindMolfilePlugin(PyObject * self, PyObject * args) static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; - const char * name = NULL; + PyMOLGlobals * G = nullptr; + const char * name = nullptr; int state = 0; int quiet = 1; int format = cLoadTypeCCP4Unspecified; @@ -695,7 +695,7 @@ static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) if (G) { APIEnterBlocked(G); auto v = ObjectMapGetCCP4Str(G, name, state, quiet, format); - PyObject * result = v.empty() ? NULL : + PyObject * result = v.empty() ? nullptr : PyBytes_FromStringAndSize(&v.front(), v.size()); APIExitBlocked(G); @@ -707,8 +707,8 @@ static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int state = 0; int ok = false; char* objName; @@ -717,7 +717,7 @@ static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -737,7 +737,7 @@ static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeHistogram(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* objName; float min_val = 0.f, max_val = 0.f; int n_points = 64; @@ -753,8 +753,8 @@ static PyObject * CmdGetVolumeHistogram(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; char* objName; int state; @@ -762,7 +762,7 @@ static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -779,7 +779,7 @@ static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) static PyObject * CmdSetVolumeRamp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* objName; PyObject *ramp_list; std::vector float_array; @@ -801,8 +801,8 @@ static PyObject * CmdSetVolumeRamp(PyObject * self, PyObject * args) static PyObject *CmdGetVis(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterBlockedNotModal(G)); result = ExecutiveGetVisAsPyDict(G); @@ -812,7 +812,7 @@ static PyObject *CmdGetVis(PyObject * self, PyObject * args) static PyObject *CmdSetVis(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; PyObject *visDict; API_SETUP_ARGS(G, self, args, "OO", &self, &visDict); @@ -824,7 +824,7 @@ static PyObject *CmdSetVis(PyObject * self, PyObject * args) static PyObject *CmdReinitialize(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int what; char *object; API_SETUP_ARGS(G, self, args, "Ois", &self, &what, &object); @@ -836,7 +836,7 @@ static PyObject *CmdReinitialize(PyObject * self, PyObject * args) static PyObject *CmdSpectrum(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *expr, *prefix; float min, max; int digits, start, stop, byres; @@ -854,12 +854,12 @@ static PyObject *CmdSpectrum(PyObject * self, PyObject * args) static PyObject *CmdMDump(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -873,12 +873,12 @@ static PyObject *CmdMDump(PyObject * self, PyObject * args) static PyObject *CmdAccept(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -894,12 +894,12 @@ static PyObject *CmdAccept(PyObject * self, PyObject * args) static PyObject *CmdDecline(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -915,7 +915,7 @@ static PyObject *CmdDecline(PyObject * self, PyObject * args) static PyObject *CmdSetSymmetry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state; float a, b, c, alpha, beta, gamma; @@ -932,7 +932,7 @@ static PyObject *CmdSetSymmetry(PyObject * self, PyObject * args) static PyObject *CmdGetSymmetry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; float a, b, c, alpha, beta, gamma; int state; @@ -957,7 +957,7 @@ static PyObject *CmdGetSymmetry(PyObject * self, PyObject * args) static PyObject *CmdSmooth(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int cycles, window, first, last, ends, quiet; float cutoff = -1; @@ -973,7 +973,7 @@ static PyObject *CmdSmooth(PyObject * self, PyObject * args) static PyObject *CmdGetSession(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *dict; int partial, quiet; const char* names; @@ -1010,7 +1010,7 @@ static PyObject *CmdGetSession(PyObject * self, PyObject * args) static PyObject *CmdSetSession(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet, partial; PyObject *obj; API_SETUP_ARGS(G, self, args, "OOii", &self, &obj, &partial, &quiet); @@ -1022,7 +1022,7 @@ static PyObject *CmdSetSession(PyObject * self, PyObject * args) static PyObject *CmdSetName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; API_SETUP_ARGS(G, self, args, "Oss", &self, &str1, &str2); API_ASSERT(APIEnterNotModal(G)); @@ -1036,17 +1036,17 @@ static PyObject *CmdSetName(PyObject * self, PyObject * args) static PyObject *CmdGetBondPrint(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; - int ***array = NULL; - PyObject *result = NULL; + int ***array = nullptr; + PyObject *result = nullptr; int int1, int2; int dim[3]; ok = PyArg_ParseTuple(args, "Osii", &self, &str1, &int1, &int2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1063,13 +1063,13 @@ static PyObject *CmdGetBondPrint(PyObject * self, PyObject * args) static PyObject *CmdDebug(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1082,12 +1082,12 @@ static PyObject *CmdDebug(PyObject * self, PyObject * args) static PyObject *CmdSculptPurge(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1103,7 +1103,7 @@ static PyObject *CmdScene(PyObject * self, PyObject * args) PyMOLGlobals *G = nullptr; MovieSceneFuncArgs margs; - const char *key, *action, *message = NULL, *new_key = NULL; + const char *key, *action, *message = nullptr, *new_key = nullptr; const char * sele = "all"; API_SETUP_ARGS(G, self, args, "Oss|zbbbbbfzbbs", &self, &key, &action, @@ -1123,7 +1123,7 @@ static PyObject *CmdScene(PyObject * self, PyObject * args) static PyObject *CmdSceneOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *location; unsigned char sort; @@ -1144,8 +1144,8 @@ static PyObject *CmdSceneOrder(PyObject * self, PyObject * args) static PyObject *CmdGetSceneOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject * result = NULL; + PyMOLGlobals *G = nullptr; + PyObject * result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnterBlocked(G); @@ -1210,13 +1210,13 @@ static PyObject* CmdSetSceneMessage(PyObject* self, PyObject* args) static PyObject *CmdSculptDeactivate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1229,14 +1229,14 @@ static PyObject *CmdSculptDeactivate(PyObject * self, PyObject * args) static PyObject *CmdSculptActivate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int int1, int2, int3; char *str1; ok = PyArg_ParseTuple(args, "Osiii", &self, &str1, &int1, &int2, &int3); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1249,7 +1249,7 @@ static PyObject *CmdSculptActivate(PyObject * self, PyObject * args) static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int int1, int2; char *str1; @@ -1257,7 +1257,7 @@ static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osii", &self, &str1, &int1, &int2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1270,7 +1270,7 @@ static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) static PyObject *CmdSetObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float ttt[16]; int quiet; char *name; @@ -1290,7 +1290,7 @@ static PyObject *CmdSetObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdTranslateObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float mov[3]; char *name; API_SETUP_ARGS(G, self, args, "Os(fff)", @@ -1304,7 +1304,7 @@ static PyObject *CmdTranslateObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdCombineObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; PyObject *m; float ttt[16]; @@ -1320,13 +1320,13 @@ static PyObject *CmdCombineObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdGetColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int mode; int a, nc, nvc; const float *rgb; int index; - PyObject *result = NULL; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &mode); APIEnterBlocked(G); { @@ -1406,7 +1406,7 @@ static PyObject* CmdCurveNew(PyObject* self, PyObject* args) static PyObject *CmdGetChains(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1; @@ -1437,15 +1437,15 @@ static PyObject *CmdGetClickString(PyObject * self, PyObject * args) static PyObject *CmdRampNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int ok = false; char *map; int state; char *sele; float beyond, within; - float sigma, *range_vla = NULL; - float *color_vla = NULL; + float sigma, *range_vla = nullptr; + float *color_vla = nullptr; int zero, quiet, calc_mode = 0; PyObject *range, *color; API_SETUP_ARGS(G, self, args, "OssOOisfffii", &self, &name, &map, &range, &color, @@ -1478,11 +1478,11 @@ static PyObject *CmdRampNew(PyObject * self, PyObject * args) /* See MapCalculate for the actual calculation */ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; + PyMOLGlobals * G = nullptr; int ok = false; char * name, * reflection_file, * tempFile, * amplitudes, * phases, * weights, *space_group; - const char * cResult = NULL; + const char * cResult = nullptr; int quiet, zoom; double reso_high, reso_low, cell[6]; @@ -1494,7 +1494,7 @@ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1523,7 +1523,7 @@ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) static PyObject *CmdMapNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; float minCorner[3], maxCorner[3]; float grid; @@ -1550,7 +1550,7 @@ static PyObject *CmdMapNew(PyObject * self, PyObject * args) static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; float level; int state; @@ -1558,7 +1558,7 @@ static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osfi", &self, &name, &level, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1571,7 +1571,7 @@ static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) static PyObject *CmdMapSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *operands; int target_state, source_state, operator_; int zoom, quiet; @@ -1587,7 +1587,7 @@ static PyObject *CmdMapSet(PyObject * self, PyObject * args) static PyObject *CmdMapTrim(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *sele; int map_state, sele_state; float buffer; @@ -1602,7 +1602,7 @@ static PyObject *CmdMapTrim(PyObject * self, PyObject * args) static PyObject *CmdMapDouble(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &state); @@ -1614,7 +1614,7 @@ static PyObject *CmdMapDouble(PyObject * self, PyObject * args) static PyObject *CmdMapHalve(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; int smooth; @@ -1627,8 +1627,8 @@ static PyObject *CmdMapHalve(PyObject * self, PyObject * args) static PyObject *CmdGetRenderer(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - char *vendor = NULL, *renderer = NULL, *version = NULL; + PyMOLGlobals *G = nullptr; + char *vendor = nullptr, *renderer = nullptr, *version = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); SceneGetCardInfo(G, &vendor, &renderer, &version); @@ -1718,7 +1718,7 @@ static PyObject* CmdGetCapabilities(PyObject*, PyObject*) static PyObject *CmdTranslateAtom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state, log, mode; float v[3]; @@ -1732,7 +1732,7 @@ static PyObject *CmdTranslateAtom(PyObject * self, PyObject * args) static PyObject *CmdMatrixCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *source_name, *target_name; int source_mode, target_mode; int source_state, target_state, target_undo; @@ -1750,7 +1750,7 @@ static PyObject *CmdMatrixCopy(PyObject * self, PyObject * args) static PyObject *CmdResetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int mode; int state; @@ -1765,7 +1765,7 @@ static PyObject *CmdResetMatrix(PyObject * self, PyObject * args) static PyObject *CmdTransformObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *sele; int state, log; PyObject *m; @@ -1784,7 +1784,7 @@ static PyObject *CmdTransformObject(PyObject * self, PyObject * args) static PyObject *CmdTransformSelection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int state, log; int homo; @@ -1802,7 +1802,7 @@ static PyObject *CmdTransformSelection(PyObject * self, PyObject * args) static PyObject *CmdLoadColorTable(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* str1; float gamma; int quiet; @@ -1815,7 +1815,7 @@ static PyObject *CmdLoadColorTable(PyObject * self, PyObject * args) static PyObject *CmdLoadPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int ok = false; int quiet; @@ -1829,7 +1829,7 @@ static PyObject *CmdLoadPNG(PyObject * self, PyObject * args) static PyObject *CmdBackgroundColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); API_ASSERT(APIEnterNotModal(G)); @@ -1840,7 +1840,7 @@ static PyObject *CmdBackgroundColor(PyObject * self, PyObject * args) static PyObject *CmdGetPosition(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float v[3] = { 0.0F, 0.0F, 0.0F }; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -1851,13 +1851,13 @@ static PyObject *CmdGetPosition(PyObject * self, PyObject * args) static PyObject *CmdGetMoviePlaying(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); result = PyInt_FromLong(MoviePlaying(G)); } else { API_HANDLE_ERROR; @@ -1867,7 +1867,7 @@ static PyObject *CmdGetMoviePlaying(PyObject * self, PyObject * args) static PyObject *CmdGetPhiPsi(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; PyObject *result = Py_None; @@ -1899,7 +1899,7 @@ static PyObject *CmdGetPhiPsi(PyObject * self, PyObject * args) static PyObject *CmdAlign(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str2, *str3, *mfile, *oname; OrthoLineType s2 = "", s3 = ""; int ok = false; @@ -1918,7 +1918,7 @@ static PyObject *CmdAlign(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1955,11 +1955,11 @@ static PyObject *CmdAlign(PyObject * self, PyObject * args) static PyObject *CmdGetCoordsAsNumPy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state = 0; OrthoLineType s1; - PyObject *result = NULL; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "Os|i", &self, &str1, &state); API_ASSERT(str1[0]); @@ -1979,8 +1979,8 @@ static PyObject *CmdGetCoordsAsNumPy(PyObject * self, PyObject * args) static PyObject *CmdGetCoordSetAsNumPy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; CoordSet *cs; int state = 0; char *name; @@ -2004,8 +2004,8 @@ static PyObject *CmdGetCoordSetAsNumPy(PyObject * self, PyObject * args) static PyObject *CmdGetSettingUpdates(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int state; char *name; @@ -2031,7 +2031,7 @@ static PyObject *CmdGetSettingIndices(PyObject * self, PyObject * args) static PyObject *CmdGetView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; SceneViewType view; API_SETUP_ARGS(G, self, args, "O", &self); { @@ -2053,7 +2053,7 @@ static PyObject *CmdGetView(PyObject * self, PyObject * args) static PyObject *CmdGetViewPort(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int width, height; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -2064,7 +2064,7 @@ static PyObject *CmdGetViewPort(PyObject * self, PyObject * args) static PyObject *CmdSetView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; SceneViewType view; int quiet; float animate; @@ -2088,13 +2088,13 @@ static PyObject *CmdSetView(PyObject * self, PyObject * args) static PyObject *CmdGetState(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2106,13 +2106,13 @@ static PyObject *CmdGetState(PyObject * self, PyObject * args) static PyObject *CmdGetEditorScheme(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2124,13 +2124,13 @@ static PyObject *CmdGetEditorScheme(PyObject * self, PyObject * args) static PyObject *CmdGetFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2142,7 +2142,7 @@ static PyObject *CmdGetFrame(PyObject * self, PyObject * args) static PyObject *CmdSetTitle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1; API_SETUP_ARGS(G, self, args, "Osis", &self, &str1, &int1, &str2); @@ -2154,7 +2154,7 @@ static PyObject *CmdSetTitle(PyObject * self, PyObject * args) static PyObject *CmdGetTitle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1; PyObject *result = Py_None; @@ -2169,7 +2169,7 @@ static PyObject *CmdGetTitle(PyObject * self, PyObject * args) static PyObject *CmdGetArea(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; API_SETUP_ARGS(G, self, args, "Osii", &self, &str1, &int1, &int2); @@ -2181,7 +2181,7 @@ static PyObject *CmdGetArea(PyObject * self, PyObject * args) static PyObject *CmdPushUndo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0; int state; OrthoLineType s0 = ""; @@ -2189,7 +2189,7 @@ static PyObject *CmdPushUndo(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi", &self, &str0, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2207,7 +2207,7 @@ static PyObject *CmdPushUndo(PyObject * self, PyObject * args) static PyObject *CmdGetType(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); APIEnter(G); @@ -2218,9 +2218,9 @@ static PyObject *CmdGetType(PyObject * self, PyObject * args) static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - pymol::CObject *obj = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + pymol::CObject *obj = nullptr; + PyObject *result = nullptr; const char *oname; int state = -1; @@ -2244,7 +2244,7 @@ static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) auto handle_state = obj->getSettingHandle(state); // only accept handle if different from object-level settings - handle = (handle_state == handle) ? NULL : handle_state; + handle = (handle_state == handle) ? nullptr : handle_state; } if (handle) { @@ -2259,14 +2259,14 @@ static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) static PyObject *CmdGetUnusedName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - char * prefix = NULL; + PyMOLGlobals *G = nullptr; + char * prefix = nullptr; int alwaysnumber = false; int ok = false; ok = PyArg_ParseTuple(args, "Osi", &self, &prefix, &alwaysnumber); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2281,18 +2281,18 @@ static PyObject *CmdGetUnusedName(PyObject * self, PyObject * args) static PyObject *CmdGetDragObjectName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *result = Py_None; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { - char *name = NULL; + char *name = nullptr; APIEnter(G); { pymol::CObject *obj = EditorDragObject(G); @@ -2310,7 +2310,7 @@ static PyObject *CmdGetDragObjectName(PyObject * self, PyObject * args) static PyObject *CmdGetLegalName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; WordType name; char *str0; API_SETUP_ARGS(G, self, args, "Os", &self, &str0); @@ -2323,7 +2323,7 @@ static PyObject *CmdGetLegalName(PyObject * self, PyObject * args) static PyObject *CmdGetNames(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2; char *str0; API_SETUP_ARGS(G, self, args, "Oiis", &self, &int1, &int2, &str0); @@ -2335,13 +2335,13 @@ static PyObject *CmdGetNames(PyObject * self, PyObject * args) static PyObject *CmdInterrupt(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2353,7 +2353,7 @@ static PyObject *CmdInterrupt(PyObject * self, PyObject * args) static PyObject *CmdInvert(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; API_SETUP_ARGS(G, self, args, "Oi", &self, &int1); API_ASSERT(APIEnterNotModal(G)); @@ -2364,7 +2364,7 @@ static PyObject *CmdInvert(PyObject * self, PyObject * args) static PyObject *CmdTorsion(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float float1; API_SETUP_ARGS(G, self, args, "Of", &self, &float1); API_ASSERT(APIEnterNotModal(G)); @@ -2375,13 +2375,13 @@ static PyObject *CmdTorsion(PyObject * self, PyObject * args) static PyObject *CmdUndo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2394,7 +2394,7 @@ static PyObject *CmdUndo(PyObject * self, PyObject * args) static PyObject *CmdMask(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, quiet; @@ -2407,7 +2407,7 @@ static PyObject *CmdMask(PyObject * self, PyObject * args) static PyObject *CmdProtect(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -2420,13 +2420,13 @@ static PyObject *CmdProtect(PyObject * self, PyObject * args) static PyObject *CmdButton(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; int ok = false; ok = PyArg_ParseTuple(args, "Oii", &self, &i1, &i2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2439,13 +2439,13 @@ static PyObject *CmdButton(PyObject * self, PyObject * args) static PyObject *CmdFeedback(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2, result = 0; int ok = false; ok = PyArg_ParseTuple(args, "Oii", &self, &i1, &i2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2459,7 +2459,7 @@ static PyObject *CmdFeedback(PyObject * self, PyObject * args) static PyObject *CmdSetFeedbackMask(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2, i3; API_SETUP_ARGS(G, self, args, "Oiii", &self, &i1, &i2, &i3); API_ASSERT(APIEnterNotModal(G)); @@ -2471,7 +2471,7 @@ static PyObject *CmdSetFeedbackMask(PyObject * self, PyObject * args) static PyObject *CmdPop(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; int result = 0; @@ -2479,7 +2479,7 @@ static PyObject *CmdPop(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Ossi", &self, &str1, &str2, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2494,12 +2494,12 @@ static PyObject *CmdPop(PyObject * self, PyObject * args) static PyObject *CmdFlushNow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2519,14 +2519,14 @@ static PyObject *CmdFlushNow(PyObject * self, PyObject * args) static PyObject *CmdWaitQueue(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2553,13 +2553,13 @@ static PyObject *CmdWaitQueue(PyObject * self, PyObject * args) static PyObject *CmdWaitDeferred(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2579,7 +2579,7 @@ static PyObject *CmdWaitDeferred(PyObject * self, PyObject * args) static PyObject *CmdPaste(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *list, *str; const char *st; int l, a; @@ -2587,7 +2587,7 @@ static PyObject *CmdPaste(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "OO", &self, &list); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2621,15 +2621,15 @@ static PyObject *CmdPaste(PyObject * self, PyObject * args) static PyObject *CmdGetVRML(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ver; API_SETUP_ARGS(G, self, args, "Oi", &self, &ver); { - char *vla = NULL; + char *vla = nullptr; API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, (ver == 1) ? 6 : 4, /* VRML1 or 2? */ - NULL, &vla, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, &vla, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(vla) { result = Py_BuildValue("s", vla); @@ -2644,16 +2644,16 @@ static PyObject *CmdGetVRML(PyObject * self, PyObject * args) */ static PyObject *CmdGetCOLLADA(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ver; - char *vla = NULL; + char *vla = nullptr; API_SETUP_ARGS(G, self, args, "Oi", &self, &ver); API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, 8, /* mode 8 = COLLADA */ - NULL, &vla, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, &vla, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if (vla && vla[0]) { @@ -2668,14 +2668,14 @@ static PyObject *CmdGetCOLLADA(PyObject * self, PyObject * args) static PyObject *CmdGetIdtf(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *node = NULL, *rsrc = NULL; + char *node = nullptr, *rsrc = nullptr; API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, cSceneRay_MODE_IDTF, - &node, &rsrc, 0.0F, 0.0F, false, NULL, false, -1); + &node, &rsrc, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(node && rsrc) { result = Py_BuildValue("(ss)", node, rsrc); @@ -2688,13 +2688,13 @@ static PyObject *CmdGetIdtf(PyObject * self, PyObject * args) static PyObject *CmdGetPovRay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *header = NULL, *geom = NULL; + char *header = nullptr, *geom = nullptr; API_ASSERT(APIEnterNotModal(G)); - SceneRay(G, 0, 0, 1, &header, &geom, 0.0F, 0.0F, false, NULL, false, -1); + SceneRay(G, 0, 0, 1, &header, &geom, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(header && geom) { result = Py_BuildValue("(ss)", header, geom); @@ -2707,13 +2707,13 @@ static PyObject *CmdGetPovRay(PyObject * self, PyObject * args) static PyObject *CmdGetMtlObj(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *obj = NULL, *mtl = NULL; + char *obj = nullptr, *mtl = nullptr; API_ASSERT(APIEnterNotModal(G)); - SceneRay(G, 0, 0, 5, &obj, &mtl, 0.0F, 0.0F, false, NULL, false, -1); + SceneRay(G, 0, 0, 5, &obj, &mtl, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(obj && mtl) { result = Py_BuildValue("(ss)", mtl, obj); @@ -2798,14 +2798,14 @@ static PyObject *CmdDirtyWizard(PyObject * self, PyObject * args) static PyObject *CmdSplash(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int query; int result = 1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &query); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2830,12 +2830,12 @@ static PyObject *CmdSplash(PyObject * self, PyObject * args) static PyObject *CmdCls(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2848,14 +2848,14 @@ static PyObject *CmdCls(PyObject * self, PyObject * args) static PyObject *CmdDump(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state, quiet; int ok = false; ok = PyArg_ParseTuple(args, "Ossii", &self, &str1, &str2, &state, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2868,7 +2868,7 @@ static PyObject *CmdDump(PyObject * self, PyObject * args) static PyObject *CmdIsomesh(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *mesh_name, *map_name, *sele; float lvl, fbuf, alt_lvl; int mesh_mode; @@ -2888,7 +2888,7 @@ static PyObject *CmdIsomesh(PyObject * self, PyObject * args) static PyObject *CmdSliceNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *slice; char *map; int state, map_state; @@ -2902,7 +2902,7 @@ static PyObject *CmdSliceNew(PyObject * self, PyObject * args) static PyObject *CmdIsosurface(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *surf_name, *map_name, *sele; float lvl, fbuf; int surf_mode; @@ -2924,7 +2924,7 @@ static PyObject *CmdIsosurface(PyObject * self, PyObject * args) static PyObject *CmdSymExp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3; float cutoff; pymol::CObject *mObj; @@ -2937,7 +2937,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) PyArg_ParseTuple(args, "Osssfii", &self, &str1, &str2, &str3, &cutoff, &segi, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2945,7 +2945,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) mObj = ExecutiveFindObjectByName(G, str2); if(mObj) { if(mObj->type != cObjectMolecule) { - mObj = NULL; + mObj = nullptr; ok = false; } } @@ -2959,7 +2959,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) static PyObject *CmdSymmetryCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *source_name, *target_name; int source_state, target_state; int quiet; @@ -2976,7 +2976,7 @@ static PyObject *CmdSymmetryCopy(PyObject * self, PyObject * args) static PyObject *CmdOverlap(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2; float overlap = -1.0; @@ -2985,7 +2985,7 @@ static PyObject *CmdOverlap(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Ossiif", &self, &str1, &str2, &state1, &state2, &adjust); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3001,7 +3001,7 @@ static PyObject *CmdOverlap(PyObject * self, PyObject * args) static PyObject *CmdDist(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2; float cutoff; int labels, quiet; @@ -3018,7 +3018,7 @@ static PyObject *CmdDist(PyObject * self, PyObject * args) static PyObject *CmdAngle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2, *str3; int labels, quiet; int mode; @@ -3038,7 +3038,7 @@ static PyObject *CmdAngle(PyObject * self, PyObject * args) static PyObject *CmdDihedral(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2, *str3, *str4; int labels, quiet; int mode; @@ -3055,7 +3055,7 @@ static PyObject *CmdDihedral(PyObject * self, PyObject * args) static PyObject *CmdBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int order, mode; int quiet; @@ -3097,7 +3097,7 @@ static PyObject* CmdRebond(PyObject* self, PyObject* args) static PyObject *CmdRevalence(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele1, *sele2, *source; int source_state, target_state, reset; int quiet; @@ -3158,7 +3158,7 @@ static PyObject* CmdPBCWrap(PyObject* self, PyObject* args) static PyObject *CmdVdwFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2, quiet; float buffer; @@ -3168,7 +3168,7 @@ static PyObject *CmdVdwFit(PyObject * self, PyObject * args) &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3181,7 +3181,7 @@ static PyObject *CmdVdwFit(PyObject * self, PyObject * args) static PyObject *CmdLabel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &quiet); @@ -3196,7 +3196,7 @@ static PyObject *CmdLabel(PyObject * self, PyObject * args) static PyObject *CmdLabel2(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &quiet); @@ -3208,7 +3208,7 @@ static PyObject *CmdLabel2(PyObject * self, PyObject * args) static PyObject *CmdAlter(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int read_only, quiet; PyObject *space; @@ -3228,7 +3228,7 @@ static PyObject *CmdAlter(PyObject * self, PyObject * args) static PyObject *CmdAlterList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; PyObject *space; @@ -3242,7 +3242,7 @@ static PyObject *CmdAlterList(PyObject * self, PyObject * args) static PyObject *CmdSelectList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *sele_name; int quiet; int mode; @@ -3263,7 +3263,7 @@ static PyObject *CmdSelectList(PyObject * self, PyObject * args) static PyObject *CmdAlterState(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state, read_only, quiet; PyObject *obj; @@ -3276,7 +3276,7 @@ static PyObject *CmdAlterState(PyObject * self, PyObject * args) static PyObject *CmdCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int zoom; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &zoom); @@ -3288,7 +3288,7 @@ static PyObject *CmdCopy(PyObject * self, PyObject * args) static PyObject *CmdRecolor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; cRep_t rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &rep); @@ -3300,7 +3300,7 @@ static PyObject *CmdRecolor(PyObject * self, PyObject * args) static PyObject *CmdRebuild(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* str1; cRep_t rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &rep); @@ -3322,7 +3322,7 @@ static PyObject *CmdRebuild(PyObject * self, PyObject * args) static PyObject *CmdResetRate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); ButModeResetRate(G); @@ -3332,12 +3332,12 @@ static PyObject *CmdResetRate(PyObject * self, PyObject * args) static PyObject *CmdReady(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3350,12 +3350,12 @@ static PyObject *CmdReady(PyObject * self, PyObject * args) static PyObject *CmdMem(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3402,7 +3402,7 @@ static void PyMOLGlobalsCapsuleDestructor(PyObject* self) */ static PyObject *Cmd_New(PyObject * self, PyObject * args) { - PyObject *pymol = NULL; /* pymol object instance */ + PyObject *pymol = nullptr; /* pymol object instance */ PyObject *pyoptions = Py_None; int singleton = false; @@ -3460,8 +3460,8 @@ static PyObject *Cmd_New(PyObject * self, PyObject * args) static PyObject *Cmd_Start(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *cmd = NULL; + PyMOLGlobals *G = nullptr; + PyObject *cmd = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "OO", &self, &cmd); if(ok) { @@ -3479,7 +3479,7 @@ static PyObject *Cmd_Start(PyObject * self, PyObject * args) static PyObject *Cmd_Stop(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { @@ -3496,7 +3496,7 @@ static PyObject *Cmd_Stop(PyObject * self, PyObject * args) static PyObject *Cmd_Idle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int result = false; ok = PyArg_ParseTuple(args, "O", &self); @@ -3515,7 +3515,7 @@ static PyObject *Cmd_Idle(PyObject * self, PyObject * args) static PyObject *Cmd_Reshape(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int width, height, force; ok = PyArg_ParseTuple(args, "Oiii", &self, &width, &height, &force); @@ -3534,7 +3534,7 @@ static PyObject *Cmd_Reshape(PyObject * self, PyObject * args) static PyObject *Cmd_GetRedisplay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int result = false; int reset; @@ -3554,7 +3554,7 @@ static PyObject *Cmd_GetRedisplay(PyObject * self, PyObject * args) static PyObject *Cmd_Draw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { @@ -3572,7 +3572,7 @@ static PyObject *Cmd_Draw(PyObject * self, PyObject * args) static PyObject *Cmd_Button(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int button, state; int x, y, modifiers; @@ -3592,7 +3592,7 @@ static PyObject *Cmd_Button(PyObject * self, PyObject * args) static PyObject *Cmd_Drag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int x, y, modifiers; ok = PyArg_ParseTuple(args, "Oiii", &self, &x, &y, &modifiers); @@ -3611,13 +3611,13 @@ static PyObject *Cmd_Drag(PyObject * self, PyObject * args) static PyObject *Cmd_Sdof(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float tx, ty, tz, rx, ry, rz; int ok = false; ok = PyArg_ParseTuple(args, "Offffff", &self, &tx, &ty, &tz, &rx, &ry, &rz); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3655,7 +3655,7 @@ static PyObject *CmdRunPyMOL(PyObject * self, PyObject * args) static PyObject *CmdCountStates(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; int ok = false; @@ -3673,18 +3673,18 @@ static PyObject *CmdCountStates(PyObject * self, PyObject * args) static PyObject *CmdCountFrames(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); SceneCountFrames(G); - int result = SceneGetNFrame(G, NULL); + int result = SceneGetNFrame(G, nullptr); APIExit(G); return (APIResultCode(result)); } static PyObject *CmdGetMovieLength(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -3695,7 +3695,7 @@ static PyObject *CmdGetMovieLength(PyObject * self, PyObject * args) static PyObject *CmdIdentify(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int mode; PyObject *result = nullptr; @@ -3728,7 +3728,7 @@ static PyObject *CmdIdentify(PyObject * self, PyObject * args) static PyObject *CmdIndex(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int mode; pymol::vla oVLA; @@ -3753,7 +3753,7 @@ static PyObject *CmdIndex(PyObject * self, PyObject * args) static PyObject *CmdFindPairs(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2; float cutoff; @@ -3786,14 +3786,14 @@ static PyObject *CmdFindPairs(PyObject * self, PyObject * args) static PyObject *CmdSystem(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int ok = false; int async; ok = PyArg_ParseTuple(args, "Osi", &self, &str1, &async); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3812,18 +3812,18 @@ static PyObject *CmdSystem(PyObject * self, PyObject * args) static PyObject *CmdGetFeedback(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { if(G->Ready) { - PyObject *result = NULL; + PyObject *result = nullptr; if(G->Terminating) { /* try to bail */ /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ @@ -3848,18 +3848,18 @@ static PyObject *CmdGetFeedback(PyObject * self, PyObject * args) static PyObject *CmdGetSeqAlignStr(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; - char *seq = NULL; + char *seq = nullptr; int state; int format; int quiet; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "Osiii", &self, &str1, &state, &format, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3876,8 +3876,8 @@ static PyObject *CmdGetSeqAlignStr(PyObject * self, PyObject * args) static PyObject *CmdGetStr(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; pymol::vla vla; char *format; char *sele; @@ -3903,17 +3903,17 @@ static PyObject *CmdGetStr(PyObject * self, PyObject * args) static PyObject *CmdGetModel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; char *ref_object; int ref_state; OrthoLineType s1; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; API_SETUP_ARGS(G, self, args, "Osisi", &self, &str1, &state, &ref_object, &ref_state); if(!ref_object[0]) - ref_object = NULL; + ref_object = nullptr; APIEnterBlocked(G); ok = (SelectorGetTmp(G, str1, s1) >= 0); if(ok) @@ -3927,8 +3927,8 @@ static PyObject *CmdGetModel(PyObject * self, PyObject * args) static PyObject *CmdGetBonds(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; char *sele; int state; @@ -3943,7 +3943,7 @@ static PyObject *CmdGetBonds(PyObject * self, PyObject * args) static PyObject *CmdCreate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int target, source, discrete, quiet; int singletons; @@ -3960,7 +3960,7 @@ static PyObject *CmdCreate(PyObject * self, PyObject * args) static PyObject *CmdOrient(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; float animate; @@ -3974,7 +3974,7 @@ static PyObject *CmdOrient(PyObject * self, PyObject * args) static PyObject *CmdFitPairs(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *list; int quiet = 0; API_SETUP_ARGS(G, self, args, "OOi", &self, &list, &quiet); @@ -3986,7 +3986,7 @@ static PyObject *CmdFitPairs(PyObject * self, PyObject * args) static PyObject *CmdIntraFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int mode; @@ -4006,7 +4006,7 @@ static PyObject *CmdIntraFit(PyObject * self, PyObject * args) static PyObject *CmdGetAtomCoords(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int quiet; @@ -4019,7 +4019,7 @@ static PyObject *CmdGetAtomCoords(PyObject * self, PyObject * args) static PyObject *CmdFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int mode; int quiet; @@ -4041,7 +4041,7 @@ static PyObject *CmdFit(PyObject * self, PyObject * args) static PyObject *CmdUpdate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1, int2; int matchmaker, quiet; @@ -4055,7 +4055,7 @@ static PyObject *CmdUpdate(PyObject * self, PyObject * args) static PyObject *CmdDirty(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); OrthoDirty(G); @@ -4065,17 +4065,17 @@ static PyObject *CmdDirty(PyObject * self, PyObject * args) static PyObject *CmdGetObjectList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; int ok = false; - PyObject *result = NULL; + PyObject *result = nullptr; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4100,7 +4100,7 @@ static PyObject *CmdGetObjectList(PyObject * self, PyObject * args) static PyObject *CmdGetDistance(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &int1); @@ -4112,7 +4112,7 @@ static PyObject *CmdGetDistance(PyObject * self, PyObject * args) static PyObject *CmdGetAngle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3; int int1; API_SETUP_ARGS(G, self, args, "Osssi", &self, &str1, &str2, &str3, &int1); @@ -4124,7 +4124,7 @@ static PyObject *CmdGetAngle(PyObject * self, PyObject * args) static PyObject *CmdGetDihe(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3, *str4; int int1; API_SETUP_ARGS(G, self, args, "Ossssi", &self, &str1, &str2, &str3, &str4, &int1); @@ -4136,7 +4136,7 @@ static PyObject *CmdGetDihe(PyObject * self, PyObject * args) static PyObject *CmdSetDihe(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3, *str4; float float1; int int1; @@ -4151,7 +4151,7 @@ static PyObject *CmdSetDihe(PyObject * self, PyObject * args) static PyObject *CmdDo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int log; int echo; @@ -4163,7 +4163,7 @@ static PyObject *CmdDo(PyObject * self, PyObject * args) if(echo) { OrthoAddOutput(G, "PyMOL>"); OrthoAddOutput(G, str1); - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); } if((str1[0] == 'P') && (str1[1] == 'y') && (str1[2] == 'M') && (str1[3] == 'O') && (str1[4] == 'L') && (str1[5] == '>')) { @@ -4192,7 +4192,7 @@ static PyObject *CmdDo(PyObject * self, PyObject * args) static PyObject *CmdRock(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; API_SETUP_ARGS(G, self, args, "Oi", &self, &int1); API_ASSERT(APIEnterNotModal(G)); @@ -4203,13 +4203,13 @@ static PyObject *CmdRock(PyObject * self, PyObject * args) static PyObject *CmdBusyDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4224,13 +4224,13 @@ static PyObject *CmdBusyDraw(PyObject * self, PyObject * args) static PyObject *CmdSetBusy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4244,14 +4244,14 @@ static PyObject *CmdSetBusy(PyObject * self, PyObject * args) static PyObject *CmdGetBusy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; int int1; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4265,13 +4265,13 @@ static PyObject *CmdGetBusy(PyObject * self, PyObject * args) static PyObject *CmdGetProgress(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int reset; /* TO DO */ ok = PyArg_ParseTuple(args, "Oi", &self, &reset); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4315,7 +4315,7 @@ static PyObject *CmdGetProgress(PyObject * self, PyObject * args) static PyObject *CmdGetMoment(PyObject * self, PyObject * args) { /* missing? */ - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; double moment[16]; PyObject *result; char *str1; @@ -4325,7 +4325,7 @@ static PyObject *CmdGetMoment(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi", &self, &str1, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4361,12 +4361,12 @@ static PyObject* CmdGetSettingLevel(PyObject*, PyObject* args) static PyObject *CmdGetSettingOfType(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2, int3; char *str1; API_SETUP_ARGS(G, self, args, "Oisii", &self, &int1, &str1, &int2, &int3); APIEnterBlocked(G); - // may set the Python error indicator and return NULL + // may set the Python error indicator and return nullptr auto result = ExecutiveGetSettingOfType(G, int1, str1, int2, int3); APIExitBlocked(G); return result; @@ -4374,7 +4374,7 @@ static PyObject *CmdGetSettingOfType(PyObject * self, PyObject * args) static PyObject *CmdSetFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int mode, frm; API_SETUP_ARGS(G, self, args, "Oii", &self, &mode, &frm); API_ASSERT(APIEnterNotModal(G)); @@ -4385,7 +4385,7 @@ static PyObject *CmdSetFrame(PyObject * self, PyObject * args) static PyObject *CmdFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int frm,trigger; API_SETUP_ARGS(G, self, args, "Oii", &self, &frm, &trigger); API_ASSERT(APIEnterNotModal(G)); @@ -4396,7 +4396,7 @@ static PyObject *CmdFrame(PyObject * self, PyObject * args) static PyObject *CmdStereo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1; API_SETUP_ARGS(G, self, args, "Oi", &self, &i1); API_ASSERT(APIEnterNotModal(G)); @@ -4407,7 +4407,7 @@ static PyObject *CmdStereo(PyObject * self, PyObject * args) static PyObject *CmdReset(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *obj; API_SETUP_ARGS(G, self, args, "Os", &self, &obj); API_ASSERT(APIEnterNotModal(G)); @@ -4419,7 +4419,7 @@ static PyObject *CmdReset(PyObject * self, PyObject * args) #if 0 static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float m[16]; int ok = false; ok = PyArg_ParseTuple(args, "Offffffffffffffff", &self, @@ -4428,7 +4428,7 @@ static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) &m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4442,7 +4442,7 @@ static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetMinMax(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float mn[3], mx[3]; char *str1; int state; @@ -4466,14 +4466,14 @@ static PyObject *CmdGetMinMax(PyObject * self, PyObject * args) #if 0 static PyObject *CmdGetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float *f; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4492,10 +4492,10 @@ static PyObject *CmdGetMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; char *name; - double *history = NULL; + double *history = nullptr; int ok = false; int found; int state; @@ -4503,7 +4503,7 @@ static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi|i", &self, &name, &state, &incl_ttt); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4531,11 +4531,11 @@ static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; const char *name; int state, quiet; - const float *ttt = NULL; + const float *ttt = nullptr; if (!PyArg_ParseTuple(args, "Osii", &self, &name, &state, &quiet)) { API_HANDLE_ERROR; @@ -4557,7 +4557,7 @@ static PyObject *CmdGetObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdMDo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *cmd; int frame; int append; @@ -4565,7 +4565,7 @@ static PyObject *CmdMDo(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oisi", &self, &frame, &cmd, &append); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4591,13 +4591,13 @@ static PyObject *CmdMDo(PyObject * self, PyObject * args) static PyObject *CmdMPlay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int cmd; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &cmd); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4610,13 +4610,13 @@ static PyObject *CmdMPlay(PyObject * self, PyObject * args) static PyObject *CmdMMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int cmd; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &cmd); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4629,12 +4629,12 @@ static PyObject *CmdMMatrix(PyObject * self, PyObject * args) static PyObject *CmdMClear(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4647,12 +4647,12 @@ static PyObject *CmdMClear(PyObject * self, PyObject * args) static PyObject *CmdRefreshLater(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4665,12 +4665,12 @@ static PyObject *CmdRefreshLater(PyObject * self, PyObject * args) static PyObject *CmdRefresh(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4684,12 +4684,12 @@ static PyObject *CmdRefresh(PyObject * self, PyObject * args) static PyObject *CmdRefreshNow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4728,7 +4728,7 @@ static PyObject* CmdPopValidContext(PyObject* self, PyObject* args) static PyObject *CmdPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* filename = nullptr; int quiet; int result = 0; @@ -4750,7 +4750,7 @@ static PyObject *CmdPNG(PyObject * self, PyObject * args) if(!prior) { if(ray || (!G->HaveGUI && (!SceneGetCopyType(G) || width || height))) { prior = SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, quiet, NULL, true, -1); + nullptr, nullptr, 0.0F, 0.0F, quiet, nullptr, true, -1); } else if(width || height) { prior = !SceneDeferImage(G, width, height, fileview.c_str(), -1, dpi, format, quiet, nullptr); @@ -4784,7 +4784,7 @@ static PyObject *CmdPNG(PyObject * self, PyObject * args) static PyObject *CmdMPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2, int3, int4, format, mode, quiet; int ok = false; @@ -4794,7 +4794,7 @@ static PyObject *CmdMPNG(PyObject * self, PyObject * args) &width, &height); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4810,7 +4810,7 @@ static PyObject *CmdMPNG(PyObject * self, PyObject * args) static PyObject *CmdMSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int start_from,freeze; API_SETUP_ARGS(G, self, args, "Osii", &self, &str1, &start_from,&freeze); @@ -4822,7 +4822,7 @@ static PyObject *CmdMSet(PyObject * self, PyObject * args) static PyObject *CmdMModify(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *object; int action,index,count,target,freeze,quiet; API_SETUP_ARGS(G, self, args, "Oiiiisii", &self, &action, &index, &count, @@ -4835,7 +4835,7 @@ static PyObject *CmdMModify(PyObject * self, PyObject * args) static PyObject *CmdMView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int action, first, last, simple, wrap, window, cycles, quiet, state, autogen; float power, bias, linear, hand, scene_cut; @@ -4845,7 +4845,7 @@ static PyObject *CmdMView(PyObject * self, PyObject * args) &window, &cycles, &scene_name, &scene_cut, &quiet, &state, &autogen); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4860,7 +4860,7 @@ static PyObject *CmdMView(PyObject * self, PyObject * args) static PyObject *CmdViewport(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int w, h; API_SETUP_ARGS(G, self, args, "Oii", &self, &w, &h); API_ASSERT(APIEnterNotModal(G)); @@ -4922,7 +4922,7 @@ static PyObject *CmdViewport(PyObject * self, PyObject * args) static PyObject *CmdFlag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int flag; int action; @@ -4936,7 +4936,7 @@ static PyObject *CmdFlag(PyObject * self, PyObject * args) static PyObject *CmdColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *color; int flags; int quiet; @@ -4950,7 +4950,7 @@ static PyObject *CmdColor(PyObject * self, PyObject * args) static PyObject *CmdColorDef(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* color; float v[3]; int mode; @@ -4964,7 +4964,7 @@ static PyObject *CmdColorDef(PyObject * self, PyObject * args) static PyObject *CmdDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2; int quiet, antialias; @@ -4988,7 +4988,7 @@ static PyObject *CmdDraw(PyObject * self, PyObject * args) static PyObject *CmdRay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int w, h, mode; float angle, shift; int quiet; @@ -5007,7 +5007,7 @@ static PyObject *CmdRay(PyObject * self, PyObject * args) static PyObject *CmdClip(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float dist; char *str1; @@ -5035,7 +5035,7 @@ static PyObject* CmdGetClip(PyObject* self, PyObject* args) static PyObject *CmdMove(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float dist; API_SETUP_ARGS(G, self, args, "Osf", &self, &sname, &dist); @@ -5047,7 +5047,7 @@ static PyObject *CmdMove(PyObject * self, PyObject * args) static PyObject *CmdTurn(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float angle; API_SETUP_ARGS(G, self, args, "Osf", &self, &sname, &angle); @@ -5059,7 +5059,7 @@ static PyObject *CmdTurn(PyObject * self, PyObject * args) static PyObject *CmdUnset(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str; int state; @@ -5074,7 +5074,7 @@ static PyObject *CmdUnset(PyObject * self, PyObject * args) static PyObject *CmdUnsetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str3, *str4; int state; @@ -5099,7 +5099,7 @@ static PyObject *CmdUnsetBond(PyObject * self, PyObject * args) static PyObject *CmdSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; PyObject *value; char *str; @@ -5116,7 +5116,7 @@ static PyObject *CmdSet(PyObject * self, PyObject * args) static PyObject *CmdSetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; PyObject *value; char *str3, *str4; @@ -5144,7 +5144,7 @@ static PyObject *CmdSetBond(PyObject * self, PyObject * args) static PyObject *CmdGetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str3, *str4; int state; @@ -5169,7 +5169,7 @@ static PyObject *CmdGetBond(PyObject * self, PyObject * args) static PyObject *CmdDelete(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; API_SETUP_ARGS(G, self, args, "Os", &self, &sname); API_ASSERT(APIEnterNotModal(G)); @@ -5180,7 +5180,7 @@ static PyObject *CmdDelete(PyObject * self, PyObject * args) static PyObject *CmdCartoon(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int type; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &type); @@ -5192,7 +5192,7 @@ static PyObject *CmdCartoon(PyObject * self, PyObject * args) static PyObject *CmdShowHide(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *sname; int rep; int state; @@ -5218,7 +5218,7 @@ static PyObject *CmdShowHide(PyObject * self, PyObject * args) static PyObject *CmdOnOffBySele(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int onoff; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &onoff); @@ -5230,7 +5230,7 @@ static PyObject *CmdOnOffBySele(PyObject * self, PyObject * args) static PyObject *CmdOnOff(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; int parents = 0; @@ -5243,7 +5243,7 @@ static PyObject *CmdOnOff(PyObject * self, PyObject * args) static PyObject *CmdToggle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &rep); @@ -5255,19 +5255,19 @@ static PyObject *CmdToggle(PyObject * self, PyObject * args) static PyObject *CmdQuit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int code = EXIT_SUCCESS; ok = PyArg_ParseTuple(args, "O|i", &self, &code); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { if(!APIEnterNotModal(G)) { /* override modal state to enable quit */ - PyMOL_SetModalDraw(G->PyMOL, NULL); + PyMOL_SetModalDraw(G->PyMOL, nullptr); APIEnter(G); } if(!G->Option->no_quit) { @@ -5283,7 +5283,7 @@ static PyObject *CmdQuit(PyObject * self, PyObject * args) static PyObject *CmdFullScreen(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int flag = 0; int ok = false; API_SETUP_ARGS(G, self, args, "Oi", &self, &flag); @@ -5295,7 +5295,7 @@ static PyObject *CmdFullScreen(PyObject * self, PyObject * args) static PyObject *CmdGroup(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *gname, *names; int quiet, action; int ok = false; @@ -5310,7 +5310,7 @@ static PyObject *CmdGroup(PyObject * self, PyObject * args) static PyObject *CmdSelect(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname, *sele; int quiet; int state = 0; @@ -5331,7 +5331,7 @@ static PyObject *CmdSelect(PyObject * self, PyObject * args) static PyObject *CmdFinishObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* oname; API_SETUP_ARGS(G, self, args, "Os", &self, &oname); @@ -5353,7 +5353,7 @@ static PyObject *CmdFinishObject(PyObject * self, PyObject * args) static PyObject *CmdLoadObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *oname; PyObject *model; int frame, type; @@ -5370,11 +5370,11 @@ static PyObject *CmdLoadObject(PyObject * self, PyObject * args) static PyObject *CmdSetStateOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *oname; PyObject *order; - pymol::CObject *obj = NULL; - int *int_array = NULL; + pymol::CObject *obj = nullptr; + int *int_array = nullptr; int ok = false; if(!PyArg_ParseTuple(args, "OsO", &self, &oname, &order)) { @@ -5416,11 +5416,11 @@ static PyObject *CmdSetStateOrder(PyObject * self, PyObject * args) static PyObject *CmdLoadCoords(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state = 0; OrthoLineType s1; - PyObject *coords = NULL; + PyObject *coords = nullptr; API_SETUP_ARGS(G, self, args, "OsO|i", &self, &str1, &coords, &state); pymol::Result<> result; @@ -5448,7 +5448,7 @@ static PyObject *CmdLoadCoords(PyObject * self, PyObject * args) static PyObject *CmdLoadCoordSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* oname; PyObject *model; int frame; @@ -5463,11 +5463,11 @@ static PyObject *CmdLoadCoordSet(PyObject * self, PyObject * args) static PyObject *CmdLoad(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *fname, *oname; - char *object_props = NULL; - char *atom_props = NULL; - char *plugin = NULL; + char *object_props = nullptr; + char *atom_props = nullptr; + char *plugin = nullptr; int frame; cLoadType_t type; int finish, discrete; @@ -5497,13 +5497,13 @@ static PyObject *CmdLoad(PyObject * self, PyObject * args) static PyObject *CmdLoadTraj(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *fname, *oname; int frame, type; int interval, average, start, stop, max, image; char *str1; float shift[3]; - char *plugin = NULL; + char *plugin = nullptr; int quiet = 0; /* TODO */ API_SETUP_ARGS(G, self, args, "Ossiiiiiiisifffs", &self, &oname, &fname, &frame, &type, &interval, &average, &start, &stop, &max, &str1, &image, @@ -5517,7 +5517,7 @@ static PyObject *CmdLoadTraj(PyObject * self, PyObject * args) static PyObject *CmdOrigin(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *obj; float v[3]; int state; @@ -5530,7 +5530,7 @@ static PyObject *CmdOrigin(PyObject * self, PyObject * args) static PyObject *CmdSort(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; API_SETUP_ARGS(G, self, args, "Os", &self, &name); API_ASSERT(APIEnterNotModal(G)); @@ -5544,7 +5544,7 @@ static PyObject *CmdAssignSS(PyObject * self, PyObject * args) /* EXPERIMENTAL */ { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int state, quiet; char *str1, *str2; int preserve; @@ -5561,7 +5561,7 @@ static PyObject *CmdSpheroid(PyObject * self, PyObject * args) /* EXPERIMENTAL */ { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int average; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &average); @@ -5573,7 +5573,7 @@ static PyObject *CmdSpheroid(PyObject * self, PyObject * args) static PyObject *CmdTest(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; /* regression tests */ int ok = false; @@ -5583,7 +5583,7 @@ static PyObject *CmdTest(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oii", &self, &group, &code); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5600,7 +5600,7 @@ static PyObject *CmdTest(PyObject * self, PyObject * args) static PyObject *CmdCenter(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int origin; @@ -5624,7 +5624,7 @@ static PyObject *CmdCenter(PyObject * self, PyObject * args) static PyObject *CmdReference(PyObject * self, PyObject * args) { int ok = false; - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; OrthoLineType s1; int action; char *sele1; @@ -5633,7 +5633,7 @@ static PyObject *CmdReference(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oisii", &self, &action, &sele1, &state, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5649,7 +5649,7 @@ static PyObject *CmdReference(PyObject * self, PyObject * args) static PyObject *CmdZoom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; float buffer; int state; @@ -5668,7 +5668,7 @@ static PyObject *CmdZoom(PyObject * self, PyObject * args) static PyObject *CmdIsolevel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float level; int state; char *name; @@ -5689,7 +5689,7 @@ static PyObject *CmdIsolevel(PyObject * self, PyObject * args) static PyObject *CmdHAdd(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; int state; @@ -5703,7 +5703,7 @@ static PyObject *CmdHAdd(PyObject * self, PyObject * args) static PyObject *CmdSetObjectColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *color; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &name, &color, &quiet); @@ -5715,7 +5715,7 @@ static PyObject *CmdSetObjectColor(PyObject * self, PyObject * args) static PyObject *CmdGetObjectColorIndex(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); APIEnter(G); @@ -5726,7 +5726,7 @@ static PyObject *CmdGetObjectColorIndex(PyObject * self, PyObject * args) static PyObject *CmdRemove(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &quiet); @@ -5738,7 +5738,7 @@ static PyObject *CmdRemove(PyObject * self, PyObject * args) static PyObject *CmdRemovePicked(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1; int quiet; API_SETUP_ARGS(G, self, args, "Oii", &self, &i1, &quiet); @@ -5750,7 +5750,7 @@ static PyObject *CmdRemovePicked(PyObject * self, PyObject * args) static PyObject *CmdHFill(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; API_SETUP_ARGS(G, self, args, "Oi", &self, &quiet); API_ASSERT(APIEnterNotModal(G)); @@ -5761,7 +5761,7 @@ static PyObject *CmdHFill(PyObject * self, PyObject * args) static PyObject *CmdHFix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; char *str1; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &quiet); @@ -5777,7 +5777,7 @@ static PyObject *CmdHFix(PyObject * self, PyObject * args) static PyObject *CmdCycleValence(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; API_SETUP_ARGS(G, self, args, "Oi", &self, &quiet); API_ASSERT(APIEnterNotModal(G)); @@ -5788,7 +5788,7 @@ static PyObject *CmdCycleValence(PyObject * self, PyObject * args) static PyObject *CmdReplace(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; char *str1, *str2; int quiet; @@ -5801,7 +5801,7 @@ static PyObject *CmdReplace(PyObject * self, PyObject * args) static PyObject *CmdSetGeometry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int geom, valence; char *sele; API_SETUP_ARGS(G, self, args, "Osii", &self, &sele, &geom, &valence); @@ -5813,7 +5813,7 @@ static PyObject *CmdSetGeometry(PyObject * self, PyObject * args) static PyObject *CmdAttach(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; char *str1; int quiet; @@ -5827,7 +5827,7 @@ static PyObject *CmdAttach(PyObject * self, PyObject * args) static PyObject *CmdFuse(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int mode; int recolor; @@ -5843,7 +5843,7 @@ static PyObject *CmdFuse(PyObject * self, PyObject * args) static PyObject *CmdUnpick(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); EditorInactivate(G); @@ -5853,7 +5853,7 @@ static PyObject *CmdUnpick(PyObject * self, PyObject * args) static PyObject *CmdEdit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0, *str1, *str2, *str3; int pkresi, pkbond; int quiet; @@ -5872,7 +5872,7 @@ static PyObject *CmdEdit(PyObject * self, PyObject * args) static PyObject *CmdDrag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0; OrthoLineType s0 = ""; int ok = false; @@ -5881,7 +5881,7 @@ static PyObject *CmdDrag(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osii", &self, &str0, &quiet,&mode); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5898,7 +5898,7 @@ static PyObject *CmdDrag(PyObject * self, PyObject * args) static PyObject *CmdRename(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -5911,7 +5911,7 @@ static PyObject *CmdRename(PyObject * self, PyObject * args) static PyObject *CmdOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -5924,7 +5924,7 @@ static PyObject *CmdOrder(PyObject * self, PyObject * args) static PyObject *CmdScrollTo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int i = 0, r = -1; @@ -5948,7 +5948,7 @@ static PyObject *CmdScrollTo(PyObject * self, PyObject * args) static PyObject *CmdWindow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, x, y, width, height; API_SETUP_ARGS(G, self, args, "Oiiiii", &self, &int1, &x, &y, &width, &height); API_ASSERT(G->HaveGUI); @@ -5999,7 +5999,7 @@ static PyObject *CmdWindow(PyObject * self, PyObject * args) static PyObject *CmdCEAlign(PyObject *self, PyObject *args) { - PyMOLGlobals * G = NULL; + PyMOLGlobals * G = nullptr; int ok = false; int windowSize = 8, gap_max=30; float d0=3.0, d1=4.0; @@ -6014,7 +6014,7 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -6023,14 +6023,14 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) lenA = PyList_Size(listA); if (lenA < 1) { - result = NULL; + result = nullptr; ok = false; } if(ok) lenB = PyList_Size(listB); if (ok && lenB < 1) { - result = NULL; + result = nullptr; ok = false; } @@ -6046,7 +6046,7 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) static PyObject *CmdVolume(PyObject *self, PyObject *args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *volume_name, *map_name, *sele; float lvl, fbuf; int state = -1; @@ -6064,7 +6064,7 @@ static PyObject *CmdVolume(PyObject *self, PyObject *args) static PyObject *CmdAssignAtomTypes(PyObject *self, PyObject *args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int state = -1; int ok = false; @@ -6095,7 +6095,7 @@ static PyObject *CmdSetDiscrete(PyObject * self, PyObject * args) if (!PyArg_ParseTuple(args, "Osi", &self, &name, &discrete)) { API_HANDLE_ERROR; } else { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_PYMOL_GLOBALS; if (G && APIEnterBlockedNotModal(G)) { @@ -6117,7 +6117,7 @@ static PyObject *CmdSetDiscrete(PyObject * self, PyObject * args) static PyObject *CmdCountDiscrete(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; pymol::vla list; @@ -6145,10 +6145,10 @@ static PyObject *CmdCountDiscrete(PyObject * self, PyObject * args) */ static PyObject *CmdCifGetArray(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *name, *key, *dtype = ""; ObjectMolecule *obj; - PyObject *ret = NULL; + PyObject *ret = nullptr; ok_assert(1, PyArg_ParseTuple(args, "Oss|s", &self, &name, &key, &dtype)); API_SETUP_PYMOL_GLOBALS; @@ -6524,7 +6524,7 @@ static PyMethodDef Cmd_methods[] = { {"update", CmdUpdate, METH_VARARGS}, {"window", CmdWindow, METH_VARARGS}, {"zoom", CmdZoom, METH_VARARGS}, - {NULL, NULL} /* sentinel */ + {NULL, nullptr} /* sentinel */ }; #ifdef __cplusplus diff --git a/layer4/Menu.cpp b/layer4/Menu.cpp index ce75199c5..51511ec19 100644 --- a/layer4/Menu.cpp +++ b/layer4/Menu.cpp @@ -38,7 +38,7 @@ void MenuActivate(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int pa if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -60,7 +60,7 @@ void MenuActivate3fv(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -79,7 +79,7 @@ void MenuActivate2Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -89,7 +89,7 @@ void MenuActivate2Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in Block *MenuActivate1Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int passive, const char *name, const char *arg1) { - Block *block = NULL; + Block *block = nullptr; #ifndef _PYMOL_NOPY PyObject *list; PBlock(G); @@ -98,7 +98,7 @@ Block *MenuActivate1Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, if(PyErr_Occurred()) PyErr_Print(); if(list) { - block = PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + block = PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -118,7 +118,7 @@ void MenuActivate0Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); diff --git a/layer4/PopUp.cpp b/layer4/PopUp.cpp index 26870de1d..0792cdab8 100644 --- a/layer4/PopUp.cpp +++ b/layer4/PopUp.cpp @@ -92,7 +92,7 @@ static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) { if(!PyList_Check(elem)) { PBlock(G); - elem = PyObject_CallObject(elem, NULL); + elem = PyObject_CallObject(elem, nullptr); if(PyErr_Occurred()) PyErr_Print(); @@ -107,7 +107,7 @@ static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) { ok_except1: #endif - return NULL; + return nullptr; } /*========================================================================*/ @@ -123,7 +123,7 @@ static Block *PopUpRecursiveFind(Block * block, int x, int y) OrthoGrab(G, block); return block; } - return NULL; + return nullptr; } @@ -132,7 +132,7 @@ Block *PopUpNew(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int passive, PyObject * list, Block * parent) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else /* assumes blocked threads (calls the Python C API) */ @@ -164,11 +164,11 @@ Block *PopUpNew(PyMOLGlobals * G, int x, int y, int last_x, int last_y, } I->Parent = parent; - I->Child = NULL; + I->Child = nullptr; I->NLine = PyList_Size(list); - I->Text = NULL; - I->Command = NULL; - I->Code = NULL; + I->Text = nullptr; + I->Command = nullptr; + I->Code = nullptr; I->Selected = -1; I->StartX = (I->LastX = last_x); I->StartY = (I->LastY = last_y); @@ -361,7 +361,7 @@ static void PopUpForgetChild(Block * block) { CPopUp *I = (CPopUp *) block->reference; - I->Child = NULL; + I->Child = nullptr; } static void PopUpRecursiveDetach(Block * block) @@ -410,7 +410,7 @@ static void PopUpRecursiveFree(Block * block) if(I->Child) PopUpFree(I->Child); - I->Child = NULL; + I->Child = nullptr; if(I->Parent) { PopUpForgetChild(I->Parent); PopUpRecursiveFree(I->Parent); @@ -423,7 +423,7 @@ static void PopUpFreeRecursiveChild(Block * block) CPopUp *I = (CPopUp *) block->reference; if(I->Child) PopUpFreeRecursiveChild(I->Child); - I->Child = NULL; + I->Child = nullptr; PopUpFree(block); } @@ -528,7 +528,7 @@ int CPopUp::drag(int x, int y, int mod) if(I->ChildDelay < UtilGetSeconds(G)) { PopUpDetachRecursiveChild(I->Child); PopUpFreeRecursiveChild(I->Child); - I->Child = NULL; + I->Child = nullptr; I->ChildLine = -1; OrthoDirty(G); OrthoInvalidateDoDraw(G); diff --git a/layer5/PyMOL.cpp b/layer5/PyMOL.cpp index 3cce84afd..d31d58d63 100644 --- a/layer5/PyMOL.cpp +++ b/layer5/PyMOL.cpp @@ -84,7 +84,7 @@ #include #ifndef _PYMOL_NOPY -PyMOLGlobals *SingletonPyMOLGlobals = NULL; +PyMOLGlobals *SingletonPyMOLGlobals = nullptr; #endif #ifdef _PYMOL_LIB_HAS_PYTHON @@ -971,7 +971,7 @@ PyMOLreturn_status PyMOL_CmdSelect(CPyMOL * I, const char *name, const char *sel int ret = -1; PYMOL_API_LOCK - auto res = SelectorCreate(I->G, name, selection, NULL, quiet, NULL); + auto res = SelectorCreate(I->G, name, selection, nullptr, quiet, nullptr); ret = res ? res.result() : -1; PYMOL_API_UNLOCK return return_status_ok(ret >= 0); // if ret is negative it should fail @@ -1449,8 +1449,8 @@ PyMOLreturn_status PyMOL_CmdRampNew(CPyMOL * I, const char *name, const char *ma int ok = true; PyMOLreturn_status result = { PyMOLstatus_FAILURE }; OrthoLineType s1 = ""; - float *color_vla = NULL; - float *range_vla = NULL; + float *color_vla = nullptr; + float *range_vla = nullptr; PYMOL_API_LOCK if(selection && selection[0]) { if(ok) ok = (SelectorGetTmp(I->G, selection, s1) >= 0); @@ -1621,7 +1621,7 @@ static PyMOLreturn_status Loader(CPyMOL * I, const char *content, const char *co content_length, pymol_content_type, object_name, - state - 1, zoom, discrete, finish, multiplex, quiet, NULL, 0, NULL); + state - 1, zoom, discrete, finish, multiplex, quiet, nullptr, 0, nullptr); ok = static_cast(result); } } @@ -1707,7 +1707,7 @@ PyMOLreturn_status PyMOL_CmdPseudoatom(CPyMOL * I, const char *object_name, cons pos[1] = y; pos[2] = z; } else { - pos = NULL; + pos = nullptr; } auto pseudoatom_name = ExecutivePreparePseudoatomName(I->G, object_name); auto res = ExecutivePseudoatom(I->G, pseudoatom_name, selection, name, @@ -1820,7 +1820,7 @@ static const CPyMOLOptions Defaults = { CPyMOLOptions *PyMOLOptions_New(void) { - CPyMOLOptions *result = NULL; + CPyMOLOptions *result = nullptr; result = pymol::calloc(1); if(result) *result = Defaults; @@ -2067,7 +2067,7 @@ void PyMOL_Free(CPyMOL * I) #ifndef _PYMOL_NOPY FreeP(I->G->P_inst); if(I->G == SingletonPyMOLGlobals) - SingletonPyMOLGlobals = NULL; + SingletonPyMOLGlobals = nullptr; #endif FreeP(I->G); @@ -2259,7 +2259,7 @@ void PyMOL_DrawWithoutLock(CPyMOL * I) if (!glDebugMessageCallback) { printf("glDebugMessageCallback not available\n"); } else { - glDebugMessageCallback(gl_debug_proc, NULL); + glDebugMessageCallback(gl_debug_proc, nullptr); glEnable(GL_DEBUG_OUTPUT); } #else @@ -2276,7 +2276,7 @@ void PyMOL_DrawWithoutLock(CPyMOL * I) } { PyMOLModalDrawFn *fn = I->ModalDraw; - I->ModalDraw = NULL; /* always resets to NULL! */ + I->ModalDraw = nullptr; /* always resets to nullptr! */ fn(G); } @@ -2562,7 +2562,7 @@ int PyMOL_GetReshape(CPyMOL * I) PyMOLreturn_int_array PyMOL_GetReshapeInfo(CPyMOL * I, int reset) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, PYMOL_RESHAPE_SIZE, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, PYMOL_RESHAPE_SIZE, nullptr }; PYMOL_API_LOCK if(reset) I->ReshapeFlag = false; @@ -2616,7 +2616,7 @@ int PyMOL_GetClickReady(CPyMOL * I, int reset) char *PyMOL_GetClickString(CPyMOL * I, int reset) { - char *result = NULL; + char *result = nullptr; PYMOL_API_LOCK int ready = I->ClickReadyFlag; if(reset) I->ClickReadyFlag = false; @@ -2743,7 +2743,7 @@ int PyMOL_GetImageReady(CPyMOL * I, int reset) PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL * I) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, nullptr }; PYMOL_API_LOCK result.array = VLAlloc(int, 2); if(!result.array) { result.status = PyMOLstatus_FAILURE; @@ -2768,7 +2768,7 @@ PyMOLreturn_int_array PyMOL_GetImageDataReturned(CPyMOL * I, int width, int height, int row_bytes, int mode, int reset) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int ok = true; int size; void *buffer; @@ -2793,7 +2793,7 @@ PyMOLreturn_int_array PyMOL_GetImageDataReturned(CPyMOL * I, int PyMOL_FreeResultString(CPyMOL * I, char *st) { PYMOL_API_LOCK FreeP(st); - PYMOL_API_UNLOCK return get_status_ok((st != NULL)); + PYMOL_API_UNLOCK return get_status_ok((st != nullptr)); } int PyMOL_GetRedisplay(CPyMOL * I, int reset) @@ -2804,7 +2804,7 @@ int PyMOL_GetRedisplay(CPyMOL * I, int reset) result = I->RedisplayFlag; if(result) { - if(SettingGet_b(G, NULL, NULL, cSetting_defer_updates)) { + if(SettingGet_b(G, nullptr, nullptr, cSetting_defer_updates)) { result = false; } else { if(reset) @@ -2825,7 +2825,7 @@ int PyMOL_GetPassive(CPyMOL * I, int reset) int PyMOL_GetModalDraw(CPyMOL * I) { if(I) - return (I->ModalDraw != NULL); + return (I->ModalDraw != nullptr); return false; } @@ -3061,7 +3061,7 @@ PyMOLreturn_status PyMOL_SetIsEnabledCallback(CPyMOL * I, void *CallbackObject, } PyMOLreturn_int_array PyMOL_GetRepsInSceneForObject(CPyMOL * I, const char *name){ - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int *retarr = 0; PYMOL_API_LOCK retarr = ExecutiveGetRepsInSceneForObject(I->G, name); @@ -3075,7 +3075,7 @@ PyMOLreturn_int_array PyMOL_GetRepsInSceneForObject(CPyMOL * I, const char *name } PyMOLreturn_int_array PyMOL_GetRepsForObject(CPyMOL * I, const char *name){ - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int *retarr = 0; PYMOL_API_LOCK retarr = ExecutiveGetRepsForObject(I->G, name); diff --git a/layer5/TestPyMOL.cpp b/layer5/TestPyMOL.cpp index 8a4ec05fa..ff43b14d7 100644 --- a/layer5/TestPyMOL.cpp +++ b/layer5/TestPyMOL.cpp @@ -42,7 +42,7 @@ static int TestPyMOL_00_00(PyMOLGlobals * G) { ObjectMap *obj; ObjectMapDesc _md, *md; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; int a; @@ -66,14 +66,14 @@ static int TestPyMOL_00_00(PyMOLGlobals * G) ObjectSetName(obj, "00_00"); ExecutiveManageObject(G, obj, -1, false); } - return (obj != NULL); + return (obj != nullptr); } #define STR_MAX 100 static char *get_st(const char array[][STR_MAX]) { - char *result = NULL; + char *result = nullptr; size_t c = 0, l = 0; while(array[c][0]) { l += strlen(array[c]); @@ -301,7 +301,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) break; case 2: { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; float pos[3] = { 0.0, 0.0, 0.0 }; PBlock(G); obj = ObjectCGONewVFontTest(G, "hello", pos); @@ -314,7 +314,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) break; case 3: { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; obj = ObjectGadgetTest(G); if(obj) { ObjectSetName(obj, "gadget"); @@ -419,7 +419,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_07", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); ExecutiveSetRepVisib(G, "test_01_07", cRepCyl, 1); ExecutiveSetRepVisib(G, "test_01_07", cRepLine, 0); SettingSetGlobal_b(G, cSetting_valence, 1); @@ -434,7 +434,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_08", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); SettingSetGlobal_b(G, cSetting_valence, 1); ControlRock(G, 1); FreeP(st); @@ -445,7 +445,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_09", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); ExecutiveSetRepVisib(G, "test_01_09", cRepMesh, 1); ExecutiveSetRepVisib(G, "test_01_09", cRepLine, 0); SettingSetGlobal_b(G, cSetting_valence, 1); diff --git a/layer5/main.cpp b/layer5/main.cpp index 60d268449..3840f1d1a 100644 --- a/layer5/main.cpp +++ b/layer5/main.cpp @@ -70,7 +70,7 @@ static void MainReshape(int width, int height); static void MainDrawLocked(void); static void MainDrag(int x, int y); -static CPyMOL *PyMOLInstance = NULL; /* eliminate */ +static CPyMOL *PyMOLInstance = nullptr; /* eliminate */ struct _CMain { int IdleMode; @@ -1248,7 +1248,7 @@ static void launch(CPyMOLOptions * options, int own_the_options) int multisample_mask = 0; int theWindow = 0; - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyMOLInstance = PyMOL_NewWithOptions(options); G = PyMOL_GetGlobals(PyMOLInstance); @@ -1489,9 +1489,9 @@ int main_shared(int block_input_hook) PyObject *MainAsPyList(PyMOLGlobals *G) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; int width, height; result = PyList_New(2); width = SceneGetBlock(G)->getWidth(); @@ -1517,7 +1517,7 @@ int MainFromPyList(PyMOLGlobals *G, PyObject * list) OrthoLineType buffer; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) diff --git a/layerCTest/Test_VLA.cpp b/layerCTest/Test_VLA.cpp index fbf54e475..f509b40b9 100644 --- a/layerCTest/Test_VLA.cpp +++ b/layerCTest/Test_VLA.cpp @@ -54,17 +54,17 @@ TEST_CASE("VLA single non-zero-int Initializer List", "[VLA]") REQUIRE(myVLA[0] == 5); } -TEST_CASE("VLA nullptr Assign", "[VLA]") +TEST_CASE("VLA NULL Assign", "[VLA]") { vla myVLA{1, 2, 3, 4, 5}; - myVLA = nullptr; + myVLA = NULL; REQUIRE(isNullptr(myVLA.data())); } -TEST_CASE("VLA NULL Assign", "[VLA]") +TEST_CASE("VLA nullptr Assign", "[VLA]") { vla myVLA{1, 2, 3, 4, 5}; - myVLA = NULL; + myVLA = nullptr; REQUIRE(isNullptr(myVLA.data())); }