deleted file mode 100644
--- a/.clang-format
+++ /dev/null
@@ -1,43 +0,0 @@
-BasedOnStyle: Google
-
-# Prevent the loss of indentation with these macros
-MacroBlockBegin: "^\
-JS_BEGIN_MACRO|\
-NS_INTERFACE_MAP_BEGIN|\
-NS_INTERFACE_TABLE_HEAD|\
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION|\
-NS_IMPL_CYCLE_COLLECTION_.*_BEGIN|\
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED|\
-NS_INTERFACE_TABLE_BEGIN|\
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED|\
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED|\
-NS_QUERYFRAME_HEAD$"
-MacroBlockEnd: "^\
-JS_END_MACRO|\
-NS_INTERFACE_MAP_END|\
-NS_IMPL_CYCLE_COLLECTION_.*_END|\
-NS_INTERFACE_TABLE_END|\
-NS_INTERFACE_TABLE_TAIL.*|\
-NS_INTERFACE_MAP_END_.*|\
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END_INHERITED|\
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED|\
-NS_QUERYFRAME_TAIL.*$"
-
-SortIncludes: false
-IndentPPDirectives: AfterHash
-StatementMacros: [MARKUPMAP, ASSERT_TRUE, ASSERT_FALSE, TEST, CHECK]
-
-# The Google coding style states:
-# You should do this consistently within a single file, so, when modifying an
-# existing file, use the style in that file.
-# Let's be more prescriptive and default to the one used in the Mozilla
-# coding style
-
-# Note that for the time being, we differ from the mozilla-central settings
-# and use derivative pointer alignment since right alignment is prevalent in
-# comm-central. Exceptions with left alignment are, amongst others:
-# db/ (Mork), mailnews/intl and mailnews/jsaccount.
-# We will decide later whether to make the pointer style consistent or not.
-# DerivePointerAlignment: false
-# PointerAlignment: Left
-DerivePointerAlignment: true
new file mode 100644
--- /dev/null
+++ b/.clang-format-ignore
@@ -0,0 +1,17 @@
+# Paths we don't want clang-format to touch.
+# NOTE:
+# This is currently just documenting intent. Due to Bug 1575449
+# `mach clang-format` will likely not pick up this file.
+
+# Specific modules to exclude.
+calendar/libical/.*
+ldap/c-sdk/.*
+suite/.*
+third_party/.*
+
+# General support directories (which don't contain any C++ anyway).
+build/.*
+mozharness/.*
+python/.*
+taskcluster/.*
+tools/.*
--- a/calendar/base/backend/libical/calAttributeHelpers.h
+++ b/calendar/base/backend/libical/calAttributeHelpers.h
@@ -17,38 +17,38 @@
/**
** A few helpers for declaring simple attribute getters and setters in
** calItemBase derivatives
**/
// helpers for string types
#define CAL_STRINGTYPE_ATTR_GETTER(cname, mtype, name) \
NS_IMETHODIMP \
- cname::Get##name(mtype &_retval) { \
+ cname::Get##name(mtype& _retval) { \
_retval.Assign(m##name); \
return NS_OK; \
}
#define CAL_STRINGTYPE_ATTR_SETTER(cname, mtype, name) \
NS_IMETHODIMP \
- cname::Set##name(const mtype &aValue) { \
+ cname::Set##name(const mtype& aValue) { \
CAL_ATTR_SET_PRE; \
m##name.Assign(aValue); \
CAL_ATTR_SET_POST; \
return NS_OK; \
}
#define CAL_STRINGTYPE_ATTR(cname, mtype, name) \
CAL_STRINGTYPE_ATTR_GETTER(cname, mtype, name) \
CAL_STRINGTYPE_ATTR_SETTER(cname, mtype, name)
// helpers for value types
#define CAL_VALUETYPE_ATTR_GETTER(cname, mtype, name) \
NS_IMETHODIMP \
- cname::Get##name(mtype *_retval) { \
+ cname::Get##name(mtype* _retval) { \
NS_ENSURE_ARG_POINTER(_retval); \
*_retval = m##name; \
return NS_OK; \
}
#define CAL_VALUETYPE_ATTR_SETTER(cname, mtype, name) \
NS_IMETHODIMP \
cname::Set##name(mtype aValue) { \
@@ -62,25 +62,25 @@
#define CAL_VALUETYPE_ATTR(cname, mtype, name) \
CAL_VALUETYPE_ATTR_GETTER(cname, mtype, name) \
CAL_VALUETYPE_ATTR_SETTER(cname, mtype, name)
// helpers for interface types
#define CAL_ISUPPORTS_ATTR_GETTER(cname, mtype, name) \
NS_IMETHODIMP \
- cname::Get##name(mtype **_retval) { \
+ cname::Get##name(mtype** _retval) { \
NS_ENSURE_ARG_POINTER(_retval); \
NS_IF_ADDREF(*_retval = m##name); \
return NS_OK; \
}
#define CAL_ISUPPORTS_ATTR_SETTER(cname, mtype, name) \
NS_IMETHODIMP \
- cname::Set##name(mtype *aValue) { \
+ cname::Set##name(mtype* aValue) { \
CAL_ATTR_SET_PRE; \
if (m##name != aValue) { \
m##name = aValue; \
CAL_ATTR_SET_POST; \
} \
return NS_OK; \
}
--- a/calendar/base/backend/libical/calDateTime.cpp
+++ b/calendar/base/backend/libical/calDateTime.cpp
@@ -25,48 +25,48 @@ extern "C" {
#define CAL_ATTR_SET_POST Normalize()
#include "calAttributeHelpers.h"
NS_IMPL_CLASSINFO(calDateTime, nullptr, 0, CAL_DATETIME_CID)
NS_IMPL_ISUPPORTS_CI(calDateTime, calIDateTime, calIDateTimeLibical)
calDateTime::calDateTime() : mImmutable(false) { Reset(); }
-calDateTime::calDateTime(icaltimetype const *atimeptr, calITimezone *tz)
+calDateTime::calDateTime(icaltimetype const* atimeptr, calITimezone* tz)
: mImmutable(false) {
FromIcalTime(atimeptr, tz);
}
NS_IMETHODIMP
-calDateTime::GetIsMutable(bool *aResult) {
+calDateTime::GetIsMutable(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = !mImmutable;
return NS_OK;
}
NS_IMETHODIMP
calDateTime::MakeImmutable() {
mImmutable = true;
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::Clone(calIDateTime **aResult) {
+calDateTime::Clone(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
icaltimetype itt;
ToIcalTime(&itt);
- calDateTime *const cdt = new calDateTime(&itt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&itt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
calDateTime::ResetTo(int16_t year, int16_t month, int16_t day, int16_t hour,
- int16_t minute, int16_t second, calITimezone *tz) {
+ int16_t minute, int16_t second, calITimezone* tz) {
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
NS_ENSURE_ARG_POINTER(tz);
mYear = year;
mMonth = month;
mDay = day;
mHour = hour;
mMinute = minute;
mSecond = second;
@@ -102,55 +102,55 @@ CAL_VALUETYPE_ATTR(calDateTime, int16_t,
CAL_VALUETYPE_ATTR(calDateTime, int16_t, Second)
CAL_VALUETYPE_ATTR(calDateTime, bool, IsDate)
CAL_VALUETYPE_ATTR_GETTER(calDateTime, bool, IsValid)
CAL_VALUETYPE_ATTR_GETTER(calDateTime, PRTime, NativeTime)
CAL_VALUETYPE_ATTR_GETTER(calDateTime, int16_t, Weekday)
CAL_VALUETYPE_ATTR_GETTER(calDateTime, int16_t, Yearday)
NS_IMETHODIMP
-calDateTime::GetTimezone(calITimezone **aResult) {
+calDateTime::GetTimezone(calITimezone** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
NS_IF_ADDREF(*aResult = mTimezone);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::SetTimezone(calITimezone *aValue) {
+calDateTime::SetTimezone(calITimezone* aValue) {
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
NS_ENSURE_ARG_POINTER(aValue);
mTimezone = aValue;
CAL_ATTR_SET_POST;
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetTimezoneOffset(int32_t *aResult) {
+calDateTime::GetTimezoneOffset(int32_t* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
icaltimetype icalt;
ToIcalTime(&icalt);
int dst;
- *aResult = icaltimezone_get_utc_offset(const_cast<icaltimezone *>(icalt.zone),
+ *aResult = icaltimezone_get_utc_offset(const_cast<icaltimezone*>(icalt.zone),
&icalt, &dst);
return NS_OK;
}
NS_IMETHODIMP
calDateTime::SetNativeTime(PRTime aNativeTime) {
icaltimetype icalt;
PRTimeToIcaltime(aNativeTime, false, icaltimezone_get_utc_timezone(), &icalt);
nsCOMPtr<calITimezone> ctz = cal::UTC();
FromIcalTime(&icalt, ctz);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::AddDuration(calIDuration *aDuration) {
+calDateTime::AddDuration(calIDuration* aDuration) {
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
NS_ENSURE_ARG_POINTER(aDuration);
ensureTimezone();
nsresult rv;
nsCOMPtr<calIDurationLibical> icaldur = do_QueryInterface(aDuration, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@@ -162,203 +162,203 @@ calDateTime::AddDuration(calIDuration *a
icaltimetype const newitt = icaltime_add(itt, idt);
FromIcalTime(&newitt, mTimezone);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::SubtractDate(calIDateTime *aDate, calIDuration **aDuration) {
+calDateTime::SubtractDate(calIDateTime* aDate, calIDuration** aDuration) {
NS_ENSURE_ARG_POINTER(aDate);
NS_ENSURE_ARG_POINTER(aDuration);
// same as icaltime_subtract(), but minding timezones:
PRTime t2t;
aDate->GetNativeTime(&t2t);
// for a duration, need to convert the difference in microseconds (prtime)
// to seconds (libical), so divide by one million.
icaldurationtype const idt = icaldurationtype_from_int(
static_cast<int>((mNativeTime - t2t) / int64_t(PR_USEC_PER_SEC)));
- calDuration *const dur = new calDuration(&idt);
+ calDuration* const dur = new calDuration(&idt);
CAL_ENSURE_MEMORY(dur);
NS_ADDREF(*aDuration = dur);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::ToString(nsACString &aResult) {
+calDateTime::ToString(nsACString& aResult) {
nsAutoCString tzid;
char buffer[256];
ensureTimezone();
mTimezone->GetTzid(tzid);
uint32_t const length = PR_snprintf(
buffer, sizeof(buffer),
"%04hd/%02hd/%02hd %02hd:%02hd:%02hd %s isDate=%01hd nativeTime=%lld",
mYear, mMonth + 1, mDay, mHour, mMinute, mSecond, tzid.get(),
static_cast<int16_t>(mIsDate), mNativeTime);
if (length != static_cast<uint32_t>(-1)) aResult.Assign(buffer, length);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetInTimezone(calITimezone *aTimezone, calIDateTime **aResult) {
+calDateTime::GetInTimezone(calITimezone* aTimezone, calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aTimezone);
NS_ENSURE_ARG_POINTER(aResult);
if (mIsDate) {
// if it's a date, we really just want to make a copy of this
// and set the timezone.
nsresult rv = Clone(aResult);
if (NS_SUCCEEDED(rv)) {
rv = (*aResult)->SetTimezone(aTimezone);
}
return rv;
} else {
icaltimetype icalt;
ToIcalTime(&icalt);
- icaltimezone *tz = cal::getIcalTimezone(aTimezone);
+ icaltimezone* tz = cal::getIcalTimezone(aTimezone);
if (icalt.zone == tz) {
return Clone(aResult);
}
/* If there's a zone, we need to convert; otherwise, we just
* assign, since this item is floating */
if (icalt.zone && tz) {
- icaltimezone_convert_time(&icalt, const_cast<icaltimezone *>(icalt.zone),
+ icaltimezone_convert_time(&icalt, const_cast<icaltimezone*>(icalt.zone),
tz);
}
icalt.zone = tz;
icalt.is_utc = (tz && tz == icaltimezone_get_utc_timezone());
- calDateTime *cdt = new calDateTime(&icalt, aTimezone);
+ calDateTime* cdt = new calDateTime(&icalt, aTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
}
NS_IMETHODIMP
-calDateTime::GetStartOfWeek(calIDateTime **aResult) {
+calDateTime::GetStartOfWeek(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
int day_of_week = icaltime_day_of_week(icalt);
if (day_of_week > 1) icaltime_adjust(&icalt, -(day_of_week - 1), 0, 0, 0);
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetEndOfWeek(calIDateTime **aResult) {
+calDateTime::GetEndOfWeek(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
int day_of_week = icaltime_day_of_week(icalt);
if (day_of_week < 7) icaltime_adjust(&icalt, 7 - day_of_week, 0, 0, 0);
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetStartOfMonth(calIDateTime **aResult) {
+calDateTime::GetStartOfMonth(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
icalt.day = 1;
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetEndOfMonth(calIDateTime **aResult) {
+calDateTime::GetEndOfMonth(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
icalt.day = icaltime_days_in_month(icalt.month, icalt.year);
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetStartOfYear(calIDateTime **aResult) {
+calDateTime::GetStartOfYear(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
icalt.month = 1;
icalt.day = 1;
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetEndOfYear(calIDateTime **aResult) {
+calDateTime::GetEndOfYear(calIDateTime** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
ensureTimezone();
icaltimetype icalt;
ToIcalTime(&icalt);
icalt.month = 12;
icalt.day = 31;
icalt.is_date = 1;
- calDateTime *const cdt = new calDateTime(&icalt, mTimezone);
+ calDateTime* const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::GetIcalString(nsACString &aResult) {
+calDateTime::GetIcalString(nsACString& aResult) {
icaltimetype t;
ToIcalTime(&t);
// note that ics is owned by libical, so we don't need to free
- char const *const ics = icaltime_as_ical_string(t);
+ char const* const ics = icaltime_as_ical_string(t);
CAL_ENSURE_MEMORY(ics);
aResult.Assign(ics);
return NS_OK;
}
NS_IMETHODIMP
-calDateTime::SetIcalString(nsACString const &aIcalString) {
+calDateTime::SetIcalString(nsACString const& aIcalString) {
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
icaltimetype icalt;
icalt = icaltime_from_string(PromiseFlatCString(aIcalString).get());
if (icaltime_is_null_time(icalt)) {
return static_cast<nsresult>(calIErrors::ICS_ERROR_BASE + icalerrno);
}
FromIcalTime(&icalt, nullptr);
return NS_OK;
@@ -379,40 +379,40 @@ void calDateTime::Normalize() {
void calDateTime::ensureTimezone() {
if (mTimezone == nullptr) {
mTimezone = cal::UTC();
}
}
NS_IMETHODIMP_(void)
-calDateTime::ToIcalTime(struct icaltimetype *icalt) {
+calDateTime::ToIcalTime(struct icaltimetype* icalt) {
ensureTimezone();
icalt->year = mYear;
icalt->month = mMonth + 1;
icalt->day = mDay;
icalt->hour = mHour;
icalt->minute = mMinute;
icalt->second = mSecond;
icalt->is_date = mIsDate ? 1 : 0;
icalt->is_daylight = 0;
- icaltimezone *tz = cal::getIcalTimezone(mTimezone);
+ icaltimezone* tz = cal::getIcalTimezone(mTimezone);
icalt->zone = tz;
icalt->is_utc = (tz && tz == icaltimezone_get_utc_timezone());
icalt->is_daylight = 0;
// xxx todo: discuss/investigate is_daylight
// if (tz) {
// icaltimezone_get_utc_offset(tz, icalt, &icalt->is_daylight);
// }
}
-void calDateTime::FromIcalTime(icaltimetype const *icalt, calITimezone *tz) {
+void calDateTime::FromIcalTime(icaltimetype const* icalt, calITimezone* tz) {
icaltimetype t = *icalt;
mIsValid =
(icaltime_is_null_time(t) || icaltime_is_valid_time(t) ? true : false);
mIsDate = t.is_date ? true : false;
if (mIsDate) {
t.hour = 0;
t.minute = 0;
@@ -445,46 +445,46 @@ void calDateTime::FromIcalTime(icaltimet
mTimezone->GetTzid(tzid);
if (tzid.EqualsLiteral("floating")) {
nsCOMPtr<calITimezone> ctz = cal::floating();
NS_ASSERTION(SameCOMIdentity(mTimezone, ctz), "floating mismatch!");
}
} else {
nsAutoCString tzid;
mTimezone->GetTzid(tzid);
- NS_ASSERTION(tzid.Equals(icaltimezone_get_tzid(
- const_cast<icaltimezone *>(t.zone))),
- "tzid mismatch!");
+ NS_ASSERTION(
+ tzid.Equals(icaltimezone_get_tzid(const_cast<icaltimezone*>(t.zone))),
+ "tzid mismatch!");
}
}
#endif
mWeekday = static_cast<int16_t>(icaltime_day_of_week(t) - 1);
mYearday = static_cast<int16_t>(icaltime_day_of_year(t));
// mNativeTime: not moving the existing date to UTC,
// but merely representing it a UTC-based way.
t.is_date = 0;
mNativeTime = IcaltimeToPRTime(&t, icaltimezone_get_utc_timezone());
}
-PRTime calDateTime::IcaltimeToPRTime(icaltimetype const *icalt,
- icaltimezone const *tz) {
+PRTime calDateTime::IcaltimeToPRTime(icaltimetype const* icalt,
+ icaltimezone const* tz) {
icaltimetype tt;
PRExplodedTime et;
/* If the time is the special null time, return 0. */
if (icaltime_is_null_time(*icalt)) {
return 0;
}
if (tz) {
// use libical for timezone conversion, as it can handle all ics
// timezones. having nspr do it is much harder.
- tt = icaltime_convert_to_zone(*icalt, const_cast<icaltimezone *>(tz));
+ tt = icaltime_convert_to_zone(*icalt, const_cast<icaltimezone*>(tz));
} else {
tt = *icalt;
}
/* Empty the destination */
memset(&et, 0, sizeof(struct PRExplodedTime));
/* Fill the fields */
@@ -498,18 +498,18 @@ PRTime calDateTime::IcaltimeToPRTime(ica
et.tm_mday = static_cast<int16_t>(tt.day);
et.tm_month = static_cast<int16_t>(tt.month - 1);
et.tm_year = static_cast<int16_t>(tt.year);
return PR_ImplodeTime(&et);
}
void calDateTime::PRTimeToIcaltime(PRTime time, bool isdate,
- icaltimezone const *tz,
- icaltimetype *icalt) {
+ icaltimezone const* tz,
+ icaltimetype* icalt) {
PRExplodedTime et;
PR_ExplodeTime(time, PR_GMTParameters, &et);
icalt->year = et.tm_year;
icalt->month = et.tm_month + 1;
icalt->day = et.tm_mday;
if (isdate) {
@@ -529,17 +529,17 @@ void calDateTime::PRTimeToIcaltime(PRTim
icalt->is_daylight = 0;
// xxx todo: discuss/investigate is_daylight
// if (tz) {
// icaltimezone_get_utc_offset(tz, icalt, &icalt->is_daylight);
// }
}
NS_IMETHODIMP
-calDateTime::Compare(calIDateTime *aOther, int32_t *aResult) {
+calDateTime::Compare(calIDateTime* aOther, int32_t* aResult) {
NS_ENSURE_ARG_POINTER(aOther);
NS_ENSURE_ARG_POINTER(aResult);
nsresult rv;
nsCOMPtr<calIDateTimeLibical> icalother = do_QueryInterface(aOther, &rv);
NS_ENSURE_SUCCESS(rv, rv);
bool otherIsDate = false;
--- a/calendar/base/backend/libical/calDuration.cpp
+++ b/calendar/base/backend/libical/calDuration.cpp
@@ -18,60 +18,60 @@
#define SECONDS_PER_HOUR 3600
#define SECONDS_PER_MINUTE 60
NS_IMPL_CLASSINFO(calDuration, nullptr, 0, CAL_DURATION_CID)
NS_IMPL_ISUPPORTS_CI(calDuration, calIDuration, calIDurationLibical)
calDuration::calDuration() : mImmutable(false) { Reset(); }
-calDuration::calDuration(const calDuration &cdt) {
+calDuration::calDuration(const calDuration& cdt) {
mDuration.is_neg = cdt.mDuration.is_neg;
mDuration.weeks = cdt.mDuration.weeks;
mDuration.days = cdt.mDuration.days;
mDuration.hours = cdt.mDuration.hours;
mDuration.minutes = cdt.mDuration.minutes;
mDuration.seconds = cdt.mDuration.seconds;
// copies are always mutable
mImmutable = false;
}
-calDuration::calDuration(const struct icaldurationtype *const aDurationPtr)
+calDuration::calDuration(const struct icaldurationtype* const aDurationPtr)
: mImmutable(false) {
FromIcalDuration(aDurationPtr);
}
NS_IMETHODIMP
calDuration::GetIcalDuration(JS::MutableHandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
calDuration::SetIcalDuration(JS::HandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-calDuration::GetIsMutable(bool *aResult) {
+calDuration::GetIsMutable(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = !mImmutable;
return NS_OK;
}
NS_IMETHODIMP
calDuration::MakeImmutable() {
mImmutable = true;
return NS_OK;
}
NS_IMETHODIMP
-calDuration::Clone(calIDuration **aResult) {
- calDuration *cdt = new calDuration(*this);
+calDuration::Clone(calIDuration** aResult) {
+ calDuration* cdt = new calDuration(*this);
if (!cdt) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
NS_IMETHODIMP
calDuration::Reset() {
@@ -82,77 +82,77 @@ calDuration::Reset() {
mDuration.days = 0;
mDuration.hours = 0;
mDuration.minutes = 0;
mDuration.seconds = 0;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetIsNegative(bool *_retval) {
+NS_IMETHODIMP calDuration::GetIsNegative(bool* _retval) {
*_retval = mDuration.is_neg;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetIsNegative(bool aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.is_neg = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetWeeks(int16_t *_retval) {
+NS_IMETHODIMP calDuration::GetWeeks(int16_t* _retval) {
*_retval = (int16_t)mDuration.weeks;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetWeeks(int16_t aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.weeks = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetDays(int16_t *_retval) {
+NS_IMETHODIMP calDuration::GetDays(int16_t* _retval) {
*_retval = (int16_t)mDuration.days;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetDays(int16_t aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.days = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetHours(int16_t *_retval) {
+NS_IMETHODIMP calDuration::GetHours(int16_t* _retval) {
*_retval = (int16_t)mDuration.hours;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetHours(int16_t aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.hours = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetMinutes(int16_t *_retval) {
+NS_IMETHODIMP calDuration::GetMinutes(int16_t* _retval) {
*_retval = (int16_t)mDuration.minutes;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetMinutes(int16_t aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.minutes = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetSeconds(int16_t *_retval) {
+NS_IMETHODIMP calDuration::GetSeconds(int16_t* _retval) {
*_retval = (int16_t)mDuration.seconds;
return NS_OK;
}
NS_IMETHODIMP calDuration::SetSeconds(int16_t aValue) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
mDuration.seconds = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::GetInSeconds(int32_t *_retval) {
+NS_IMETHODIMP calDuration::GetInSeconds(int32_t* _retval) {
int32_t retval =
(((int32_t)((int16_t)mDuration.weeks * SECONDS_PER_WEEK)) +
((int32_t)((int16_t)mDuration.days * SECONDS_PER_DAY)) +
((int32_t)((int16_t)mDuration.hours * SECONDS_PER_HOUR)) +
((int32_t)((int16_t)mDuration.minutes * SECONDS_PER_MINUTE)) +
((int32_t)((int16_t)mDuration.seconds)));
if (mDuration.is_neg) retval = -retval;
*_retval = retval;
@@ -179,17 +179,17 @@ NS_IMETHODIMP calDuration::SetInSeconds(
mDuration.minutes = aValue / SECONDS_PER_MINUTE;
aValue -= (mDuration.minutes * SECONDS_PER_MINUTE);
mDuration.seconds = aValue;
return NS_OK;
}
-NS_IMETHODIMP calDuration::AddDuration(calIDuration *aDuration) {
+NS_IMETHODIMP calDuration::AddDuration(calIDuration* aDuration) {
if (mImmutable) return NS_ERROR_CALENDAR_IMMUTABLE;
nsresult rv;
nsCOMPtr<calIDurationLibical> icaldur = do_QueryInterface(aDuration, &rv);
NS_ENSURE_SUCCESS(rv, rv);
struct icaldurationtype idt;
icaldur->ToIcalDuration(&idt);
@@ -224,61 +224,61 @@ calDuration::Normalize() {
int32_t totalInSeconds;
GetInSeconds(&totalInSeconds);
SetInSeconds(totalInSeconds);
return NS_OK;
}
NS_IMETHODIMP
-calDuration::ToString(nsACString &aResult) { return GetIcalString(aResult); }
+calDuration::ToString(nsACString& aResult) { return GetIcalString(aResult); }
NS_IMETHODIMP_(void)
-calDuration::ToIcalDuration(struct icaldurationtype *icald) {
+calDuration::ToIcalDuration(struct icaldurationtype* icald) {
icald->is_neg = mDuration.is_neg;
icald->weeks = mDuration.weeks;
icald->days = mDuration.days;
icald->hours = mDuration.hours;
icald->minutes = mDuration.minutes;
icald->seconds = mDuration.seconds;
return;
}
-void calDuration::FromIcalDuration(const struct icaldurationtype *const icald) {
+void calDuration::FromIcalDuration(const struct icaldurationtype* const icald) {
mDuration.is_neg = icald->is_neg;
mDuration.weeks = icald->weeks;
mDuration.days = icald->days;
mDuration.hours = icald->hours;
mDuration.minutes = icald->minutes;
mDuration.seconds = icald->seconds;
return;
}
NS_IMETHODIMP
-calDuration::GetIcalString(nsACString &aResult) {
+calDuration::GetIcalString(nsACString& aResult) {
// note that ics is owned by libical, so we don't need to free
- const char *ics = icaldurationtype_as_ical_string(mDuration);
+ const char* ics = icaldurationtype_as_ical_string(mDuration);
if (ics) {
aResult.Assign(ics);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
-calDuration::SetIcalString(const nsACString &aIcalString) {
+calDuration::SetIcalString(const nsACString& aIcalString) {
mDuration =
icaldurationtype_from_string(PromiseFlatCString(aIcalString).get());
return NS_OK;
}
NS_IMETHODIMP
-calDuration::Compare(calIDuration *aOther, int32_t *aResult) {
+calDuration::Compare(calIDuration* aOther, int32_t* aResult) {
int32_t thisInSeconds, otherInSeconds;
// cast to void because these calls can't fail
(void)GetInSeconds(&thisInSeconds);
(void)aOther->GetInSeconds(&otherInSeconds);
if (thisInSeconds < otherInSeconds) {
*aResult = -1;
--- a/calendar/base/backend/libical/calICSService.cpp
+++ b/calendar/base/backend/libical/calICSService.cpp
@@ -19,59 +19,59 @@ calIcalProperty::~calIcalProperty() {
if (!mParent) {
icalproperty_free(mProperty);
}
}
NS_IMPL_CLASSINFO(calIcalProperty, nullptr, 0, CAL_ICALPROPERTY_CID)
NS_IMPL_ISUPPORTS_CI(calIcalProperty, calIIcalProperty, calIIcalPropertyLibical)
-NS_IMETHODIMP_(icalproperty *)
+NS_IMETHODIMP_(icalproperty*)
calIcalProperty::GetLibicalProperty() { return mProperty; }
-NS_IMETHODIMP_(icalcomponent *)
+NS_IMETHODIMP_(icalcomponent*)
calIcalProperty::GetLibicalComponent() {
return mParent->GetLibicalComponent();
}
NS_IMETHODIMP
-calIcalProperty::GetIcalString(nsACString &str) {
- char const *icalstr = icalproperty_as_ical_string(mProperty);
+calIcalProperty::GetIcalString(nsACString& str) {
+ char const* icalstr = icalproperty_as_ical_string(mProperty);
if (icalstr == 0) {
#ifdef DEBUG
fprintf(stderr, "Error getting ical string: %d (%s)\n", icalerrno,
icalerror_strerror(icalerrno));
#endif
return static_cast<nsresult>(calIErrors::ICS_ERROR_BASE + icalerrno);
}
str.Assign(icalstr);
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::ToString(nsACString &aResult) {
+calIcalProperty::ToString(nsACString& aResult) {
return GetIcalString(aResult);
}
NS_IMETHODIMP
-calIcalProperty::GetValue(nsACString &str) {
- icalvalue *value = icalproperty_get_value(mProperty);
+calIcalProperty::GetValue(nsACString& str) {
+ icalvalue* value = icalproperty_get_value(mProperty);
icalvalue_kind valuekind = icalvalue_isa(value);
- const char *icalstr;
+ const char* icalstr;
if (valuekind == ICAL_TEXT_VALUE) {
icalstr = icalvalue_get_text(value);
} else if (valuekind == ICAL_X_VALUE) {
icalstr = icalvalue_get_x(value);
} else if (valuekind == ICAL_ATTACH_VALUE) {
- icalattach *attach = icalvalue_get_attach(value);
+ icalattach* attach = icalvalue_get_attach(value);
if (icalattach_get_is_url(attach)) {
icalstr = icalattach_get_url(attach);
} else {
- icalstr = (const char *)icalattach_get_data(attach);
+ icalstr = (const char*)icalattach_get_data(attach);
}
} else {
icalstr = icalproperty_get_value_as_string(mProperty);
}
if (!icalstr) {
if (icalerrno == ICAL_BADARG_ERROR) {
str.Truncate();
@@ -88,39 +88,39 @@ calIcalProperty::GetValue(nsACString &st
return NS_ERROR_FAILURE;
}
str.Assign(icalstr);
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::SetValue(const nsACString &str) {
+calIcalProperty::SetValue(const nsACString& str) {
icalvalue_kind kind =
icalproperty_kind_to_value_kind(icalproperty_isa(mProperty));
if (kind == ICAL_TEXT_VALUE) {
- icalvalue *v = icalvalue_new_text(PromiseFlatCString(str).get());
+ icalvalue* v = icalvalue_new_text(PromiseFlatCString(str).get());
icalproperty_set_value(mProperty, v);
} else if (kind == ICAL_X_VALUE) {
- icalvalue *v = icalvalue_new_x(PromiseFlatCString(str).get());
+ icalvalue* v = icalvalue_new_x(PromiseFlatCString(str).get());
icalproperty_set_value(mProperty, v);
} else if (kind == ICAL_ATTACH_VALUE) {
- icalattach *v = icalattach_new_from_data(PromiseFlatCString(str).get(),
+ icalattach* v = icalattach_new_from_data(PromiseFlatCString(str).get(),
nullptr, nullptr);
icalproperty_set_attach(mProperty, v);
} else {
icalproperty_set_value_from_string(mProperty, PromiseFlatCString(str).get(),
icalvalue_kind_to_string(kind));
}
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::GetValueAsIcalString(nsACString &str) {
- const char *icalstr = icalproperty_get_value_as_string(mProperty);
+calIcalProperty::GetValueAsIcalString(nsACString& str) {
+ const char* icalstr = icalproperty_get_value_as_string(mProperty);
if (!icalstr) {
if (icalerrno == ICAL_BADARG_ERROR) {
str.Truncate();
// Set string to null, because we don't have a value
// (which is something different then an empty value)
str.SetIsVoid(true);
return NS_OK;
}
@@ -132,62 +132,62 @@ calIcalProperty::GetValueAsIcalString(ns
return NS_ERROR_FAILURE;
}
str.Assign(icalstr);
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::SetValueAsIcalString(const nsACString &str) {
- const char *kindstr = icalvalue_kind_to_string(
+calIcalProperty::SetValueAsIcalString(const nsACString& str) {
+ const char* kindstr = icalvalue_kind_to_string(
icalproperty_kind_to_value_kind(icalproperty_isa(mProperty)));
icalproperty_set_value_from_string(mProperty, PromiseFlatCString(str).get(),
kindstr);
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::GetPropertyName(nsACString &name) {
- const char *icalstr = icalproperty_get_property_name(mProperty);
+calIcalProperty::GetPropertyName(nsACString& name) {
+ const char* icalstr = icalproperty_get_property_name(mProperty);
if (!icalstr) {
#ifdef DEBUG
fprintf(stderr, "Error getting property name: %d (%s)\n", icalerrno,
icalerror_strerror(icalerrno));
#endif
return NS_ERROR_FAILURE;
}
name.Assign(icalstr);
return NS_OK;
}
-static icalparameter *FindParameter(icalproperty *prop, const nsACString ¶m,
+static icalparameter* FindParameter(icalproperty* prop, const nsACString& param,
icalparameter_kind kind) {
- for (icalparameter *icalparam = icalproperty_get_first_parameter(prop, kind);
+ for (icalparameter* icalparam = icalproperty_get_first_parameter(prop, kind);
icalparam; icalparam = icalproperty_get_next_parameter(prop, kind)) {
if (param.Equals(icalparameter_get_xname(icalparam))) return icalparam;
}
return nullptr;
}
NS_IMETHODIMP
-calIcalProperty::GetParameter(const nsACString ¶m, nsACString &value) {
+calIcalProperty::GetParameter(const nsACString& param, nsACString& value) {
// More ridiculous parameter/X-PARAMETER handling.
icalparameter_kind paramkind =
icalparameter_string_to_kind(PromiseFlatCString(param).get());
if (paramkind == ICAL_NO_PARAMETER) return NS_ERROR_INVALID_ARG;
- const char *icalstr = nullptr;
+ const char* icalstr = nullptr;
if (paramkind == ICAL_X_PARAMETER) {
- icalparameter *icalparam =
+ icalparameter* icalparam =
FindParameter(mProperty, param, ICAL_X_PARAMETER);
if (icalparam) icalstr = icalparameter_get_xvalue(icalparam);
} else if (paramkind == ICAL_IANA_PARAMETER) {
- icalparameter *icalparam =
+ icalparameter* icalparam =
FindParameter(mProperty, param, ICAL_IANA_PARAMETER);
if (icalparam) icalstr = icalparameter_get_iana_value(icalparam);
} else {
icalstr = icalproperty_get_parameter_as_string(
mProperty, PromiseFlatCString(param).get());
}
if (!icalstr) {
@@ -195,50 +195,50 @@ calIcalProperty::GetParameter(const nsAC
value.SetIsVoid(true);
} else {
value.Assign(icalstr);
}
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::SetParameter(const nsACString ¶m,
- const nsACString &value) {
+calIcalProperty::SetParameter(const nsACString& param,
+ const nsACString& value) {
icalparameter_kind paramkind =
icalparameter_string_to_kind(PromiseFlatCString(param).get());
if (paramkind == ICAL_NO_PARAMETER) return NS_ERROR_INVALID_ARG;
// Because libical's support for manipulating parameters is weak, and
// X-PARAMETERS doubly so, we walk the list looking for an existing one of
// that name, and reset its value if found.
if (paramkind == ICAL_X_PARAMETER) {
- icalparameter *icalparam =
+ icalparameter* icalparam =
FindParameter(mProperty, param, ICAL_X_PARAMETER);
if (icalparam) {
icalparameter_set_xvalue(icalparam, PromiseFlatCString(value).get());
return NS_OK;
}
// If not found, fall through to adding a new parameter below.
} else if (paramkind == ICAL_IANA_PARAMETER) {
- icalparameter *icalparam =
+ icalparameter* icalparam =
FindParameter(mProperty, param, ICAL_IANA_PARAMETER);
if (icalparam) {
icalparameter_set_iana_value(icalparam, PromiseFlatCString(value).get());
return NS_OK;
}
// If not found, fall through to adding a new parameter below.
} else {
// We could try getting an existing parameter here and resetting its
// value, but this is easier and I don't care that much about parameter
// performance at this point.
RemoveParameter(param);
}
- icalparameter *icalparam = icalparameter_new_from_value_string(
+ icalparameter* icalparam = icalparameter_new_from_value_string(
paramkind, PromiseFlatCString(value).get());
if (!icalparam) return NS_ERROR_OUT_OF_MEMORY;
// You might ask me "why does libical not do this for us?" and I would
// just nod knowingly but sadly at you in return.
//
// You might also, if you were not too distracted by the first question,
// ask why we have icalproperty_set_x_name but icalparameter_set_xname.
@@ -248,18 +248,18 @@ calIcalProperty::SetParameter(const nsAC
else if (paramkind == ICAL_IANA_PARAMETER)
icalparameter_set_iana_name(icalparam, PromiseFlatCString(param).get());
icalproperty_add_parameter(mProperty, icalparam);
// XXX check ical errno
return NS_OK;
}
-static nsresult FillParameterName(icalparameter *icalparam, nsACString &name) {
- const char *propname = nullptr;
+static nsresult FillParameterName(icalparameter* icalparam, nsACString& name) {
+ const char* propname = nullptr;
if (icalparam) {
icalparameter_kind paramkind = icalparameter_isa(icalparam);
if (paramkind == ICAL_X_PARAMETER)
propname = icalparameter_get_xname(icalparam);
else if (paramkind == ICAL_IANA_PARAMETER)
propname = icalparameter_get_iana_name(icalparam);
else if (paramkind != ICAL_NO_PARAMETER)
propname = icalparameter_kind_to_string(paramkind);
@@ -271,31 +271,31 @@ static nsresult FillParameterName(icalpa
name.Truncate();
name.SetIsVoid(true);
}
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::GetFirstParameterName(nsACString &name) {
- icalparameter *icalparam =
+calIcalProperty::GetFirstParameterName(nsACString& name) {
+ icalparameter* icalparam =
icalproperty_get_first_parameter(mProperty, ICAL_ANY_PARAMETER);
return FillParameterName(icalparam, name);
}
NS_IMETHODIMP
-calIcalProperty::GetNextParameterName(nsACString &name) {
- icalparameter *icalparam =
+calIcalProperty::GetNextParameterName(nsACString& name) {
+ icalparameter* icalparam =
icalproperty_get_next_parameter(mProperty, ICAL_ANY_PARAMETER);
return FillParameterName(icalparam, name);
}
NS_IMETHODIMP
-calIcalProperty::RemoveParameter(const nsACString ¶m) {
+calIcalProperty::RemoveParameter(const nsACString& param) {
icalproperty_remove_parameter_by_name(mProperty,
PromiseFlatCString(param).get());
// XXX check ical errno
return NS_OK;
}
NS_IMETHODIMP
calIcalProperty::ClearXParameters() {
@@ -304,89 +304,89 @@ calIcalProperty::ClearXParameters() {
oldcount = paramcount;
icalproperty_remove_parameter(mProperty, ICAL_X_PARAMETER);
paramcount = icalproperty_count_parameters(mProperty);
} while (oldcount != paramcount);
return NS_OK;
}
NS_IMETHODIMP
-calIcalProperty::GetValueAsDatetime(calIDateTime **dtp) {
+calIcalProperty::GetValueAsDatetime(calIDateTime** dtp) {
NS_ENSURE_ARG_POINTER(dtp);
return getDatetime_(toIcalComponent(mParent), mProperty, dtp);
}
-nsresult calIcalProperty::getDatetime_(calIcalComponent *parent,
- icalproperty *prop, calIDateTime **dtp) {
- icalvalue *const val = icalproperty_get_value(prop);
+nsresult calIcalProperty::getDatetime_(calIcalComponent* parent,
+ icalproperty* prop, calIDateTime** dtp) {
+ icalvalue* const val = icalproperty_get_value(prop);
icalvalue_kind const valkind = icalvalue_isa(val);
if (valkind != ICAL_DATETIME_VALUE && valkind != ICAL_DATE_VALUE) {
return NS_ERROR_UNEXPECTED;
}
icaltimetype itt = icalvalue_get_datetime(val);
- char const *tzid_ = nullptr;
+ char const* tzid_ = nullptr;
if (!itt.is_utc) {
if (itt.zone) {
- tzid_ = icaltimezone_get_tzid(const_cast<icaltimezone *>(itt.zone));
+ tzid_ = icaltimezone_get_tzid(const_cast<icaltimezone*>(itt.zone));
} else {
// Need to get the tzid param. Unfortunately, libical tends to return raw
// ics strings, with quotes and everything. That's not what we want. Need
// to work around.
- icalparameter *const tzparam =
+ icalparameter* const tzparam =
icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER);
if (tzparam) {
tzid_ = icalparameter_get_xvalue(tzparam);
}
}
}
nsCOMPtr<calITimezone> tz;
if (tzid_) {
nsDependentCString const tzid(tzid_);
- calIcalComponent *comp = nullptr;
+ calIcalComponent* comp = nullptr;
if (parent) {
comp = parent->getParentVCalendarOrThis();
}
// look up parent if timezone is already referenced:
if (comp) {
comp->mReferencedTimezones.Get(tzid, getter_AddRefs(tz));
}
if (!tz) {
if (parent) {
// passed tz provider has precedence over timezone service:
- calITimezoneProvider *const tzProvider = parent->getTzProvider();
+ calITimezoneProvider* const tzProvider = parent->getTzProvider();
if (tzProvider) {
tzProvider->GetTimezone(tzid, getter_AddRefs(tz));
NS_ASSERTION(tz, tzid_);
}
}
if (!tz) {
// look up tz in tz service.
// this hides errors from incorrect ics files, which could state
// a TZID that is not present in the ics file.
// The other way round, it makes this product more error tolerant.
nsresult rv =
cal::getTimezoneService()->GetTimezone(tzid, getter_AddRefs(tz));
if (NS_FAILED(rv) || !tz) {
- icaltimezone const *zone = itt.zone;
+ icaltimezone const* zone = itt.zone;
if (!zone && comp) {
// look up parent VCALENDAR for VTIMEZONE:
zone = icalcomponent_get_timezone(comp->mComponent, tzid_);
NS_ASSERTION(zone, tzid_);
}
if (zone) {
// We need to decouple this (inner) VTIMEZONE from the parent
// VCALENDAR to avoid running into circular references (referenced
// timezones):
- icaltimezone *const clonedZone = icaltimezone_new();
+ icaltimezone* const clonedZone = icaltimezone_new();
CAL_ENSURE_MEMORY(clonedZone);
- icalcomponent *const clonedZoneComp = icalcomponent_new_clone(
- icaltimezone_get_component(const_cast<icaltimezone *>(zone)));
+ icalcomponent* const clonedZoneComp = icalcomponent_new_clone(
+ icaltimezone_get_component(const_cast<icaltimezone*>(zone)));
if (!clonedZoneComp) {
icaltimezone_free(clonedZone, 1 /* free struct */);
CAL_ENSURE_MEMORY(clonedZoneComp);
}
if (!icaltimezone_set_component(clonedZone, clonedZoneComp)) {
icaltimezone_free(clonedZone, 1 /* free struct */);
return NS_ERROR_INVALID_ARG;
}
@@ -437,261 +437,261 @@ calIcalComponent::GetIcalComponent(JS::M
}
NS_IMETHODIMP
calIcalComponent::SetIcalComponent(JS::HandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-calIcalComponent::GetParent(calIIcalComponent **parent) {
+calIcalComponent::GetParent(calIIcalComponent** parent) {
NS_ENSURE_ARG_POINTER(parent);
NS_IF_ADDREF(*parent = mParent);
return NS_OK;
}
NS_IMETHODIMP
calIcalComponent::GetIcalTimezone(JS::MutableHandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
calIcalComponent::SetIcalTimezone(JS::HandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-calIcalComponent::AddTimezoneReference(calITimezone *aTimezone) {
+calIcalComponent::AddTimezoneReference(calITimezone* aTimezone) {
NS_ENSURE_ARG_POINTER(aTimezone);
nsAutoCString tzid;
nsresult rv = aTimezone->GetTzid(tzid);
NS_ENSURE_SUCCESS(rv, rv);
mReferencedTimezones.Put(tzid, aTimezone);
return NS_OK;
}
NS_IMETHODIMP
calIcalComponent::GetReferencedTimezones(
- nsTArray<RefPtr<calITimezone>> &aTimezones) {
+ nsTArray<RefPtr<calITimezone>>& aTimezones) {
aTimezones.ClearAndRetainStorage();
uint32_t const count = mReferencedTimezones.Count();
if (count == 0) {
return NS_OK;
}
aTimezones.SetCapacity(count);
for (auto iter = mReferencedTimezones.ConstIter(); !iter.Done();
iter.Next()) {
aTimezones.AppendElement(iter.Data());
}
return NS_OK;
}
nsresult calIcalComponent::SetPropertyValue(icalproperty_kind kind,
- icalvalue *val) {
+ icalvalue* val) {
ClearAllProperties(kind);
if (!val) return NS_OK;
- icalproperty *prop = icalproperty_new(kind);
+ icalproperty* prop = icalproperty_new(kind);
if (!prop) {
icalvalue_free(val);
return NS_ERROR_OUT_OF_MEMORY;
}
icalproperty_set_value(prop, val);
icalcomponent_add_property(mComponent, prop);
return NS_OK;
}
nsresult calIcalComponent::SetProperty(icalproperty_kind kind,
- icalproperty *prop) {
+ icalproperty* prop) {
ClearAllProperties(kind);
if (!prop) return NS_OK;
icalcomponent_add_property(mComponent, prop);
return NS_OK;
}
#define COMP_STRING_TO_ENUM_ATTRIBUTE(Attrname, ICALNAME, lcname) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(nsACString &str) { \
+ calIcalComponent::Get##Attrname(nsACString& str) { \
int32_t val; \
nsresult rv = GetIntProperty(ICAL_##ICALNAME##_PROPERTY, &val); \
if (NS_FAILED(rv)) return rv; \
if (val == -1) { \
str.Truncate(); \
str.SetIsVoid(true); \
} else { \
str.Assign( \
icalproperty_##lcname##_to_string((icalproperty_##lcname)val)); \
} \
return NS_OK; \
} \
\
NS_IMETHODIMP \
- calIcalComponent::Set##Attrname(const nsACString &str) { \
- icalproperty *prop = nullptr; \
+ calIcalComponent::Set##Attrname(const nsACString& str) { \
+ icalproperty* prop = nullptr; \
if (!str.IsVoid()) { \
icalproperty_##lcname val = \
icalproperty_string_to_##lcname(PromiseFlatCString(str).get()); \
prop = icalproperty_new_##lcname(val); \
if (!prop) return NS_ERROR_OUT_OF_MEMORY; /* XXX map errno */ \
} \
return SetProperty(ICAL_##ICALNAME##_PROPERTY, prop); \
}
#define COMP_GENERAL_STRING_ATTRIBUTE(Attrname, ICALNAME) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(nsACString &str) { \
+ calIcalComponent::Get##Attrname(nsACString& str) { \
return GetStringProperty(ICAL_##ICALNAME##_PROPERTY, str); \
} \
\
NS_IMETHODIMP \
- calIcalComponent::Set##Attrname(const nsACString &str) { \
+ calIcalComponent::Set##Attrname(const nsACString& str) { \
return SetStringProperty(ICAL_##ICALNAME##_PROPERTY, str); \
}
#define COMP_STRING_ATTRIBUTE(Attrname, ICALNAME, lcname) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(nsACString &str) { \
+ calIcalComponent::Get##Attrname(nsACString& str) { \
return GetStringProperty(ICAL_##ICALNAME##_PROPERTY, str); \
} \
\
NS_IMETHODIMP \
- calIcalComponent::Set##Attrname(const nsACString &str) { \
- icalproperty *prop = \
+ calIcalComponent::Set##Attrname(const nsACString& str) { \
+ icalproperty* prop = \
icalproperty_new_##lcname(PromiseFlatCString(str).get()); \
return SetProperty(ICAL_##ICALNAME##_PROPERTY, prop); \
}
#define COMP_GENERAL_INT_ATTRIBUTE(Attrname, ICALNAME) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(int32_t *valp) { \
+ calIcalComponent::Get##Attrname(int32_t* valp) { \
return GetIntProperty(ICAL_##ICALNAME##_PROPERTY, valp); \
} \
\
NS_IMETHODIMP \
calIcalComponent::Set##Attrname(int32_t val) { \
return SetIntProperty(ICAL_##ICALNAME##_PROPERTY, val); \
}
#define COMP_ENUM_ATTRIBUTE(Attrname, ICALNAME, lcname) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(int32_t *valp) { \
+ calIcalComponent::Get##Attrname(int32_t* valp) { \
return GetIntProperty(ICAL_##ICALNAME##_PROPERTY, valp); \
} \
\
NS_IMETHODIMP \
calIcalComponent::Set##Attrname(int32_t val) { \
- icalproperty *prop = \
+ icalproperty* prop = \
icalproperty_new_##lcname((icalproperty_##lcname)val); \
return SetProperty(ICAL_##ICALNAME##_PROPERTY, prop); \
}
#define COMP_INT_ATTRIBUTE(Attrname, ICALNAME, lcname) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(int32_t *valp) { \
+ calIcalComponent::Get##Attrname(int32_t* valp) { \
return GetIntProperty(ICAL_##ICALNAME##_PROPERTY, valp); \
} \
\
NS_IMETHODIMP \
calIcalComponent::Set##Attrname(int32_t val) { \
- icalproperty *prop = icalproperty_new_##lcname(val); \
+ icalproperty* prop = icalproperty_new_##lcname(val); \
return SetProperty(ICAL_##ICALNAME##_PROPERTY, prop); \
}
nsresult calIcalComponent::GetStringProperty(icalproperty_kind kind,
- nsACString &str) {
- icalproperty *prop = icalcomponent_get_first_property(mComponent, kind);
+ nsACString& str) {
+ icalproperty* prop = icalcomponent_get_first_property(mComponent, kind);
if (!prop) {
str.Truncate();
str.SetIsVoid(true);
} else {
str.Assign(icalvalue_get_string(icalproperty_get_value(prop)));
}
return NS_OK;
}
nsresult calIcalComponent::SetStringProperty(icalproperty_kind kind,
- const nsACString &str) {
- icalvalue *val = nullptr;
+ const nsACString& str) {
+ icalvalue* val = nullptr;
if (!str.IsVoid()) {
val = icalvalue_new_string(PromiseFlatCString(str).get());
if (!val) return NS_ERROR_OUT_OF_MEMORY;
}
return SetPropertyValue(kind, val);
}
nsresult calIcalComponent::GetIntProperty(icalproperty_kind kind,
- int32_t *valp) {
- icalproperty *prop = icalcomponent_get_first_property(mComponent, kind);
+ int32_t* valp) {
+ icalproperty* prop = icalcomponent_get_first_property(mComponent, kind);
if (!prop)
*valp = calIIcalComponent::INVALID_VALUE;
else
*valp = (int32_t)icalvalue_get_integer(icalproperty_get_value(prop));
return NS_OK;
}
nsresult calIcalComponent::SetIntProperty(icalproperty_kind kind, int32_t i) {
- icalvalue *val = icalvalue_new_integer(i);
+ icalvalue* val = icalvalue_new_integer(i);
if (!val) return NS_ERROR_OUT_OF_MEMORY;
return SetPropertyValue(kind, val);
}
nsresult calIcalComponent::GetDateTimeAttribute(icalproperty_kind kind,
- calIDateTime **dtp) {
+ calIDateTime** dtp) {
NS_ENSURE_ARG_POINTER(dtp);
- icalproperty *prop = icalcomponent_get_first_property(mComponent, kind);
+ icalproperty* prop = icalcomponent_get_first_property(mComponent, kind);
if (!prop) {
*dtp = nullptr; /* invalid date */
return NS_OK;
}
return calIcalProperty::getDatetime_(this, prop, dtp);
}
nsresult calIcalComponent::SetDateTimeAttribute(icalproperty_kind kind,
- calIDateTime *dt) {
+ calIDateTime* dt) {
ClearAllProperties(kind);
bool isValid;
if (!dt || NS_FAILED(dt->GetIsValid(&isValid)) || !isValid) {
return NS_OK;
}
- icalproperty *prop = icalproperty_new(kind);
+ icalproperty* prop = icalproperty_new(kind);
CAL_ENSURE_MEMORY(prop);
nsresult rc = calIcalProperty::setDatetime_(this, prop, dt);
if (NS_SUCCEEDED(rc))
icalcomponent_add_property(mComponent, prop);
else
icalproperty_free(prop);
return rc;
}
NS_IMETHODIMP
-calIcalProperty::GetParent(calIIcalComponent **parent) {
+calIcalProperty::GetParent(calIIcalComponent** parent) {
NS_IF_ADDREF(*parent = mParent);
return NS_OK;
}
NS_IMETHODIMP
calIcalProperty::GetIcalProperty(JS::MutableHandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
calIcalProperty::SetIcalProperty(JS::HandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-calIcalProperty::SetValueAsDatetime(calIDateTime *dt) {
+calIcalProperty::SetValueAsDatetime(calIDateTime* dt) {
NS_ENSURE_ARG_POINTER(dt);
return setDatetime_(toIcalComponent(mParent), mProperty, dt);
}
-nsresult calIcalProperty::setDatetime_(calIcalComponent *parent,
- icalproperty *prop, calIDateTime *dt) {
+nsresult calIcalProperty::setDatetime_(calIcalComponent* parent,
+ icalproperty* prop, calIDateTime* dt) {
NS_ENSURE_ARG_POINTER(prop);
NS_ENSURE_ARG_POINTER(dt);
nsresult rv;
nsCOMPtr<calIDateTimeLibical> icaldt = do_QueryInterface(dt, &rv);
NS_ENSURE_SUCCESS(rv, rv);
icaltimetype itt;
@@ -700,66 +700,66 @@ nsresult calIcalProperty::setDatetime_(c
if (parent) {
if (!itt.is_utc) {
nsCOMPtr<calITimezone> tz;
rv = dt->GetTimezone(getter_AddRefs(tz));
NS_ENSURE_SUCCESS(rv, rv);
if (itt.zone) {
rv = parent->getParentVCalendarOrThis()->AddTimezoneReference(tz);
NS_ENSURE_SUCCESS(rv, rv);
- icalparameter *const param = icalparameter_new_from_value_string(
+ icalparameter* const param = icalparameter_new_from_value_string(
ICAL_TZID_PARAMETER,
- icaltimezone_get_tzid(const_cast<icaltimezone *>(itt.zone)));
+ icaltimezone_get_tzid(const_cast<icaltimezone*>(itt.zone)));
icalproperty_set_parameter(prop, param);
} else { // either floating or phantom:
bool b = false;
if (NS_FAILED(tz->GetIsFloating(&b)) || !b) {
// restore the same phantom TZID:
nsAutoCString tzid;
rv = tz->GetTzid(tzid);
NS_ENSURE_SUCCESS(rv, rv);
- icalparameter *const param = icalparameter_new_from_value_string(
+ icalparameter* const param = icalparameter_new_from_value_string(
ICAL_TZID_PARAMETER, tzid.get());
icalproperty_set_parameter(prop, param);
}
}
}
} else if (!itt.is_date && !itt.is_utc && itt.zone) {
// no parent to add the CTIMEZONE to: coerce DATETIMEs to UTC, DATEs to
// floating
- icaltimezone_convert_time(&itt, const_cast<icaltimezone *>(itt.zone),
+ icaltimezone_convert_time(&itt, const_cast<icaltimezone*>(itt.zone),
icaltimezone_get_utc_timezone());
itt.zone = icaltimezone_get_utc_timezone();
itt.is_utc = 1;
}
- icalvalue *const val = icalvalue_new_datetime(itt);
+ icalvalue* const val = icalvalue_new_datetime(itt);
CAL_ENSURE_MEMORY(val);
icalproperty_set_value(prop, val);
return NS_OK;
}
#define RO_COMP_DATE_ATTRIBUTE(Attrname, ICALNAME) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(calIDateTime **dtp) { \
+ calIcalComponent::Get##Attrname(calIDateTime** dtp) { \
return GetDateTimeAttribute(ICAL_##ICALNAME##_PROPERTY, dtp); \
}
#define COMP_DATE_ATTRIBUTE(Attrname, ICALNAME) \
RO_COMP_DATE_ATTRIBUTE(Attrname, ICALNAME) \
\
NS_IMETHODIMP \
- calIcalComponent::Set##Attrname(calIDateTime *dt) { \
+ calIcalComponent::Set##Attrname(calIDateTime* dt) { \
return SetDateTimeAttribute(ICAL_##ICALNAME##_PROPERTY, dt); \
}
#define RO_COMP_DURATION_ATTRIBUTE(Attrname, ICALNAME) \
NS_IMETHODIMP \
- calIcalComponent::Get##Attrname(calIDuration **dtp) { \
- icalproperty *prop = icalcomponent_get_first_property( \
+ calIcalComponent::Get##Attrname(calIDuration** dtp) { \
+ icalproperty* prop = icalcomponent_get_first_property( \
mComponent, ICAL_##ICALNAME##_PROPERTY); \
if (!prop) { \
*dtp = nullptr; /* invalid duration */ \
return NS_OK; \
} \
struct icaldurationtype idt = \
icalvalue_get_duration(icalproperty_get_value(prop)); \
*dtp = new calDuration(&idt); \
@@ -768,91 +768,91 @@ nsresult calIcalProperty::setDatetime_(c
return NS_OK; \
}
NS_IMPL_CLASSINFO(calIcalComponent, nullptr, nsIClassInfo::THREADSAFE,
CAL_ICALCOMPONENT_CID)
NS_IMPL_ISUPPORTS_CI(calIcalComponent, calIIcalComponent,
calIIcalComponentLibical)
-NS_IMETHODIMP_(icalcomponent *)
+NS_IMETHODIMP_(icalcomponent*)
calIcalComponent::GetLibicalComponent() { return mComponent; }
-NS_IMETHODIMP_(icaltimezone *)
+NS_IMETHODIMP_(icaltimezone*)
calIcalComponent::GetLibicalTimezone() {
NS_ASSERTION(icalcomponent_isa(mComponent) == ICAL_VTIMEZONE_COMPONENT,
"no VTIMEZONE -- unexpected!");
if (!mTimezone &&
(icalcomponent_isa(mComponent) == ICAL_VTIMEZONE_COMPONENT)) {
// xxx todo: libical needs a parent VCALENDAR to retrieve a icaltimezone
NS_ASSERTION(mParent, "VTIMEZONE has no parent!");
if (mParent) {
- icalproperty *const tzidProp =
+ icalproperty* const tzidProp =
icalcomponent_get_first_property(mComponent, ICAL_TZID_PROPERTY);
NS_ASSERTION(tzidProp, "no TZID property in VTIMEZONE!?");
if (tzidProp) {
mTimezone = icalcomponent_get_timezone(
mParent->GetLibicalComponent(),
icalvalue_get_string(icalproperty_get_value(tzidProp)));
}
}
}
return mTimezone;
}
NS_IMETHODIMP
-calIcalComponent::GetFirstSubcomponent(const nsACString &kind,
- calIIcalComponent **subcomp) {
+calIcalComponent::GetFirstSubcomponent(const nsACString& kind,
+ calIIcalComponent** subcomp) {
NS_ENSURE_ARG_POINTER(subcomp);
icalcomponent_kind compkind =
icalcomponent_string_to_kind(PromiseFlatCString(kind).get());
// Maybe someday I'll support X-COMPONENTs
if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
return NS_ERROR_INVALID_ARG;
- icalcomponent *ical = icalcomponent_get_first_component(mComponent, compkind);
+ icalcomponent* ical = icalcomponent_get_first_component(mComponent, compkind);
if (!ical) {
*subcomp = nullptr;
return NS_OK;
}
*subcomp = new calIcalComponent(ical, this);
CAL_ENSURE_MEMORY(*subcomp);
NS_ADDREF(*subcomp);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::GetNextSubcomponent(const nsACString &kind,
- calIIcalComponent **subcomp) {
+calIcalComponent::GetNextSubcomponent(const nsACString& kind,
+ calIIcalComponent** subcomp) {
NS_ENSURE_ARG_POINTER(subcomp);
icalcomponent_kind compkind =
icalcomponent_string_to_kind(PromiseFlatCString(kind).get());
// Maybe someday I'll support X-COMPONENTs
if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
return NS_ERROR_INVALID_ARG;
- icalcomponent *ical = icalcomponent_get_next_component(mComponent, compkind);
+ icalcomponent* ical = icalcomponent_get_next_component(mComponent, compkind);
if (!ical) {
*subcomp = nullptr;
return NS_OK;
}
*subcomp = new calIcalComponent(ical, this);
CAL_ENSURE_MEMORY(*subcomp);
NS_ADDREF(*subcomp);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::GetComponentType(nsACString &componentType) {
+calIcalComponent::GetComponentType(nsACString& componentType) {
componentType.Assign(
icalcomponent_kind_to_string(icalcomponent_isa(mComponent)));
return NS_OK;
}
COMP_STRING_ATTRIBUTE(Uid, UID, uid)
COMP_STRING_ATTRIBUTE(Prodid, PRODID, prodid)
COMP_STRING_ATTRIBUTE(Version, VERSION, version)
@@ -880,65 +880,65 @@ void calIcalComponent::ClearAllPropertie
prop; prop = next) {
next = icalcomponent_get_next_property(mComponent, kind);
icalcomponent_remove_property(mComponent, prop);
icalproperty_free(prop);
}
}
NS_IMETHODIMP
-calIcalComponent::SerializeToICS(nsACString &serialized) {
- char *icalstr;
+calIcalComponent::SerializeToICS(nsACString& serialized) {
+ char* icalstr;
nsresult rv = Serialize(&icalstr);
if (NS_FAILED(rv)) {
return rv;
}
serialized.Assign(icalstr);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::ToString(nsACString &aResult) {
+calIcalComponent::ToString(nsACString& aResult) {
return SerializeToICS(aResult);
}
NS_IMETHODIMP
-calIcalComponent::SerializeToICSStream(nsIInputStream **aStreamResult) {
+calIcalComponent::SerializeToICSStream(nsIInputStream** aStreamResult) {
NS_ENSURE_ARG_POINTER(aStreamResult);
- char *icalstr;
+ char* icalstr;
nsresult rv = Serialize(&icalstr);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringInputStream> aStringStream(
do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// copies the string into the input stream that's handed back.
// This copy is necessary because we don't really own icalstr;
// it's one of libical's ring buffers
rv = aStringStream->SetData(icalstr, -1);
NS_ENSURE_SUCCESS(rv, rv);
aStringStream.forget(aStreamResult);
return NS_OK;
}
-nsresult calIcalComponent::Serialize(char **icalstr) {
+nsresult calIcalComponent::Serialize(char** icalstr) {
NS_ENSURE_ARG_POINTER(icalstr);
// add the timezone bits
if (icalcomponent_isa(mComponent) == ICAL_VCALENDAR_COMPONENT &&
mReferencedTimezones.Count() > 0) {
for (auto iter = mReferencedTimezones.ConstIter(); !iter.Done();
iter.Next()) {
- icaltimezone *icaltz = cal::getIcalTimezone(iter.Data());
+ icaltimezone* icaltz = cal::getIcalTimezone(iter.Data());
if (icaltz) {
- icalcomponent *const tzcomp =
+ icalcomponent* const tzcomp =
icalcomponent_new_clone(icaltimezone_get_component(icaltz));
icalcomponent_add_component(mComponent, tzcomp);
}
}
}
*icalstr = icalcomponent_as_ical_string(mComponent);
if (!*icalstr) {
@@ -951,54 +951,54 @@ nsresult calIcalComponent::Serialize(cha
// so no need for a conversion table or anything.
return static_cast<nsresult>(calIErrors::ICS_ERROR_BASE + icalerrno);
}
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::Clone(calIIcalComponent **_retval) {
+calIcalComponent::Clone(calIIcalComponent** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
- icalcomponent *cloned = icalcomponent_new_clone(mComponent);
+ icalcomponent* cloned = icalcomponent_new_clone(mComponent);
if (cloned == nullptr) return NS_ERROR_OUT_OF_MEMORY;
- calIcalComponent *const comp =
+ calIcalComponent* const comp =
new calIcalComponent(cloned, nullptr, getTzProvider());
if (comp == nullptr) {
icalcomponent_free(cloned);
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*_retval = comp);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::AddSubcomponent(calIIcalComponent *aComp) {
+calIcalComponent::AddSubcomponent(calIIcalComponent* aComp) {
NS_ENSURE_ARG_POINTER(aComp);
/* XXX mildly unsafe assumption here.
* To fix it, I will:
* - check the object's classinfo to find out if I have one of my
* own objects, and if not
* - use comp->serializeToICS and reparse to create a copy.
*
* I should probably also return the new/reused component so that the
* caller has something it can poke at all live-like.
*/
nsresult rv;
nsCOMPtr<calIIcalComponentLibical> icalcomp = do_QueryInterface(aComp, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- calIcalComponent *const ical = toIcalComponent(icalcomp);
+ calIcalComponent* const ical = toIcalComponent(icalcomp);
nsTArray<RefPtr<calITimezone>> timezones;
rv = ical->GetReferencedTimezones(timezones);
- calIcalComponent *const vcal = getParentVCalendarOrThis();
- for (auto &tz : timezones) {
+ calIcalComponent* const vcal = getParentVCalendarOrThis();
+ for (auto& tz : timezones) {
rv = vcal->AddTimezoneReference(tz);
NS_ENSURE_SUCCESS(rv, rv);
}
if (ical->mParent) {
ical->mComponent = icalcomponent_new_clone(ical->mComponent);
}
ical->mParent = this;
@@ -1012,26 +1012,26 @@ calIcalComponent::AddSubcomponent(calIIc
// NS_ENSURE_ARG_POINTER(comp);
// calIcalComponent *ical = static_cast<calIcalComponent *>(comp);
// icalcomponent_remove_component(mComponent, ical->mComponent);
// ical->mParent = nullptr;
// return NS_OK;
// }
NS_IMETHODIMP
-calIcalComponent::GetFirstProperty(const nsACString &kind,
- calIIcalProperty **prop) {
+calIcalComponent::GetFirstProperty(const nsACString& kind,
+ calIIcalProperty** prop) {
NS_ENSURE_ARG_POINTER(prop);
icalproperty_kind propkind =
icalproperty_string_to_kind(PromiseFlatCString(kind).get());
if (propkind == ICAL_NO_PROPERTY) return NS_ERROR_INVALID_ARG;
- icalproperty *icalprop = nullptr;
+ icalproperty* icalprop = nullptr;
if (propkind == ICAL_X_PROPERTY) {
for (icalprop =
icalcomponent_get_first_property(mComponent, ICAL_X_PROPERTY);
icalprop; icalprop = icalcomponent_get_next_property(
mComponent, ICAL_X_PROPERTY)) {
if (kind.Equals(icalproperty_get_x_name(icalprop))) break;
}
} else {
@@ -1045,25 +1045,25 @@ calIcalComponent::GetFirstProperty(const
*prop = new calIcalProperty(icalprop, this);
CAL_ENSURE_MEMORY(*prop);
NS_ADDREF(*prop);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::GetNextProperty(const nsACString &kind,
- calIIcalProperty **prop) {
+calIcalComponent::GetNextProperty(const nsACString& kind,
+ calIIcalProperty** prop) {
NS_ENSURE_ARG_POINTER(prop);
icalproperty_kind propkind =
icalproperty_string_to_kind(PromiseFlatCString(kind).get());
if (propkind == ICAL_NO_PROPERTY) return NS_ERROR_INVALID_ARG;
- icalproperty *icalprop = nullptr;
+ icalproperty* icalprop = nullptr;
if (propkind == ICAL_X_PROPERTY) {
for (icalprop =
icalcomponent_get_next_property(mComponent, ICAL_X_PROPERTY);
icalprop; icalprop = icalcomponent_get_next_property(
mComponent, ICAL_X_PROPERTY)) {
if (kind.Equals(icalproperty_get_x_name(icalprop))) break;
}
} else {
@@ -1077,27 +1077,27 @@ calIcalComponent::GetNextProperty(const
*prop = new calIcalProperty(icalprop, this);
CAL_ENSURE_MEMORY(*prop);
NS_ADDREF(*prop);
return NS_OK;
}
NS_IMETHODIMP
-calIcalComponent::AddProperty(calIIcalProperty *aProp) {
+calIcalComponent::AddProperty(calIIcalProperty* aProp) {
NS_ENSURE_ARG_POINTER(aProp);
// We assume a calIcalProperty is passed in (else the cast wouldn't run and
// we are about to crash), so we assume that this ICS service code has created
// the property.
nsresult rv;
nsCOMPtr<calIIcalPropertyLibical> icalprop = do_QueryInterface(aProp, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- calIcalProperty *const ical = toIcalProperty(icalprop);
+ calIcalProperty* const ical = toIcalProperty(icalprop);
if (ical->mParent) {
ical->mProperty = icalproperty_new_clone(ical->mProperty);
}
ical->mParent = this;
icalcomponent_add_property(mComponent, ical->mProperty);
nsCOMPtr<calIDateTime> dt;
if (NS_SUCCEEDED(aProp->GetValueAsDatetime(getter_AddRefs(dt))) && dt) {
@@ -1126,46 +1126,46 @@ calIcalComponent::AddProperty(calIIcalPr
NS_IMPL_CLASSINFO(calICSService, nullptr, nsIClassInfo::THREADSAFE,
CAL_ICSSERVICE_CID)
NS_IMPL_ISUPPORTS_CI(calICSService, calIICSService)
calICSService::calICSService() {}
NS_IMETHODIMP
-calICSService::ParseICS(const nsACString &serialized,
- calITimezoneProvider *tzProvider,
- calIIcalComponent **component) {
+calICSService::ParseICS(const nsACString& serialized,
+ calITimezoneProvider* tzProvider,
+ calIIcalComponent** component) {
NS_ENSURE_ARG_POINTER(component);
- icalcomponent *ical =
+ icalcomponent* ical =
icalparser_parse_string(PromiseFlatCString(serialized).get());
if (!ical) {
#ifdef DEBUG
fprintf(stderr, "Error parsing: '%20s': %d (%s)\n",
PromiseFlatCString(serialized).get(), icalerrno,
icalerror_strerror(icalerrno));
#endif
// The return values is calIError match with ical errors,
// so no need for a conversion table or anything.
return static_cast<nsresult>(calIErrors::ICS_ERROR_BASE + icalerrno);
}
- calIcalComponent *comp = new calIcalComponent(ical, nullptr, tzProvider);
+ calIcalComponent* comp = new calIcalComponent(ical, nullptr, tzProvider);
if (!comp) {
icalcomponent_free(ical);
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*component = comp);
return NS_OK;
}
NS_IMETHODIMP
calICSService::ParserWorker::Run() {
- icalcomponent *ical = icalparser_parse_string(mString.get());
+ icalcomponent* ical = icalparser_parse_string(mString.get());
nsresult status = NS_OK;
- calIIcalComponent *comp = nullptr;
+ calIIcalComponent* comp = nullptr;
if (ical) {
comp = new calIcalComponent(ical, nullptr, mProvider);
if (!comp) {
icalcomponent_free(ical);
status = NS_ERROR_OUT_OF_MEMORY;
}
} else {
@@ -1188,19 +1188,19 @@ calICSService::ParserWorker::ParserWorke
nsresult rv = mWorkerThread->Shutdown();
NS_ENSURE_SUCCESS(rv, rv);
mWorkerThread = nullptr;
return NS_OK;
}
NS_IMETHODIMP
-calICSService::ParseICSAsync(const nsACString &serialized,
- calITimezoneProvider *tzProvider,
- calIIcsComponentParsingListener *listener) {
+calICSService::ParseICSAsync(const nsACString& serialized,
+ calITimezoneProvider* tzProvider,
+ calIIcsComponentParsingListener* listener) {
nsresult rv;
NS_ENSURE_ARG_POINTER(listener);
nsCOMPtr<nsIThread> workerThread;
nsCOMPtr<nsIThread> currentThread;
rv = NS_GetCurrentThread(getter_AddRefs(currentThread));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewNamedThread("ICS parser", getter_AddRefs(workerThread));
@@ -1212,65 +1212,65 @@ calICSService::ParseICSAsync(const nsACS
rv = workerThread->Dispatch(worker, NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
NS_IMETHODIMP
-calICSService::CreateIcalComponent(const nsACString &kind,
- calIIcalComponent **comp) {
+calICSService::CreateIcalComponent(const nsACString& kind,
+ calIIcalComponent** comp) {
NS_ENSURE_ARG_POINTER(comp);
icalcomponent_kind compkind =
icalcomponent_string_to_kind(PromiseFlatCString(kind).get());
// Maybe someday I'll support X-COMPONENTs
if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
return NS_ERROR_INVALID_ARG;
- icalcomponent *ical = icalcomponent_new(compkind);
+ icalcomponent* ical = icalcomponent_new(compkind);
if (!ical) return NS_ERROR_OUT_OF_MEMORY; // XXX translate
*comp = new calIcalComponent(ical, nullptr);
if (!*comp) {
icalcomponent_free(ical);
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*comp);
return NS_OK;
}
NS_IMETHODIMP
-calICSService::CreateIcalProperty(const nsACString &kind,
- calIIcalProperty **prop) {
+calICSService::CreateIcalProperty(const nsACString& kind,
+ calIIcalProperty** prop) {
NS_ENSURE_ARG_POINTER(prop);
icalproperty_kind propkind =
icalproperty_string_to_kind(PromiseFlatCString(kind).get());
if (propkind == ICAL_NO_PROPERTY) return NS_ERROR_INVALID_ARG;
- icalproperty *icalprop = icalproperty_new(propkind);
+ icalproperty* icalprop = icalproperty_new(propkind);
if (!icalprop) return NS_ERROR_OUT_OF_MEMORY; // XXX translate
if (propkind == ICAL_X_PROPERTY)
icalproperty_set_x_name(icalprop, PromiseFlatCString(kind).get());
*prop = new calIcalProperty(icalprop, nullptr);
CAL_ENSURE_MEMORY(*prop);
NS_ADDREF(*prop);
return NS_OK;
}
NS_IMETHODIMP
-calICSService::CreateIcalPropertyFromString(const nsACString &str,
- calIIcalProperty **prop) {
+calICSService::CreateIcalPropertyFromString(const nsACString& str,
+ calIIcalProperty** prop) {
NS_ENSURE_ARG_POINTER(prop);
- icalproperty *icalprop =
+ icalproperty* icalprop =
icalproperty_new_from_string(PromiseFlatCString(str).get());
*prop = new calIcalProperty(icalprop, nullptr);
CAL_ENSURE_MEMORY(*prop);
NS_ADDREF(*prop);
return NS_OK;
}
--- a/calendar/base/backend/libical/calICSService.h
+++ b/calendar/base/backend/libical/calICSService.h
@@ -16,19 +16,19 @@ extern "C" {
# include "ical.h"
}
class calICSService : public calIICSService, public cal::XpcomBase {
protected:
virtual ~calICSService() {}
class ParserWorker : public mozilla::Runnable {
public:
- ParserWorker(nsIThread *mainThread, nsIThread *workerThread,
- const nsACString &icsString, calITimezoneProvider *tzProvider,
- calIIcsComponentParsingListener *listener)
+ ParserWorker(nsIThread* mainThread, nsIThread* workerThread,
+ const nsACString& icsString, calITimezoneProvider* tzProvider,
+ calIIcsComponentParsingListener* listener)
: mozilla::Runnable("ParserWorker"),
mString(icsString),
mProvider(tzProvider),
mMainThread(mainThread),
mWorkerThread(workerThread) {
mListener = new nsMainThreadPtrHolder<calIIcsComponentParsingListener>(
"calICSService::mListener", listener);
}
@@ -40,20 +40,20 @@ class calICSService : public calIICSServ
nsCOMPtr<calITimezoneProvider> mProvider;
nsMainThreadPtrHandle<calIIcsComponentParsingListener> mListener;
nsCOMPtr<nsIThread> mMainThread;
nsCOMPtr<nsIThread> mWorkerThread;
class ParserWorkerCompleter : public mozilla::Runnable {
public:
ParserWorkerCompleter(
- nsIThread *workerThread, nsresult status,
- calIIcalComponent *component,
- const nsMainThreadPtrHandle<calIIcsComponentParsingListener>
- &listener)
+ nsIThread* workerThread, nsresult status,
+ calIIcalComponent* component,
+ const nsMainThreadPtrHandle<calIIcsComponentParsingListener>&
+ listener)
: mozilla::Runnable("ParserWorkerCompleter"),
mWorkerThread(workerThread),
mListener(listener),
mComp(component),
mStatus(status) {}
NS_DECL_NSIRUNNABLE
protected:
@@ -72,107 +72,107 @@ class calICSService : public calIICSServ
};
class calIcalComponent;
class calIcalProperty : public calIIcalPropertyLibical, public cal::XpcomBase {
friend class calIcalComponent;
public:
- calIcalProperty(icalproperty *prop, calIIcalComponentLibical *parent)
+ calIcalProperty(icalproperty* prop, calIIcalComponentLibical* parent)
: mProperty(prop), mParent(parent) {}
NS_DECL_ISUPPORTS
NS_DECL_CALIICALPROPERTY
NS_DECL_CALIICALPROPERTYLIBICAL
protected:
virtual ~calIcalProperty();
- static nsresult getDatetime_(calIcalComponent *parent, icalproperty *prop,
- calIDateTime **dtp);
- static nsresult setDatetime_(calIcalComponent *parent, icalproperty *prop,
- calIDateTime *dt);
+ static nsresult getDatetime_(calIcalComponent* parent, icalproperty* prop,
+ calIDateTime** dtp);
+ static nsresult setDatetime_(calIcalComponent* parent, icalproperty* prop,
+ calIDateTime* dt);
- icalproperty *mProperty;
+ icalproperty* mProperty;
nsCOMPtr<calIIcalComponentLibical> mParent;
};
class calIcalComponent : public calIIcalComponentLibical,
public cal::XpcomBase {
friend class calIcalProperty;
public:
- calIcalComponent(icalcomponent *ical, calIIcalComponentLibical *parent,
- calITimezoneProvider *tzProvider = nullptr)
+ calIcalComponent(icalcomponent* ical, calIIcalComponentLibical* parent,
+ calITimezoneProvider* tzProvider = nullptr)
: mComponent(ical),
mTimezone(nullptr),
mTzProvider(tzProvider),
mParent(parent) {}
// VTIMEZONE ctor
- calIcalComponent(icaltimezone *icaltz, icalcomponent *ical)
+ calIcalComponent(icaltimezone* icaltz, icalcomponent* ical)
: mComponent(ical), mTimezone(icaltz) {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_CALIICALCOMPONENT
NS_DECL_CALIICALCOMPONENTLIBICAL
protected:
virtual ~calIcalComponent();
- calITimezoneProvider *getTzProvider() const {
+ calITimezoneProvider* getTzProvider() const {
// walk up the parents to find a tz provider:
- calIcalComponent const *that = this;
+ calIcalComponent const* that = this;
while (that) {
- calITimezoneProvider *const ret = that->mTzProvider;
+ calITimezoneProvider* const ret = that->mTzProvider;
if (ret) {
return ret;
}
- calIIcalComponentLibical *const p = that->mParent;
- that = static_cast<calIcalComponent const *>(p);
+ calIIcalComponentLibical* const p = that->mParent;
+ that = static_cast<calIcalComponent const*>(p);
}
return nullptr;
}
- calIcalComponent *getParentVCalendarOrThis() {
+ calIcalComponent* getParentVCalendarOrThis() {
// walk up the parents to find a VCALENDAR:
- calIcalComponent *that = this;
+ calIcalComponent* that = this;
while (that &&
icalcomponent_isa(that->mComponent) != ICAL_VCALENDAR_COMPONENT) {
- calIIcalComponentLibical *const p = that->mParent;
- that = static_cast<calIcalComponent *>(p);
+ calIIcalComponentLibical* const p = that->mParent;
+ that = static_cast<calIcalComponent*>(p);
}
if (!that) that = this;
return that;
}
- nsresult GetDateTimeAttribute(icalproperty_kind kind, calIDateTime **dtp);
- nsresult SetDateTimeAttribute(icalproperty_kind kind, calIDateTime *dt);
+ nsresult GetDateTimeAttribute(icalproperty_kind kind, calIDateTime** dtp);
+ nsresult SetDateTimeAttribute(icalproperty_kind kind, calIDateTime* dt);
- nsresult SetPropertyValue(icalproperty_kind kind, icalvalue *val);
- nsresult SetProperty(icalproperty_kind kind, icalproperty *prop);
+ nsresult SetPropertyValue(icalproperty_kind kind, icalvalue* val);
+ nsresult SetProperty(icalproperty_kind kind, icalproperty* prop);
- nsresult GetStringProperty(icalproperty_kind kind, nsACString &str);
- nsresult SetStringProperty(icalproperty_kind kind, const nsACString &str);
+ nsresult GetStringProperty(icalproperty_kind kind, nsACString& str);
+ nsresult SetStringProperty(icalproperty_kind kind, const nsACString& str);
- nsresult GetIntProperty(icalproperty_kind kind, int32_t *valp);
+ nsresult GetIntProperty(icalproperty_kind kind, int32_t* valp);
nsresult SetIntProperty(icalproperty_kind kind, int32_t i);
void ClearAllProperties(icalproperty_kind kind);
- nsresult Serialize(char **icalstr);
+ nsresult Serialize(char** icalstr);
nsInterfaceHashtable<nsCStringHashKey, calITimezone> mReferencedTimezones;
- icalcomponent *mComponent;
- icaltimezone *mTimezone; // set iff VTIMEZONE
+ icalcomponent* mComponent;
+ icaltimezone* mTimezone; // set iff VTIMEZONE
nsCOMPtr<calITimezoneProvider> const mTzProvider;
nsCOMPtr<calIIcalComponentLibical> mParent;
};
-inline calIcalProperty *toIcalProperty(calIIcalPropertyLibical *p) {
- return static_cast<calIcalProperty *>(p);
+inline calIcalProperty* toIcalProperty(calIIcalPropertyLibical* p) {
+ return static_cast<calIcalProperty*>(p);
}
-inline calIcalComponent *toIcalComponent(calIIcalComponentLibical *p) {
- return static_cast<calIcalComponent *>(p);
+inline calIcalComponent* toIcalComponent(calIIcalComponentLibical* p) {
+ return static_cast<calIcalComponent*>(p);
}
#endif // INCLUDED_CALICSSERVICE_H
--- a/calendar/base/backend/libical/calPeriod.cpp
+++ b/calendar/base/backend/libical/calPeriod.cpp
@@ -10,141 +10,141 @@
#include "calUtils.h"
NS_IMPL_CLASSINFO(calPeriod, nullptr, 0, CAL_PERIOD_CID)
NS_IMPL_ISUPPORTS_CI(calPeriod, calIPeriod, calIPeriodLibical)
calPeriod::calPeriod() : mImmutable(false) {}
-calPeriod::calPeriod(const calPeriod &cpt) : mImmutable(false) {
+calPeriod::calPeriod(const calPeriod& cpt) : mImmutable(false) {
if (cpt.mStart) {
nsCOMPtr<calIDateTime> start;
cpt.mStart->Clone(getter_AddRefs(start));
mStart = do_QueryInterface(start);
}
if (cpt.mEnd) {
nsCOMPtr<calIDateTime> end;
cpt.mEnd->Clone(getter_AddRefs(end));
mEnd = do_QueryInterface(end);
}
}
-calPeriod::calPeriod(struct icalperiodtype const *aPeriodPtr)
+calPeriod::calPeriod(struct icalperiodtype const* aPeriodPtr)
: mImmutable(false) {
FromIcalPeriod(aPeriodPtr);
}
NS_IMETHODIMP
calPeriod::GetIcalPeriod(JS::MutableHandleValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
calPeriod::SetIcalPeriod(JS::HandleValue) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
-calPeriod::GetIsMutable(bool *aResult) {
+calPeriod::GetIsMutable(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = !mImmutable;
return NS_OK;
}
NS_IMETHODIMP
calPeriod::MakeImmutable() {
mImmutable = true;
return NS_OK;
}
NS_IMETHODIMP
-calPeriod::Clone(calIPeriod **aResult) {
+calPeriod::Clone(calIPeriod** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
- calPeriod *cpt = new calPeriod(*this);
+ calPeriod* cpt = new calPeriod(*this);
if (!cpt) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult = cpt);
return NS_OK;
}
-NS_IMETHODIMP calPeriod::GetStart(calIDateTime **_retval) {
+NS_IMETHODIMP calPeriod::GetStart(calIDateTime** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
*_retval = mStart;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
-NS_IMETHODIMP calPeriod::SetStart(calIDateTime *aValue) {
+NS_IMETHODIMP calPeriod::SetStart(calIDateTime* aValue) {
NS_ENSURE_ARG_POINTER(aValue);
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
mStart = do_QueryInterface(aValue);
return mStart->MakeImmutable();
}
-NS_IMETHODIMP calPeriod::GetEnd(calIDateTime **_retval) {
+NS_IMETHODIMP calPeriod::GetEnd(calIDateTime** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
*_retval = mEnd;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
-NS_IMETHODIMP calPeriod::SetEnd(calIDateTime *aValue) {
+NS_IMETHODIMP calPeriod::SetEnd(calIDateTime* aValue) {
NS_ENSURE_ARG_POINTER(aValue);
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
mEnd = do_QueryInterface(aValue);
return mEnd->MakeImmutable();
}
-NS_IMETHODIMP calPeriod::GetDuration(calIDuration **_retval) {
+NS_IMETHODIMP calPeriod::GetDuration(calIDuration** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
if (!mStart || !mEnd) return NS_ERROR_UNEXPECTED;
return mEnd->SubtractDate(mStart, _retval);
}
NS_IMETHODIMP
-calPeriod::ToString(nsACString &aResult) { return GetIcalString(aResult); }
+calPeriod::ToString(nsACString& aResult) { return GetIcalString(aResult); }
NS_IMETHODIMP_(void)
-calPeriod::ToIcalPeriod(struct icalperiodtype *icalp) {
+calPeriod::ToIcalPeriod(struct icalperiodtype* icalp) {
// makes no sense to create a duration without bath a start and end
if (!mStart || !mEnd) {
*icalp = icalperiodtype_null_period();
return;
}
mStart->ToIcalTime(&icalp->start);
mEnd->ToIcalTime(&icalp->end);
}
-void calPeriod::FromIcalPeriod(struct icalperiodtype const *icalp) {
+void calPeriod::FromIcalPeriod(struct icalperiodtype const* icalp) {
mStart = new calDateTime(&(icalp->start), nullptr);
mStart->MakeImmutable();
mEnd = new calDateTime(&(icalp->end), nullptr);
mEnd->MakeImmutable();
return;
}
NS_IMETHODIMP
-calPeriod::GetIcalString(nsACString &aResult) {
+calPeriod::GetIcalString(nsACString& aResult) {
struct icalperiodtype ip;
ToIcalPeriod(&ip);
// note that ics is owned by libical, so we don't need to free
- const char *ics = icalperiodtype_as_ical_string(ip);
+ const char* ics = icalperiodtype_as_ical_string(ip);
if (ics) {
aResult.Assign(ics);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
-calPeriod::SetIcalString(const nsACString &aIcalString) {
+calPeriod::SetIcalString(const nsACString& aIcalString) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
struct icalperiodtype ip;
ip = icalperiodtype_from_string(PromiseFlatCString(aIcalString).get());
// XXX Shortcut. Assumes nobody tried to overrule our impl. of calIDateTime
mStart = new calDateTime(&ip.start, nullptr);
if (icaltime_is_null_time(ip.end)) {
struct icaltimetype end;
end = icaltime_add(ip.start, ip.duration);
--- a/calendar/base/backend/libical/calRecurrenceRule.cpp
+++ b/calendar/base/backend/libical/calRecurrenceRule.cpp
@@ -20,73 +20,73 @@ NS_IMPL_CLASSINFO(calRecurrenceRule, NUL
NS_IMPL_ISUPPORTS_CI(calRecurrenceRule, calIRecurrenceItem, calIRecurrenceRule)
calRecurrenceRule::calRecurrenceRule()
: mImmutable(false), mIsNegative(false), mIsByCount(false) {
icalrecurrencetype_clear(&mIcalRecur);
}
NS_IMETHODIMP
-calRecurrenceRule::GetIsMutable(bool *aResult) {
+calRecurrenceRule::GetIsMutable(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = !mImmutable;
return NS_OK;
}
NS_IMETHODIMP
calRecurrenceRule::MakeImmutable() {
mImmutable = true;
return NS_OK;
}
NS_IMETHODIMP
-calRecurrenceRule::Clone(calIRecurrenceItem **aResult) {
- calRecurrenceRule *const crc = new calRecurrenceRule();
+calRecurrenceRule::Clone(calIRecurrenceItem** aResult) {
+ calRecurrenceRule* const crc = new calRecurrenceRule();
CAL_ENSURE_MEMORY(crc);
crc->mIsNegative = mIsNegative;
crc->mIsByCount = mIsByCount;
crc->mIcalRecur = mIcalRecur;
NS_ADDREF(*aResult = crc);
return NS_OK;
}
/* attribute boolean isNegative; */
NS_IMETHODIMP
-calRecurrenceRule::GetIsNegative(bool *_retval) {
+calRecurrenceRule::GetIsNegative(bool* _retval) {
NS_ENSURE_ARG_POINTER(_retval);
*_retval = mIsNegative;
return NS_OK;
}
NS_IMETHODIMP
calRecurrenceRule::SetIsNegative(bool aIsNegative) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
mIsNegative = aIsNegative;
return NS_OK;
}
/* readonly attribute boolean isFinite; */
NS_IMETHODIMP
-calRecurrenceRule::GetIsFinite(bool *_retval) {
+calRecurrenceRule::GetIsFinite(bool* _retval) {
NS_ENSURE_ARG_POINTER(_retval);
if ((mIsByCount && mIcalRecur.count == 0) ||
(!mIsByCount && icaltime_is_null_time(mIcalRecur.until))) {
*_retval = false;
} else {
*_retval = true;
}
return NS_OK;
}
/* attribute long type; */
NS_IMETHODIMP
-calRecurrenceRule::GetType(nsACString &aType) {
+calRecurrenceRule::GetType(nsACString& aType) {
switch (mIcalRecur.freq) {
#define RECUR_HELPER(x) \
case ICAL_##x##_RECURRENCE: \
aType.AssignLiteral(#x); \
break
RECUR_HELPER(SECONDLY);
RECUR_HELPER(MINUTELY);
RECUR_HELPER(HOURLY);
@@ -98,17 +98,17 @@ calRecurrenceRule::GetType(nsACString &a
default:
aType.AssignLiteral("");
}
return NS_OK;
}
NS_IMETHODIMP
-calRecurrenceRule::SetType(const nsACString &aType) {
+calRecurrenceRule::SetType(const nsACString& aType) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
#define RECUR_HELPER(x) \
if (aType.EqualsLiteral(#x)) mIcalRecur.freq = ICAL_##x##_RECURRENCE
RECUR_HELPER(SECONDLY);
else RECUR_HELPER(MINUTELY);
else RECUR_HELPER(HOURLY);
else RECUR_HELPER(DAILY);
else RECUR_HELPER(WEEKLY);
@@ -119,17 +119,17 @@ calRecurrenceRule::SetType(const nsACStr
ICAL_NO_RECURRENCE;
else return NS_ERROR_FAILURE;
return NS_OK;
}
/* attribute long count; */
NS_IMETHODIMP
-calRecurrenceRule::GetCount(int32_t *aRecurCount) {
+calRecurrenceRule::GetCount(int32_t* aRecurCount) {
NS_ENSURE_ARG_POINTER(aRecurCount);
if (!mIsByCount) return NS_ERROR_FAILURE;
if (mIcalRecur.count == 0 && icaltime_is_null_time(mIcalRecur.until)) {
*aRecurCount = -1;
} else if (mIcalRecur.count) {
*aRecurCount = mIcalRecur.count;
@@ -155,34 +155,34 @@ calRecurrenceRule::SetCount(int32_t aRec
mIcalRecur.until = icaltime_null_time();
return NS_OK;
}
/* attribute calIDateTime untilDate; */
NS_IMETHODIMP
-calRecurrenceRule::GetUntilDate(calIDateTime **aRecurEnd) {
+calRecurrenceRule::GetUntilDate(calIDateTime** aRecurEnd) {
NS_ENSURE_ARG_POINTER(aRecurEnd);
if (mIsByCount) return NS_ERROR_FAILURE;
if (!icaltime_is_null_time(mIcalRecur.until)) {
*aRecurEnd = new calDateTime(&mIcalRecur.until, nullptr);
CAL_ENSURE_MEMORY(*aRecurEnd);
NS_ADDREF(*aRecurEnd);
} else {
// infinite recurrence
*aRecurEnd = nullptr;
}
return NS_OK;
}
NS_IMETHODIMP
-calRecurrenceRule::SetUntilDate(calIDateTime *aRecurEnd) {
+calRecurrenceRule::SetUntilDate(calIDateTime* aRecurEnd) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
if (aRecurEnd) {
nsresult rv;
bool b;
nsCOMPtr<calIDateTimeLibical> icaldt;
nsCOMPtr<calITimezone> tz;
aRecurEnd->GetTimezone(getter_AddRefs(tz));
@@ -210,41 +210,41 @@ calRecurrenceRule::SetUntilDate(calIDate
mIsByCount = false;
return NS_OK;
}
/* readonly attribute boolean isByCount; */
NS_IMETHODIMP
-calRecurrenceRule::GetIsByCount(bool *aIsByCount) {
+calRecurrenceRule::GetIsByCount(bool* aIsByCount) {
*aIsByCount = mIsByCount;
return NS_OK;
}
/* attribute long interval; */
NS_IMETHODIMP
-calRecurrenceRule::GetInterval(int32_t *aInterval) {
+calRecurrenceRule::GetInterval(int32_t* aInterval) {
NS_ENSURE_ARG_POINTER(aInterval);
*aInterval = mIcalRecur.interval;
return NS_OK;
}
NS_IMETHODIMP
calRecurrenceRule::SetInterval(int32_t aInterval) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
if (aInterval < 0 || aInterval > SHRT_MAX) return NS_ERROR_ILLEGAL_VALUE;
mIcalRecur.interval = static_cast<short>(aInterval);
return NS_OK;
}
// Helper table to encode the size/location of the various arrays in the
// icalrecurrencetype struct.
static const struct {
- const char *name;
+ const char* name;
size_t offset;
size_t maxCount;
} recurrenceTable[] = {
{"BYSECOND", offsetof(icalrecurrencetype, by_second), ICAL_BY_SECOND_SIZE},
{"BYMINUTE", offsetof(icalrecurrencetype, by_minute), ICAL_BY_MINUTE_SIZE},
{"BYHOUR", offsetof(icalrecurrencetype, by_hour), ICAL_BY_HOUR_SIZE},
{"BYDAY", offsetof(icalrecurrencetype, by_day), ICAL_BY_DAY_SIZE},
{"BYMONTHDAY", offsetof(icalrecurrencetype, by_month_day),
@@ -252,47 +252,47 @@ static const struct {
{"BYYEARDAY", offsetof(icalrecurrencetype, by_year_day),
ICAL_BY_YEARDAY_SIZE},
{"BYWEEKNO", offsetof(icalrecurrencetype, by_week_no), ICAL_BY_WEEKNO_SIZE},
{"BYMONTH", offsetof(icalrecurrencetype, by_month), ICAL_BY_MONTH_SIZE},
{"BYSETPOS", offsetof(icalrecurrencetype, by_set_pos), ICAL_BY_SETPOS_SIZE},
{nullptr, 0, 0}};
NS_IMETHODIMP
-calRecurrenceRule::GetComponent(const nsACString &aComponentType,
- nsTArray<int16_t> &aValues) {
+calRecurrenceRule::GetComponent(const nsACString& aComponentType,
+ nsTArray<int16_t>& aValues) {
aValues.ClearAndRetainStorage();
// Look up the array for this component type.
for (int i = 0; recurrenceTable[i].name; ++i) {
- auto const &row = recurrenceTable[i];
+ auto const& row = recurrenceTable[i];
if (aComponentType.EqualsASCII(row.name)) {
// Found it.
- int16_t const *src = (int16_t *)((uint8_t *)&mIcalRecur + row.offset);
+ int16_t const* src = (int16_t*)((uint8_t*)&mIcalRecur + row.offset);
size_t count;
for (count = 0; count < row.maxCount; count++) {
if (src[count] == ICAL_RECURRENCE_ARRAY_MAX) break;
}
aValues.ReplaceElementsAt(0, aValues.Length(), src, count);
return NS_OK;
}
}
return NS_ERROR_FAILURE; // Invalid component.
}
NS_IMETHODIMP
-calRecurrenceRule::SetComponent(const nsACString &aComponentType,
- nsTArray<int16_t> const &aValues) {
+calRecurrenceRule::SetComponent(const nsACString& aComponentType,
+ nsTArray<int16_t> const& aValues) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
// Look up the array for this component type.
for (int i = 0; recurrenceTable[i].name; ++i) {
- auto const &row = recurrenceTable[i];
+ auto const& row = recurrenceTable[i];
if (aComponentType.EqualsASCII(row.name)) {
// Found it.
- int16_t *dest = (int16_t *)((uint8_t *)&mIcalRecur + row.offset);
+ int16_t* dest = (int16_t*)((uint8_t*)&mIcalRecur + row.offset);
if (aValues.Length() > row.maxCount) return NS_ERROR_FAILURE;
for (int16_t v : aValues) {
*dest++ = v;
}
// Terminate array unless full.
if (aValues.Length() < row.maxCount) {
*dest++ = ICAL_RECURRENCE_ARRAY_MAX;
}
@@ -300,19 +300,19 @@ calRecurrenceRule::SetComponent(const ns
}
}
return NS_ERROR_FAILURE; // Invalid component.
}
/* calIDateTime getNextOccurrence (in calIDateTime aStartTime, in calIDateTime
* aOccurrenceTime); */
NS_IMETHODIMP
-calRecurrenceRule::GetNextOccurrence(calIDateTime *aStartTime,
- calIDateTime *aOccurrenceTime,
- calIDateTime **_retval) {
+calRecurrenceRule::GetNextOccurrence(calIDateTime* aStartTime,
+ calIDateTime* aOccurrenceTime,
+ calIDateTime** _retval) {
NS_ENSURE_ARG_POINTER(aStartTime);
NS_ENSURE_ARG_POINTER(aOccurrenceTime);
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv;
nsCOMPtr<calIDateTimeLibical> icaldtstart =
do_QueryInterface(aStartTime, &rv);
@@ -323,17 +323,17 @@ calRecurrenceRule::GetNextOccurrence(cal
NS_ENSURE_SUCCESS(rv, rv);
struct icaltimetype dtstart;
icaldtstart->ToIcalTime(&dtstart);
struct icaltimetype occurtime;
icaloccurtime->ToIcalTime(&occurtime);
- icalrecur_iterator *recur_iter;
+ icalrecur_iterator* recur_iter;
recur_iter = icalrecur_iterator_new(mIcalRecur, dtstart);
if (!recur_iter) return NS_ERROR_OUT_OF_MEMORY;
struct icaltimetype next = icalrecur_iterator_next(recur_iter);
while (!icaltime_is_null_time(next)) {
if (icaltime_compare(next, occurtime) > 0) break;
next = icalrecur_iterator_next(recur_iter);
@@ -349,49 +349,49 @@ calRecurrenceRule::GetNextOccurrence(cal
nsCOMPtr<calITimezone> tz;
aStartTime->GetTimezone(getter_AddRefs(tz));
*_retval = new calDateTime(&next, tz);
CAL_ENSURE_MEMORY(*_retval);
NS_ADDREF(*_retval);
return NS_OK;
}
-static inline icaltimetype ensureDateTime(icaltimetype const &icalt) {
+static inline icaltimetype ensureDateTime(icaltimetype const& icalt) {
if (!icalt.is_date) {
return icalt;
} else {
icaltimetype ret = icalt;
ret.is_date = 0;
ret.hour = 0;
ret.minute = 0;
ret.second = 0;
return ret;
}
}
NS_IMETHODIMP
-calRecurrenceRule::GetOccurrences(calIDateTime *aStartTime,
- calIDateTime *aRangeStart,
- calIDateTime *aRangeEnd, uint32_t aMaxCount,
- nsTArray<RefPtr<calIDateTime>> &aDates) {
+calRecurrenceRule::GetOccurrences(calIDateTime* aStartTime,
+ calIDateTime* aRangeStart,
+ calIDateTime* aRangeEnd, uint32_t aMaxCount,
+ nsTArray<RefPtr<calIDateTime>>& aDates) {
NS_ENSURE_ARG_POINTER(aStartTime);
NS_ENSURE_ARG_POINTER(aRangeStart);
aDates.ClearAndRetainStorage();
// make sure the request is sane; infinite recurrence
// with no end time is bad times.
if (!aMaxCount && !aRangeEnd && mIcalRecur.count == 0 &&
icaltime_is_null_time(mIcalRecur.until))
return NS_ERROR_INVALID_ARG;
nsCOMArray<calIDateTime> dates;
#ifdef DEBUG_dbo
{
- char const *const ss = icalrecurrencetype_as_string(&mIcalRecur);
+ char const* const ss = icalrecurrencetype_as_string(&mIcalRecur);
nsAutoCString tst, tend;
aRangeStart->ToString(tst);
aRangeEnd->ToString(tend);
printf("RULE: [%s -> %s, %d]: %s\n", tst.get(), tend.get(),
mIcalRecur.count, ss);
}
#endif
@@ -421,33 +421,33 @@ calRecurrenceRule::GetOccurrences(calIDa
// if the start of the recurrence is past the end,
// we have no dates
if (icaltime_compare(dtstart, dtend) >= 0) {
return NS_OK;
}
}
- icalrecur_iterator *recur_iter;
+ icalrecur_iterator* recur_iter;
recur_iter = icalrecur_iterator_new(mIcalRecur, dtstart);
if (!recur_iter) return NS_ERROR_OUT_OF_MEMORY;
for (icaltimetype next = icalrecur_iterator_next(recur_iter);
!icaltime_is_null_time(next);
next = icalrecur_iterator_next(recur_iter)) {
icaltimetype const dtNext(ensureDateTime(next));
// if this thing is before the range start
if (icaltime_compare(dtNext, rangestart) < 0) {
continue;
}
if (aRangeEnd && icaltime_compare(dtNext, dtend) >= 0) break;
- calIDateTime *cdt = new calDateTime(&next, tz);
+ calIDateTime* cdt = new calDateTime(&next, tz);
aDates.AppendElement(cdt);
#ifdef DEBUG_dbo
{
nsAutoCString str;
cdt->ToString(str);
printf(" occ: %s\n", str.get());
}
#endif
@@ -458,31 +458,31 @@ calRecurrenceRule::GetOccurrences(calIDa
return NS_OK;
}
/**
** ical property getting/setting
**/
NS_IMETHODIMP
-calRecurrenceRule::GetIcalProperty(calIIcalProperty **prop) {
- icalproperty *const rrule = icalproperty_new_rrule(mIcalRecur);
+calRecurrenceRule::GetIcalProperty(calIIcalProperty** prop) {
+ icalproperty* const rrule = icalproperty_new_rrule(mIcalRecur);
CAL_ENSURE_MEMORY(rrule);
*prop = new calIcalProperty(rrule, nullptr);
if (!*prop) {
icalproperty_free(rrule);
return NS_ERROR_FAILURE;
}
NS_ADDREF(*prop);
return NS_OK;
}
NS_IMETHODIMP
-calRecurrenceRule::SetIcalProperty(calIIcalProperty *aProp) {
+calRecurrenceRule::SetIcalProperty(calIIcalProperty* aProp) {
NS_ENSURE_ARG_POINTER(aProp);
nsresult rv;
nsCOMPtr<calIIcalPropertyLibical> icalprop = do_QueryInterface(aProp, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
@@ -490,17 +490,17 @@ calRecurrenceRule::SetIcalProperty(calII
rv = aProp->GetPropertyName(propname);
NS_ENSURE_SUCCESS(rv, rv);
if (propname.EqualsLiteral("RRULE")) {
mIsNegative = false;
} else {
return NS_ERROR_INVALID_ARG;
}
- icalproperty *prop;
+ icalproperty* prop;
struct icalrecurrencetype icalrecur;
prop = icalprop->GetLibicalProperty();
icalrecur = icalproperty_get_rrule(prop);
// XXX Note that we ignore the dtstart and use the one from the
// event, though I realize now that we shouldn't. Ignoring
@@ -518,17 +518,17 @@ calRecurrenceRule::SetIcalProperty(calII
mIsByCount = false;
mIcalRecur = icalrecur;
return NS_OK;
}
NS_IMETHODIMP
-calRecurrenceRule::SetIcalString(const nsACString &str) {
+calRecurrenceRule::SetIcalString(const nsACString& str) {
if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
nsresult rv = NS_OK;
nsAutoCString name;
nsCOMPtr<calIICSService> icsSvc = cal::getICSService();
nsCOMPtr<calIIcalProperty> prop;
rv = icsSvc->CreateIcalPropertyFromString(str, getter_AddRefs(prop));
@@ -540,27 +540,27 @@ calRecurrenceRule::SetIcalString(const n
if (!name.EqualsLiteral("RRULE")) {
return NS_ERROR_ILLEGAL_VALUE;
}
return SetIcalProperty(prop);
}
NS_IMETHODIMP
-calRecurrenceRule::GetIcalString(nsACString &str) {
+calRecurrenceRule::GetIcalString(nsACString& str) {
nsresult rv = NS_OK;
nsCOMPtr<calIIcalProperty> prop;
rv = this->GetIcalProperty(getter_AddRefs(prop));
if (NS_SUCCEEDED(rv)) {
rv = prop->GetIcalString(str);
}
return rv;
}
NS_IMETHODIMP
-calRecurrenceRule::GetWeekStart(short *) { return NS_ERROR_NOT_IMPLEMENTED; }
+calRecurrenceRule::GetWeekStart(short*) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
calRecurrenceRule::SetWeekStart(short) { return NS_ERROR_NOT_IMPLEMENTED; }
--- a/common/saxparser/nsSAXAttributes.cpp
+++ b/common/saxparser/nsSAXAttributes.cpp
@@ -3,183 +3,183 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSAXAttributes.h"
NS_IMPL_ISUPPORTS(nsSAXAttributes, nsISAXAttributes)
NS_IMETHODIMP
-nsSAXAttributes::GetIndexFromName(const nsAString &aURI,
- const nsAString &aLocalName,
- int32_t *aResult) {
+nsSAXAttributes::GetIndexFromName(const nsAString& aURI,
+ const nsAString& aLocalName,
+ int32_t* aResult) {
int32_t len = mAttrs.Length();
int32_t i;
for (i = 0; i < len; ++i) {
- const SAXAttr &att = mAttrs[i];
+ const SAXAttr& att = mAttrs[i];
if (att.localName.Equals(aLocalName) && att.uri.Equals(aURI)) {
*aResult = i;
return NS_OK;
}
}
*aResult = -1;
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetIndexFromQName(const nsAString &aQName, int32_t *aResult) {
+nsSAXAttributes::GetIndexFromQName(const nsAString& aQName, int32_t* aResult) {
int32_t len = mAttrs.Length();
int32_t i;
for (i = 0; i < len; ++i) {
- const SAXAttr &att = mAttrs[i];
+ const SAXAttr& att = mAttrs[i];
if (att.qName.Equals(aQName)) {
*aResult = i;
return NS_OK;
}
}
*aResult = -1;
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetLength(int32_t *aResult) {
+nsSAXAttributes::GetLength(int32_t* aResult) {
*aResult = mAttrs.Length();
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetLocalName(uint32_t aIndex, nsAString &aResult) {
+nsSAXAttributes::GetLocalName(uint32_t aIndex, nsAString& aResult) {
uint32_t len = mAttrs.Length();
if (aIndex >= len) {
aResult.SetIsVoid(true);
} else {
- const SAXAttr &att = mAttrs[aIndex];
+ const SAXAttr& att = mAttrs[aIndex];
aResult = att.localName;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetQName(uint32_t aIndex, nsAString &aResult) {
+nsSAXAttributes::GetQName(uint32_t aIndex, nsAString& aResult) {
uint32_t len = mAttrs.Length();
if (aIndex >= len) {
aResult.SetIsVoid(true);
} else {
- const SAXAttr &att = mAttrs[aIndex];
+ const SAXAttr& att = mAttrs[aIndex];
aResult = att.qName;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetType(uint32_t aIndex, nsAString &aResult) {
+nsSAXAttributes::GetType(uint32_t aIndex, nsAString& aResult) {
uint32_t len = mAttrs.Length();
if (aIndex >= len) {
aResult.SetIsVoid(true);
} else {
- const SAXAttr &att = mAttrs[aIndex];
+ const SAXAttr& att = mAttrs[aIndex];
aResult = att.type;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetTypeFromName(const nsAString &aURI,
- const nsAString &aLocalName,
- nsAString &aResult) {
+nsSAXAttributes::GetTypeFromName(const nsAString& aURI,
+ const nsAString& aLocalName,
+ nsAString& aResult) {
int32_t index = -1;
GetIndexFromName(aURI, aLocalName, &index);
if (index >= 0) {
aResult = mAttrs[index].type;
} else {
aResult.SetIsVoid(true);
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetTypeFromQName(const nsAString &aQName, nsAString &aResult) {
+nsSAXAttributes::GetTypeFromQName(const nsAString& aQName, nsAString& aResult) {
int32_t index = -1;
GetIndexFromQName(aQName, &index);
if (index >= 0) {
aResult = mAttrs[index].type;
} else {
aResult.SetIsVoid(true);
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetURI(uint32_t aIndex, nsAString &aResult) {
+nsSAXAttributes::GetURI(uint32_t aIndex, nsAString& aResult) {
uint32_t len = mAttrs.Length();
if (aIndex >= len) {
aResult.SetIsVoid(true);
} else {
- const SAXAttr &att = mAttrs[aIndex];
+ const SAXAttr& att = mAttrs[aIndex];
aResult = att.uri;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetValue(uint32_t aIndex, nsAString &aResult) {
+nsSAXAttributes::GetValue(uint32_t aIndex, nsAString& aResult) {
uint32_t len = mAttrs.Length();
if (aIndex >= len) {
aResult.SetIsVoid(true);
} else {
- const SAXAttr &att = mAttrs[aIndex];
+ const SAXAttr& att = mAttrs[aIndex];
aResult = att.value;
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetValueFromName(const nsAString &aURI,
- const nsAString &aLocalName,
- nsAString &aResult) {
+nsSAXAttributes::GetValueFromName(const nsAString& aURI,
+ const nsAString& aLocalName,
+ nsAString& aResult) {
int32_t index = -1;
GetIndexFromName(aURI, aLocalName, &index);
if (index >= 0) {
aResult = mAttrs[index].value;
} else {
aResult.SetIsVoid(true);
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXAttributes::GetValueFromQName(const nsAString &aQName,
- nsAString &aResult) {
+nsSAXAttributes::GetValueFromQName(const nsAString& aQName,
+ nsAString& aResult) {
int32_t index = -1;
GetIndexFromQName(aQName, &index);
if (index >= 0) {
aResult = mAttrs[index].value;
} else {
aResult.SetIsVoid(true);
}
return NS_OK;
}
-nsresult nsSAXAttributes::AddAttribute(const nsAString &aURI,
- const nsAString &aLocalName,
- const nsAString &aQName,
- const nsAString &aType,
- const nsAString &aValue) {
- SAXAttr *att = mAttrs.AppendElement();
+nsresult nsSAXAttributes::AddAttribute(const nsAString& aURI,
+ const nsAString& aLocalName,
+ const nsAString& aQName,
+ const nsAString& aType,
+ const nsAString& aValue) {
+ SAXAttr* att = mAttrs.AppendElement();
if (!att) {
return NS_ERROR_OUT_OF_MEMORY;
}
att->uri = aURI;
att->localName = aLocalName;
att->qName = aQName;
att->type = aType;
--- a/common/saxparser/nsSAXAttributes.h
+++ b/common/saxparser/nsSAXAttributes.h
@@ -20,18 +20,18 @@ struct SAXAttr {
nsString value;
};
class nsSAXAttributes final : public nsISAXAttributes {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISAXATTRIBUTES
- nsresult AddAttribute(const nsAString &aURI, const nsAString &aLocalName,
- const nsAString &aQName, const nsAString &aType,
- const nsAString &aValue);
+ nsresult AddAttribute(const nsAString& aURI, const nsAString& aLocalName,
+ const nsAString& aQName, const nsAString& aType,
+ const nsAString& aValue);
private:
~nsSAXAttributes() {}
nsTArray<SAXAttr> mAttrs;
};
#endif // nsSAXAttributes_h__
--- a/common/saxparser/nsSAXXMLReader.cpp
+++ b/common/saxparser/nsSAXXMLReader.cpp
@@ -6,17 +6,17 @@
#include "nsSAXXMLReader.h"
#include "mozilla/Encoding.h"
#include "mozilla/NullPrincipal.h"
#include "nsIInputStream.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIParser.h"
-#include "nsComponentManagerUtils.h" // for do_CreateInstance
+#include "nsComponentManagerUtils.h" // for do_CreateInstance
#include "nsParserCIID.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
#include "nsIScriptError.h"
#include "nsSAXAttributes.h"
#include "nsCharsetSource.h"
using mozilla::Encoding;
@@ -53,23 +53,23 @@ nsSAXXMLReader::WillBuildModel(nsDTDMode
NS_IMETHODIMP
nsSAXXMLReader::DidBuildModel(bool aTerminated) {
if (mContentHandler) return mContentHandler->EndDocument();
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::SetParser(nsParserBase *aParser) { return NS_OK; }
+nsSAXXMLReader::SetParser(nsParserBase* aParser) { return NS_OK; }
// nsIExpatSink
NS_IMETHODIMP
-nsSAXXMLReader::HandleStartElement(const char16_t *aName,
- const char16_t **aAtts, uint32_t aAttsCount,
+nsSAXXMLReader::HandleStartElement(const char16_t* aName,
+ const char16_t** aAtts, uint32_t aAttsCount,
uint32_t aLineNumber,
uint32_t aColumnNumber) {
if (!mContentHandler) return NS_OK;
RefPtr<nsSAXAttributes> atts = new nsSAXAttributes();
if (!atts) return NS_ERROR_OUT_OF_MEMORY;
nsAutoString uri, localName, qName;
for (; *aAtts; aAtts += 2) {
@@ -85,82 +85,82 @@ nsSAXXMLReader::HandleStartElement(const
}
// Deal with the element name
SplitExpatName(aName, uri, localName, qName);
return mContentHandler->StartElement(uri, localName, qName, atts);
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleEndElement(const char16_t *aName) {
+nsSAXXMLReader::HandleEndElement(const char16_t* aName) {
if (mContentHandler) {
nsAutoString uri, localName, qName;
SplitExpatName(aName, uri, localName, qName);
return mContentHandler->EndElement(uri, localName, qName);
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleComment(const char16_t *aName) {
+nsSAXXMLReader::HandleComment(const char16_t* aName) {
NS_ASSERTION(aName, "null passed to handler");
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleCDataSection(const char16_t *aData, uint32_t aLength) {
+nsSAXXMLReader::HandleCDataSection(const char16_t* aData, uint32_t aLength) {
if (mContentHandler) {
nsresult rv =
mContentHandler->Characters(Substring(aData, aData + aLength));
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleDoctypeDecl(const nsAString &aSubset,
- const nsAString &aName,
- const nsAString &aSystemId,
- const nsAString &aPublicId,
- nsISupports *aCatalogData) {
+nsSAXXMLReader::HandleDoctypeDecl(const nsAString& aSubset,
+ const nsAString& aName,
+ const nsAString& aSystemId,
+ const nsAString& aPublicId,
+ nsISupports* aCatalogData) {
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleCharacterData(const char16_t *aData, uint32_t aLength) {
+nsSAXXMLReader::HandleCharacterData(const char16_t* aData, uint32_t aLength) {
if (mContentHandler)
return mContentHandler->Characters(Substring(aData, aData + aLength));
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleProcessingInstruction(const char16_t *aTarget,
- const char16_t *aData) {
+nsSAXXMLReader::HandleProcessingInstruction(const char16_t* aTarget,
+ const char16_t* aData) {
NS_ASSERTION(aTarget && aData, "null passed to handler");
if (mContentHandler) {
return mContentHandler->ProcessingInstruction(nsDependentString(aTarget),
nsDependentString(aData));
}
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::HandleXMLDeclaration(const char16_t *aVersion,
- const char16_t *aEncoding,
+nsSAXXMLReader::HandleXMLDeclaration(const char16_t* aVersion,
+ const char16_t* aEncoding,
int32_t aStandalone) {
NS_ASSERTION(aVersion, "null passed to handler");
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::ReportError(const char16_t *aErrorText,
- const char16_t *aSourceText, nsIScriptError *aError,
- bool *_retval) {
+nsSAXXMLReader::ReportError(const char16_t* aErrorText,
+ const char16_t* aSourceText, nsIScriptError* aError,
+ bool* _retval) {
MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!");
// Normally, the expat driver should report the error.
*_retval = true;
if (mErrorHandler) {
nsresult rv = mErrorHandler->FatalError(nsDependentString(aErrorText));
if (NS_SUCCEEDED(rv)) {
// The error handler has handled the script error. Don't log to console.
@@ -169,97 +169,97 @@ nsSAXXMLReader::ReportError(const char16
}
return NS_OK;
}
// nsISAXXMLReader
NS_IMETHODIMP
-nsSAXXMLReader::GetBaseURI(nsIURI **aBaseURI) {
+nsSAXXMLReader::GetBaseURI(nsIURI** aBaseURI) {
NS_IF_ADDREF(*aBaseURI = mBaseURI);
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::SetBaseURI(nsIURI *aBaseURI) {
+nsSAXXMLReader::SetBaseURI(nsIURI* aBaseURI) {
mBaseURI = aBaseURI;
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::GetContentHandler(nsISAXContentHandler **aContentHandler) {
+nsSAXXMLReader::GetContentHandler(nsISAXContentHandler** aContentHandler) {
NS_IF_ADDREF(*aContentHandler = mContentHandler);
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::SetContentHandler(nsISAXContentHandler *aContentHandler) {
+nsSAXXMLReader::SetContentHandler(nsISAXContentHandler* aContentHandler) {
mContentHandler = aContentHandler;
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::GetErrorHandler(nsISAXErrorHandler **aErrorHandler) {
+nsSAXXMLReader::GetErrorHandler(nsISAXErrorHandler** aErrorHandler) {
NS_IF_ADDREF(*aErrorHandler = mErrorHandler);
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::SetErrorHandler(nsISAXErrorHandler *aErrorHandler) {
+nsSAXXMLReader::SetErrorHandler(nsISAXErrorHandler* aErrorHandler) {
mErrorHandler = aErrorHandler;
return NS_OK;
}
NS_IMETHODIMP
-nsSAXXMLReader::ParseAsync(nsIRequestObserver *aObserver) {
+nsSAXXMLReader::ParseAsync(nsIRequestObserver* aObserver) {
mParserObserver = aObserver;
mIsAsyncParse = true;
return NS_OK;
}
// nsIRequestObserver
NS_IMETHODIMP
-nsSAXXMLReader::OnStartRequest(nsIRequest *aRequest) {
+nsSAXXMLReader::OnStartRequest(nsIRequest* aRequest) {
NS_ENSURE_TRUE(mIsAsyncParse, NS_ERROR_FAILURE);
nsresult rv;
rv = EnsureBaseURI();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
rv = InitParser(mParserObserver, channel);
NS_ENSURE_SUCCESS(rv, rv);
// we don't need or want this anymore
mParserObserver = nullptr;
return mListener->OnStartRequest(aRequest);
}
NS_IMETHODIMP
-nsSAXXMLReader::OnStopRequest(nsIRequest *aRequest, nsresult status) {
+nsSAXXMLReader::OnStopRequest(nsIRequest* aRequest, nsresult status) {
NS_ENSURE_TRUE(mIsAsyncParse, NS_ERROR_FAILURE);
NS_ENSURE_STATE(mListener);
nsresult rv = mListener->OnStopRequest(aRequest, status);
mListener = nullptr;
mIsAsyncParse = false;
return rv;
}
// nsIStreamListener
NS_IMETHODIMP
-nsSAXXMLReader::OnDataAvailable(nsIRequest *aRequest,
- nsIInputStream *aInputStream, uint64_t offset,
+nsSAXXMLReader::OnDataAvailable(nsIRequest* aRequest,
+ nsIInputStream* aInputStream, uint64_t offset,
uint32_t count) {
NS_ENSURE_TRUE(mIsAsyncParse, NS_ERROR_FAILURE);
NS_ENSURE_STATE(mListener);
return mListener->OnDataAvailable(aRequest, aInputStream, offset, count);
}
-nsresult nsSAXXMLReader::InitParser(nsIRequestObserver *aObserver,
- nsIChannel *aChannel) {
+nsresult nsSAXXMLReader::InitParser(nsIRequestObserver* aObserver,
+ nsIChannel* aChannel) {
nsresult rv;
// setup the parser
nsCOMPtr<nsIParser> parser = do_CreateInstance(kParserCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
parser->SetContentSink(this);
@@ -272,26 +272,26 @@ nsresult nsSAXXMLReader::InitParser(nsIR
NS_ENSURE_SUCCESS(rv, rv);
mListener = do_QueryInterface(parser, &rv);
return rv;
}
// from nsDocument.cpp
-bool nsSAXXMLReader::TryChannelCharset(nsIChannel *aChannel,
- int32_t &aCharsetSource,
- NotNull<const Encoding *> &aEncoding) {
+bool nsSAXXMLReader::TryChannelCharset(nsIChannel* aChannel,
+ int32_t& aCharsetSource,
+ NotNull<const Encoding*>& aEncoding) {
if (aCharsetSource >= kCharsetFromChannel) return true;
if (aChannel) {
nsAutoCString charsetVal;
nsresult rv = aChannel->GetContentCharset(charsetVal);
if (NS_SUCCEEDED(rv)) {
- const Encoding *preferred = Encoding::ForLabel(charsetVal);
+ const Encoding* preferred = Encoding::ForLabel(charsetVal);
if (!preferred) return false;
aEncoding = WrapNotNull(preferred);
aCharsetSource = kCharsetFromChannel;
return true;
}
}
@@ -299,19 +299,19 @@ bool nsSAXXMLReader::TryChannelCharset(n
}
nsresult nsSAXXMLReader::EnsureBaseURI() {
if (mBaseURI) return NS_OK;
return NS_NewURI(getter_AddRefs(mBaseURI), "about:blank");
}
-nsresult nsSAXXMLReader::SplitExpatName(const char16_t *aExpatName,
- nsString &aURI, nsString &aLocalName,
- nsString &aQName) {
+nsresult nsSAXXMLReader::SplitExpatName(const char16_t* aExpatName,
+ nsString& aURI, nsString& aLocalName,
+ nsString& aQName) {
/**
* Adapted from RDFContentSinkImpl
*
* Expat can send the following:
* localName
* namespaceURI<separator>localName
* namespaceURI<separator>localName<separator>prefix
*
--- a/common/saxparser/nsSAXXMLReader.h
+++ b/common/saxparser/nsSAXXMLReader.h
@@ -39,39 +39,39 @@ class nsSAXXMLReader final : public nsIS
nsSAXXMLReader();
// nsIContentSink
NS_IMETHOD WillParse() override { return NS_OK; }
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
NS_IMETHOD DidBuildModel(bool aTerminated) override;
- NS_IMETHOD SetParser(nsParserBase *aParser) override;
+ NS_IMETHOD SetParser(nsParserBase* aParser) override;
NS_IMETHOD WillInterrupt() override { return NS_OK; }
NS_IMETHOD WillResume() override { return NS_OK; }
virtual void FlushPendingNotifications(mozilla::FlushType aType) override {}
- virtual void SetDocumentCharset(
- NotNull<const Encoding *> aEncoding) override {}
+ virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override {
+ }
- virtual nsISupports *GetTarget() override { return nullptr; }
+ virtual nsISupports* GetTarget() override { return nullptr; }
private:
~nsSAXXMLReader() {}
nsCOMPtr<nsISAXContentHandler> mContentHandler;
nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIRequestObserver> mParserObserver;
bool mIsAsyncParse;
- static bool TryChannelCharset(nsIChannel *aChannel, int32_t &aCharsetSource,
- NotNull<const Encoding *> &aEncoding);
+ static bool TryChannelCharset(nsIChannel* aChannel, int32_t& aCharsetSource,
+ NotNull<const Encoding*>& aEncoding);
nsresult EnsureBaseURI();
- nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
- nsresult SplitExpatName(const char16_t *aExpatName, nsString &aURI,
- nsString &aLocalName, nsString &aQName);
+ nsresult InitParser(nsIRequestObserver* aListener, nsIChannel* aChannel);
+ nsresult SplitExpatName(const char16_t* aExpatName, nsString& aURI,
+ nsString& aLocalName, nsString& aQName);
};
#endif // nsSAXXMLReader_h__
--- a/common/src/nsCommonModule.cpp
+++ b/common/src/nsCommonModule.cpp
@@ -26,18 +26,18 @@ NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGE
NS_DEFINE_NAMED_CID(NS_SYNCSTREAMLISTENER_CID);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader)
NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo)
NS_DEFINE_NAMED_CID(NS_USERINFO_CID);
-static nsresult CreateNewSyncStreamListener(nsISupports *aOuter, REFNSIID aIID,
- void **aResult) {
+static nsresult CreateNewSyncStreamListener(nsISupports* aOuter, REFNSIID aIID,
+ void** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nullptr;
if (aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
RefPtr<nsISyncStreamListener> inst = nsSyncStreamListener::Create();
--- a/db/mork/build/nsIMdbFactoryFactory.h
+++ b/db/mork/build/nsIMdbFactoryFactory.h
@@ -20,14 +20,14 @@ class nsIMdbFactory;
} \
}
// because Mork doesn't support XPCOM, we have to wrap the mdb factory interface
// with an interface that gives you an mdb factory.
class nsIMdbFactoryService : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMDBFACTORYFACTORY_IID)
- NS_IMETHOD GetMdbFactory(nsIMdbFactory **aFactory) = 0;
+ NS_IMETHOD GetMdbFactory(nsIMdbFactory** aFactory) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMdbFactoryService, NS_IMDBFACTORYFACTORY_IID)
#endif
--- a/db/mork/build/nsMorkFactory.cpp
+++ b/db/mork/build/nsMorkFactory.cpp
@@ -10,17 +10,17 @@
#include "mdb.h"
class nsMorkFactoryService final : public nsIMdbFactoryService {
public:
nsMorkFactoryService(){};
// nsISupports methods
NS_DECL_ISUPPORTS
- NS_IMETHOD GetMdbFactory(nsIMdbFactory **aFactory) override;
+ NS_IMETHOD GetMdbFactory(nsIMdbFactory** aFactory) override;
protected:
~nsMorkFactoryService() {}
nsCOMPtr<nsIMdbFactory> mMdbFactory;
};
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMorkFactoryService)
@@ -32,13 +32,13 @@ const mozilla::Module::CIDEntry kMorkCID
const mozilla::Module::ContractIDEntry kMorkContracts[] = {
{NS_MORK_CONTRACTID, &kNS_MORK_CID}, {NULL}};
extern const mozilla::Module kMorkModule = {mozilla::Module::kVersion,
kMorkCIDs, kMorkContracts};
NS_IMPL_ISUPPORTS(nsMorkFactoryService, nsIMdbFactoryService)
-NS_IMETHODIMP nsMorkFactoryService::GetMdbFactory(nsIMdbFactory **aFactory) {
+NS_IMETHODIMP nsMorkFactoryService::GetMdbFactory(nsIMdbFactory** aFactory) {
if (!mMdbFactory) mMdbFactory = MakeMdbFactory();
NS_IF_ADDREF(*aFactory = mMdbFactory);
return *aFactory ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
--- a/db/mork/public/mdb.h
+++ b/db/mork/public/mdb.h
@@ -2341,21 +2341,20 @@ class nsIMdbRowCellCursor : public nsISu
// { ===== begin nsIMdbRowCellCursor methods =====
// { ----- begin attribute methods -----
NS_IMETHOD SetRow(nsIMdbEnv* ev, nsIMdbRow* ioRow) = 0; // sets pos to -1
NS_IMETHOD GetRow(nsIMdbEnv* ev, nsIMdbRow** acqRow) = 0;
// } ----- end attribute methods -----
// { ----- begin cell seeking methods -----
- NS_IMETHOD SeekCell(
- nsIMdbEnv* ev, // context
- mdb_pos inPos, // position of cell in row sequence
- mdb_column* outColumn, // column for this particular cell
- nsIMdbCell** acqCell) = 0; // the cell at inPos
+ NS_IMETHOD SeekCell(nsIMdbEnv* ev, // context
+ mdb_pos inPos, // position of cell in row sequence
+ mdb_column* outColumn, // column for this particular cell
+ nsIMdbCell** acqCell) = 0; // the cell at inPos
// } ----- end cell seeking methods -----
// { ----- begin cell iteration methods -----
NS_IMETHOD NextCell( // get next cell in the row
nsIMdbEnv* ev, // context
nsIMdbCell** acqCell, // changes to the next cell in the iteration
mdb_column* outColumn, // column for this particular cell
mdb_pos* outPos) = 0; // position of cell in row sequence
--- a/db/mork/src/morkQuickSort.cpp
+++ b/db/mork/src/morkQuickSort.cpp
@@ -44,72 +44,72 @@
#if !defined(DEBUG) && (defined(__cplusplus) || defined(__gcc))
# ifndef INLINE
# define INLINE inline
# endif
#else
# define INLINE
#endif
-static INLINE mork_u1 *morkQS_med3(mork_u1 *, mork_u1 *, mork_u1 *,
- mdbAny_Order, void *);
+static INLINE mork_u1* morkQS_med3(mork_u1*, mork_u1*, mork_u1*, mdbAny_Order,
+ void*);
-static INLINE void morkQS_swapfunc(mork_u1 *, mork_u1 *, int, int);
+static INLINE void morkQS_swapfunc(mork_u1*, mork_u1*, int, int);
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
*/
#define morkQS_swapcode(TYPE, parmi, parmj, n) \
{ \
long i = (n) / sizeof(TYPE); \
- TYPE *pi = (TYPE *)(parmi); \
- TYPE *pj = (TYPE *)(parmj); \
+ TYPE* pi = (TYPE*)(parmi); \
+ TYPE* pj = (TYPE*)(parmj); \
do { \
TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
} while (--i > 0); \
}
-#define morkQS_SwapInit(a, es) \
- swaptype = (a - (mork_u1 *)0) % sizeof(long) || es % sizeof(long) \
- ? 2 \
+#define morkQS_SwapInit(a, es) \
+ swaptype = (a - (mork_u1*)0) % sizeof(long) || es % sizeof(long) \
+ ? 2 \
: es == sizeof(long) ? 0 : 1;
-static INLINE void morkQS_swapfunc(mork_u1 *a, mork_u1 *b, int n,
+static INLINE void morkQS_swapfunc(mork_u1* a, mork_u1* b, int n,
int swaptype) {
if (swaptype <= 1)
morkQS_swapcode(long, a, b, n) else morkQS_swapcode(mork_u1, a, b, n)
}
-#define morkQS_swap(a, b) \
- if (swaptype == 0) { \
- long t = *(long *)(a); \
- *(long *)(a) = *(long *)(b); \
- *(long *)(b) = t; \
- } else \
+#define morkQS_swap(a, b) \
+ if (swaptype == 0) { \
+ long t = *(long*)(a); \
+ *(long*)(a) = *(long*)(b); \
+ *(long*)(b) = t; \
+ } else \
morkQS_swapfunc(a, b, (int)inSize, swaptype)
#define morkQS_vecswap(a, b, n) \
if ((n) > 0) morkQS_swapfunc(a, b, (int)n, swaptype)
-static INLINE mork_u1 *morkQS_med3(mork_u1 *a, mork_u1 *b, mork_u1 *c,
- mdbAny_Order cmp, void *closure) {
+static INLINE mork_u1* morkQS_med3(mork_u1* a, mork_u1* b, mork_u1* c,
+ mdbAny_Order cmp, void* closure) {
return (*cmp)(a, b, closure) < 0
? ((*cmp)(b, c, closure) < 0 ? b
: ((*cmp)(a, c, closure) < 0 ? c : a))
: ((*cmp)(b, c, closure) > 0
? b
: ((*cmp)(a, c, closure) < 0 ? a : c));
}
#define morkQS_MIN(x, y) ((x) < (y) ? (x) : (y))
-void morkQuickSort(mork_u1 *ioVec, mork_u4 inCount, mork_u4 inSize,
- mdbAny_Order inOrder, void *ioClosure) {
+void morkQuickSort(mork_u1* ioVec, mork_u4 inCount, mork_u4 inSize,
+ mdbAny_Order inOrder, void* ioClosure) {
mork_u1 *pa, *pb, *pc, *pd, *pl, *pm, *pn;
int d, r, swaptype, swap_cnt;
tailCall:
morkQS_SwapInit(ioVec, inSize);
swap_cnt = 0;
if (inCount < 7) {
for (pm = ioVec + inSize; pm < ioVec + inCount * inSize; pm += inSize)
--- a/db/mork/src/morkRowCellCursor.cpp
+++ b/db/mork/src/morkRowCellCursor.cpp
@@ -155,19 +155,19 @@ morkRowCellCursor::GetRow(nsIMdbEnv* mev
if (acqRow) *acqRow = outRow;
return outErr;
}
// } ----- end attribute methods -----
// { ----- begin cell seeking methods -----
NS_IMETHODIMP
morkRowCellCursor::SeekCell(
- nsIMdbEnv* mev, // context
- mdb_pos inPos, // position of cell in row sequence
- mdb_column* outColumn, // column for this particular cell
+ nsIMdbEnv* mev, // context
+ mdb_pos inPos, // position of cell in row sequence
+ mdb_column* outColumn, // column for this particular cell
nsIMdbCell** acqCell) {
NS_ASSERTION(false, "not implemented");
return NS_ERROR_NOT_IMPLEMENTED;
}
// } ----- end cell seeking methods -----
// { ----- begin cell iteration methods -----
NS_IMETHODIMP
--- a/db/mork/src/morkRowCellCursor.h
+++ b/db/mork/src/morkRowCellCursor.h
@@ -56,21 +56,20 @@ class morkRowCellCursor : public morkCur
// { ----- begin attribute methods -----
NS_IMETHOD SetRow(nsIMdbEnv* ev,
nsIMdbRow* ioRow) override; // sets pos to -1
NS_IMETHOD GetRow(nsIMdbEnv* ev, nsIMdbRow** acqRow) override;
// } ----- end attribute methods -----
// { ----- begin cell seeking methods -----
- NS_IMETHOD SeekCell(
- nsIMdbEnv* ev, // context
- mdb_pos inPos, // position of cell in row sequence
- mdb_column* outColumn, // column for this particular cell
- nsIMdbCell** acqCell) override; // the cell at inPos
+ NS_IMETHOD SeekCell(nsIMdbEnv* ev, // context
+ mdb_pos inPos, // position of cell in row sequence
+ mdb_column* outColumn, // column for this particular cell
+ nsIMdbCell** acqCell) override; // the cell at inPos
// } ----- end cell seeking methods -----
// { ----- begin cell iteration methods -----
NS_IMETHOD NextCell( // get next cell in the row
nsIMdbEnv* ev, // context
nsIMdbCell** acqCell, // changes to the next cell in the iteration
mdb_column* outColumn, // column for this particular cell
mdb_pos* outPos) override; // position of cell in row sequence
--- a/ldap/xpcom/src/nsLDAPBERElement.cpp
+++ b/ldap/xpcom/src/nsLDAPBERElement.cpp
@@ -19,33 +19,33 @@ nsLDAPBERElement::~nsLDAPBERElement() {
// this object, so free it
ber_free(mElement, 1);
}
return;
}
NS_IMETHODIMP
-nsLDAPBERElement::Init(nsILDAPBERValue *aValue) {
+nsLDAPBERElement::Init(nsILDAPBERValue* aValue) {
if (aValue) {
return NS_ERROR_NOT_IMPLEMENTED;
}
mElement = ber_alloc_t(LBER_USE_DER);
return mElement ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
/* void putString (in AUTF8String aString, in unsigned long aTag); */
NS_IMETHODIMP
-nsLDAPBERElement::PutString(const nsACString &aString, uint32_t aTag,
- uint32_t *aBytesWritten) {
+nsLDAPBERElement::PutString(const nsACString& aString, uint32_t aTag,
+ uint32_t* aBytesWritten) {
// XXX if the string translation feature of the C SDK is ever used,
// this const_cast will break
int i = ber_put_ostring(mElement,
- const_cast<char *>(PromiseFlatCString(aString).get()),
+ const_cast<char*>(PromiseFlatCString(aString).get()),
aString.Length(), aTag);
if (i < 0) {
return NS_ERROR_FAILURE;
}
*aBytesWritten = i;
return NS_OK;
@@ -58,37 +58,37 @@ NS_IMETHODIMP nsLDAPBERElement::StartSet
if (i < 0) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
/* void putSet (); */
-NS_IMETHODIMP nsLDAPBERElement::PutSet(uint32_t *aBytesWritten) {
+NS_IMETHODIMP nsLDAPBERElement::PutSet(uint32_t* aBytesWritten) {
int i = ber_put_set(mElement);
if (i < 0) {
return NS_ERROR_FAILURE;
}
*aBytesWritten = i;
return NS_OK;
}
/* nsILDAPBERValue flatten (); */
-NS_IMETHODIMP nsLDAPBERElement::GetAsValue(nsILDAPBERValue **_retval) {
- struct berval *bv;
+NS_IMETHODIMP nsLDAPBERElement::GetAsValue(nsILDAPBERValue** _retval) {
+ struct berval* bv;
if (ber_flatten(mElement, &bv) < 0) {
return NS_ERROR_OUT_OF_MEMORY;
}
RefPtr<nsLDAPBERValue> berValue = new nsLDAPBERValue();
nsresult rv =
- berValue->SetRaw(bv->bv_len, reinterpret_cast<uint8_t *>(bv->bv_val));
+ berValue->SetRaw(bv->bv_len, reinterpret_cast<uint8_t*>(bv->bv_val));
// whether or not we've succeeded, we're done with the ldap c sdk struct
ber_bvfree(bv);
// as of this writing, this error can only be NS_ERROR_OUT_OF_MEMORY
if (NS_FAILED(rv)) {
return rv;
}
--- a/ldap/xpcom/src/nsLDAPBERElement.h
+++ b/ldap/xpcom/src/nsLDAPBERElement.h
@@ -20,12 +20,12 @@ class nsLDAPBERElement final : public ns
NS_DECL_ISUPPORTS
NS_DECL_NSILDAPBERELEMENT
nsLDAPBERElement();
private:
~nsLDAPBERElement();
- BerElement *mElement;
+ BerElement* mElement;
protected:
};
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -65,19 +65,19 @@ NS_INTERFACE_MAP_BEGIN(nsLDAPConnection)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsILDAPConnection)
NS_IMPL_QUERY_CLASSINFO(nsLDAPConnection)
NS_INTERFACE_MAP_END
NS_IMPL_CI_INTERFACE_GETTER(nsLDAPConnection, nsILDAPConnection,
nsISupportsWeakReference, nsIDNSListener,
nsIObserver)
NS_IMETHODIMP
-nsLDAPConnection::Init(nsILDAPURL *aUrl, const nsACString &aBindName,
- nsILDAPMessageListener *aMessageListener,
- nsISupports *aClosure, uint32_t aVersion) {
+nsLDAPConnection::Init(nsILDAPURL* aUrl, const nsACString& aBindName,
+ nsILDAPMessageListener* aMessageListener,
+ nsISupports* aClosure, uint32_t aVersion) {
NS_ENSURE_ARG_POINTER(aUrl);
NS_ENSURE_ARG_POINTER(aMessageListener);
nsresult rv;
// Cache the STS thread we'll use to dispatch IO on.
mSTS = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@@ -200,26 +200,26 @@ void nsLDAPConnection::Close() {
if (mDNSRequest) {
mDNSRequest->Cancel(NS_ERROR_ABORT);
mDNSRequest = nullptr;
}
mInitListener = nullptr;
}
NS_IMETHODIMP
-nsLDAPConnection::Observe(nsISupports *aSubject, const char *aTopic,
- const char16_t *aData) {
+nsLDAPConnection::Observe(nsISupports* aSubject, const char* aTopic,
+ const char16_t* aData) {
if (!strcmp(aTopic, "profile-change-net-teardown")) {
// Abort all ldap requests.
/* We cannot use enumerate function to abort operations because
* nsILDAPOperation::AbandonExt() is modifying list of operations
* and this leads to starvation.
* We have to do a copy of pending operations.
*/
- nsTArray<nsILDAPOperation *> pending_operations;
+ nsTArray<nsILDAPOperation*> pending_operations;
{
MutexAutoLock lock(mPendingOperationsMutex);
for (auto iter = mPendingOperations.Iter(); !iter.Done(); iter.Next()) {
pending_operations.AppendElement(iter.UserData());
}
}
for (uint32_t i = 0; i < pending_operations.Length(); i++) {
pending_operations[i]->AbandonExt();
@@ -228,68 +228,68 @@ nsLDAPConnection::Observe(nsISupports *a
} else {
MOZ_ASSERT_UNREACHABLE("unexpected topic");
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPConnection::GetClosure(nsISupports **_retval) {
+nsLDAPConnection::GetClosure(nsISupports** _retval) {
if (!_retval) {
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IF_ADDREF(*_retval = mClosure);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPConnection::SetClosure(nsISupports *aClosure) {
+nsLDAPConnection::SetClosure(nsISupports* aClosure) {
mClosure = aClosure;
return NS_OK;
}
// who we're binding as
//
// readonly attribute AUTF8String bindName
//
NS_IMETHODIMP
-nsLDAPConnection::GetBindName(nsACString &_retval) {
+nsLDAPConnection::GetBindName(nsACString& _retval) {
_retval.Assign(mBindName);
return NS_OK;
}
// wrapper for ldap_get_lderrno
// XXX should copy before returning
//
NS_IMETHODIMP
-nsLDAPConnection::GetLdErrno(nsACString &matched, nsACString &errString,
- int32_t *_retval) {
+nsLDAPConnection::GetLdErrno(nsACString& matched, nsACString& errString,
+ int32_t* _retval) {
char *match, *err;
NS_ENSURE_ARG_POINTER(_retval);
*_retval = ldap_get_lderrno(mConnectionHandle, &match, &err);
matched.Assign(match);
errString.Assign(err);
return NS_OK;
}
// return the error string corresponding to GetLdErrno.
//
// XXX - deal with optional params
// XXX - how does ldap_perror know to look at the global errno?
//
NS_IMETHODIMP
-nsLDAPConnection::GetErrorString(char16_t **_retval) {
+nsLDAPConnection::GetErrorString(char16_t** _retval) {
NS_ENSURE_ARG_POINTER(_retval);
// get the error string
//
- char *rv = ldap_err2string(ldap_get_lderrno(mConnectionHandle, 0, 0));
+ char* rv = ldap_err2string(ldap_get_lderrno(mConnectionHandle, 0, 0));
if (!rv) {
return NS_ERROR_OUT_OF_MEMORY;
}
// make a copy using the XPCOM shared allocator
//
*_retval = ToNewUnicode(NS_ConvertUTF8toUTF16(rv));
if (!*_retval) {
@@ -299,20 +299,20 @@ nsLDAPConnection::GetErrorString(char16_
}
/**
* Add an nsILDAPOperation to the list of operations pending on
* this connection. This is also mainly intended for use by the
* nsLDAPOperation code.
*/
nsresult nsLDAPConnection::AddPendingOperation(uint32_t aOperationID,
- nsILDAPOperation *aOperation) {
+ nsILDAPOperation* aOperation) {
MOZ_ASSERT(aOperation != nullptr);
- nsIRunnable *runnable =
+ nsIRunnable* runnable =
new nsLDAPConnectionRunnable(aOperationID, aOperation, this);
{
MutexAutoLock lock(mPendingOperationsMutex);
mPendingOperations.Put((uint32_t)aOperationID, aOperation);
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("Operation id=%d added (%d now pending)", aOperationID,
mPendingOperations.Count()));
}
@@ -330,17 +330,17 @@ nsresult nsLDAPConnection::AddPendingOpe
// For now, just log it and leave it at that.
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
("nsLDAPConnection::AddPendingOperation() failed, rv=%" PRIx32,
static_cast<uint32_t>(rv)));
}
return rv;
}
-nsresult nsLDAPConnection::StartOp(nsIRunnable *aOp) {
+nsresult nsLDAPConnection::StartOp(nsIRunnable* aOp) {
return mSTS->Dispatch(aOp, nsIEventTarget::DISPATCH_NORMAL);
}
/**
* Remove an nsILDAPOperation from the list of operations pending on this
* connection. Mainly intended for use by the nsLDAPOperation code.
*
* @param aOperation operation to add
@@ -361,28 +361,28 @@ nsresult nsLDAPConnection::RemovePending
mPendingOperations.Count()));
}
return NS_OK;
}
class nsOnLDAPMessageRunnable : public Runnable {
public:
- nsOnLDAPMessageRunnable(nsLDAPMessage *aMsg, bool aClear)
+ nsOnLDAPMessageRunnable(nsLDAPMessage* aMsg, bool aClear)
: Runnable("nsOnLDAPMessageRunnable"), m_msg(aMsg), m_clear(aClear) {}
NS_DECL_NSIRUNNABLE
private:
RefPtr<nsLDAPMessage> m_msg;
bool m_clear;
};
NS_IMETHODIMP nsOnLDAPMessageRunnable::Run() {
// get the message listener object.
- nsLDAPOperation *nsoperation =
- static_cast<nsLDAPOperation *>(m_msg->mOperation.get());
+ nsLDAPOperation* nsoperation =
+ static_cast<nsLDAPOperation*>(m_msg->mOperation.get());
nsCOMPtr<nsILDAPMessageListener> listener;
nsresult rv = nsoperation->GetMessageListener(getter_AddRefs(listener));
if (m_clear) {
// try to break cycles
nsoperation->Clear();
}
@@ -391,18 +391,18 @@ NS_IMETHODIMP nsOnLDAPMessageRunnable::R
"nsLDAPConnection::InvokeMessageCallback(): probable "
"memory corruption: GetMessageListener() returned nullptr");
return rv;
}
return listener->OnLDAPMessage(m_msg);
}
-nsresult nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
- nsILDAPMessage *aMsg,
+nsresult nsLDAPConnection::InvokeMessageCallback(LDAPMessage* aMsgHandle,
+ nsILDAPMessage* aMsg,
int32_t aOperation,
bool aRemoveOpFromConnQ) {
#if defined(DEBUG)
// We only want this being logged for debug builds so as not to affect
// performance too much.
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("InvokeMessageCallback entered"));
#endif
@@ -411,17 +411,17 @@ nsresult nsLDAPConnection::InvokeMessage
nsCOMPtr<nsILDAPOperation> operation;
{
MutexAutoLock lock(mPendingOperationsMutex);
mPendingOperations.Get((uint32_t)aOperation, getter_AddRefs(operation));
}
NS_ENSURE_TRUE(operation, NS_ERROR_NULL_POINTER);
- nsLDAPMessage *msg = static_cast<nsLDAPMessage *>(aMsg);
+ nsLDAPMessage* msg = static_cast<nsLDAPMessage*>(aMsg);
msg->mOperation = operation;
// proxy the listener callback to the ui thread.
RefPtr<nsOnLDAPMessageRunnable> runnable =
new nsOnLDAPMessageRunnable(msg, aRemoveOpFromConnQ);
// invoke the callback
NS_DispatchToMainThread(runnable);
@@ -435,18 +435,18 @@ nsresult nsLDAPConnection::InvokeMessage
("pending operation removed; total pending operations now = %d",
mPendingOperations.Count()));
}
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPConnection::OnLookupComplete(nsICancelable *aRequest,
- nsIDNSRecord *aRecord, nsresult aStatus) {
+nsLDAPConnection::OnLookupComplete(nsICancelable* aRequest,
+ nsIDNSRecord* aRecord, nsresult aStatus) {
nsresult rv = NS_OK;
if (aRecord) {
// Build mResolvedIP list
//
mResolvedIP.Truncate();
int32_t index = 0;
@@ -544,17 +544,17 @@ nsLDAPConnection::OnLookupComplete(nsICa
"nsLDAPConnection::OnLookupComplete(): mVersion"
" invalid");
}
// This code sets up the current connection to use PSM for SSL
// functionality. Making this use libssldap instead for
// non-browser user shouldn't be hard.
- extern nsresult nsLDAPInstallSSL(LDAP * ld, const char *aHostName);
+ extern nsresult nsLDAPInstallSSL(LDAP * ld, const char* aHostName);
if (mSSL) {
if (ldap_set_option(mConnectionHandle, LDAP_OPT_SSL, LDAP_OPT_ON) !=
LDAP_SUCCESS) {
NS_ERROR(
"nsLDAPConnection::OnStopLookup(): Error"
" configuring connection to use SSL");
rv = NS_ERROR_UNEXPECTED;
@@ -581,18 +581,18 @@ nsLDAPConnection::OnLookupComplete(nsICa
//
mInitListener->OnLDAPInit(this, rv);
mInitListener = nullptr;
return rv;
}
nsLDAPConnectionRunnable::nsLDAPConnectionRunnable(
- int32_t aOperationID, nsILDAPOperation *aOperation,
- nsLDAPConnection *aConnection)
+ int32_t aOperationID, nsILDAPOperation* aOperation,
+ nsLDAPConnection* aConnection)
: mOperationID(aOperationID), mConnection(aConnection) {}
nsLDAPConnectionRunnable::~nsLDAPConnectionRunnable() {
if (mConnection) {
NS_ReleaseOnMainThread("nsLDAPConnectionRunnable::mConnection",
mConnection.forget());
}
}
@@ -600,17 +600,17 @@ nsLDAPConnectionRunnable::~nsLDAPConnect
NS_IMPL_ISUPPORTS(nsLDAPConnectionRunnable, nsIRunnable)
NS_IMETHODIMP nsLDAPConnectionRunnable::Run() {
if (!mOperationID) {
NS_ERROR("mOperationID is null");
return NS_ERROR_NULL_POINTER;
}
- LDAPMessage *msgHandle;
+ LDAPMessage* msgHandle;
bool operationFinished = true;
RefPtr<nsLDAPMessage> msg;
struct timeval timeout = {0, 0};
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
int32_t returnCode = ldap_result(mConnection->mConnectionHandle, mOperationID,
LDAP_MSG_ONE, &timeout, &msgHandle);
@@ -666,17 +666,17 @@ NS_IMETHODIMP nsLDAPConnectionRunnable::
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
}
// If we're midway through a SASL Bind, we need to continue
// without letting our caller know what we're up to!
//
if (errorCode == LDAP_SASL_BIND_IN_PROGRESS) {
- struct berval *creds;
+ struct berval* creds;
ldap_parse_sasl_bind_result(mConnection->mConnectionHandle,
msgHandle, &creds, 0);
nsCOMPtr<nsILDAPOperation> operation;
{
MutexAutoLock lock(mConnection->mPendingOperationsMutex);
mConnection->mPendingOperations.Get((uint32_t)mOperationID,
getter_AddRefs(operation));
--- a/ldap/xpcom/src/nsLDAPConnection.h
+++ b/ldap/xpcom/src/nsLDAPConnection.h
@@ -23,18 +23,18 @@
#include "nsCOMArray.h"
#include "nsIObserver.h"
#include "mozilla/Mutex.h"
/**
* Casting nsILDAPConnection to nsISupports is ambiguous.
* This method handles that.
*/
-inline nsISupports *ToSupports(nsILDAPConnection *p) {
- return NS_ISUPPORTS_CAST(nsILDAPConnection *, p);
+inline nsISupports* ToSupports(nsILDAPConnection* p) {
+ return NS_ISUPPORTS_CAST(nsILDAPConnection*, p);
}
// 0d871e30-1dd2-11b2-8ea9-831778c78e93
//
#define NS_LDAPCONNECTION_CID \
{ \
0x0d871e30, 0x1dd2, 0x11b2, { \
0x8e, 0xa9, 0x83, 0x17, 0x78, 0xc7, 0x8e, 0x93 \
@@ -70,17 +70,17 @@ class nsLDAPConnection : public nsILDAPC
*
* @param aOperation operation to add
* @exception NS_ERROR_ILLEGAL_VALUE aOperation was NULL
* @exception NS_ERROR_UNEXPECTED this operation's msgId was not
* unique to this connection
* @exception NS_ERROR_OUT_OF_MEMORY out of memory
*/
nsresult AddPendingOperation(uint32_t aOperationID,
- nsILDAPOperation *aOperation);
+ nsILDAPOperation* aOperation);
/**
* Remove an nsILDAPOperation from the list of operations pending on this
* connection. Mainly intended for use by the nsLDAPOperation code.
*
* @param aOperation operation to add
* @exception NS_ERROR_INVALID_POINTER aOperation was NULL
* @exception NS_ERROR_OUT_OF_MEMORY out of memory
@@ -89,27 +89,27 @@ class nsLDAPConnection : public nsILDAPC
nsresult RemovePendingOperation(uint32_t aOperationID);
protected:
virtual ~nsLDAPConnection();
/** invoke the callback associated with a given message, and possibly
* delete it from the connection queue.
*/
- nsresult InvokeMessageCallback(LDAPMessage *aMsgHandle, nsILDAPMessage *aMsg,
+ nsresult InvokeMessageCallback(LDAPMessage* aMsgHandle, nsILDAPMessage* aMsg,
int32_t aOperation, bool aRemoveOpFromConnQ);
/**
* Dispatch an operation to the socket thread. This is intended for use by
* the nsLDAPOperation code.
*/
- nsresult StartOp(nsIRunnable *aOp);
+ nsresult StartOp(nsIRunnable* aOp);
void Close(); // close the connection
- LDAP *mConnectionHandle; // the LDAP C SDK's connection object
+ LDAP* mConnectionHandle; // the LDAP C SDK's connection object
nsCString mBindName; // who to bind as
// We'll be dispatching operations on the SocketTransportService. This is
// because there might be some SSL/TLS security handshaking happening
// under the hood (the handshaking is deferred until the first IO Send).
// The handshaking expects to be running on the STS thread (see Bug 1576364).
// It also saves us spinning up a new thread to handle LDAP IO.
nsCOMPtr<nsIEventTarget> mSTS;
@@ -129,18 +129,18 @@ class nsLDAPConnection : public nsILDAPC
mClosure; // private parameter (anything caller desires)
};
class nsLDAPConnectionRunnable : public nsIRunnable {
friend class nsLDAPConnection;
friend class nsLDAPMessage;
public:
- nsLDAPConnectionRunnable(int32_t aOperationID, nsILDAPOperation *aOperation,
- nsLDAPConnection *aConnection);
+ nsLDAPConnectionRunnable(int32_t aOperationID, nsILDAPOperation* aOperation,
+ nsLDAPConnection* aConnection);
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIRUNNABLE
int32_t mOperationID;
RefPtr<nsLDAPConnection> mConnection;
private:
--- a/ldap/xpcom/src/nsLDAPControl.cpp
+++ b/ldap/xpcom/src/nsLDAPControl.cpp
@@ -11,60 +11,60 @@
NS_IMPL_ISUPPORTS(nsLDAPControl, nsILDAPControl)
nsLDAPControl::nsLDAPControl() : mIsCritical(false) {}
nsLDAPControl::~nsLDAPControl() {}
/* attribute ACString oid; */
-NS_IMETHODIMP nsLDAPControl::GetOid(nsACString &aOid) {
+NS_IMETHODIMP nsLDAPControl::GetOid(nsACString& aOid) {
aOid.Assign(mOid);
return NS_OK;
}
-NS_IMETHODIMP nsLDAPControl::SetOid(const nsACString &aOid) {
+NS_IMETHODIMP nsLDAPControl::SetOid(const nsACString& aOid) {
mOid = aOid;
return NS_OK;
}
/* attribute nsILDAPBERValue value; */
NS_IMETHODIMP
-nsLDAPControl::GetValue(nsILDAPBERValue **aValue) {
+nsLDAPControl::GetValue(nsILDAPBERValue** aValue) {
NS_IF_ADDREF(*aValue = mValue);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPControl::SetValue(nsILDAPBERValue *aValue) {
+nsLDAPControl::SetValue(nsILDAPBERValue* aValue) {
mValue = aValue;
return NS_OK;
}
/* attribute boolean isCritical; */
NS_IMETHODIMP
-nsLDAPControl::GetIsCritical(bool *aIsCritical) {
+nsLDAPControl::GetIsCritical(bool* aIsCritical) {
*aIsCritical = mIsCritical;
return NS_OK;
}
NS_IMETHODIMP
nsLDAPControl::SetIsCritical(bool aIsCritical) {
mIsCritical = aIsCritical;
return NS_OK;
}
/**
* utility routine for use inside the LDAP XPCOM SDK
*/
-nsresult nsLDAPControl::ToLDAPControl(LDAPControl **control) {
+nsresult nsLDAPControl::ToLDAPControl(LDAPControl** control) {
// because nsLDAPProtocolModule::Init calls prldap_install_routines we know
// that the C SDK will be using the NSPR allocator under the hood, so our
// callers will therefore be able to use ldap_control_free() and friends on
// this control.
- LDAPControl *ctl =
- static_cast<LDAPControl *>(PR_Calloc(1, sizeof(LDAPControl)));
+ LDAPControl* ctl =
+ static_cast<LDAPControl*>(PR_Calloc(1, sizeof(LDAPControl)));
if (!ctl) {
return NS_ERROR_OUT_OF_MEMORY;
}
// need to ensure that this string is also allocated by PR_Alloc
ctl->ldctl_oid = PL_strdup(mOid.get());
if (!ctl->ldctl_oid) {
PR_Free(ctl);
@@ -74,27 +74,27 @@ nsresult nsLDAPControl::ToLDAPControl(LD
ctl->ldctl_iscritical = mIsCritical;
if (!mValue) {
// no data associated with this control
ctl->ldctl_value.bv_len = 0;
ctl->ldctl_value.bv_val = 0;
} else {
// just to make the code below a bit more readable
- nsLDAPBERValue *nsBerVal = static_cast<nsLDAPBERValue *>(
- static_cast<nsILDAPBERValue *>(mValue.get()));
+ nsLDAPBERValue* nsBerVal = static_cast<nsLDAPBERValue*>(
+ static_cast<nsILDAPBERValue*>(mValue.get()));
ctl->ldctl_value.bv_len = nsBerVal->mSize;
if (!nsBerVal->mSize) {
// a zero-length value is associated with this control
return NS_ERROR_NOT_IMPLEMENTED;
} else {
// same for the berval itself
ctl->ldctl_value.bv_len = nsBerVal->mSize;
- ctl->ldctl_value.bv_val = static_cast<char *>(PR_Malloc(nsBerVal->mSize));
+ ctl->ldctl_value.bv_val = static_cast<char*>(PR_Malloc(nsBerVal->mSize));
if (!ctl->ldctl_value.bv_val) {
ldap_control_free(ctl);
return NS_ERROR_OUT_OF_MEMORY;
}
memcpy(ctl->ldctl_value.bv_val, nsBerVal->mValue,
ctl->ldctl_value.bv_len);
}
--- a/ldap/xpcom/src/nsLDAPControl.h
+++ b/ldap/xpcom/src/nsLDAPControl.h
@@ -27,17 +27,17 @@ class nsLDAPControl final : public nsILD
/**
* return a pointer to C-SDK compatible LDAPControl structure. Note that
* this is allocated with NS_Alloc and must be freed with NS_Free, both by
* ldap_control_free() and friends.
*
* @exception null pointer return if allocation failed
*/
- nsresult ToLDAPControl(LDAPControl **aControl);
+ nsresult ToLDAPControl(LDAPControl** aControl);
private:
~nsLDAPControl();
protected:
nsCOMPtr<nsILDAPBERValue> mValue; // the value portion of this control
bool mIsCritical; // should server abort if control not understood?
nsCString mOid; // Object ID for this control
--- a/ldap/xpcom/src/nsLDAPMessage.cpp
+++ b/ldap/xpcom/src/nsLDAPMessage.cpp
@@ -104,18 +104,18 @@ nsLDAPMessage::~nsLDAPMessage(void) {
* @param aConnection The nsLDAPConnection this message is on
* @param aMsgHandle The native LDAPMessage to be wrapped.
*
* @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
* @exception NS_ERROR_UNEXPECTED internal err; shouldn't happen
* @exception NS_ERROR_LDAP_DECODING_ERROR problem during BER decoding
* @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
*/
-nsresult nsLDAPMessage::Init(nsILDAPConnection *aConnection,
- LDAPMessage *aMsgHandle) {
+nsresult nsLDAPMessage::Init(nsILDAPConnection* aConnection,
+ LDAPMessage* aMsgHandle) {
int parseResult;
if (!aConnection || !aMsgHandle) {
NS_WARNING("Null pointer passed in to nsLDAPMessage::Init()");
return NS_ERROR_ILLEGAL_VALUE;
}
// initialize the appropriate member vars
@@ -123,17 +123,17 @@ nsresult nsLDAPMessage::Init(nsILDAPConn
mConnection = aConnection;
mMsgHandle = aMsgHandle;
// cache the connection handle. we're violating the XPCOM type-system
// here since we're a friend of the connection class and in the
// same module.
//
mConnectionHandle =
- static_cast<nsLDAPConnection *>(aConnection)->mConnectionHandle;
+ static_cast<nsLDAPConnection*>(aConnection)->mConnectionHandle;
// do any useful message parsing
//
const int msgType = ldap_msgtype(mMsgHandle);
if (msgType == -1) {
NS_ERROR("nsLDAPMessage::Init(): ldap_msgtype() failed");
return NS_ERROR_UNEXPECTED;
}
@@ -201,45 +201,45 @@ nsresult nsLDAPMessage::Init(nsILDAPConn
/**
* The result code of the (possibly partial) operation.
*
* @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
*
* readonly attribute long errorCode;
*/
NS_IMETHODIMP
-nsLDAPMessage::GetErrorCode(int32_t *aErrorCode) {
+nsLDAPMessage::GetErrorCode(int32_t* aErrorCode) {
if (!aErrorCode) {
return NS_ERROR_ILLEGAL_VALUE;
}
*aErrorCode = mErrorCode;
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPMessage::GetType(int32_t *aType) {
+nsLDAPMessage::GetType(int32_t* aType) {
if (!aType) {
return NS_ERROR_ILLEGAL_VALUE;
}
*aType = ldap_msgtype(mMsgHandle);
if (*aType == -1) {
return NS_ERROR_UNEXPECTED;
};
return NS_OK;
}
// Array<AUTF8String> getAttributes();
NS_IMETHODIMP
-nsLDAPMessage::GetAttributes(nsTArray<nsCString> &attrs) {
+nsLDAPMessage::GetAttributes(nsTArray<nsCString>& attrs) {
attrs.Clear();
- BerElement *ber = nullptr;
- char *attr = ldap_first_attribute(mConnectionHandle, mMsgHandle, &ber);
+ BerElement* ber = nullptr;
+ char* attr = ldap_first_attribute(mConnectionHandle, mMsgHandle, &ber);
while (attr) {
attrs.AppendElement(attr);
ldap_memfree(attr);
attr = ldap_next_attribute(mConnectionHandle, mMsgHandle, ber);
}
if (ber) {
ber_free(ber, 0);
}
@@ -262,18 +262,18 @@ nsLDAPMessage::GetAttributes(nsTArray<ns
NS_WARNING(
"nsLDAPMessage::GetAttributes(): LDAP C SDK returned "
"unexpected value; possible bug or memory corruption");
return NS_ERROR_UNEXPECTED;
}
}
// readonly attribute wstring dn;
-NS_IMETHODIMP nsLDAPMessage::GetDn(nsACString &aDn) {
- char *rawDn = ldap_get_dn(mConnectionHandle, mMsgHandle);
+NS_IMETHODIMP nsLDAPMessage::GetDn(nsACString& aDn) {
+ char* rawDn = ldap_get_dn(mConnectionHandle, mMsgHandle);
if (!rawDn) {
int32_t lderrno = ldap_get_lderrno(mConnectionHandle, 0, 0);
switch (lderrno) {
case LDAP_DECODING_ERROR:
NS_WARNING("nsLDAPMessage::GetDn(): ldap decoding error");
return NS_ERROR_LDAP_DECODING_ERROR;
@@ -292,19 +292,19 @@ NS_IMETHODIMP nsLDAPMessage::GetDn(nsACS
ldap_memfree(rawDn);
return NS_OK;
}
// wrapper for ldap_get_values()
//
NS_IMETHODIMP
-nsLDAPMessage::GetValues(const char *aAttr, nsTArray<nsString> &aValues) {
+nsLDAPMessage::GetValues(const char* aAttr, nsTArray<nsString>& aValues) {
aValues.Clear();
- char **values;
+ char** values;
#if defined(DEBUG)
// We only want this being logged for debug builds so as not to affect
// performance too much.
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPMessage::GetValues(): called with aAttr = '%s'", aAttr));
#endif
@@ -350,19 +350,19 @@ nsLDAPMessage::GetValues(const char *aAt
ldap_value_free(values);
return NS_OK;
}
// wrapper for get_values_len
//
NS_IMETHODIMP
-nsLDAPMessage::GetBinaryValues(const char *aAttr,
- nsTArray<RefPtr<nsILDAPBERValue>> &aValues) {
- struct berval **values;
+nsLDAPMessage::GetBinaryValues(const char* aAttr,
+ nsTArray<RefPtr<nsILDAPBERValue>>& aValues) {
+ struct berval** values;
aValues.Clear();
#if defined(DEBUG)
// We only want this being logged for debug builds so as not to affect
// performance too much.
MOZ_LOG(
gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPMessage::GetBinaryValues(): called with aAttr = '%s'", aAttr));
@@ -406,17 +406,17 @@ nsLDAPMessage::GetBinaryValues(const cha
nsresult rv;
for (i = 0; i < numVals; i++) {
// create an nsBERValue object
RefPtr<nsLDAPBERValue> berValue = new nsLDAPBERValue();
// copy the value from the struct into the nsBERValue
//
rv = berValue->SetRaw(values[i]->bv_len,
- reinterpret_cast<uint8_t *>(values[i]->bv_val));
+ reinterpret_cast<uint8_t*>(values[i]->bv_val));
if (NS_FAILED(rv)) {
NS_ERROR(
"nsLDAPMessage::GetBinaryValues(): error setting"
" nsBERValue");
ldap_value_free_len(values);
return rv == NS_ERROR_OUT_OF_MEMORY ? rv : NS_ERROR_UNEXPECTED;
}
@@ -424,34 +424,34 @@ nsLDAPMessage::GetBinaryValues(const cha
aValues.AppendElement(berValue);
}
ldap_value_free_len(values);
return NS_OK;
}
// readonly attribute nsILDAPOperation operation;
-NS_IMETHODIMP nsLDAPMessage::GetOperation(nsILDAPOperation **_retval) {
+NS_IMETHODIMP nsLDAPMessage::GetOperation(nsILDAPOperation** _retval) {
if (!_retval) {
NS_ERROR("nsLDAPMessage::GetOperation: null pointer ");
return NS_ERROR_NULL_POINTER;
}
NS_IF_ADDREF(*_retval = mOperation);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPMessage::ToUnicode(char16_t **aString) {
+nsLDAPMessage::ToUnicode(char16_t** aString) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsLDAPMessage::GetErrorMessage(nsACString &aErrorMessage) {
+nsLDAPMessage::GetErrorMessage(nsACString& aErrorMessage) {
aErrorMessage.Assign(mErrorMessage);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPMessage::GetMatchedDn(nsACString &aMatchedDn) {
+nsLDAPMessage::GetMatchedDn(nsACString& aMatchedDn) {
aMatchedDn.Assign(mMatchedDn);
return NS_OK;
}
--- a/ldap/xpcom/src/nsLDAPMessage.h
+++ b/ldap/xpcom/src/nsLDAPMessage.h
@@ -33,34 +33,34 @@ class nsLDAPMessage : public nsILDAPMess
// constructor & destructor
//
nsLDAPMessage();
protected:
virtual ~nsLDAPMessage();
- nsresult IterateAttrErrHandler(int32_t aLderrno, uint32_t *aAttrCount,
- char ***aAttributes, BerElement *position);
- nsresult IterateAttributes(uint32_t *aAttrCount, char ***aAttributes,
+ nsresult IterateAttrErrHandler(int32_t aLderrno, uint32_t* aAttrCount,
+ char*** aAttributes, BerElement* position);
+ nsresult IterateAttributes(uint32_t* aAttrCount, char*** aAttributes,
bool getP);
- nsresult Init(nsILDAPConnection *aConnection, LDAPMessage *aMsgHandle);
- LDAPMessage *mMsgHandle; // the message we're wrapping
+ nsresult Init(nsILDAPConnection* aConnection, LDAPMessage* aMsgHandle);
+ LDAPMessage* mMsgHandle; // the message we're wrapping
nsCOMPtr<nsILDAPOperation> mOperation; // operation this msg relates to
- LDAP *mConnectionHandle; // cached connection this op is on
+ LDAP* mConnectionHandle; // cached connection this op is on
// since we're caching the connection handle (above), we need to
// hold an owning ref to the relevant nsLDAPConnection object as long
// as we're around
//
nsCOMPtr<nsILDAPConnection> mConnection;
// the next five member vars are returned by ldap_parse_result()
//
int mErrorCode;
- char *mMatchedDn;
- char *mErrorMessage;
- char **mReferrals;
- LDAPControl **mServerControls;
+ char* mMatchedDn;
+ char* mErrorMessage;
+ char** mReferrals;
+ LDAPControl** mServerControls;
};
#endif // _nsLDAPMessage_h
--- a/ldap/xpcom/src/nsLDAPModification.cpp
+++ b/ldap/xpcom/src/nsLDAPModification.cpp
@@ -20,55 +20,55 @@ nsLDAPModification::nsLDAPModification()
// destructor
//
nsLDAPModification::~nsLDAPModification() {}
nsresult nsLDAPModification::Init() { return NS_OK; }
NS_IMETHODIMP
-nsLDAPModification::GetOperation(int32_t *aOperation) {
+nsLDAPModification::GetOperation(int32_t* aOperation) {
NS_ENSURE_ARG_POINTER(aOperation);
*aOperation = mOperation;
return NS_OK;
}
NS_IMETHODIMP nsLDAPModification::SetOperation(int32_t aOperation) {
mOperation = aOperation;
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPModification::GetType(nsACString &aType) {
+nsLDAPModification::GetType(nsACString& aType) {
aType.Assign(mType);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPModification::SetType(const nsACString &aType) {
+nsLDAPModification::SetType(const nsACString& aType) {
mType.Assign(aType);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPModification::GetValues(nsIArray **aResult) {
+nsLDAPModification::GetValues(nsIArray** aResult) {
NS_ENSURE_ARG_POINTER(aResult);
MutexAutoLock lock(mValuesLock);
if (!mValues) return NS_ERROR_NOT_INITIALIZED;
NS_ADDREF(*aResult = mValues);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPModification::SetValues(nsIArray *aValues) {
+nsLDAPModification::SetValues(nsIArray* aValues) {
NS_ENSURE_ARG_POINTER(aValues);
MutexAutoLock lock(mValuesLock);
nsresult rv;
if (!mValues)
mValues = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
else
@@ -97,34 +97,34 @@ nsLDAPModification::SetValues(nsIArray *
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
NS_IMETHODIMP
nsLDAPModification::SetUpModification(int32_t aOperation,
- const nsACString &aType,
- nsIArray *aValues) {
+ const nsACString& aType,
+ nsIArray* aValues) {
// Set the values using our local function before entering lock
// to avoid deadlocks due to holding the same lock twice.
nsresult rv = SetValues(aValues);
MutexAutoLock lock(mValuesLock);
mOperation = aOperation;
mType.Assign(aType);
return rv;
}
NS_IMETHODIMP
nsLDAPModification::SetUpModificationOneValue(int32_t aOperation,
- const nsACString &aType,
- nsILDAPBERValue *aValue) {
+ const nsACString& aType,
+ nsILDAPBERValue* aValue) {
NS_ENSURE_ARG_POINTER(aValue);
MutexAutoLock lock(mValuesLock);
mOperation = aOperation;
mType.Assign(aType);
nsresult rv;
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -16,41 +16,41 @@
#include "nsILDAPErrors.h"
#include "nsIClassInfoImpl.h"
#include "nsIAuthModule.h"
#include "nsArrayUtils.h"
#include "nsMemory.h"
#include "nsThreadUtils.h"
// Declare helper fns for dealing with C++ LDAP <-> libldap mismatch.
-static nsresult convertValues(nsIArray *values, berval ***aBValues);
-static void freeValues(berval **aVals);
-static nsresult convertMods(nsIArray *aMods, LDAPMod ***aOut);
-static void freeMods(LDAPMod **aMods);
-static nsresult convertControlArray(nsIArray *aXpcomArray,
- LDAPControl ***aArray);
+static nsresult convertValues(nsIArray* values, berval*** aBValues);
+static void freeValues(berval** aVals);
+static nsresult convertMods(nsIArray* aMods, LDAPMod*** aOut);
+static void freeMods(LDAPMod** aMods);
+static nsresult convertControlArray(nsIArray* aXpcomArray,
+ LDAPControl*** aArray);
/**
* OpRunnable is a helper class to dispatch ldap operations on the socket
* thread.
*/
class OpRunnable : public mozilla::Runnable {
public:
- OpRunnable(const char *name, nsLDAPOperation *aOperation)
+ OpRunnable(const char* name, nsLDAPOperation* aOperation)
: mozilla::Runnable(name), mOp(aOperation) {}
RefPtr<nsLDAPOperation> mOp;
protected:
virtual ~OpRunnable() {}
// Provide access to protected members we need in nsLDAPOperation, without
// declaring every individual Runnable as a friend class.
- LDAP *LDAPHandle() { return mOp->mConnectionHandle; }
+ LDAP* LDAPHandle() { return mOp->mConnectionHandle; }
void SetID(int32_t id) { mOp->mMsgID = id; }
- nsLDAPConnection *Conn() { return mOp->mConnection; }
+ nsLDAPConnection* Conn() { return mOp->mConnection; }
void NotifyLDAPError() {
// At this point we should be letting the listener know that there's
// an error, but listener doesn't have a suitable callback.
// See Bug 1592449.
// For now, just log it and leave it at that.
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
("nsLDAPOperation failed id=%d, lderrno=%d", mOp->mMsgID,
@@ -114,58 +114,58 @@ NS_IMPL_CI_INTERFACE_GETTER(nsLDAPOperat
/**
* Initializes this operation. Must be called prior to use.
*
* @param aConnection connection this operation should use
* @param aMessageListener where are the results are called back to.
*/
NS_IMETHODIMP
-nsLDAPOperation::Init(nsILDAPConnection *aConnection,
- nsILDAPMessageListener *aMessageListener,
- nsISupports *aClosure) {
+nsLDAPOperation::Init(nsILDAPConnection* aConnection,
+ nsILDAPMessageListener* aMessageListener,
+ nsISupports* aClosure) {
if (!aConnection) {
return NS_ERROR_ILLEGAL_VALUE;
}
// so we know that the operation is not yet running (and therefore don't
// try and call ldap_abandon_ext() on it) or remove it from the queue.
//
mMsgID = 0;
// set the member vars
//
- mConnection = static_cast<nsLDAPConnection *>(aConnection);
+ mConnection = static_cast<nsLDAPConnection*>(aConnection);
mMessageListener = aMessageListener;
mClosure = aClosure;
// cache the connection handle
//
mConnectionHandle = mConnection->mConnectionHandle;
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::GetClosure(nsISupports **_retval) {
+nsLDAPOperation::GetClosure(nsISupports** _retval) {
if (!_retval) {
return NS_ERROR_ILLEGAL_VALUE;
}
NS_IF_ADDREF(*_retval = mClosure);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::SetClosure(nsISupports *aClosure) {
+nsLDAPOperation::SetClosure(nsISupports* aClosure) {
mClosure = aClosure;
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::GetConnection(nsILDAPConnection **aConnection) {
+nsLDAPOperation::GetConnection(nsILDAPConnection** aConnection) {
if (!aConnection) {
return NS_ERROR_ILLEGAL_VALUE;
}
*aConnection = mConnection;
NS_IF_ADDREF(*aConnection);
return NS_OK;
@@ -173,40 +173,40 @@ nsLDAPOperation::GetConnection(nsILDAPCo
void nsLDAPOperation::Clear() {
mMessageListener = nullptr;
mClosure = nullptr;
mConnection = nullptr;
}
NS_IMETHODIMP
-nsLDAPOperation::GetMessageListener(nsILDAPMessageListener **aMessageListener) {
+nsLDAPOperation::GetMessageListener(nsILDAPMessageListener** aMessageListener) {
if (!aMessageListener) {
return NS_ERROR_ILLEGAL_VALUE;
}
*aMessageListener = mMessageListener;
NS_IF_ADDREF(*aMessageListener);
return NS_OK;
}
/**
* SaslBindRunnable - wraps up an ldap_sasl_bind operation so it can
* be dispatched to the socket thread.
*/
class SaslBindRunnable : public OpRunnable {
public:
- SaslBindRunnable(nsLDAPOperation *aOperation, const nsACString &bindName,
- const nsACString &mechanism, uint8_t *credData,
+ SaslBindRunnable(nsLDAPOperation* aOperation, const nsACString& bindName,
+ const nsACString& mechanism, uint8_t* credData,
unsigned int credLen)
: OpRunnable("SaslBindRunnable", aOperation),
mBindName(bindName),
mMechanism(mechanism) {
- mCreds.bv_val = (char *)credData;
+ mCreds.bv_val = (char*)credData;
mCreds.bv_len = credLen;
}
virtual ~SaslBindRunnable() { free(mCreds.bv_val); }
nsCString mBindName;
nsCString mMechanism;
BerValue mCreds;
@@ -223,68 +223,68 @@ class SaslBindRunnable : public OpRunnab
SetID(msgID);
// Register the operation to pick up responses.
Conn()->AddPendingOperation(msgID, mOp);
return NS_OK;
}
};
NS_IMETHODIMP
-nsLDAPOperation::SaslBind(const nsACString &service,
- const nsACString &mechanism,
- nsIAuthModule *authModule) {
+nsLDAPOperation::SaslBind(const nsACString& service,
+ const nsACString& mechanism,
+ nsIAuthModule* authModule) {
nsresult rv;
nsAutoCString bindName;
mAuthModule = authModule;
mMechanism.Assign(mechanism);
rv = mConnection->GetBindName(bindName);
NS_ENSURE_SUCCESS(rv, rv);
mAuthModule->Init(PromiseFlatCString(service).get(),
nsIAuthModule::REQ_DEFAULT, nullptr,
NS_ConvertUTF8toUTF16(bindName).get(), nullptr);
- uint8_t *credData = nullptr;
+ uint8_t* credData = nullptr;
unsigned int credLen;
- rv = mAuthModule->GetNextToken(nullptr, 0, (void **)&credData, &credLen);
+ rv = mAuthModule->GetNextToken(nullptr, 0, (void**)&credData, &credLen);
if (NS_FAILED(rv) || !credData) return rv;
nsCOMPtr<nsIRunnable> op =
new SaslBindRunnable(this, bindName, mMechanism, credData, credLen);
mConnection->StartOp(op);
return NS_OK;
}
/**
* SaslStep is called by nsLDAPConnection behind the scenes to continue
* a SaslBind.
* This is called from nsLDAPConnectionRunnable, which will already be running
* on the socket thread, so we don't need to do any fancy dispatch stuff here.
*/
NS_IMETHODIMP
-nsLDAPOperation::SaslStep(const char *token, uint32_t tokenLen) {
+nsLDAPOperation::SaslStep(const char* token, uint32_t tokenLen) {
nsresult rv;
nsAutoCString bindName;
struct berval clientCreds;
struct berval serverCreds;
unsigned int credlen;
rv = mConnection->RemovePendingOperation(mMsgID);
NS_ENSURE_SUCCESS(rv, rv);
- serverCreds.bv_val = (char *)token;
+ serverCreds.bv_val = (char*)token;
serverCreds.bv_len = tokenLen;
rv = mConnection->GetBindName(bindName);
NS_ENSURE_SUCCESS(rv, rv);
rv = mAuthModule->GetNextToken(serverCreds.bv_val, serverCreds.bv_len,
- (void **)&clientCreds.bv_val, &credlen);
+ (void**)&clientCreds.bv_val, &credlen);
NS_ENSURE_SUCCESS(rv, rv);
clientCreds.bv_len = credlen;
const int lderrno =
ldap_sasl_bind(mConnectionHandle, bindName.get(), mMechanism.get(),
&clientCreds, NULL, NULL, &mMsgID);
@@ -298,28 +298,28 @@ nsLDAPOperation::SaslStep(const char *to
}
/**
* SimpleBindRunnable - wraps up an ldap_simple_bind operation so it can
* be dispatched to the socket thread.
*/
class SimpleBindRunnable : public OpRunnable {
public:
- SimpleBindRunnable(nsLDAPOperation *aOperation, const nsACString &bindName,
- const nsACString &passwd)
+ SimpleBindRunnable(nsLDAPOperation* aOperation, const nsACString& bindName,
+ const nsACString& passwd)
: OpRunnable("SimpleBindRunnable", aOperation),
mBindName(bindName),
mPasswd(passwd) {}
virtual ~SimpleBindRunnable() {}
nsCString mBindName;
nsCString mPasswd;
NS_IMETHOD Run() override {
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int32_t msgID = ldap_simple_bind(ld, mBindName.get(), mPasswd.get());
if (msgID == -1) {
NotifyLDAPError();
return NS_OK;
}
SetID(msgID);
@@ -327,17 +327,17 @@ class SimpleBindRunnable : public OpRunn
Conn()->AddPendingOperation(msgID, mOp);
return NS_OK;
}
};
// wrapper for ldap_simple_bind()
//
NS_IMETHODIMP
-nsLDAPOperation::SimpleBind(const nsACString &passwd) {
+nsLDAPOperation::SimpleBind(const nsACString& passwd) {
RefPtr<nsLDAPConnection> connection = mConnection;
// There is a possibility that mConnection can be cleared by another
// thread. Grabbing a local reference to mConnection may avoid this.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=557928#c1
nsresult rv;
nsAutoCString bindName;
int32_t originalMsgID = mMsgID;
// Ugly hack alert:
@@ -372,35 +372,35 @@ nsLDAPOperation::SimpleBind(const nsACSt
mConnection->StartOp(op);
return NS_OK;
}
/**
* Given an nsIArray of nsILDAPControls, return the appropriate
* zero-terminated array of LDAPControls ready to pass in to the C SDK.
*/
-static nsresult convertControlArray(nsIArray *aXpcomArray,
- LDAPControl ***aArray) {
+static nsresult convertControlArray(nsIArray* aXpcomArray,
+ LDAPControl*** aArray) {
// get the size of the original array
uint32_t length;
nsresult rv = aXpcomArray->GetLength(&length);
NS_ENSURE_SUCCESS(rv, rv);
// don't allocate an array if someone passed us in an empty one
if (!length) {
*aArray = 0;
return NS_OK;
}
// allocate a local array of the form understood by the C-SDK;
// +1 is to account for the final null terminator. PR_Calloc is
// is used so that ldap_controls_free will work anywhere during the
// iteration
- LDAPControl **controls =
- static_cast<LDAPControl **>(PR_Calloc(length + 1, sizeof(LDAPControl)));
+ LDAPControl** controls =
+ static_cast<LDAPControl**>(PR_Calloc(length + 1, sizeof(LDAPControl)));
// prepare to enumerate the array
nsCOMPtr<nsISimpleEnumerator> enumerator;
rv = aXpcomArray->Enumerate(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(rv, rv);
bool moreElements;
rv = enumerator->HasMoreElements(&moreElements);
@@ -415,18 +415,18 @@ static nsresult convertControlArray(nsIA
ldap_controls_free(controls);
return rv;
}
nsCOMPtr<nsILDAPControl> control = do_QueryInterface(isupports, &rv);
if (NS_FAILED(rv)) {
ldap_controls_free(controls);
return NS_ERROR_INVALID_ARG; // bogus element in the array
}
- nsLDAPControl *ctl = static_cast<nsLDAPControl *>(
- static_cast<nsILDAPControl *>(control.get()));
+ nsLDAPControl* ctl = static_cast<nsLDAPControl*>(
+ static_cast<nsILDAPControl*>(control.get()));
// convert it to an LDAPControl structure placed in the new array
rv = ctl->ToLDAPControl(&controls[i]);
if (NS_FAILED(rv)) {
ldap_controls_free(controls);
return rv;
}
@@ -439,35 +439,35 @@ static nsresult convertControlArray(nsIA
++i;
}
*aArray = controls;
return NS_OK;
}
/* attribute unsigned long requestNum; */
-NS_IMETHODIMP nsLDAPOperation::GetRequestNum(uint32_t *aRequestNum) {
+NS_IMETHODIMP nsLDAPOperation::GetRequestNum(uint32_t* aRequestNum) {
*aRequestNum = mRequestNum;
return NS_OK;
}
NS_IMETHODIMP nsLDAPOperation::SetRequestNum(uint32_t aRequestNum) {
mRequestNum = aRequestNum;
return NS_OK;
}
/**
* SearchExtRunnable - wraps up an ldap_search_ext operation so it can
* be dispatched to the socket thread.
*/
class SearchExtRunnable : public OpRunnable {
public:
- SearchExtRunnable(nsLDAPOperation *aOperation, const nsACString &aBaseDn,
- int32_t aScope, const nsACString &aFilter, char **aAttrs,
- LDAPControl **aServerctls, LDAPControl **aClientctls,
+ SearchExtRunnable(nsLDAPOperation* aOperation, const nsACString& aBaseDn,
+ int32_t aScope, const nsACString& aFilter, char** aAttrs,
+ LDAPControl** aServerctls, LDAPControl** aClientctls,
int32_t aSizeLimit)
: OpRunnable("SearchExtRunnable", aOperation),
mBaseDn(aBaseDn),
mScope(aScope),
mFilter(aFilter),
mAttrs(aAttrs),
mServerctls(aServerctls),
mClientctls(aClientctls),
@@ -483,24 +483,24 @@ class SearchExtRunnable : public OpRunna
++numAttrs;
}
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(numAttrs, mAttrs);
}
nsCString mBaseDn;
int32_t mScope;
nsCString mFilter;
- char **mAttrs;
- LDAPControl **mServerctls;
- LDAPControl **mClientctls;
+ char** mAttrs;
+ LDAPControl** mServerctls;
+ LDAPControl** mClientctls;
int32_t mSizeLimit;
NS_IMETHOD Run() override {
int32_t msgID;
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int retVal =
ldap_search_ext(ld, PromiseFlatCString(mBaseDn).get(), mScope,
PromiseFlatCString(mFilter).get(), mAttrs, 0,
mServerctls, mClientctls, 0, mSizeLimit, &msgID);
// Did the operation succeed?
if (retVal != LDAP_SUCCESS) {
NotifyLDAPError();
return NS_OK;
@@ -509,67 +509,66 @@ class SearchExtRunnable : public OpRunna
SetID(msgID);
// Register the operation to pick up responses.
Conn()->AddPendingOperation(msgID, mOp);
return NS_OK;
}
};
NS_IMETHODIMP
-nsLDAPOperation::SearchExt(const nsACString &aBaseDn, int32_t aScope,
- const nsACString &aFilter,
- const nsACString &aAttributes,
+nsLDAPOperation::SearchExt(const nsACString& aBaseDn, int32_t aScope,
+ const nsACString& aFilter,
+ const nsACString& aAttributes,
PRIntervalTime aTimeOut, int32_t aSizeLimit) {
if (!mMessageListener) {
NS_ERROR("nsLDAPOperation::SearchExt(): mMessageListener not set");
return NS_ERROR_NOT_INITIALIZED;
}
// XXX add control logging
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPOperation::SearchExt(): called with aBaseDn = '%s'; "
"aFilter = '%s'; aAttributes = %s; aSizeLimit = %d",
PromiseFlatCString(aBaseDn).get(), PromiseFlatCString(aFilter).get(),
PromiseFlatCString(aAttributes).get(), aSizeLimit));
- LDAPControl **serverctls = 0;
+ LDAPControl** serverctls = 0;
nsresult rv;
if (mServerControls) {
rv = convertControlArray(mServerControls, &serverctls);
if (NS_FAILED(rv)) {
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
("nsLDAPOperation::SearchExt(): error converting server "
"control array: %" PRIx32,
static_cast<uint32_t>(rv)));
return rv;
}
}
- LDAPControl **clientctls = 0;
+ LDAPControl** clientctls = 0;
if (mClientControls) {
rv = convertControlArray(mClientControls, &clientctls);
if (NS_FAILED(rv)) {
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
("nsLDAPOperation::SearchExt(): error converting client "
"control array: %" PRIx32,
static_cast<uint32_t>(rv)));
ldap_controls_free(serverctls);
return rv;
}
}
// Convert our comma separated string to one that the C-SDK will like, i.e.
// convert to a char array and add a last NULL element.
nsTArray<nsCString> attrArray;
ParseString(aAttributes, ',', attrArray);
- char **attrs = nullptr;
+ char** attrs = nullptr;
uint32_t origLength = attrArray.Length();
if (origLength) {
- attrs =
- static_cast<char **>(moz_xmalloc((origLength + 1) * sizeof(char *)));
+ attrs = static_cast<char**>(moz_xmalloc((origLength + 1) * sizeof(char*)));
if (!attrs) return NS_ERROR_OUT_OF_MEMORY;
for (uint32_t i = 0; i < origLength; ++i)
attrs[i] = ToNewCString(attrArray[i]);
attrs[origLength] = 0;
}
@@ -578,17 +577,17 @@ nsLDAPOperation::SearchExt(const nsACStr
nsCOMPtr<nsIRunnable> op =
new SearchExtRunnable(this, aBaseDn, aScope, aFilter, attrs, serverctls,
clientctls, aSizeLimit);
mConnection->StartOp(op);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::GetMessageID(int32_t *aMsgID) {
+nsLDAPOperation::GetMessageID(int32_t* aMsgID) {
if (!aMsgID) {
return NS_ERROR_ILLEGAL_VALUE;
}
*aMsgID = mMsgID;
return NS_OK;
}
@@ -598,24 +597,24 @@ nsLDAPOperation::GetMessageID(int32_t *a
//
/**
* AbandonExtRunnable - wraps up an ldap_abandon_ext operation so it can be
* dispatched to the socket thread.
*/
class AbandonExtRunnable : public OpRunnable {
public:
- AbandonExtRunnable(nsLDAPOperation *aOperation, int aMsgID)
+ AbandonExtRunnable(nsLDAPOperation* aOperation, int aMsgID)
: OpRunnable("AbandonExtRunnable", aOperation), mMsgID(aMsgID) {}
virtual ~AbandonExtRunnable() {}
int32_t mMsgID;
NS_IMETHOD Run() override {
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int retVal = ldap_abandon_ext(ld, mMsgID, 0, 0);
if (retVal != LDAP_SUCCESS) {
NotifyLDAPError();
return NS_OK;
}
// try to remove it from the pendingOperations queue, if it's there.
// even if something goes wrong here, the abandon() has already succeeded
@@ -660,54 +659,54 @@ nsLDAPOperation::AbandonExt() {
}
nsCOMPtr<nsIRunnable> op = new AbandonExtRunnable(this, mMsgID);
mConnection->StartOp(op);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::GetClientControls(nsIMutableArray **aControls) {
+nsLDAPOperation::GetClientControls(nsIMutableArray** aControls) {
NS_IF_ADDREF(*aControls = mClientControls);
return NS_OK;
}
NS_IMETHODIMP
-nsLDAPOperation::SetClientControls(nsIMutableArray *aControls) {
+nsLDAPOperation::SetClientControls(nsIMutableArray* aControls) {
mClientControls = aControls;
return NS_OK;
}
-NS_IMETHODIMP nsLDAPOperation::GetServerControls(nsIMutableArray **aControls) {
+NS_IMETHODIMP nsLDAPOperation::GetServerControls(nsIMutableArray** aControls) {
NS_IF_ADDREF(*aControls = mServerControls);
return NS_OK;
}
-NS_IMETHODIMP nsLDAPOperation::SetServerControls(nsIMutableArray *aControls) {
+NS_IMETHODIMP nsLDAPOperation::SetServerControls(nsIMutableArray* aControls) {
mServerControls = aControls;
return NS_OK;
}
/**
* AddExtRunnable - wraps up an ldap_add_ext operation so it can be dispatched
* to the socket thread.
*/
class AddExtRunnable : public OpRunnable {
public:
- AddExtRunnable(nsLDAPOperation *aOperation, const nsACString &aDn,
- LDAPMod **aMods)
+ AddExtRunnable(nsLDAPOperation* aOperation, const nsACString& aDn,
+ LDAPMod** aMods)
: OpRunnable("AddExtRunnable", aOperation), mDn(aDn), mMods(aMods) {}
virtual ~AddExtRunnable() { freeMods(mMods); }
nsCString mDn;
- LDAPMod **mMods;
+ LDAPMod** mMods;
NS_IMETHOD Run() override {
int32_t msgID;
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int retVal =
ldap_add_ext(ld, PromiseFlatCString(mDn).get(), mMods, 0, 0, &msgID);
if (retVal != LDAP_SUCCESS) {
NotifyLDAPError();
return NS_OK;
}
SetID(msgID);
// Register the operation to pick up responses.
@@ -721,26 +720,26 @@ class AddExtRunnable : public OpRunnable
*
* @param aBaseDn Base DN to search
* @param aMods Array of modifications
*
* XXX doesn't currently handle LDAPControl params
*
*/
NS_IMETHODIMP
-nsLDAPOperation::AddExt(const nsACString &aBaseDn, nsIArray *aMods) {
+nsLDAPOperation::AddExt(const nsACString& aBaseDn, nsIArray* aMods) {
if (!mMessageListener) {
NS_ERROR("nsLDAPOperation::AddExt(): mMessageListener not set");
return NS_ERROR_NOT_INITIALIZED;
}
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPOperation::AddExt(): called with aBaseDn = '%s'",
PromiseFlatCString(aBaseDn).get()));
- LDAPMod **rawMods;
+ LDAPMod** rawMods;
nsresult rv = convertMods(aMods, &rawMods);
NS_ENSURE_SUCCESS(rv, rv);
if (rawMods) {
#ifdef NS_DEBUG
// Sanity check - only LDAP_MOD_ADD modifications allowed.
for (int i = 0; rawMods[i]; ++i) {
int32_t op = rawMods[i]->mod_op;
@@ -755,25 +754,25 @@ nsLDAPOperation::AddExt(const nsACString
}
/**
* DeleteExtRunnable - wraps up an ldap_delete_ext operation so it can be
* dispatched to the socket thread.
*/
class DeleteExtRunnable : public OpRunnable {
public:
- DeleteExtRunnable(nsLDAPOperation *aOperation, const nsACString &aDn)
+ DeleteExtRunnable(nsLDAPOperation* aOperation, const nsACString& aDn)
: OpRunnable("DeleteExtRunnable", aOperation), mDn(aDn) {}
virtual ~DeleteExtRunnable() {}
nsCString mDn;
NS_IMETHOD Run() override {
int32_t msgID;
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int retVal =
ldap_delete_ext(ld, PromiseFlatCString(mDn).get(), 0, 0, &msgID);
if (retVal != LDAP_SUCCESS) {
NotifyLDAPError();
return NS_OK;
}
SetID(msgID);
// Register the operation to pick up responses.
@@ -787,17 +786,17 @@ class DeleteExtRunnable : public OpRunna
*
* @param aBaseDn Base DN to delete
*
* XXX doesn't currently handle LDAPControl params
*
* void deleteExt(in AUTF8String aBaseDn);
*/
NS_IMETHODIMP
-nsLDAPOperation::DeleteExt(const nsACString &aDn) {
+nsLDAPOperation::DeleteExt(const nsACString& aDn) {
if (!mMessageListener) {
NS_ERROR("nsLDAPOperation::DeleteExt(): mMessageListener not set");
return NS_ERROR_NOT_INITIALIZED;
}
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPOperation::DeleteExt(): called with aDn = '%s'",
PromiseFlatCString(aDn).get()));
@@ -808,27 +807,27 @@ nsLDAPOperation::DeleteExt(const nsACStr
}
/**
* ModifyExtRunnable - wraps up an ldap_modify_ext operation so it can be
* dispatched to the socket thread.
*/
class ModifyExtRunnable : public OpRunnable {
public:
- ModifyExtRunnable(nsLDAPOperation *aOperation, const nsACString &aDn,
- LDAPMod **aMods)
+ ModifyExtRunnable(nsLDAPOperation* aOperation, const nsACString& aDn,
+ LDAPMod** aMods)
: OpRunnable("ModifyExtRunnable", aOperation), mDn(aDn), mMods(aMods) {}
virtual ~ModifyExtRunnable() { freeMods(mMods); }
nsCString mDn;
- LDAPMod **mMods;
+ LDAPMod** mMods;
NS_IMETHOD Run() override {
int32_t msgID;
- LDAP *ld = LDAPHandle();
+ LDAP* ld = LDAPHandle();
int retVal =
ldap_modify_ext(ld, PromiseFlatCString(mDn).get(), mMods, 0, 0, &msgID);
if (retVal != LDAP_SUCCESS) {
NotifyLDAPError();
return NS_OK;
}
SetID(msgID);
// Register the operation to pick up responses.
@@ -845,44 +844,44 @@ class ModifyExtRunnable : public OpRunna
* @param aMods Array of modifications
*
* XXX doesn't currently handle LDAPControl params
*
* void modifyExt (in AUTF8String aBaseDn, in unsigned long aModCount,
* [array, size_is (aModCount)] in nsILDAPModification aMods);
*/
NS_IMETHODIMP
-nsLDAPOperation::ModifyExt(const nsACString &aBaseDn, nsIArray *aMods) {
+nsLDAPOperation::ModifyExt(const nsACString& aBaseDn, nsIArray* aMods) {
if (!mMessageListener) {
NS_ERROR("nsLDAPOperation::ModifyExt(): mMessageListener not set");
return NS_ERROR_NOT_INITIALIZED;
}
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPOperation::ModifyExt(): called with aBaseDn = '%s'",
PromiseFlatCString(aBaseDn).get()));
- LDAPMod **rawMods;
+ LDAPMod** rawMods;
nsresult rv = convertMods(aMods, &rawMods);
NS_ENSURE_SUCCESS(rv, rv);
if (rawMods) {
nsCOMPtr<nsIRunnable> op = new ModifyExtRunnable(this, aBaseDn, rawMods);
mConnection->StartOp(op);
}
return NS_OK;
}
/**
* RenameRunnable - wraps up an ldap_modify_ext operation so it can be
* dispatched to the socket thread.
*/
class RenameRunnable : public OpRunnable {
public:
- RenameRunnable(nsLDAPOperation *aOperation, const nsACString &aBaseDn,
- const nsACString &aNewRDn, const nsACString &aNewParent,
+ RenameRunnable(nsLDAPOperation* aOperation, const nsACString& aBaseDn,
+ const nsACString& aNewRDn, const nsACString& aNewParent,
bool aDeleteOldRDn)
: OpRunnable("RenameRunnable", aOperation),
mBaseDn(aBaseDn),
mNewRDn(aNewRDn),
mNewParent(aNewParent),
mDeleteOldRDn(aDeleteOldRDn) {}
virtual ~RenameRunnable() {}
@@ -916,18 +915,18 @@ class RenameRunnable : public OpRunnable
* @param aNewParent DN of the new parent under which to move the
*
* XXX doesn't currently handle LDAPControl params
*
* void rename(in AUTF8String aBaseDn, in AUTF8String aNewRDn,
* in AUTF8String aNewParent, in boolean aDeleteOldRDn);
*/
NS_IMETHODIMP
-nsLDAPOperation::Rename(const nsACString &aBaseDn, const nsACString &aNewRDn,
- const nsACString &aNewParent, bool aDeleteOldRDn) {
+nsLDAPOperation::Rename(const nsACString& aBaseDn, const nsACString& aNewRDn,
+ const nsACString& aNewParent, bool aDeleteOldRDn) {
if (!mMessageListener) {
NS_ERROR("nsLDAPOperation::Rename(): mMessageListener not set");
return NS_ERROR_NOT_INITIALIZED;
}
MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
("nsLDAPOperation::Rename(): called with aBaseDn = '%s'",
PromiseFlatCString(aBaseDn).get()));
@@ -936,36 +935,36 @@ nsLDAPOperation::Rename(const nsACString
mConnection->StartOp(op);
return NS_OK;
}
/**
* Convert nsILDAPBERValue array to null-terminated array of berval ptrs.
* The returned array should be freed with freeValues().
*/
-static nsresult convertValues(nsIArray *values, berval ***aBValues) {
+static nsresult convertValues(nsIArray* values, berval*** aBValues) {
uint32_t valuesCount;
nsresult rv = values->GetLength(&valuesCount);
NS_ENSURE_SUCCESS(rv, rv);
*aBValues =
- static_cast<berval **>(moz_xmalloc((valuesCount + 1) * sizeof(berval *)));
+ static_cast<berval**>(moz_xmalloc((valuesCount + 1) * sizeof(berval*)));
if (!*aBValues) return NS_ERROR_OUT_OF_MEMORY;
uint32_t valueIndex;
for (valueIndex = 0; valueIndex < valuesCount; ++valueIndex) {
nsCOMPtr<nsILDAPBERValue> value = do_QueryElementAt(values, valueIndex);
nsTArray<uint8_t> tmp;
rv = value->Get(tmp);
if (NS_FAILED(rv)) break;
- berval *bval = new berval;
+ berval* bval = new berval;
bval->bv_len = tmp.Length() * sizeof(uint8_t);
- bval->bv_val = static_cast<char *>(moz_xmalloc(bval->bv_len));
+ bval->bv_val = static_cast<char*>(moz_xmalloc(bval->bv_len));
if (!bval->bv_val) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
memcpy(bval->bv_val, tmp.Elements(), bval->bv_len);
(*aBValues)[valueIndex] = bval;
}
(*aBValues)[valueIndex] = nullptr;
@@ -973,52 +972,52 @@ static nsresult convertValues(nsIArray *
if (NS_FAILED(rv)) {
freeValues(*aBValues);
*aBValues = nullptr;
return rv;
}
return NS_OK;
}
-static void freeValues(berval **aVals) {
+static void freeValues(berval** aVals) {
if (!aVals) {
return;
}
for (int i = 0; aVals[i]; ++i) {
free(aVals[i]->bv_val);
delete (aVals[i]);
}
free(aVals);
}
/**
* Convert nsILDAPModifications to null-terminated array of LDAPMod ptrs.
* If input aMods is missing/empty, will return null ptr (and NS_OK).
* Will return null upon error.
* The returned array should be freed with freeMods().
*/
-static nsresult convertMods(nsIArray *aMods, LDAPMod ***aOut) {
+static nsresult convertMods(nsIArray* aMods, LDAPMod*** aOut) {
*aOut = nullptr;
uint32_t modCount = 0;
nsresult rv = aMods->GetLength(&modCount);
NS_ENSURE_SUCCESS(rv, rv);
if (aMods && modCount) {
- *aOut = static_cast<LDAPMod **>(
- moz_xmalloc((modCount + 1) * sizeof(LDAPMod *)));
+ *aOut =
+ static_cast<LDAPMod**>(moz_xmalloc((modCount + 1) * sizeof(LDAPMod*)));
if (!*aOut) {
NS_ERROR("nsLDAPOperation::AddExt: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
}
nsAutoCString type;
uint32_t index;
for (index = 0; index < modCount && NS_SUCCEEDED(rv); ++index) {
- LDAPMod *mod = new LDAPMod();
+ LDAPMod* mod = new LDAPMod();
nsCOMPtr<nsILDAPModification> modif(do_QueryElementAt(aMods, index, &rv));
if (NS_FAILED(rv)) break;
int32_t operation;
rv = modif->GetOperation(&operation);
if (NS_FAILED(rv)) break;
mod->mod_op = operation | LDAP_MOD_BVALUES;
@@ -1047,21 +1046,21 @@ static nsresult convertMods(nsIArray *aM
}
}
return NS_OK;
}
/**
* Free an LDAPMod array created by convertMods().
*/
-static void freeMods(LDAPMod **aMods) {
+static void freeMods(LDAPMod** aMods) {
if (!aMods) {
return;
}
int i;
for (i = 0; aMods[i]; ++i) {
- LDAPMod *mod = aMods[i];
+ LDAPMod* mod = aMods[i];
free(mod->mod_type);
freeValues(mod->mod_bvalues);
delete mod;
}
free(aMods);
}
--- a/ldap/xpcom/src/nsLDAPOperation.h
+++ b/ldap/xpcom/src/nsLDAPOperation.h
@@ -47,17 +47,17 @@ class nsLDAPOperation : public nsILDAPOp
virtual ~nsLDAPOperation();
protected:
nsCOMPtr<nsILDAPMessageListener> mMessageListener; // results go here
nsCOMPtr<nsISupports>
mClosure; // private parameter (anything caller desires)
RefPtr<nsLDAPConnection> mConnection; // connection this op is on
- LDAP *mConnectionHandle; // cache connection handle
+ LDAP* mConnectionHandle; // cache connection handle
nsCString mSavePassword;
nsCString mMechanism;
nsCOMPtr<nsIAuthModule> mAuthModule;
int32_t mMsgID; // opaque handle to outbound message for this op
nsCOMPtr<nsIMutableArray> mClientControls;
nsCOMPtr<nsIMutableArray> mServerControls;
};
--- a/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
+++ b/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
@@ -18,86 +18,86 @@
#include "ldap.h"
#include "ldappr.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
// LDAP per-session data structure.
//
typedef struct {
- char *hostname;
- LDAP_X_EXTIOF_CLOSE_CALLBACK *realClose;
- LDAP_X_EXTIOF_CONNECT_CALLBACK *realConnect;
- LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *realDisposeHandle;
+ char* hostname;
+ LDAP_X_EXTIOF_CLOSE_CALLBACK* realClose;
+ LDAP_X_EXTIOF_CONNECT_CALLBACK* realConnect;
+ LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK* realDisposeHandle;
} nsLDAPSSLSessionClosure;
// LDAP per-socket data structure.
//
typedef struct {
- nsLDAPSSLSessionClosure *sessionClosure; /* session info */
+ nsLDAPSSLSessionClosure* sessionClosure; /* session info */
} nsLDAPSSLSocketClosure;
// free the per-socket data structure as necessary
//
-static void nsLDAPSSLFreeSocketClosure(nsLDAPSSLSocketClosure **aClosure) {
+static void nsLDAPSSLFreeSocketClosure(nsLDAPSSLSocketClosure** aClosure) {
if (aClosure && *aClosure) {
free(*aClosure);
*aClosure = nullptr;
}
}
// Replacement close() function, which cleans up local stuff associated
// with this socket, and then calls the real close function.
//
extern "C" int LDAP_CALLBACK
-nsLDAPSSLClose(int s, struct lextiof_socket_private *socketarg) {
+nsLDAPSSLClose(int s, struct lextiof_socket_private* socketarg) {
PRLDAPSocketInfo socketInfo;
- nsLDAPSSLSocketClosure *socketClosure;
- nsLDAPSSLSessionClosure *sessionClosure;
+ nsLDAPSSLSocketClosure* socketClosure;
+ nsLDAPSSLSessionClosure* sessionClosure;
// get the socketInfo associated with this socket
//
memset(&socketInfo, 0, sizeof(socketInfo));
socketInfo.soinfo_size = PRLDAP_SOCKETINFO_SIZE;
if (prldap_get_socket_info(s, socketarg, &socketInfo) != LDAP_SUCCESS) {
NS_ERROR("nsLDAPSSLClose(): prldap_get_socket_info() failed");
return -1;
}
// save off the session closure data in an automatic, since we're going to
// need to call through it
//
socketClosure =
- reinterpret_cast<nsLDAPSSLSocketClosure *>(socketInfo.soinfo_appdata);
+ reinterpret_cast<nsLDAPSSLSocketClosure*>(socketInfo.soinfo_appdata);
if (!socketClosure) {
NS_ERROR("nsLDAPSSLClose(): no socketClosure to be had");
return -1;
}
sessionClosure = socketClosure->sessionClosure;
// free the socket closure data
//
nsLDAPSSLFreeSocketClosure(
- reinterpret_cast<nsLDAPSSLSocketClosure **>(&socketInfo.soinfo_appdata));
+ reinterpret_cast<nsLDAPSSLSocketClosure**>(&socketInfo.soinfo_appdata));
// call the real close function
//
return (*(sessionClosure->realClose))(s, socketarg);
}
// Replacement connection function. Calls the real connect function,
//
extern "C" int LDAP_CALLBACK nsLDAPSSLConnect(
- const char *hostlist, int defport, int timeout, unsigned long options,
- struct lextiof_session_private *sessionarg,
- struct lextiof_socket_private **socketargp) {
+ const char* hostlist, int defport, int timeout, unsigned long options,
+ struct lextiof_session_private* sessionarg,
+ struct lextiof_socket_private** socketargp) {
PRLDAPSocketInfo socketInfo;
PRLDAPSessionInfo sessionInfo;
- nsLDAPSSLSocketClosure *socketClosure = nullptr;
- nsLDAPSSLSessionClosure *sessionClosure;
+ nsLDAPSSLSocketClosure* socketClosure = nullptr;
+ nsLDAPSSLSessionClosure* sessionClosure;
int intfd = -1;
nsCOMPtr<nsISupports> securityInfo;
nsCOMPtr<nsISocketProvider> tlsSocketProvider;
nsCOMPtr<nsISSLSocketControl> sslSocketControl;
nsCOMPtr<nsISocketProviderService> sps;
nsresult rv;
// Ensure secure option is set. Also, clear secure bit in options
@@ -116,17 +116,17 @@ extern "C" int LDAP_CALLBACK nsLDAPSSLCo
memset(&sessionInfo, 0, sizeof(sessionInfo));
sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
if (prldap_get_session_info(nullptr, sessionarg, &sessionInfo) !=
LDAP_SUCCESS) {
NS_ERROR("nsLDAPSSLConnect(): unable to get session info");
return -1;
}
sessionClosure =
- reinterpret_cast<nsLDAPSSLSessionClosure *>(sessionInfo.seinfo_appdata);
+ reinterpret_cast<nsLDAPSSLSessionClosure*>(sessionInfo.seinfo_appdata);
// Call the real connect() callback to make the TCP connection. If it
// succeeds, *socketargp is set.
//
intfd = (*(sessionClosure->realConnect))(hostlist, defport, timeout, options,
sessionarg, socketargp);
if (intfd < 0) {
MOZ_LOG(
@@ -142,17 +142,17 @@ extern "C" int LDAP_CALLBACK nsLDAPSSLCo
socketInfo.soinfo_size = PRLDAP_SOCKETINFO_SIZE;
if (prldap_get_socket_info(intfd, *socketargp, &socketInfo) != LDAP_SUCCESS) {
NS_ERROR("nsLDAPSSLConnect(): unable to get socket info");
goto close_socket_and_exit_with_error;
}
// Allocate a structure to hold our socket-specific data.
//
- socketClosure = static_cast<nsLDAPSSLSocketClosure *>(
+ socketClosure = static_cast<nsLDAPSSLSocketClosure*>(
moz_xmalloc(sizeof(nsLDAPSSLSocketClosure)));
if (!socketClosure) {
NS_WARNING("nsLDAPSSLConnect(): unable to allocate socket closure");
goto close_socket_and_exit_with_error;
}
memset(socketClosure, 0, sizeof(nsLDAPSSLSocketClosure));
socketClosure->sessionClosure = sessionClosure;
@@ -198,17 +198,17 @@ extern "C" int LDAP_CALLBACK nsLDAPSSLCo
if (NS_FAILED(rv)) {
NS_WARNING("nsLDAPSSLConnect(): StartTLS failed");
}
}
// Attach our closure to the socketInfo.
//
socketInfo.soinfo_appdata =
- reinterpret_cast<prldap_socket_private *>(socketClosure);
+ reinterpret_cast<prldap_socket_private*>(socketClosure);
if (prldap_set_socket_info(intfd, *socketargp, &socketInfo) != LDAP_SUCCESS) {
NS_ERROR("nsLDAPSSLConnect(): unable to set socket info");
}
return intfd; // success
close_socket_and_exit_with_error:
if (socketInfo.soinfo_prfd) {
PR_Close(socketInfo.soinfo_prfd);
@@ -220,17 +220,17 @@ close_socket_and_exit_with_error:
(*(sessionClosure->realClose))(intfd, *socketargp);
}
return -1;
}
// Free data associated with this session (LDAP *) as necessary.
//
static void nsLDAPSSLFreeSessionClosure(
- nsLDAPSSLSessionClosure **aSessionClosure) {
+ nsLDAPSSLSessionClosure** aSessionClosure) {
if (aSessionClosure && *aSessionClosure) {
// free the hostname
//
if ((*aSessionClosure)->hostname) {
PL_strfree((*aSessionClosure)->hostname);
(*aSessionClosure)->hostname = nullptr;
}
@@ -240,57 +240,57 @@ static void nsLDAPSSLFreeSessionClosure(
*aSessionClosure = nullptr;
}
}
// Replacement session handle disposal code. First cleans up our local
// stuff, then calls the original session handle disposal function.
//
extern "C" void LDAP_CALLBACK
-nsLDAPSSLDisposeHandle(LDAP *ld, struct lextiof_session_private *sessionarg) {
+nsLDAPSSLDisposeHandle(LDAP* ld, struct lextiof_session_private* sessionarg) {
PRLDAPSessionInfo sessionInfo;
- nsLDAPSSLSessionClosure *sessionClosure;
- LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *disposehdl_fn;
+ nsLDAPSSLSessionClosure* sessionClosure;
+ LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK* disposehdl_fn;
memset(&sessionInfo, 0, sizeof(sessionInfo));
sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
if (prldap_get_session_info(ld, nullptr, &sessionInfo) == LDAP_SUCCESS) {
sessionClosure =
- reinterpret_cast<nsLDAPSSLSessionClosure *>(sessionInfo.seinfo_appdata);
+ reinterpret_cast<nsLDAPSSLSessionClosure*>(sessionInfo.seinfo_appdata);
disposehdl_fn = sessionClosure->realDisposeHandle;
nsLDAPSSLFreeSessionClosure(&sessionClosure);
(*disposehdl_fn)(ld, sessionarg);
}
}
// Installs appropriate routines and data for making this connection
// handle SSL. The aHostName is ultimately passed to PSM and is used to
// validate certificates.
//
-nsresult nsLDAPInstallSSL(LDAP *ld, const char *aHostName) {
+nsresult nsLDAPInstallSSL(LDAP* ld, const char* aHostName) {
struct ldap_x_ext_io_fns iofns;
- nsLDAPSSLSessionClosure *sessionClosure;
+ nsLDAPSSLSessionClosure* sessionClosure;
PRLDAPSessionInfo sessionInfo;
// Allocate our own session information.
//
- sessionClosure = static_cast<nsLDAPSSLSessionClosure *>(
+ sessionClosure = static_cast<nsLDAPSSLSessionClosure*>(
moz_xmalloc(sizeof(nsLDAPSSLSessionClosure)));
if (!sessionClosure) {
return NS_ERROR_OUT_OF_MEMORY;
}
memset(sessionClosure, 0, sizeof(nsLDAPSSLSessionClosure));
// Override a few functions, saving a pointer to the original function
// in each case so we can call it from our SSL savvy functions.
//
memset(&iofns, 0, sizeof(iofns));
iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE;
if (ldap_get_option(ld, LDAP_X_OPT_EXTIO_FN_PTRS,
- static_cast<void *>(&iofns)) != LDAP_SUCCESS) {
+ static_cast<void*>(&iofns)) != LDAP_SUCCESS) {
NS_ERROR(
"nsLDAPInstallSSL(): unexpected error getting"
" LDAP_X_OPT_EXTIO_FN_PTRS");
nsLDAPSSLFreeSessionClosure(&sessionClosure);
return NS_ERROR_UNEXPECTED;
}
// Make a copy of the hostname to pass to AddToSocket later
@@ -307,27 +307,27 @@ nsresult nsLDAPInstallSSL(LDAP *ld, cons
sessionClosure->realClose = iofns.lextiof_close;
iofns.lextiof_close = nsLDAPSSLClose;
sessionClosure->realConnect = iofns.lextiof_connect;
iofns.lextiof_connect = nsLDAPSSLConnect;
sessionClosure->realDisposeHandle = iofns.lextiof_disposehandle;
iofns.lextiof_disposehandle = nsLDAPSSLDisposeHandle;
if (ldap_set_option(ld, LDAP_X_OPT_EXTIO_FN_PTRS,
- static_cast<void *>(&iofns)) != LDAP_SUCCESS) {
+ static_cast<void*>(&iofns)) != LDAP_SUCCESS) {
NS_ERROR("nsLDAPInstallSSL(): error setting LDAP_X_OPT_EXTIO_FN_PTRS");
nsLDAPSSLFreeSessionClosure(&sessionClosure);
return NS_ERROR_FAILURE;
}
// Store session info. for later retrieval.
//
sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
sessionInfo.seinfo_appdata =
- reinterpret_cast<prldap_session_private *>(sessionClosure);
+ reinterpret_cast<prldap_session_private*>(sessionClosure);
if (prldap_set_session_info(ld, nullptr, &sessionInfo) != LDAP_SUCCESS) {
NS_ERROR("nsLDAPInstallSSL(): error setting prldap session info");
free(sessionClosure);
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
}
--- a/ldap/xpcom/src/nsLDAPService.cpp
+++ b/ldap/xpcom/src/nsLDAPService.cpp
@@ -64,42 +64,42 @@ bool nsLDAPServiceEntry::DecrementLeases
uint32_t nsLDAPServiceEntry::GetLeases() { return mLeases; }
// Get/Set the nsLDAPServer object for this entry.
//
already_AddRefed<nsILDAPServer> nsLDAPServiceEntry::GetServer() {
nsCOMPtr<nsILDAPServer> server = mServer;
return server.forget();
}
-bool nsLDAPServiceEntry::SetServer(nsILDAPServer *aServer) {
+bool nsLDAPServiceEntry::SetServer(nsILDAPServer* aServer) {
if (!aServer) {
return false;
}
mServer = aServer;
return true;
}
// Get/Set/Clear the nsLDAPConnection object for this entry.
//
already_AddRefed<nsILDAPConnection> nsLDAPServiceEntry::GetConnection() {
nsCOMPtr<nsILDAPConnection> conn = mConnection;
return conn.forget();
}
-void nsLDAPServiceEntry::SetConnection(nsILDAPConnection *aConnection) {
+void nsLDAPServiceEntry::SetConnection(nsILDAPConnection* aConnection) {
mConnection = aConnection;
}
// Get/Set the nsLDAPMessage object for this entry (it's a "cache").
//
already_AddRefed<nsILDAPMessage> nsLDAPServiceEntry::GetMessage() {
nsCOMPtr<nsILDAPMessage> message = mMessage;
return message.forget();
}
-void nsLDAPServiceEntry::SetMessage(nsILDAPMessage *aMessage) {
+void nsLDAPServiceEntry::SetMessage(nsILDAPMessage* aMessage) {
mMessage = aMessage;
}
// Push/Pop pending listeners/callback for this server entry. This is
// implemented as a "stack" on top of the nsCOMArray, since we can
// potentially have more than one listener waiting for the connection
// to be available for consumption.
//
@@ -107,17 +107,17 @@ already_AddRefed<nsILDAPMessageListener>
if (mListeners.IsEmpty()) {
return 0;
}
nsCOMPtr<nsILDAPMessageListener> listener = mListeners[0];
mListeners.RemoveObjectAt(0);
return listener.forget();
}
-bool nsLDAPServiceEntry::PushListener(nsILDAPMessageListener *listener) {
+bool nsLDAPServiceEntry::PushListener(nsILDAPMessageListener* listener) {
return mListeners.AppendObject(listener);
}
// Mark this server to currently be rebinding. This is to avoid a
// race condition where multiple consumers could potentially request
// to reconnect the connection.
//
bool nsLDAPServiceEntry::IsRebinding() { return mRebinding; }
@@ -145,18 +145,18 @@ nsLDAPService::nsLDAPService() : mLock("
//
nsLDAPService::~nsLDAPService() {}
// Initializer
//
nsresult nsLDAPService::Init() { return NS_OK; }
// void addServer (in nsILDAPServer aServer);
-NS_IMETHODIMP nsLDAPService::AddServer(nsILDAPServer *aServer) {
- nsLDAPServiceEntry *entry;
+NS_IMETHODIMP nsLDAPService::AddServer(nsILDAPServer* aServer) {
+ nsLDAPServiceEntry* entry;
nsString key;
nsresult rv;
if (!aServer) {
NS_ERROR("nsLDAPService::AddServer: null pointer ");
return NS_ERROR_NULL_POINTER;
}
@@ -206,18 +206,18 @@ NS_IMETHODIMP nsLDAPService::AddServer(n
mServers.Put(key, entry);
}
NS_ADDREF(aServer);
return NS_OK;
}
// void deleteServer (in wstring aKey);
-NS_IMETHODIMP nsLDAPService::DeleteServer(const char16_t *aKey) {
- nsLDAPServiceEntry *entry;
+NS_IMETHODIMP nsLDAPService::DeleteServer(const char16_t* aKey) {
+ nsLDAPServiceEntry* entry;
MutexAutoLock lock(mLock);
// We should probably rename the key for this entry now that it's
// "deleted", so that we can add in a new one with the same ID.
// This is bug #77669.
//
if (mServers.Get(nsDependentString(aKey), &entry) && entry) {
if (entry->GetLeases() > 0) {
@@ -229,19 +229,19 @@ NS_IMETHODIMP nsLDAPService::DeleteServe
//
return NS_ERROR_FAILURE;
}
return NS_OK;
}
// nsILDAPServer getServer (in wstring aKey);
-NS_IMETHODIMP nsLDAPService::GetServer(const char16_t *aKey,
- nsILDAPServer **_retval) {
- nsLDAPServiceEntry *entry;
+NS_IMETHODIMP nsLDAPService::GetServer(const char16_t* aKey,
+ nsILDAPServer** _retval) {
+ nsLDAPServiceEntry* entry;
MutexAutoLock lock(mLock);
if (!_retval) {
NS_ERROR("nsLDAPService::GetServer: null pointer ");
return NS_ERROR_NULL_POINTER;
}
if (!mServers.Get(nsDependentString(aKey), &entry)) {
@@ -253,18 +253,18 @@ NS_IMETHODIMP nsLDAPService::GetServer(c
}
return NS_OK;
}
// void requestConnection (in wstring aKey,
// in nsILDAPMessageListener aMessageListener);
NS_IMETHODIMP nsLDAPService::RequestConnection(
- const char16_t *aKey, nsILDAPMessageListener *aListener) {
- nsLDAPServiceEntry *entry;
+ const char16_t* aKey, nsILDAPMessageListener* aListener) {
+ nsLDAPServiceEntry* entry;
nsCOMPtr<nsILDAPConnection> conn;
nsCOMPtr<nsILDAPMessage> message;
nsresult rv;
if (!aListener) {
NS_ERROR("nsLDAPService::RequestConection: null pointer ");
return NS_ERROR_NULL_POINTER;
}
@@ -301,29 +301,28 @@ NS_IMETHODIMP nsLDAPService::RequestConn
// We got a new connection, now push the listeners on our stack,
// until we get the LDAP message back.
//
{
MutexAutoLock lock(mLock);
if (!mServers.Get(nsDependentString(aKey), &entry) ||
- !entry->PushListener(
- static_cast<nsILDAPMessageListener *>(aListener))) {
+ !entry->PushListener(static_cast<nsILDAPMessageListener*>(aListener))) {
return NS_ERROR_FAILURE;
}
}
return NS_OK;
}
// nsILDAPConnection getConnection (in wstring aKey);
-NS_IMETHODIMP nsLDAPService::GetConnection(const char16_t *aKey,
- nsILDAPConnection **_retval) {
- nsLDAPServiceEntry *entry;
+NS_IMETHODIMP nsLDAPService::GetConnection(const char16_t* aKey,
+ nsILDAPConnection** _retval) {
+ nsLDAPServiceEntry* entry;
MutexAutoLock lock(mLock);
if (!_retval) {
NS_ERROR("nsLDAPService::GetConnection: null pointer ");
return NS_ERROR_NULL_POINTER;
}
if (!mServers.Get(nsDependentString(aKey), &entry)) {
@@ -335,18 +334,18 @@ NS_IMETHODIMP nsLDAPService::GetConnecti
if (!(*_retval = entry->GetConnection().take())) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
// void releaseConnection (in wstring aKey);
-NS_IMETHODIMP nsLDAPService::ReleaseConnection(const char16_t *aKey) {
- nsLDAPServiceEntry *entry;
+NS_IMETHODIMP nsLDAPService::ReleaseConnection(const char16_t* aKey) {
+ nsLDAPServiceEntry* entry;
MutexAutoLock lock(mLock);
if (!mServers.Get(nsDependentString(aKey), &entry)) {
return NS_ERROR_FAILURE;
}
if (entry->GetLeases() > 0) {
entry->SetTimestamp();
@@ -357,18 +356,18 @@ NS_IMETHODIMP nsLDAPService::ReleaseConn
}
return NS_OK;
}
// void reconnectConnection (in wstring aKey,
// in nsILDAPMessageListener aMessageListener);
NS_IMETHODIMP nsLDAPService::ReconnectConnection(
- const char16_t *aKey, nsILDAPMessageListener *aListener) {
- nsLDAPServiceEntry *entry;
+ const char16_t* aKey, nsILDAPMessageListener* aListener) {
+ nsLDAPServiceEntry* entry;
nsresult rv;
if (!aListener) {
NS_ERROR("nsLDAPService::ReconnectConnection: null pointer ");
return NS_ERROR_NULL_POINTER;
}
{
@@ -403,35 +402,34 @@ NS_IMETHODIMP nsLDAPService::ReconnectCo
rv = EstablishConnection(entry, aListener);
if (NS_FAILED(rv)) {
return rv;
}
{
MutexAutoLock lock(mLock);
- if (!entry->PushListener(
- static_cast<nsILDAPMessageListener *>(aListener))) {
+ if (!entry->PushListener(static_cast<nsILDAPMessageListener*>(aListener))) {
entry->SetRebinding(false);
return NS_ERROR_FAILURE;
}
}
return NS_OK;
}
/**
* Messages received are passed back via this function.
*
* @arg aMessage The message that was returned, 0 if none was.
*
* void OnLDAPMessage (in nsILDAPMessage aMessage)
*/
NS_IMETHODIMP
-nsLDAPService::OnLDAPMessage(nsILDAPMessage *aMessage) {
+nsLDAPService::OnLDAPMessage(nsILDAPMessage* aMessage) {
nsCOMPtr<nsILDAPOperation> operation;
nsCOMPtr<nsILDAPConnection> connection;
int32_t messageType;
// XXXleif: NULL messages are supposedly allowed, but the semantics
// are not definted (yet?). This is something to look out for...
//
@@ -466,17 +464,17 @@ nsLDAPService::OnLDAPMessage(nsILDAPMess
}
// Now we have the connection, lets find the corresponding
// server entry in the Service.
//
{
nsCOMPtr<nsILDAPMessageListener> listener;
nsCOMPtr<nsILDAPMessage> message;
- nsLDAPServiceEntry *entry;
+ nsLDAPServiceEntry* entry;
MutexAutoLock lock(mLock);
if (!mConnections.Get(connection, &entry)) {
return NS_ERROR_FAILURE;
}
message = entry->GetMessage();
if (message) {
@@ -527,24 +525,24 @@ nsLDAPService::OnLDAPMessage(nsILDAPMess
}
return NS_OK;
}
// void onLDAPInit (in nsILDAPConnection aConn, in nsresult aStatus); */
//
NS_IMETHODIMP
-nsLDAPService::OnLDAPInit(nsILDAPConnection *aConn, nsresult aStatus) {
+nsLDAPService::OnLDAPInit(nsILDAPConnection* aConn, nsresult aStatus) {
return NS_ERROR_NOT_IMPLEMENTED;
}
// Helper function to establish an LDAP connection properly.
//
-nsresult nsLDAPService::EstablishConnection(nsLDAPServiceEntry *aEntry,
- nsILDAPMessageListener *aListener) {
+nsresult nsLDAPService::EstablishConnection(nsLDAPServiceEntry* aEntry,
+ nsILDAPMessageListener* aListener) {
nsCOMPtr<nsILDAPOperation> operation;
nsCOMPtr<nsILDAPServer> server;
nsCOMPtr<nsILDAPURL> url;
nsCOMPtr<nsILDAPConnection> conn, conn2;
nsCOMPtr<nsILDAPMessage> message;
nsAutoCString binddn;
nsAutoCString password;
uint32_t protocolVersion;
@@ -623,17 +621,17 @@ nsresult nsLDAPService::EstablishConnect
aListener->OnLDAPMessage(message);
return NS_OK;
}
{
MutexAutoLock lock(mLock);
if (!aEntry->PushListener(
- static_cast<nsILDAPMessageListener *>(aListener))) {
+ static_cast<nsILDAPMessageListener*>(aListener))) {
return NS_ERROR_FAILURE;
}
}
return NS_OK;
}
// We made the connection, lets store it to the server entry,
@@ -674,32 +672,32 @@ nsresult nsLDAPService::EstablishConnect
}
return NS_OK;
}
/* AString createFilter (in unsigned long aMaxSize, in AString aPattern, in
* AString aPrefix, in AString aSuffix, in AString aAttr, in AString aValue); */
NS_IMETHODIMP nsLDAPService::CreateFilter(
- uint32_t aMaxSize, const nsACString &aPattern, const nsACString &aPrefix,
- const nsACString &aSuffix, const nsACString &aAttr,
- const nsACString &aValue, nsACString &_retval) {
+ uint32_t aMaxSize, const nsACString& aPattern, const nsACString& aPrefix,
+ const nsACString& aSuffix, const nsACString& aAttr,
+ const nsACString& aValue, nsACString& _retval) {
if (!aMaxSize) {
return NS_ERROR_INVALID_ARG;
}
// figure out how big of an array we're going to need for the tokens,
// including a trailing NULL, and allocate space for it.
//
- const char *iter = aValue.BeginReading();
- const char *iterEnd = aValue.EndReading();
+ const char* iter = aValue.BeginReading();
+ const char* iterEnd = aValue.EndReading();
uint32_t numTokens = CountTokens(iter, iterEnd);
- char **valueWords;
+ char** valueWords;
valueWords =
- static_cast<char **>(moz_xmalloc((numTokens + 1) * sizeof(char *)));
+ static_cast<char**>(moz_xmalloc((numTokens + 1) * sizeof(char*)));
if (!valueWords) {
return NS_ERROR_OUT_OF_MEMORY;
}
// build the array of values
//
uint32_t curToken = 0;
while (iter != iterEnd && curToken < numTokens) {
@@ -709,31 +707,31 @@ NS_IMETHODIMP nsLDAPService::CreateFilte
return NS_ERROR_OUT_OF_MEMORY;
}
curToken++;
}
valueWords[numTokens] = 0; // end of array signal to LDAP C SDK
// make buffer to be used for construction
//