Replace occurrences of NULL with nullptr.

This commit is contained in:
Robert Maynard 2017-05-03 08:27:14 -04:00
parent 5a4c029719
commit 57ab48fe8e
17 changed files with 61 additions and 61 deletions

@ -77,7 +77,7 @@ inline GLuint LoadShaders()
// Compile Vertex Shader
std::cout << "Compiling vertex shader" << std::endl;
char const * VertexSourcePointer = VertexShaderCode.c_str();
glShaderSource(VertexShaderID, 1, &VertexSourcePointer, NULL);
glShaderSource(VertexShaderID, 1, &VertexSourcePointer, nullptr);
glCompileShader(VertexShaderID);
// Check Vertex Shader
@ -86,14 +86,14 @@ inline GLuint LoadShaders()
std::vector<char> VertexShaderErrorMessage( static_cast<std::size_t>(InfoLogLength) );
if(VertexShaderErrorMessage.size() > 0)
{
glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
glGetShaderInfoLog(VertexShaderID, InfoLogLength, nullptr, &VertexShaderErrorMessage[0]);
std::cout << &VertexShaderErrorMessage[0] << std::endl;
}
// Compile Fragment Shader
std::cout << "Compiling fragment shader" << std::endl;
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer, NULL);
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer, nullptr);
glCompileShader(FragmentShaderID);
// Check Fragment Shader
@ -102,7 +102,7 @@ inline GLuint LoadShaders()
std::vector<char> FragmentShaderErrorMessage( static_cast<std::size_t>(InfoLogLength) );
if(FragmentShaderErrorMessage.size() > 0)
{
glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
glGetShaderInfoLog(FragmentShaderID, InfoLogLength, nullptr, &FragmentShaderErrorMessage[0]);
std::cout << &FragmentShaderErrorMessage[0] << std::endl;
}
@ -119,7 +119,7 @@ inline GLuint LoadShaders()
std::vector<char> ProgramErrorMessage( static_cast<std::size_t>(InfoLogLength) );
if(ProgramErrorMessage.size() > 0)
{
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
glGetProgramInfoLog(ProgramID, InfoLogLength, nullptr, &ProgramErrorMessage[0]);
std::cout << &ProgramErrorMessage[0] << std::endl;
}

@ -1062,7 +1062,7 @@ public:
VTKM_EXEC_CONT
VecC()
: Components(NULL), NumberOfComponents(0)
: Components(nullptr), NumberOfComponents(0)
{ }
VTKM_EXEC_CONT
@ -1151,7 +1151,7 @@ public:
VTKM_EXEC_CONT
VecCConst()
: Components(NULL), NumberOfComponents(0)
: Components(nullptr), NumberOfComponents(0)
{ }
VTKM_EXEC_CONT

@ -86,14 +86,14 @@ public:
size_t j=range.size;
// Partition interval [i+1,j-1] with key *key0.
for(;;) {
__TBB_ASSERT( i<j, NULL );
__TBB_ASSERT( i<j, nullptr );
// Loop must terminate since array[l]==*key0.
do {
--j;
__TBB_ASSERT( i<=j, "bad ordering relation?" );
} while( comp( *key0, array[j] ));
do {
__TBB_ASSERT( i<=j, NULL );
__TBB_ASSERT( i<=j, nullptr );
if( i==j ) goto partition;
++i;
} while( comp( array[i],*key0 ));

@ -245,7 +245,7 @@ UniformTests()
void
TestDataSetBuilderUniform()
{
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(NULL));
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(nullptr));
std::cout << "Seed: " << seed << std::endl;
g_RandomGenerator.seed(seed);

@ -54,7 +54,7 @@ public:
VTKM_CONT
AtomicArray()
: AtomicImplementation(vtkm::cont::make_ArrayHandle((T*)NULL, 0))
: AtomicImplementation(vtkm::cont::make_ArrayHandle((T*)nullptr, 0))
{ }
template<typename StorageType>

@ -41,7 +41,7 @@ class ErrorMessageBuffer
{
public:
VTKM_EXEC_CONT ErrorMessageBuffer()
: MessageBuffer(NULL), MessageBufferSize(0) { }
: MessageBuffer(nullptr), MessageBufferSize(0) { }
VTKM_EXEC_CONT
ErrorMessageBuffer(char *messageBuffer, vtkm::Id bufferSize)

@ -36,7 +36,7 @@ namespace {
struct TestExecObject
{
VTKM_EXEC_CONT
TestExecObject() : Value(NULL) { }
TestExecObject() : Value(nullptr) { }
VTKM_EXEC_CONT
TestExecObject(vtkm::Id *value) : Value(value) { }

@ -316,7 +316,7 @@ struct TestDerivativeFunctor
void TestDerivative()
{
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(std::time(NULL));
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(std::time(nullptr));
std::cout << "Seed: " << seed << std::endl;
g_RandomGenerator.seed(seed);

@ -89,7 +89,7 @@ public:
}
BufferState():
OpenGLHandle(NULL),
OpenGLHandle(nullptr),
BufferType(GL_INVALID_VALUE),
SizeOfActiveSection(0),
CapacityOfBuffer(0),

@ -102,7 +102,7 @@ void CanvasEGL::Initialize()
}
eglBindAPI(EGL_OPENGL_API);
this->Internals->Context =
eglCreateContext(this->Internals->Display, cfg, EGL_NO_CONTEXT, NULL);
eglCreateContext(this->Internals->Display, cfg, EGL_NO_CONTEXT, nullptr);
if (!this->Internals->Context)
{
throw vtkm::cont::ErrorBadValue("Failed to create EGL context");

@ -64,7 +64,7 @@ CanvasOSMesa::~CanvasOSMesa()
void CanvasOSMesa::Initialize()
{
this->Internals->Context =
OSMesaCreateContextExt(OSMESA_RGBA, 32, 0, 0, NULL);
OSMesaCreateContextExt(OSMESA_RGBA, 32, 0, 0, nullptr);
if (!this->Internals->Context)
{

@ -270,9 +270,9 @@ void RenderTriangles(MapperGL &mapper,
glGenVertexArrays(1, &mapper.vao);
glBindVertexArray(mapper.vao);
glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glBindBuffer(GL_ARRAY_BUFFER, colours_vbo);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
@ -297,7 +297,7 @@ void RenderTriangles(MapperGL &mapper,
"}";
GLuint vs = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vs, 1, &vertex_shader, NULL);
glShaderSource(vs, 1, &vertex_shader, nullptr);
glCompileShader(vs);
GLint isCompiled = 0;
glGetShaderiv(vs, GL_COMPILE_STATUS, &isCompiled);
@ -311,7 +311,7 @@ void RenderTriangles(MapperGL &mapper,
msg = "No error message";
else
{
// The maxLength includes the NULL character
// The maxLength includes the nullptr character
GLchar *strInfoLog = new GLchar[maxLength + 1];
glGetShaderInfoLog(vs, maxLength, &maxLength, strInfoLog);
msg = std::string(strInfoLog);
@ -321,7 +321,7 @@ void RenderTriangles(MapperGL &mapper,
}
GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fs, 1, &fragment_shader, NULL);
glShaderSource(fs, 1, &fragment_shader, nullptr);
glCompileShader(fs);
glGetShaderiv(fs, GL_COMPILE_STATUS, &isCompiled);
if(isCompiled == GL_FALSE)
@ -334,7 +334,7 @@ void RenderTriangles(MapperGL &mapper,
msg = "No error message";
else
{
// The maxLength includes the NULL character
// The maxLength includes the nullptr character
GLchar *strInfoLog = new GLchar[maxLength + 1];
glGetShaderInfoLog(vs, maxLength, &maxLength, strInfoLog);
msg = std::string(strInfoLog);
@ -388,7 +388,7 @@ void RenderTriangles(MapperGL &mapper,
} // anonymous namespace
MapperGL::MapperGL() : Canvas(NULL), loaded(false)
MapperGL::MapperGL() : Canvas(nullptr), loaded(false)
{
}
@ -474,10 +474,10 @@ void MapperGL::EndScene()
void MapperGL::SetCanvas(vtkm::rendering::Canvas *c)
{
if (c != NULL)
if (c != nullptr)
{
this->Canvas = dynamic_cast<vtkm::rendering::CanvasGL*>(c);
if (this->Canvas == NULL)
if (this->Canvas == nullptr)
throw vtkm::cont::ErrorBadValue("Bad canvas type for MapperGL. Must be CanvasGL");
}
}

@ -51,7 +51,7 @@ struct MapperRayTracer::InternalsType
typedef vtkm::rendering::raytracing::RayTracer<Device> RayTracerType;
typedef vtkm::cont::internal::SimplePolymorphicContainer<RayTracerType>
ContainerType;
RayTracerType *tracer = NULL;
RayTracerType *tracer = nullptr;
if (this->RayTracerContainer)
{
ContainerType *container =
@ -62,7 +62,7 @@ struct MapperRayTracer::InternalsType
}
}
if (tracer == NULL)
if (tracer == nullptr)
{
ContainerType *container
= new vtkm::cont::internal::SimplePolymorphicContainer<RayTracerType>;

@ -65,7 +65,7 @@ struct MapperVolume::InternalsType
RayTracerType;
typedef vtkm::cont::internal::SimplePolymorphicContainer<RayTracerType>
ContainerType;
RayTracerType *tracer = NULL;
RayTracerType *tracer = nullptr;
if (this->RayTracerContainer)
{
ContainerType *container =
@ -76,7 +76,7 @@ struct MapperVolume::InternalsType
}
}
if (tracer == NULL)
if (tracer == nullptr)
{
ContainerType *container
= new vtkm::cont::internal::SimplePolymorphicContainer<RayTracerType>;
@ -156,8 +156,8 @@ struct MapperVolume::RenderFunctor
if(this->Self->Internals->SampleDistance != DEFAULT_SAMPLE_DISTANCE)
{
tracer->SetSampleDistance(this->Self->Internals->SampleDistance);
}
}
tracer->SetCompositeBackground(this->Self->Internals->CompositeBackground);
vtkm::Bounds dataBounds = this->Coordinates.GetBounds();

@ -47,7 +47,7 @@ keyCallback(GLFWwindow* vtkmNotUsed(window), int key,
done = true;
if (action == 1)
which = (which+1) % NUM_DATASETS;
}
}
void RenderTests()
{
@ -57,12 +57,12 @@ void RenderTests()
typedef vtkm::rendering::CanvasGL CanvasType;
typedef vtkm::rendering::View3D View3DType;
typedef vtkm::rendering::View2D View2DType;
vtkm::cont::testing::MakeTestDataSet maker;
vtkm::rendering::ColorTable colorTable("thermal");
glfwInit();
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "GLFW Test", NULL, NULL);
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "GLFW Test", nullptr, nullptr);
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, keyCallback);

@ -58,7 +58,7 @@ displayCall()
{
vtkm::cont::testing::MakeTestDataSet maker;
vtkm::rendering::ColorTable colorTable("thermal");
typedef vtkm::rendering::MapperGL<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> M;
typedef vtkm::rendering::CanvasGL C;
typedef vtkm::rendering::View3D V3;
@ -94,7 +94,7 @@ void RenderTests()
std::cout<<"Press any key to cycle through datasets. ESC to quit."<<std::endl;
int argc = 0;
char *argv = NULL;
char *argv = nullptr;
glutInit(&argc, &argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(WIDTH,HEIGHT);
@ -103,10 +103,10 @@ void RenderTests()
glutKeyboardFunc(keyboardCall);
if (batch)
glutIdleFunc(batchIdle);
glutMainLoop();
}
} //namespace
int UnitTestMapperGLUT(int argc, char *argv[])
@ -117,6 +117,6 @@ int UnitTestMapperGLUT(int argc, char *argv[])
{
batch = true;
}
}
}
return vtkm::cont::testing::Testing::Run(RenderTests);
}

@ -274,7 +274,7 @@ enum ArgStatus
* @code ArgStatus CheckArg(const Option& option, bool msg); @endcode
*
* It is used to check if a potential argument would be acceptable for the option.
* It will even be called if there is no argument. In that case @c option.arg will be @c NULL.
* It will even be called if there is no argument. In that case @c option.arg will be @c nullptr.
*
* If @c msg is @c true and the function determines that an argument is not acceptable and
* that this is a fatal error, it should output a message to the user before
@ -353,7 +353,7 @@ struct Descriptor
* behaviour.
*
* If this Descriptor should not have short option characters, use the empty
* string "". NULL is not permitted here!
* string "". nullptr is not permitted here!
*
* See @ref longopt for more information.
*/
@ -363,7 +363,7 @@ struct Descriptor
* @brief The long option name (without the leading @c -- ).
*
* If this Descriptor should not have a long option name, use the empty
* string "". NULL is not permitted here!
* string "". nullptr is not permitted here!
*
* While @ref shortopt allows multiple short option characters, each
* Descriptor can have only a single long option name. If you have multiple
@ -399,7 +399,7 @@ struct Descriptor
* will be called to check a potential argument to the option.
*
* This function will be called even if there is no potential argument. In that case
* it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty
* it will be passed @c nullptr as @c arg parameter. Do not confuse this with the empty
* string.
*
* See @ref CheckArg for more information.
@ -453,7 +453,7 @@ public:
* for unknown options.
*
* @attention
* @c desc==NULL signals that this Option is unused. This is the default state of
* @c desc==nullptr signals that this Option is unused. This is the default state of
* elements in the result array. You don't need to test @c desc explicitly. You
* can simply write something like this:
* @code
@ -485,7 +485,7 @@ public:
/**
* @brief Pointer to this Option's argument (if any).
*
* NULL if this option has no argument. Do not confuse this with the empty string which
* nullptr if this option has no argument. Do not confuse this with the empty string which
* is a valid argument.
*/
const char* arg;
@ -637,10 +637,10 @@ public:
}
/**
* @brief Returns a pointer to the previous element of the linked list or NULL if
* @brief Returns a pointer to the previous element of the linked list or nullptr if
* called on first().
*
* If called on first() this method returns NULL. Otherwise it will return the
* If called on first() this method returns nullptr. Otherwise it will return the
* option with the same Descriptor::index that precedes this option on the command
* line.
*/
@ -663,10 +663,10 @@ public:
}
/**
* @brief Returns a pointer to the next element of the linked list or NULL if called
* @brief Returns a pointer to the next element of the linked list or nullptr if called
* on last().
*
* If called on last() this method returns NULL. Otherwise it will return the
* If called on last() this method returns nullptr. Otherwise it will return the
* option with the same Descriptor::index that follows this option on the command
* line.
*/
@ -711,8 +711,8 @@ public:
/**
* @brief Casts from Option to const Option* but only if this Option is valid.
*
* If this Option is valid (i.e. @c desc!=NULL), returns this.
* Otherwise returns NULL. This allows testing an Option directly
* If this Option is valid (i.e. @c desc!=nullptr), returns this.
* Otherwise returns nullptr. This allows testing an Option directly
* in an if-clause to see if it is used:
* @code
* if (options[CREATE])
@ -732,8 +732,8 @@ public:
/**
* @brief Casts from Option to Option* but only if this Option is valid.
*
* If this Option is valid (i.e. @c desc!=NULL), returns this.
* Otherwise returns NULL. This allows testing an Option directly
* If this Option is valid (i.e. @c desc!=nullptr), returns this.
* Otherwise returns nullptr. This allows testing an Option directly
* in an if-clause to see if it is used:
* @code
* if (options[CREATE])
@ -751,7 +751,7 @@ public:
}
/**
* @brief Creates a new Option that is a one-element linked list and has NULL
* @brief Creates a new Option that is a one-element linked list and has nullptr
* @ref desc, @ref name, @ref arg and @ref namelen.
*/
Option() :
@ -1110,10 +1110,10 @@ public:
* @param usage Array of Descriptor objects that describe the options to support. The last entry
* of this array must have 0 in all fields.
* @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number
* will be determined automatically. In that case the @c argv list must end with a NULL
* will be determined automatically. In that case the @c argv list must end with a nullptr
* pointer.
* @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv
* list must be NULL to mark the end.
* list must be nullptr to mark the end.
* @param options Each entry is the first element of a linked list of Options. Each new option
* that is parsed will be appended to the list specified by that Option's
* Descriptor::index. If an entry is not yet used (i.e. the Option is invalid),
@ -1515,7 +1515,7 @@ inline void Stats::add(bool gnu, const Descriptor usage[], int argc, const char*
inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action,
bool single_minus_longopt, bool print_errors, int min_abbr_len)
{
// protect against NULL pointer
// protect against nullptr pointer
if (args == 0)
{ numargs = 0; }
@ -1896,8 +1896,8 @@ struct PrintUsageImplementation
* iterates over these components.
*
* The top-level organizational unit is the @e table.
* A table begins at a Descriptor with @c help!=NULL and extends up to
* a Descriptor with @c help==NULL.
* A table begins at a Descriptor with @c help!=nullptr and extends up to
* a Descriptor with @c help==nullptr.
*
* A table consists of @e rows. Due to line-wrapping and explicit breaks
* a row may take multiple lines on screen. Rows within the table are separated