mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-08-14 15:17:52 +00:00
Clean up some const issues, particularly when moving between single and double pointers
This commit is contained in:
+12
-12
@@ -1025,8 +1025,8 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
|
|||||||
{
|
{
|
||||||
UNITY_UINT32 i = 0;
|
UNITY_UINT32 i = 0;
|
||||||
UNITY_UINT32 j = 0;
|
UNITY_UINT32 j = 0;
|
||||||
const char* exp;
|
const char* exp = NULL;
|
||||||
const char* act;
|
const char* act = NULL;
|
||||||
|
|
||||||
RETURN_IF_FAIL_OR_IGNORE;
|
RETURN_IF_FAIL_OR_IGNORE;
|
||||||
|
|
||||||
@@ -1036,7 +1036,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
|
|||||||
UnityPrintPointlessAndBail();
|
UnityPrintPointlessAndBail();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((const char**)expected == actual)
|
if ((const void*)expected == (const void*)actual)
|
||||||
{
|
{
|
||||||
return; /* Both are NULL or same pointer */
|
return; /* Both are NULL or same pointer */
|
||||||
}
|
}
|
||||||
@@ -1056,7 +1056,7 @@ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
|
|||||||
act = actual[j];
|
act = actual[j];
|
||||||
if (flags == UNITY_ARRAY_TO_ARRAY)
|
if (flags == UNITY_ARRAY_TO_ARRAY)
|
||||||
{
|
{
|
||||||
exp = ((const char**)expected)[j];
|
exp = ((const char* const*)expected)[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if both pointers not null compare the strings */
|
/* if both pointers not null compare the strings */
|
||||||
@@ -1175,20 +1175,20 @@ UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
|
|||||||
switch(size)
|
switch(size)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
UnityQuickCompare.i8 = num;
|
UnityQuickCompare.i8 = (UNITY_INT8)num;
|
||||||
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
|
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
UnityQuickCompare.i16 = num;
|
UnityQuickCompare.i16 = (UNITY_INT16)num;
|
||||||
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
|
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
|
||||||
|
|
||||||
#ifdef UNITY_SUPPORT_64
|
#ifdef UNITY_SUPPORT_64
|
||||||
case 8:
|
case 8:
|
||||||
UnityQuickCompare.i64 = num;
|
UnityQuickCompare.i64 = (UNITY_INT64)num;
|
||||||
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
|
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
|
||||||
#endif
|
#endif
|
||||||
default: //4 bytes
|
default: //4 bytes
|
||||||
UnityQuickCompare.i32 = num;
|
UnityQuickCompare.i32 = (UNITY_INT32)num;
|
||||||
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
|
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1405,9 +1405,9 @@ int UnityParseOptions(int argc, char** argv)
|
|||||||
|
|
||||||
int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
||||||
{
|
{
|
||||||
char* lptr = (char*)longstring;
|
const char* lptr = longstring;
|
||||||
char* sptr = (char*)shortstring;
|
const char* sptr = shortstring;
|
||||||
char* lnext = lptr;
|
const char* lnext = lptr;
|
||||||
|
|
||||||
if (*sptr == '*')
|
if (*sptr == '*')
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1439,7 +1439,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
|||||||
|
|
||||||
/* Otherwise we start in the long pointer 1 character further and try again */
|
/* Otherwise we start in the long pointer 1 character further and try again */
|
||||||
lptr = lnext;
|
lptr = lnext;
|
||||||
sptr = (char*)shortstring;
|
sptr = shortstring;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ compiler:
|
|||||||
- '-Wbad-function-cast'
|
- '-Wbad-function-cast'
|
||||||
- '-fms-extensions'
|
- '-fms-extensions'
|
||||||
- '-fno-omit-frame-pointer'
|
- '-fno-omit-frame-pointer'
|
||||||
- '-ffloat-store'
|
#- '-ffloat-store'
|
||||||
- '-fno-common'
|
- '-fno-common'
|
||||||
- '-fstrict-aliasing'
|
- '-fstrict-aliasing'
|
||||||
- '-std=gnu99'
|
- '-std=gnu99'
|
||||||
|
|||||||
Reference in New Issue
Block a user