mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-5445 Fix some compiler warnings.
X-SVN-Rev: 22355
This commit is contained in:
parent
e137661259
commit
5ba4307fc8
3 changed files with 35 additions and 23 deletions
|
@ -1741,7 +1741,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
UBiDiDirection direction;
|
||||
|
||||
/* check the argument values */
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(pBiDi==NULL || text==NULL || length<-1 ||
|
||||
(paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevel<UBIDI_DEFAULT_LTR)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
@ -2124,9 +2124,9 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
|
|||
int32_t paraStart;
|
||||
|
||||
/* check the argument values */
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, );
|
||||
RETURN_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode);
|
||||
RETURN_VOID_IF_BAD_RANGE(paraIndex, 0, pBiDi->paraCount, *pErrorCode);
|
||||
|
||||
pBiDi=pBiDi->pParaBiDi; /* get Para object if Line object */
|
||||
if(paraIndex) {
|
||||
|
@ -2143,7 +2143,6 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
|
|||
if(pParaLevel!=NULL) {
|
||||
*pParaLevel=GET_PARALEVEL(pBiDi, paraStart);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
@ -2169,7 +2168,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
|
|||
const void *newContext, UBiDiClassCallback **oldFn,
|
||||
const void **oldContext, UErrorCode *pErrorCode)
|
||||
{
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(pBiDi==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
|
|
@ -328,6 +328,24 @@ typedef union {
|
|||
return retvalue; \
|
||||
}
|
||||
|
||||
#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) \
|
||||
if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return
|
||||
#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) \
|
||||
if(!IS_VALID_PARA(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) \
|
||||
if(!IS_VALID_PARA_OR_LINE(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) \
|
||||
if((arg)<(start) || (arg)>=(limit)) { \
|
||||
(errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
|
||||
return; \
|
||||
}
|
||||
|
||||
/* helper function to (re)allocate memory if allowed */
|
||||
U_CFUNC UBool
|
||||
ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded);
|
||||
|
|
|
@ -14,11 +14,6 @@
|
|||
* created by: Markus W. Scherer, updated by Matitiahu Allouche
|
||||
*/
|
||||
|
||||
/* set import/export definitions */
|
||||
#ifndef U_COMMON_IMPLEMENTATION
|
||||
# define U_COMMON_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#include "cmemory.h"
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/ustring.h"
|
||||
|
@ -133,10 +128,10 @@ ubidi_setLine(const UBiDi *pParaBiDi,
|
|||
int32_t length;
|
||||
|
||||
/* check the argument values */
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode, );
|
||||
RETURN_IF_BAD_RANGE(start, 0, limit, *pErrorCode, );
|
||||
RETURN_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode);
|
||||
RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode);
|
||||
RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode);
|
||||
if(pLineBiDi==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -312,7 +307,7 @@ ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalStart,
|
|||
Run iRun;
|
||||
|
||||
errorCode=U_ZERO_ERROR;
|
||||
RETURN_IF_BAD_RANGE(logicalStart, 0, pBiDi->length, errorCode, );
|
||||
RETURN_VOID_IF_BAD_RANGE(logicalStart, 0, pBiDi->length, errorCode);
|
||||
/* ubidi_countRuns will check VALID_PARA_OR_LINE */
|
||||
runCount=ubidi_countRuns((UBiDi *)pBiDi, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
|
@ -1112,7 +1107,7 @@ ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode)
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
/* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
|
||||
ubidi_countRuns(pBiDi, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
|
@ -1213,14 +1208,14 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, );
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(indexMap==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
/* ubidi_countRuns() checks for VALID_PARA_OR_LINE */
|
||||
ubidi_countRuns(pBiDi, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
/* no op */
|
||||
} else if(indexMap==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
} else {
|
||||
if(U_SUCCESS(*pErrorCode)) {
|
||||
/* fill a visual-to-logical index map using the runs[] */
|
||||
Run *runs=pBiDi->runs, *runsLimit=runs+pBiDi->runCount;
|
||||
int32_t logicalStart, visualStart, visualLimit, *pi=indexMap;
|
||||
|
|
Loading…
Add table
Reference in a new issue