mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
NULL is a pointer, not string terminator
Replace some instances of NULL to '\0', when referring to string terminator.
This commit is contained in:
parent
3b06b6a6b7
commit
706fccb50e
14 changed files with 32 additions and 32 deletions
|
@ -997,7 +997,7 @@ csa_list_entry_sequence(
|
||||||
rtype = &entry->e->attrs[CSA_ENTRY_ATTR_RECURRENCE_RULE_I];
|
rtype = &entry->e->attrs[CSA_ENTRY_ATTR_RECURRENCE_RULE_I];
|
||||||
if (rtype->value == NULL ||
|
if (rtype->value == NULL ||
|
||||||
rtype->value->item.string_value == NULL ||
|
rtype->value->item.string_value == NULL ||
|
||||||
*(rtype->value->item.string_value) == NULL) {
|
*(rtype->value->item.string_value) == '\0' ) {
|
||||||
return (CSA_E_INVALID_PARAMETER);
|
return (CSA_E_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1907,8 +1907,8 @@ _CheckNameAtHost(char *owner, char *value)
|
||||||
return (CSA_E_FAILURE);
|
return (CSA_E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optr = strchr(owner, '@')) *optr = NULL;
|
if (optr = strchr(owner, '@')) *optr = '\0';
|
||||||
if (ptr = strchr(value, '@')) *ptr = NULL;
|
if (ptr = strchr(value, '@')) *ptr = '\0';
|
||||||
res = strcmp(value, owner);
|
res = strcmp(value, owner);
|
||||||
if (optr) *optr = '@';
|
if (optr) *optr = '@';
|
||||||
if (ptr) *ptr = '@';
|
if (ptr) *ptr = '@';
|
||||||
|
@ -1965,7 +1965,7 @@ _CheckCalendarName(char *owner, char *cname, cms_attribute_value *val)
|
||||||
/* now make sure if cal name is a user name, it's
|
/* now make sure if cal name is a user name, it's
|
||||||
* the same as that of the calling user
|
* the same as that of the calling user
|
||||||
*/
|
*/
|
||||||
if (ptr = strchr(val->item.string_value, '@')) *ptr = NULL;
|
if (ptr = strchr(val->item.string_value, '@')) *ptr = '\0';
|
||||||
isuser = _DtCmIsUserName(val->item.string_value);
|
isuser = _DtCmIsUserName(val->item.string_value);
|
||||||
if (ptr) *ptr = '@';
|
if (ptr) *ptr = '@';
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ _DtCm_new_Calendar(const char *calendar)
|
||||||
if ((cal = (Calendar *)malloc(sizeof(Calendar))) == NULL)
|
if ((cal = (Calendar *)malloc(sizeof(Calendar))) == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
memset((void *)cal, NULL, sizeof(Calendar));
|
memset((void *)cal, 0, sizeof(Calendar));
|
||||||
|
|
||||||
if ((cal->name = strdup(calendar)) == NULL) {
|
if ((cal->name = strdup(calendar)) == NULL) {
|
||||||
free(cal);
|
free(cal);
|
||||||
|
@ -305,7 +305,7 @@ _DtCm_list_old_cal_attr_names(
|
||||||
for (i = 1, j = 0; i <= _DtCM_DEFINED_CAL_ATTR_SIZE; i++) {
|
for (i = 1, j = 0; i <= _DtCM_DEFINED_CAL_ATTR_SIZE; i++) {
|
||||||
if (_CSA_cal_attr_info[i].fst_vers > 0 &&
|
if (_CSA_cal_attr_info[i].fst_vers > 0 &&
|
||||||
_CSA_cal_attr_info[i].fst_vers <= cal->file_version) {
|
_CSA_cal_attr_info[i].fst_vers <= cal->file_version) {
|
||||||
if (i == CSA_CAL_ATTR_CALENDAR_OWNER_I && *buf == NULL)
|
if (i == CSA_CAL_ATTR_CALENDAR_OWNER_I && *buf == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((names[j] =
|
if ((names[j] =
|
||||||
|
@ -527,7 +527,7 @@ _get_owner_from_old_cal(Calendar *cal, char *owner)
|
||||||
if (_DtCmIsUserName(calname) == B_TRUE)
|
if (_DtCmIsUserName(calname) == B_TRUE)
|
||||||
strcpy(owner, calname);
|
strcpy(owner, calname);
|
||||||
else
|
else
|
||||||
*owner = NULL;
|
*owner = '\0';
|
||||||
|
|
||||||
free(calname);
|
free(calname);
|
||||||
return (CSA_SUCCESS);
|
return (CSA_SUCCESS);
|
||||||
|
@ -555,7 +555,7 @@ _get_calendar_owner(
|
||||||
} else {
|
} else {
|
||||||
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS)
|
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS)
|
||||||
return (stat);
|
return (stat);
|
||||||
else if (*buf == NULL)
|
else if (*buf == '\0')
|
||||||
return (CSA_SUCCESS);
|
return (CSA_SUCCESS);
|
||||||
else
|
else
|
||||||
owner = buf;
|
owner = buf;
|
||||||
|
|
|
@ -164,7 +164,7 @@ _DtCmGrowAttrArray(uint *num_attrs, cms_attribute **attrs, cms_attribute *attr)
|
||||||
return (CSA_E_INSUFFICIENT_MEMORY);
|
return (CSA_E_INSUFFICIENT_MEMORY);
|
||||||
else {
|
else {
|
||||||
*attrs = newptr;
|
*attrs = newptr;
|
||||||
memset((void *)&(*attrs)[*num_attrs+1], NULL,
|
memset((void *)&(*attrs)[*num_attrs+1], 0,
|
||||||
sizeof(cms_attribute) * (index - *num_attrs));
|
sizeof(cms_attribute) * (index - *num_attrs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ _DtCmAttr4ToReminderValue(
|
||||||
_csa_duration_to_iso8601(atoi(remval->value), timestr);
|
_csa_duration_to_iso8601(atoi(remval->value), timestr);
|
||||||
rval.lead_time = timestr;
|
rval.lead_time = timestr;
|
||||||
|
|
||||||
if (remval->clientdata && *remval->clientdata != NULL) {
|
if (remval->clientdata && *remval->clientdata != '\0') {
|
||||||
rval.reminder_data.size = strlen(remval->clientdata);
|
rval.reminder_data.size = strlen(remval->clientdata);
|
||||||
rval.reminder_data.data = (unsigned char *)remval->clientdata;
|
rval.reminder_data.data = (unsigned char *)remval->clientdata;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -92,11 +92,11 @@ _DtCm_cmsattrs_to_apptdata(uint size, cms_attribute *attrs, Appt_4 *appt)
|
||||||
{
|
{
|
||||||
strncpy(buf, (char *)aptr->value->item.opaque_data_value->data,
|
strncpy(buf, (char *)aptr->value->item.opaque_data_value->data,
|
||||||
aptr->value->item.opaque_data_value->size);
|
aptr->value->item.opaque_data_value->size);
|
||||||
buf[aptr->value->item.opaque_data_value->size] = NULL;
|
buf[aptr->value->item.opaque_data_value->size] = '\0';
|
||||||
|
|
||||||
ptr = strchr(buf, ':');
|
ptr = strchr(buf, ':');
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
*ptr = NULL;
|
*ptr = '\0';
|
||||||
|
|
||||||
appt->appt_id.key = atol(buf);
|
appt->appt_id.key = atol(buf);
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ _DtCm_add_reminder(char *rem, CSA_reminder * val, Appt_4 *appt)
|
||||||
}
|
}
|
||||||
memcpy(newattr->clientdata, val->reminder_data.data,
|
memcpy(newattr->clientdata, val->reminder_data.data,
|
||||||
val->reminder_data.size);
|
val->reminder_data.size);
|
||||||
newattr->clientdata[val->reminder_data.size] = NULL;
|
newattr->clientdata[val->reminder_data.size] = '\0';
|
||||||
|
|
||||||
} else if ((newattr->clientdata = calloc(1,1)) == NULL) {
|
} else if ((newattr->clientdata = calloc(1,1)) == NULL) {
|
||||||
_DtCm_free_attr4(newattr);
|
_DtCm_free_attr4(newattr);
|
||||||
|
|
|
@ -578,7 +578,7 @@ _DtCm_free_entry_content(uint dummy, _DtCm_libentry *entry)
|
||||||
{
|
{
|
||||||
_DtCm_remove_from_entry_list(entry->cal, (caddr_t)entry, (caddr_t)entry);
|
_DtCm_remove_from_entry_list(entry->cal, (caddr_t)entry, (caddr_t)entry);
|
||||||
if (entry->e) _DtCm_free_cms_entry(entry->e);
|
if (entry->e) _DtCm_free_cms_entry(entry->e);
|
||||||
memset((void *)entry, NULL, sizeof(_DtCm_libentry));
|
memset((void *)entry, 0, sizeof(_DtCm_libentry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -611,7 +611,7 @@ _DtCm_free_libentries(_DtCm_libentry *entry)
|
||||||
nptr = entry->next;
|
nptr = entry->next;
|
||||||
|
|
||||||
if (entry->e) _DtCm_free_cms_entry(entry->e);
|
if (entry->e) _DtCm_free_cms_entry(entry->e);
|
||||||
memset((void *)entry, NULL, sizeof(_DtCm_libentry));
|
memset((void *)entry, 0, sizeof(_DtCm_libentry));
|
||||||
|
|
||||||
free(entry);
|
free(entry);
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ _csa_iso8601_to_duration(char *buf, time_t *sec)
|
||||||
numptr = ptr;
|
numptr = ptr;
|
||||||
while (*ptr >= '0' && *ptr <= '9') ptr++;
|
while (*ptr >= '0' && *ptr <= '9') ptr++;
|
||||||
|
|
||||||
if (numptr == ptr || !(*ptr && *ptr++ == 'S' && *ptr == NULL))
|
if (numptr == ptr || !(*ptr && *ptr++ == 'S' && *ptr == '\0'))
|
||||||
return (-1);
|
return (-1);
|
||||||
else {
|
else {
|
||||||
num = atoi(numptr);
|
num = atoi(numptr);
|
||||||
|
|
|
@ -215,10 +215,10 @@ match_forward(char *str1, char *str2)
|
||||||
get_component(&str2, com2, '.');
|
get_component(&str2, com2, '.');
|
||||||
|
|
||||||
if (*com1) {
|
if (*com1) {
|
||||||
if (*com2 == NULL)
|
if (*com2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
} else {
|
} else {
|
||||||
if (*com2 == NULL)
|
if (*com2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
else
|
else
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
@ -229,18 +229,18 @@ match_forward(char *str1, char *str2)
|
||||||
|
|
||||||
/* take care of case: a.b a. */
|
/* take care of case: a.b a. */
|
||||||
if (strcmp(str2, ".") == 0
|
if (strcmp(str2, ".") == 0
|
||||||
&& (strcmp(str1, ".") != 0 || *str1 != NULL))
|
&& (strcmp(str1, ".") != 0 || *str1 != '\0'))
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
|
||||||
/* skip "." */
|
/* skip "." */
|
||||||
if (*str1 == '.') {
|
if (*str1 == '.') {
|
||||||
if (*str2 == NULL)
|
if (*str2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
else {
|
else {
|
||||||
str1++;
|
str1++;
|
||||||
str2++;
|
str2++;
|
||||||
}
|
}
|
||||||
} else if (strcmp(str2, ".") == 0 || *str2 == NULL)
|
} else if (strcmp(str2, ".") == 0 || *str2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
else
|
else
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
@ -278,10 +278,10 @@ match_backward(char *str1, char *str2)
|
||||||
get_last_component(str2, &ptr2, com2, '.');
|
get_last_component(str2, &ptr2, com2, '.');
|
||||||
|
|
||||||
if (*com1) {
|
if (*com1) {
|
||||||
if (*com2 == NULL)
|
if (*com2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
} else {
|
} else {
|
||||||
if (*com2 == NULL)
|
if (*com2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
else
|
else
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
|
|
@ -69,7 +69,7 @@ _DtCmGetPrefix(char *str, char sep)
|
||||||
if (ptr == buf)
|
if (ptr == buf)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
else {
|
else {
|
||||||
*ptr = NULL;
|
*ptr = '\0';
|
||||||
return(strdup(buf));
|
return(strdup(buf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1134,15 +1134,15 @@ contain_substr(char *str1, char *str2)
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
if (str2 == NULL || *str2 == NULL)
|
if (str2 == NULL || *str2 == '\0')
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
|
|
||||||
if (str1 == NULL || *str1 == NULL) {
|
if (str1 == NULL || *str1 == '\0') {
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
} else {
|
} else {
|
||||||
len = strlen(str2);
|
len = strlen(str2);
|
||||||
|
|
||||||
for (i = 0; str1[i] != NULL; i++) {
|
for (i = 0; str1[i] != '\0'; i++) {
|
||||||
if (strncasecmp(&str1[i], str2, len) == 0)
|
if (strncasecmp(&str1[i], str2, len) == 0)
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ _DtCm_add_name_to_table(_DtCmNameTable *tbl, int index, char *newname)
|
||||||
return (CSA_E_INSUFFICIENT_MEMORY);
|
return (CSA_E_INSUFFICIENT_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
tbl->names = newptr;
|
tbl->names = newptr;
|
||||||
memset((void *)&tbl->names[tbl->size+1], NULL,
|
memset((void *)&tbl->names[tbl->size+1], 0,
|
||||||
sizeof(char *)*(index - tbl->size));
|
sizeof(char *)*(index - tbl->size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,12 +435,12 @@ occurrence : FIRSTWEEK endMarker
|
||||||
|
|
||||||
endDate : /* empty */
|
endDate : /* empty */
|
||||||
{
|
{
|
||||||
$$ = NULL;
|
$$ = '\0';
|
||||||
}
|
}
|
||||||
| DATE
|
| DATE
|
||||||
{
|
{
|
||||||
if (_csa_iso8601_to_tick($1, &$$) == -1)
|
if (_csa_iso8601_to_tick($1, &$$) == -1)
|
||||||
$$ = NULL;
|
$$ = '\0';
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ _DtCm_rpc_create_calendar(
|
||||||
/* check to make sure user is not creating a calendar
|
/* check to make sure user is not creating a calendar
|
||||||
* using another user's name
|
* using another user's name
|
||||||
*/
|
*/
|
||||||
if (ptr = strchr(cal->name, '@')) *ptr = NULL;
|
if (ptr = strchr(cal->name, '@')) *ptr = '\0';
|
||||||
if (_DtCmIsUserName(cal->name) == B_TRUE) {
|
if (_DtCmIsUserName(cal->name) == B_TRUE) {
|
||||||
|
|
||||||
if ((owner = _DtCmGetUserName()) == NULL)
|
if ((owner = _DtCmGetUserName()) == NULL)
|
||||||
|
@ -1412,7 +1412,7 @@ _GetV4UserAccess(Calendar *cal, cms_access_entry *alist)
|
||||||
boolean_t isowner = B_FALSE;
|
boolean_t isowner = B_FALSE;
|
||||||
|
|
||||||
/* first check if user is owner */
|
/* first check if user is owner */
|
||||||
if (ptr = strchr(cal->name, '@')) *ptr = NULL;
|
if (ptr = strchr(cal->name, '@')) *ptr = '\0';
|
||||||
|
|
||||||
if (_DtCmIsUserName(cal->name) == B_TRUE) {
|
if (_DtCmIsUserName(cal->name) == B_TRUE) {
|
||||||
if (strcmp(user, cal->name) == 0) {
|
if (strcmp(user, cal->name) == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue