diff --git a/doc/index.dox b/doc/index.dox index aacb859..55b208e 100644 --- a/doc/index.dox +++ b/doc/index.dox @@ -9,7 +9,7 @@ Getting started \subpage Build "Build libragephoto" -\subpage Usage "Using libragephoto" +\subpage Usage "Using libragephoto" Reference \ref RagePhotoInstance "RagePhoto C API" diff --git a/src/core/RagePhoto.c b/src/core/RagePhoto.c index 0bab048..73ee954 100644 --- a/src/core/RagePhoto.c +++ b/src/core/RagePhoto.c @@ -681,9 +681,7 @@ const char* ragephoto_getphotojpeg(ragephoto_t instance_t) RagePhotoInstance *instance = (RagePhotoInstance*)instance_t; if (instance->data->jpeg) return instance->data->jpeg; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return NULL; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? NULL : nullchar; } uint64_t ragephotodata_getphotosignf(RagePhotoData *rp_data, uint32_t photoFormat) @@ -737,9 +735,7 @@ const char* ragephoto_getphotodesc(ragephoto_t instance_t) RagePhotoInstance *instance = (RagePhotoInstance*)instance_t; if (instance->data->description) return instance->data->description; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return NULL; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? NULL : nullchar; } const char* ragephoto_getphotojson(ragephoto_t instance_t) @@ -747,9 +743,7 @@ const char* ragephoto_getphotojson(ragephoto_t instance_t) RagePhotoInstance *instance = (RagePhotoInstance*)instance_t; if (instance->data->json) return instance->data->json; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return NULL; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? NULL : nullchar; } const char* ragephoto_getphotoheader(ragephoto_t instance_t) @@ -757,9 +751,7 @@ const char* ragephoto_getphotoheader(ragephoto_t instance_t) RagePhotoInstance *instance = (RagePhotoInstance*)instance_t; if (instance->data->header) return instance->data->header; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return NULL; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? NULL : nullchar; } const char* ragephoto_getphototitle(ragephoto_t instance_t) @@ -767,9 +759,7 @@ const char* ragephoto_getphototitle(ragephoto_t instance_t) RagePhotoInstance *instance = (RagePhotoInstance*)instance_t; if (instance->data->title) return instance->data->title; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return NULL; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? NULL : nullchar; } const char* ragephoto_version() @@ -1113,10 +1103,7 @@ void ragephoto_setbufferoffsets(ragephoto_t instance_t) void ragephoto_setlibraryflag(RagePhotoLibraryFlag flag, bool state) { - if (state) - libraryflags |= flag; - else - libraryflags &= ~flag; + state ? (libraryflags |= flag) : (libraryflags &= ~flag); } bool ragephoto_setphotodata(ragephoto_t instance_t, RagePhotoData *rp_data) diff --git a/src/core/RagePhoto.cpp b/src/core/RagePhoto.cpp index bc94be2..15c73b5 100644 --- a/src/core/RagePhoto.cpp +++ b/src/core/RagePhoto.cpp @@ -643,9 +643,7 @@ const char* RagePhoto::jpegData() const { if (m_data->jpeg) return m_data->jpeg; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return nullptr; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? nullptr : nullchar; } uint64_t RagePhoto::jpegSign(uint32_t photoFormat, RagePhotoData *rp_data) @@ -685,36 +683,28 @@ const char* RagePhoto::description() const { if (m_data->description) return m_data->description; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return nullptr; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? nullptr : nullchar; } const char* RagePhoto::header() const { if (m_data->header) return m_data->header; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return nullptr; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? nullptr : nullchar; } const char* RagePhoto::json() const { if (m_data->json) return m_data->json; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return nullptr; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? nullptr : nullchar; } const char* RagePhoto::title() const { if (m_data->title) return m_data->title; - if (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) - return nullptr; - return nullchar; + return (libraryflags & RAGEPHOTO_FLAG_LEGACY_NULL_RETURN) ? nullptr : nullchar; } const char* RagePhoto::version() @@ -1242,10 +1232,7 @@ void RagePhoto::setJson(const char *json, uint32_t bufferSize) void RagePhoto::setLibraryFlag(RagePhotoLibraryFlag flag, bool state) { - if (state) - libraryflags |= flag; - else - libraryflags &= ~flag; + state ? (libraryflags |= flag) : (libraryflags &= ~flag); } void RagePhoto::setTitle(const char *title, uint32_t bufferSize)