Skip to content

Commit

Permalink
Merge pull request zeux#621 from zeux/null0
Browse files Browse the repository at this point in the history
Use NULL for null pointer constants instead of 0/nullptr
  • Loading branch information
zeux authored Oct 14, 2023
2 parents 284669b + b1b2192 commit 1a2b357
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion gltf/basisenc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static const char* prepareEncode(basisu::basis_compressor_params& params, const

fillParams(params, temp_input.c_str(), temp_output.c_str(), uastc, width, height, bs, info, settings);

return nullptr;
return NULL;
}

void encodeImages(std::string* encoded, const cgltf_data* data, const std::vector<ImageInfo>& images, const char* input_path, const Settings& settings)
Expand Down
12 changes: 6 additions & 6 deletions gltf/gltfpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ static std::string getBufferSpec(const char* bin_path, size_t bin_size, const ch

int gltfpack(const char* input, const char* output, const char* report, Settings settings)
{
cgltf_data* data = 0;
cgltf_data* data = NULL;
std::vector<Mesh> meshes;
std::vector<Animation> animations;

Expand All @@ -967,7 +967,7 @@ int gltfpack(const char* input, const char* output, const char* report, Settings

if (iext == ".gltf" || iext == ".glb")
{
const char* error = 0;
const char* error = NULL;
data = parseGltf(input, meshes, animations, &error);

if (error)
Expand All @@ -978,7 +978,7 @@ int gltfpack(const char* input, const char* output, const char* report, Settings
}
else if (iext == ".obj")
{
const char* error = 0;
const char* error = NULL;
data = parseObj(input, meshes, &error);

if (!data)
Expand Down Expand Up @@ -1205,9 +1205,9 @@ int main(int argc, char** argv)

Settings settings = defaults();

const char* input = 0;
const char* output = 0;
const char* report = 0;
const char* input = NULL;
const char* output = NULL;
const char* report = NULL;
bool help = false;
bool test = false;

Expand Down
2 changes: 1 addition & 1 deletion gltf/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static bool parseDataUri(const char* uri, std::string& mime_type, std::string& r
size -= base64[base64_size - 1] == '=';
}

void* data = 0;
void* data = NULL;

cgltf_options options = {};
cgltf_result res = cgltf_load_buffer_base64(&options, size, base64, &data);
Expand Down
8 changes: 4 additions & 4 deletions gltf/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ static Stream* getStream(Mesh& mesh, cgltf_attribute_type type, int index = 0)
if (mesh.streams[i].type == type && mesh.streams[i].index == index)
return &mesh.streams[i];

return 0;
return NULL;
}

static void simplifyMesh(Mesh& mesh, float threshold, bool aggressive, bool lock_borders)
Expand Down Expand Up @@ -807,9 +807,9 @@ void debugSimplify(const Mesh& source, Mesh& kinds, Mesh& loops, float ratio)

simplifyMesh(mesh, ratio, /* aggressive= */ false, /* lock_borders= */ false);

meshopt_simplifyDebugKind = 0;
meshopt_simplifyDebugLoop = 0;
meshopt_simplifyDebugLoopBack = 0;
meshopt_simplifyDebugKind = NULL;
meshopt_simplifyDebugLoop = NULL;
meshopt_simplifyDebugLoopBack = NULL;

// fill out live info
for (size_t i = 0; i < mesh.indices.size(); ++i)
Expand Down
4 changes: 2 additions & 2 deletions gltf/parsegltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static bool freeUnusedBuffers(cgltf_data* data)

cgltf_data* parseGltf(const char* path, std::vector<Mesh>& meshes, std::vector<Animation>& animations, const char** error)
{
cgltf_data* data = 0;
cgltf_data* data = NULL;

cgltf_options options = {};
cgltf_result result = cgltf_parse_file(&options, path, &data);
Expand Down Expand Up @@ -476,7 +476,7 @@ cgltf_data* parseGltf(const char* path, std::vector<Mesh>& meshes, std::vector<A
if (*error)
{
cgltf_free(data);
return 0;
return NULL;
}

if (requiresExtension(data, "KHR_mesh_quantization"))
Expand Down
4 changes: 2 additions & 2 deletions gltf/parseobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static void parseNodesObj(fastObjMesh* obj, cgltf_data* data)
static void parseMeshObj(fastObjMesh* obj, unsigned int face_offset, unsigned int face_vertex_offset, unsigned int face_count, unsigned int face_vertex_count, unsigned int index_count, Mesh& mesh)
{
std::vector<unsigned int> remap(face_vertex_count);
size_t unique_vertices = meshopt_generateVertexRemap(remap.data(), nullptr, face_vertex_count, &obj->indices[face_vertex_offset], face_vertex_count, sizeof(fastObjIndex));
size_t unique_vertices = meshopt_generateVertexRemap(remap.data(), NULL, face_vertex_count, &obj->indices[face_vertex_offset], face_vertex_count, sizeof(fastObjIndex));

int pos_stream = 0;
int nrm_stream = obj->normal_count > 1 ? 1 : -1;
Expand Down Expand Up @@ -279,7 +279,7 @@ cgltf_data* parseObj(const char* path, std::vector<Mesh>& meshes, const char** e
if (!obj)
{
*error = "file not found";
return 0;
return NULL;
}

cgltf_data* data = (cgltf_data*)calloc(1, sizeof(cgltf_data));
Expand Down
2 changes: 1 addition & 1 deletion gltf/write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ void writeBufferView(std::string& json, BufferView::Kind kind, StreamFormat::Fil
append(json, "}");
}

static void writeAccessor(std::string& json, size_t view, size_t offset, cgltf_type type, cgltf_component_type component_type, bool normalized, size_t count, const float* min = 0, const float* max = 0, size_t numminmax = 0)
static void writeAccessor(std::string& json, size_t view, size_t offset, cgltf_type type, cgltf_component_type component_type, bool normalized, size_t count, const float* min = NULL, const float* max = NULL, size_t numminmax = 0)
{
append(json, "{\"bufferView\":");
append(json, view);
Expand Down
2 changes: 1 addition & 1 deletion src/indexgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static T* hashLookup(T* table, size_t buckets, const Hash& hash, const T& key, c
}

assert(false && "Hash table is full"); // unreachable
return 0;
return NULL;
}

static void buildPositionRemap(unsigned int* remap, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, meshopt_Allocator& allocator)
Expand Down
Loading

0 comments on commit 1a2b357

Please sign in to comment.