Skip to content

Commit

Permalink
nullptr update
Browse files Browse the repository at this point in the history
  • Loading branch information
dalefugier committed Mar 16, 2018
1 parent cf409af commit 64c8462
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 110 deletions.
2 changes: 1 addition & 1 deletion AnalysisDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void CAnalysisDialog::CreateHueBar()
int height = rect.Height();

LPBITMAPINFO dib = m_huebar_dib.CreateDib(width, height, 24);
if (0 == dib)
if (nullptr == dib)
return;

char* baseptr = (char*)m_huebar_dib.FindDIBBits();
Expand Down
2 changes: 1 addition & 1 deletion AnalysisObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ VARIANT CAnalysisObject::AnalysisMeshData(const VARIANT& vaObject, const VARIANT
if (CRhinoVariantHelpers::ConvertVariant(vaData, new_data) && new_data.Count() == mesh->VertexCount())
{
bool bAttach = false;
if (0 == ud)
if (nullptr == ud)
{
ud = new CAnalysisUserData();
bAttach = true;
Expand Down
64 changes: 32 additions & 32 deletions AnalysisToolsPlugIn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static const wchar_t* ParseInt(const wchar_t* s, int& i)
}

if (*s < '0' || *s > '9')
s = 0;
s = nullptr;
else
{
while (*s >= '0' && *s <= '9')
Expand Down Expand Up @@ -222,7 +222,7 @@ static const wchar_t* ParseDouble(const wchar_t* s, double& x)
}

if ((*s < '0' || *s > '9'))
s = 0;
s = nullptr;
else
{
while (*s >= '0' && *s <= '9' && buffer_length < 512)
Expand All @@ -234,7 +234,7 @@ static const wchar_t* ParseDouble(const wchar_t* s, double& x)
if ('.' == *s && buffer_length < 512)
{
if (bHaveDecimal)
return 0;
return nullptr;

bHaveDecimal = true;
buffer[buffer_length++] = *s++;
Expand All @@ -256,22 +256,22 @@ static const wchar_t* ParseDouble(const wchar_t* s, double& x)
buffer[buffer_length++] = *s++;

if (*s < '0' || *s > '9')
return 0;
return nullptr;

while (*s >= '0' && *s <= '9' && buffer_length < 512)
buffer[buffer_length++] = *s++;
}

if (buffer_length >= 512 || IsNumeric(*s))
return 0;
return nullptr;

buffer[buffer_length] = 0;
double v = ON_UNSET_VALUE;

if (1 == swscanf(buffer, L"%lg", &v))
x = v;
else
s = 0;
s = nullptr;
}
}

Expand All @@ -281,23 +281,23 @@ static const wchar_t* ParseDouble(const wchar_t* s, double& x)
static const wchar_t* ParseCount(const wchar_t* line, const wchar_t* string, int& count)
{
count = 0;
if (0 == line || 0 == string)
return 0;
if (nullptr == line || nullptr == string)
return nullptr;

const size_t string_length = wcslen(string);
if (string_length <= 0)
return 0;
return nullptr;

const wchar_t* s = SkipJunk(line);
if (0 == s)
return 0;
if (nullptr == s)
return nullptr;

if (_wcsnicmp(string, s, string_length))
return 0;
return nullptr;

s = SkipJunk(s + string_length);
s = ParseInt(s, count);
if (0 == s)
if (nullptr == s)
count = 0;

return s;
Expand All @@ -322,7 +322,7 @@ static const wchar_t* ParseVertex(const wchar_t* line, ON_3dPoint& v, double& c)
c = a;
}
else
line = 0;
line = nullptr;
}
return line;
}
Expand Down Expand Up @@ -358,7 +358,7 @@ static const wchar_t* ParseFace(const wchar_t* line, const int vcount, ON_MeshFa
f.vi[3] = d;
}
else
line = 0;
line = nullptr;
}
return line;
}
Expand Down Expand Up @@ -399,37 +399,37 @@ ON_Mesh* CAnalysisToolsPlugIn::ReadStructuredTechPlotFile(FILE* fp, ON_Mesh* mes
int IMAX = 0;
int JMAX = 0;
int KMAX = 0;
const wchar_t* s = 0;
const wchar_t* s = nullptr;

while (IMAX <= 0)
{
while (0 == s || *s == 0)
while (nullptr == s || *s == 0)
{
s = fgetws(line, 127, fp);
if (0 == s)
return 0;
if (nullptr == s)
return nullptr;
}
s = ParseCount(s, L"I=", IMAX);
}

while (JMAX <= 0)
{
while (0 == s || *s == 0)
while (nullptr == s || *s == 0)
{
s = fgetws(line, 127, fp);
if (0 == s)
return 0;
if (nullptr == s)
return nullptr;
}
s = ParseCount(s, L"J=", JMAX);
}

while (KMAX <= 0)
{
while (0 == s || *s == 0)
while (nullptr == s || *s == 0)
{
s = fgetws(line, 127, fp);
if (0 == s)
return 0;
if (nullptr == s)
return nullptr;
}
s = ParseCount(s, L"K=", KMAX);
}
Expand Down Expand Up @@ -557,7 +557,7 @@ ON_Mesh* CAnalysisToolsPlugIn::ReadStructuredTechPlotFile(FILE* fp, ON_Mesh* mes
CAnalysisUserData::UpdateColors(mesh);
}
else
mesh = 0;
mesh = nullptr;

return mesh;
}
Expand All @@ -573,31 +573,31 @@ ON_Mesh* CAnalysisToolsPlugIn::ReadFalseColorMeshFile(FILE* fp, ON_Mesh* mesh)
while (vcount <= 0 && fgetws(line, 127, fp))
ParseCount(line, L"vertexcount", vcount);
if (vcount < 3)
return 0;
return nullptr;

if (fgetws(line, 127, fp))
ParseCount(line, L"facecount", fcount);
if (fcount <= 0)
return 0;
return nullptr;

ON_SimpleArray<ON_3dPoint> v(vcount);
ON_SimpleArray<double> a(vcount);

for (int i = 0; i < vcount; i++)
{
if (!fgetws(line, 127, fp))
return 0;
return nullptr;
if (!ParseVertex(line, v.AppendNew(), a.AppendNew()))
return 0;
return nullptr;
}

ON_SimpleArray<ON_MeshFace> f(fcount);
for (int i = 0; i < fcount; i++)
{
if (!fgetws(line, 127, fp))
return 0;
return nullptr;
if (!ParseFace(line, vcount, f.AppendNew()))
return 0;
return nullptr;
}

if (mesh)
Expand Down
2 changes: 1 addition & 1 deletion AnalysisUserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ON_UUID CAnalysisUserData::Id()

const CAnalysisUserData* CAnalysisUserData::Get(const ON_Mesh* mesh)
{
const CAnalysisUserData* ud = 0;
const CAnalysisUserData* ud = nullptr;
if (mesh)
ud = CAnalysisUserData::Cast(mesh->GetUserData(CAnalysisUserData::Id()));
return ud;
Expand Down
Loading

0 comments on commit 64c8462

Please sign in to comment.