From 0d2c3f3bb56e124410bc1183f1c2cea7988dc47f Mon Sep 17 00:00:00 2001 From: Yunhui Fu Date: Mon, 19 Jan 2015 04:08:58 -0500 Subject: [PATCH] minor clean the code --- src/ucdapi.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/ucdapi.cpp b/src/ucdapi.cpp index f095316..1aaf32a 100644 --- a/src/ucdapi.cpp +++ b/src/ucdapi.cpp @@ -117,9 +117,8 @@ int ucd_end (ucd_t * det) if (*det) { reinterpret_cast(*det)->DataEnd(); return UCD_RESULT_OK; - } else { - return UCD_RESULT_INVALID_DETECTOR; } + return UCD_RESULT_INVALID_DETECTOR; } @@ -130,9 +129,8 @@ int ucd_reset(ucd_t * det) if (*det) { reinterpret_cast(*det)->Reset(); return UCD_RESULT_OK; - } else { - return UCD_RESULT_INVALID_DETECTOR; } + return UCD_RESULT_INVALID_DETECTOR; } UCD_IMEXPORT @@ -150,20 +148,16 @@ int ucd_results (ucd_t * det, char* namebuf, size_t buflen) //*namebuf = 0; strcpy (namebuf, CSTR_DEFAULT); return UCD_RESULT_OK; - } else { - return UCD_RESULT_NOMEMORY; - } - } else { - // encoding detected - if (buflen >= strlen(name)+1) { - strcpy(namebuf, name); - return UCD_RESULT_OK; - } else { - return UCD_RESULT_NOMEMORY; } + return UCD_RESULT_NOMEMORY; } - } else { - return UCD_RESULT_INVALID_DETECTOR; + // encoding detected + if (buflen >= strlen(name)+1) { + strcpy(namebuf, name); + return UCD_RESULT_OK; + } + return UCD_RESULT_NOMEMORY; } + return UCD_RESULT_INVALID_DETECTOR; }