liblog: Add const pedantics

(cherry picked from commit 9e03ce45f9)

Change-Id: I819695b778ac08fcfc9b1a87f3f86e5715f53084
This commit is contained in:
Mark Salyzyn 2014-01-10 14:07:58 -08:00
parent 5d3d1f17db
commit 318bb72601

View file

@ -7,8 +7,8 @@
** General Public License.
*/
#ifndef _UTILS_LOGGER_H
#define _UTILS_LOGGER_H
#ifndef _LIBS_LOG_LOGGER_H
#define _LIBS_LOG_LOGGER_H
#include <stdint.h>
#include <log/log.h>
@ -77,36 +77,36 @@ struct log_msg {
} extra;
} __attribute__((aligned(4)));
#ifdef __cplusplus
/* Matching log_time_t operators */
bool operator== (log_msg &T)
/* Matching log_time operators */
bool operator== (const log_msg &T) const
{
return (entry.sec == T.entry.sec) && (entry.nsec == T.entry.nsec);
}
bool operator!= (log_msg &T)
bool operator!= (const log_msg &T) const
{
return !(*this == T);
}
bool operator< (log_msg &T)
bool operator< (const log_msg &T) const
{
return (entry.sec < T.entry.sec)
|| ((entry.sec == T.entry.sec)
&& (entry.nsec < T.entry.nsec));
}
bool operator>= (log_msg &T)
bool operator>= (const log_msg &T) const
{
return !(*this < T);
}
bool operator> (log_msg &T)
bool operator> (const log_msg &T) const
{
return (entry.sec > T.entry.sec)
|| ((entry.sec == T.entry.sec)
&& (entry.nsec > T.entry.nsec));
}
bool operator<= (log_msg &T)
bool operator<= (const log_msg &T) const
{
return !(*this > T);
}
uint64_t nsec(void)
uint64_t nsec(void) const
{
return static_cast<uint64_t>(entry.sec) * NS_PER_SEC + entry.nsec;
}
@ -167,4 +167,4 @@ const char *android_log_id_to_name(log_id_t log_id);
}
#endif
#endif /* _UTILS_LOGGER_H */
#endif /* _LIBS_LOG_LOGGER_H */