Repository: trafodion Updated Branches: refs/heads/master b0d0d53a9 -> 0f025ac62
http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sqf/src/seabed/src/fsi.cpp ---------------------------------------------------------------------- diff --git a/core/sqf/src/seabed/src/fsi.cpp b/core/sqf/src/seabed/src/fsi.cpp index 01c41db..d7b011d 100644 --- a/core/sqf/src/seabed/src/fsi.cpp +++ b/core/sqf/src/seabed/src/fsi.cpp @@ -564,7 +564,9 @@ Fs_Open_Thread *Fs_Open_Thread::thread_get(const char *pp_filename, lp_entry = new Map_Open_Entry_Type; lp_entry->ip_thr = lp_thr; cv_map.putv(pp_filename, lp_entry); - lp_thr->md_list_add(pp_md); + // this only want to fix error checked by tools + if (NULL != lp_thr) + lp_thr->md_list_add(pp_md); lv_status = cv_map_mutex.unlock(); SB_util_assert_ieq(lv_status, 0); } @@ -572,10 +574,10 @@ Fs_Open_Thread *Fs_Open_Thread::thread_get(const char *pp_filename, if (gv_fs_trace) { if (lv_reuse) trace_where_printf(WHERE, "name=%s, reuse thread, filename=%s\n", - lp_thr->get_name(), pp_filename); + (lp_thr == NULL) ? "NULL" : lp_thr->get_name(), pp_filename); else trace_where_printf(WHERE, "name=%s, got thread, filename=%s\n", - lp_thr->get_name(), pp_filename); + (lp_thr == NULL) ? "NULL" : lp_thr->get_name(), pp_filename); } lv_status = cv_thread_get_mutex.unlock(); http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sqf/src/seabed/src/msmon.cpp ---------------------------------------------------------------------- diff --git a/core/sqf/src/seabed/src/msmon.cpp b/core/sqf/src/seabed/src/msmon.cpp index 311e099..241c150 100644 --- a/core/sqf/src/seabed/src/msmon.cpp +++ b/core/sqf/src/seabed/src/msmon.cpp @@ -4446,7 +4446,7 @@ SB_Export int msg_mon_open_process_self_ic(SB_Phandle_Type *pp_phandle, // void msg_mon_oc_cbt(MS_Md_Type *pp_md, void *pp_stream) { const char *WHERE = "msg_mon_oc_cbt"; - Mon_Msg_Type *lp_msg; + Mon_Msg_Type *lp_msg = NULL; bool lv_aborted; bool lv_close_dup; bool lv_close_shutdown; @@ -4550,7 +4550,6 @@ void msg_mon_oc_cbt(MS_Md_Type *pp_md, void *pp_stream) { break; default: - lp_msg = NULL; SB_util_abort("invalid pp_md->out.iv_msg_type"); // sw fault break; } @@ -4592,13 +4591,13 @@ void msg_mon_oc_cbt(MS_Md_Type *pp_md, void *pp_stream) { trace_where_printf(WHERE, "connection-open (aborted)\n"); } - if (gv_ms_trace_mon) { + if (gv_ms_trace_mon && NULL != lp_msg) { const char *lp_msg_type = msg_util_get_msg_type(lp_msg->type); trace_where_printf(WHERE, "manufacturing/queueing %s (%d) mon message\n", lp_msg_type, lp_msg->type); msg_mon_trace_msg(WHERE, lp_msg); } - if (gv_ms_enable_messages) { + if (gv_ms_enable_messages && NULL != lp_msg) { if (lp_msg->type == MsgType_Close) { do { http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/cli/Context.cpp ---------------------------------------------------------------------- diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp index 6eef48f..4ee326f 100644 --- a/core/sql/cli/Context.cpp +++ b/core/sql/cli/Context.cpp @@ -3357,7 +3357,8 @@ ExStatisticsArea *ContextCli::getMergedStats( break; break; } - *ssmpMsgStream << *rtsQueryId; + if (NULL != rtsQueryId) + *ssmpMsgStream << *rtsQueryId; } if (RtsTimeout != 0) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/cli/ExSqlComp.cpp ---------------------------------------------------------------------- diff --git a/core/sql/cli/ExSqlComp.cpp b/core/sql/cli/ExSqlComp.cpp index 9d57157..3a514b0 100644 --- a/core/sql/cli/ExSqlComp.cpp +++ b/core/sql/cli/ExSqlComp.cpp @@ -89,7 +89,7 @@ void ExSqlComp::clearDiags() if (diagArea_) diagArea_->clear(); else - diagArea_ = diagArea_->allocate(h_); + diagArea_ = ComDiagsArea::allocate(h_); } inline void ExSqlComp::initRequests(Requests& req) http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/cli/Globals.cpp ---------------------------------------------------------------------- diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp index b9dd6e5..1c3a9d0 100644 --- a/core/sql/cli/Globals.cpp +++ b/core/sql/cli/Globals.cpp @@ -791,7 +791,7 @@ Lng32 CliGlobals::setEnvVar(const char * name, const char * value, if (NOT reset) newEnvvarsLen += strlen(name) + strlen("=") + strlen(value) + 1; } - else + else if (NULL != envvars_) newEnvvarsLen += str_len(envvars_[count])+1; } @@ -827,7 +827,7 @@ Lng32 CliGlobals::setEnvVar(const char * name, const char * value, tgtCount++; } } - else + else if (NULL != envvars_) { l = str_len(envvars_[count])+1; str_cpy_all(newEnvvarsValue, envvars_[count], l); http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/executor/ExExplain.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExExplain.cpp b/core/sql/executor/ExExplain.cpp index ba142ec..b0e2a90 100644 --- a/core/sql/executor/ExExplain.cpp +++ b/core/sql/executor/ExExplain.cpp @@ -768,9 +768,9 @@ short ExExplainTcb::work() // starts with an '/'. It is an oss pathname. if ((modDir_) && - (strlen(modDir_) >= 3) && - (strncmp(modDir_, "/E/", 3) == 0) || - (strncmp(modDir_, "/G/", 3) == 0)) + ((strlen(modDir_) >= 3) && + (strncmp(modDir_, "/E/", 3) == 0) || + (strncmp(modDir_, "/G/", 3) == 0))) { // Pathname cannot be an Expand or a Guardian name. // Return error. http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/executor/ExStats.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExStats.cpp b/core/sql/executor/ExStats.cpp index 23d9c0d..7093c44 100644 --- a/core/sql/executor/ExStats.cpp +++ b/core/sql/executor/ExStats.cpp @@ -8239,7 +8239,8 @@ ExStatisticsArea *ExStatsTcb::sendToSsmp() rtsQueryId = NULL; break; } - *ssmpMsgStream << *rtsQueryId; + if (NULL != rtsQueryId) + *ssmpMsgStream << *rtsQueryId; } if (RtsTimeout != 0) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/executor/cluster.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/cluster.cpp b/core/sql/executor/cluster.cpp index 69e863b..0b82fb1 100644 --- a/core/sql/executor/cluster.cpp +++ b/core/sql/executor/cluster.cpp @@ -2395,7 +2395,7 @@ NABoolean Cluster::checkAndSplit(ExeErrorCode * rc) rc); if ( !next_ || *rc ) { - if ( ! rc ) * rc = EXE_NO_MEM_TO_EXEC; + * rc = EXE_NO_MEM_TO_EXEC; return TRUE; } http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/optimizer/BindItemExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp index dcd6897..8ce0519 100644 --- a/core/sql/optimizer/BindItemExpr.cpp +++ b/core/sql/optimizer/BindItemExpr.cpp @@ -8110,6 +8110,12 @@ ItemExpr *ColReference::bindNode(BindWA *bindWA) return this; } + if (NULL == xcnmEntry) + { + bindWA->setErrStatus(); + return this; + } + // Continue with no-error, non-star column reference. ValueId valId = xcnmEntry->getValueId(); setValueId(valId); // not bound yet, but this makes more informative errmsg @@ -12216,7 +12222,7 @@ ItemExpr *ZZZBinderFunction::tryToUndoBindTransformation(ItemExpr *expr) // ...))) if (op1->getOperatorType() == ITM_CAST) { - if (expr->origOpType() == ITM_DATEDIFF_QUARTER && + if (NULL != expr && expr->origOpType() == ITM_DATEDIFF_QUARTER && op1->child(0)->getOperatorType() == ITM_DIVIDE) op1 = op1->child(0)->child(0); // the minus operator // cast / - @@ -12224,7 +12230,7 @@ ItemExpr *ZZZBinderFunction::tryToUndoBindTransformation(ItemExpr *expr) op1 = op1->child(0); // the minus operator // cast - - if (expr->origOpType() == ITM_DATEDIFF_YEAR) + if (NULL != expr && expr->origOpType() == ITM_DATEDIFF_YEAR) { if (op1->child(0)->getOperatorType() == ITM_EXTRACT || op1->child(0)->getOperatorType() == ITM_EXTRACT_ODBC) @@ -12741,7 +12747,7 @@ ItemExpr *HbaseColumnCreate::bindNode(BindWA *bindWA) if ((co != hcco->convType()) || (! firstType && hcco->naType()) || (firstType && ! hcco->naType()) || - (firstType && (NOT (*firstType == *hcco->naType())))) + (firstType && hcco->naType() && (NOT (*firstType == *hcco->naType())))) { *CmpCommon::diags() << DgSqlCode(-4221) << DgString0("COLUMN_CREATE(list format)") http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/optimizer/MVInfo.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/MVInfo.cpp b/core/sql/optimizer/MVInfo.cpp index 03e324b..08ba9ee 100644 --- a/core/sql/optimizer/MVInfo.cpp +++ b/core/sql/optimizer/MVInfo.cpp @@ -4450,9 +4450,9 @@ void MVInfoForDDL::processNormalizedInformation(BindWA *bindWA) { // Find the top most Join node (or the Scan node if there is no Join). RelExpr *topJoin = rootNode_; - while ( topJoin->getOperatorType() != REL_SCAN && - !topJoin->getOperator().match(REL_ANY_JOIN) && - topJoin != NULL) + while (topJoin != NULL && + topJoin->getOperatorType() != REL_SCAN && + !topJoin->getOperator().match(REL_ANY_JOIN)) topJoin = topJoin->child(0); // Check if the Join tree is left linear. http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/optimizer/OptPhysRelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/OptPhysRelExpr.cpp b/core/sql/optimizer/OptPhysRelExpr.cpp index 838eae4..f7bb358 100644 --- a/core/sql/optimizer/OptPhysRelExpr.cpp +++ b/core/sql/optimizer/OptPhysRelExpr.cpp @@ -6081,9 +6081,9 @@ NABoolean NestedJoin::OCBJoinIsFeasible(const Context* myContext) const if ( (myContext->requiresOrder() AND partReq AND partReq->isRequirementExactlyOne() == FALSE) OR - partReq == NULL OR - (partReq->isRequirementApproximatelyN() AND - NOT partReq->partitioningKeyIsSpecified() + (partReq AND + partReq->isRequirementApproximatelyN() AND + NOT partReq->partitioningKeyIsSpecified() ) ) { http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/optimizer/PhyProp.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/PhyProp.cpp b/core/sql/optimizer/PhyProp.cpp index 892886f..f0d6c8f 100644 --- a/core/sql/optimizer/PhyProp.cpp +++ b/core/sql/optimizer/PhyProp.cpp @@ -528,12 +528,12 @@ ReqdPhysicalProperty::compareRequirements(const ReqdPhysicalProperty &other) con // can't use any plan if the optimization goals are different // $$$$ may apply some fuzzy logic in the future for the number of rows if ( (perfGoal_ != NULL) AND - ( perfGoal_->isOptimizeForLastRow() AND + (( perfGoal_->isOptimizeForLastRow() AND (NOT other.perfGoal_->isOptimizeForLastRow()) ) OR - ( perfGoal_->isOptimizeForFirstRow() AND + ( perfGoal_->isOptimizeForFirstRow() AND (NOT other.perfGoal_->isOptimizeForFirstRow()) ) OR - ( perfGoal_->isOptimizeForResourceConsumption() AND - (NOT other.perfGoal_->isOptimizeForResourceConsumption()) ) ) + ( perfGoal_->isOptimizeForResourceConsumption() AND + (NOT other.perfGoal_->isOptimizeForResourceConsumption()) )) ) return UNDEFINED; // if the cost weights are different, the optimal solution is no http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/optimizer/memo.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/memo.cpp b/core/sql/optimizer/memo.cpp index 8363b33..b6d4b75 100644 --- a/core/sql/optimizer/memo.cpp +++ b/core/sql/optimizer/memo.cpp @@ -1041,10 +1041,10 @@ RelExpr * CascadesMemo::findDuplicate(RelExpr * expr) const // compare characteristic inputs/outputs if ((ga = expr->getGroupAttr()) != NULL AND - NOT (ga->getCharacteristicInputs() == - old->getGroupAttr()->getCharacteristicInputs()) OR - NOT (ga->getCharacteristicOutputs() == - old->getGroupAttr()->getCharacteristicOutputs())) + (NOT (ga->getCharacteristicInputs() == + old->getGroupAttr()->getCharacteristicInputs()) OR + NOT (ga->getCharacteristicOutputs() == + old->getGroupAttr()->getCharacteristicOutputs()))) goto not_a_duplicate; // compare operators and their arguments http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/parser/ElemDDLNode.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ElemDDLNode.cpp b/core/sql/parser/ElemDDLNode.cpp index 78225af..4d67199 100644 --- a/core/sql/parser/ElemDDLNode.cpp +++ b/core/sql/parser/ElemDDLNode.cpp @@ -3170,7 +3170,7 @@ void ElemDDLDivisionClause::synthesize(ElemDDLNode * pColRefTree) { columnRefArray_.insert(pColRefTree->castToElemDDLColRef()); } - else if (colRefEntries > 1) + else if (colRefEntries > 1 AND pColRefTree NEQ NULL) { ElemDDLList * pElemDDLList = pColRefTree->castToElemDDLList(); ElemDDLColRef * pElemDDLColRef = NULL; http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/qms/QmsMVMemo.cpp ---------------------------------------------------------------------- diff --git a/core/sql/qms/QmsMVMemo.cpp b/core/sql/qms/QmsMVMemo.cpp index 1c9461e..548a04e 100644 --- a/core/sql/qms/QmsMVMemo.cpp +++ b/core/sql/qms/QmsMVMemo.cpp @@ -475,7 +475,7 @@ void MVMemo::insert(QRJBBPtr jbb, MVDetailsPtr mv) if ( subGraph->isSelfJoin() && !isSelfJoinTooBig && !isDuplicate && - (!found || map->isFull()) ) + (!found || (NULL != map && map->isFull())) ) { // Generate all the equivalent hash keys, and insert them all. map->prepareForSelfJoinWork(); http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/core/sql/runtimestats/ssmpipc.cpp ---------------------------------------------------------------------- diff --git a/core/sql/runtimestats/ssmpipc.cpp b/core/sql/runtimestats/ssmpipc.cpp index 56a72e1..857913a 100755 --- a/core/sql/runtimestats/ssmpipc.cpp +++ b/core/sql/runtimestats/ssmpipc.cpp @@ -2051,7 +2051,7 @@ void SsmpNewIncomingConnectionStream::actOnCpuStatsReq(IpcConnection *connection default: break; } - if (cpuStats != NULL || cpuStats->numEntries() > 0) + if (cpuStats != NULL && cpuStats->numEntries() > 0) *this << *(cpuStats); send(FALSE); reply->decrRefCount(); http://git-wip-us.apache.org/repos/asf/trafodion/blob/b32351ff/win-odbc64/odbcclient/drvr35/charsetconv.cpp ---------------------------------------------------------------------- diff --git a/win-odbc64/odbcclient/drvr35/charsetconv.cpp b/win-odbc64/odbcclient/drvr35/charsetconv.cpp index 34a2179..f53cc81 100644 --- a/win-odbc64/odbcclient/drvr35/charsetconv.cpp +++ b/win-odbc64/odbcclient/drvr35/charsetconv.cpp @@ -27,7 +27,7 @@ SQLRETURN WCharToUTF8(wchar_t *wst, int wstlen, char *st, int stlen, int *transl { int len; SQLRETURN rc = SQL_SUCCESS; - if (!error) + if (NULL != error) error[0] ='\0'; if(translen != NULL) *translen = 0; @@ -42,14 +42,14 @@ SQLRETURN WCharToUTF8(wchar_t *wst, int wstlen, char *st, int stlen, int *transl len = wcslen((const wchar_t *)wst); else // Invalid length, return SQL_ERROR { - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Invalid Length"); return SQL_ERROR; } } if (stlen == 1) // no room for translation, just null terminator { - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Insufficient Buffer "); rc = SQL_SUCCESS_WITH_INFO; } @@ -69,22 +69,22 @@ SQLRETURN WCharToUTF8(wchar_t *wst, int wstlen, char *st, int stlen, int *transl } strcpyUTF8(st, (const char*)temp, stlen); *translen = strlen(st); - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Insufficient Buffer "); delete[] temp; return SQL_SUCCESS_WITH_INFO; } break; case ERROR_INVALID_FLAGS: - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Invalid parameter"); break; default: - if (!error) + if (NULL != error) strcpy(error,"WCharToUTF8: Unknown Translation Error"); break; } @@ -112,7 +112,7 @@ SQLRETURN UTF8ToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *transl { short len; SQLRETURN rc = SQL_SUCCESS; - if (!error) + if (NULL != error) error[0] ='\0'; if(translen != NULL) *translen = 0; @@ -127,14 +127,14 @@ SQLRETURN UTF8ToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *transl len = strlen((const char *)st); else { - if (!error) + if (NULL != error) strcpy(error, "UTF8ToWChar: Invalid String Length"); return SQL_ERROR; } } if (wstlen == 1) // no room for translation, just null terminator { - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: Insufficient Buffer "); rc = SQL_SUCCESS_WITH_INFO; } @@ -155,26 +155,26 @@ SQLRETURN UTF8ToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *transl wcsncpy(wst, (const wchar_t*)temp, wstlen-1); wst[wstlen-1] = L'\0'; *translen = wcslen(wst); - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: Insufficient Buffer "); delete[] temp; return SQL_SUCCESS_WITH_INFO; } break; case ERROR_INVALID_FLAGS: - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: Invalid parameter"); break; case ERROR_NO_UNICODE_TRANSLATION: - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: No Unicode Translation"); break; default: - if (!error) + if (NULL != error) strcpy(error,"UTF8ToWChar: Unknown Translation Error"); break; } @@ -208,7 +208,7 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou if(translen != NULL) *translen = 0; - if (!errorMsg) + if (NULL != errorMsg) errorMsg[0] ='\0'; if (forward) { @@ -231,23 +231,23 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou switch (GetLastError()) { case ERROR_INSUFFICIENT_BUFFER: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Insufficient Buffer "); break; case ERROR_INVALID_FLAGS: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Invalid parameter"); break; case ERROR_NO_UNICODE_TRANSLATION: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: No Unicode Translation"); break; default: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Unknown Translation Error"); break; } @@ -260,7 +260,7 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou if (outlen == 1) // no room for translation, just null terminator { - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Insufficient Buffer "); rc = SQL_SUCCESS_WITH_INFO; } @@ -271,7 +271,7 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou case ERROR_INSUFFICIENT_BUFFER: { outst[outlen-1] ='\0'; - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Insufficient Buffer "); if (wst != NULL) { @@ -282,15 +282,15 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou } break; case ERROR_INVALID_FLAGS: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Invalid parameter"); break; default: - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Unknown Translation Error"); break; } @@ -312,7 +312,7 @@ SQLRETURN TranslateUTF8(bool forward, char *inst, int inlen, char *outst, int ou { if(outst != NULL) *outst = '\0'; - if (!errorMsg) + if (NULL != errorMsg) strcpy(errorMsg,"TranslateUTF8: Out string is NULL "); return SQL_ERROR; } @@ -325,7 +325,7 @@ SQLRETURN WCharToLocale(wchar_t *wst, int wstlen, char *st, int stlen, int *tran { int len; SQLRETURN rc = SQL_SUCCESS; - if(!error) + if(NULL != error) error[0] ='\0'; if(translen != NULL) *translen = 0; @@ -341,14 +341,14 @@ SQLRETURN WCharToLocale(wchar_t *wst, int wstlen, char *st, int stlen, int *tran len = wcslen((const wchar_t *)wst); else { - if(!error) + if(NULL != error) strcpy(error, "WCharToLocale: Invalid Length for in WChar string"); return SQL_ERROR; } } if (stlen == 1) // no room for translation, just null terminator { - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Insufficient Buffer "); rc = SQL_SUCCESS_WITH_INFO; } @@ -361,7 +361,7 @@ SQLRETURN WCharToLocale(wchar_t *wst, int wstlen, char *st, int stlen, int *tran char *temp = new char[len*4+1]; if ((*translen=(int)WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wst, len, temp, len*4, (LPCSTR)replacementChar, NULL)) == 0) { - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Unknown Translation Error"); *translen = 0; delete[] temp; @@ -370,22 +370,22 @@ SQLRETURN WCharToLocale(wchar_t *wst, int wstlen, char *st, int stlen, int *tran strncpy(st, (const char*)temp, stlen-1); st[stlen-1] ='\0'; *translen = strlen(st); - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Insufficient Buffer "); delete[] temp; return SQL_SUCCESS_WITH_INFO; } break; case ERROR_INVALID_FLAGS: - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Invalid parameter"); break; default: - if(!error) + if(NULL != error) strcpy(error,"WCharToLocale: Unknown Translation Error"); break; } @@ -410,7 +410,7 @@ SQLRETURN WCharToLocale(wchar_t *wst, int wstlen, char *st, int stlen, int *tran SQLRETURN LocaleToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *translen, char* error) { int len; - if(!error) + if(NULL != error) error[0] = '\0'; SQLRETURN rc = SQL_SUCCESS; if(translen != NULL) @@ -426,14 +426,14 @@ SQLRETURN LocaleToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *tran len = strlen((const char *)st); else { - if(!error) + if(NULL != error) strcpy(error, "LocaleToWChar: Invalid Length for in Locale string"); return SQL_ERROR; } } if (wstlen == 1) // no room for translation, just null-terminator { - if(!error) + if(NULL != error) strcpy(error,"LocaleToWChar: Insufficient Buffer "); rc = SQL_SUCCESS_WITH_INFO; } @@ -454,22 +454,22 @@ SQLRETURN LocaleToWChar(char *st, int stlen, wchar_t *wst, int wstlen, int *tran wcsncpy(wst, (const wchar_t*)temp, wstlen-1); wst[wstlen-1] =L'\0'; *translen = wcslen(wst); - if(!error) + if(NULL != error) strcpy(error,"LocaleToWChar: Insufficient Buffer "); delete[] temp; return SQL_SUCCESS_WITH_INFO; } break; case ERROR_INVALID_FLAGS: - if(!error) + if(NULL != error) strcpy(error,"LocaleToWChar: Invalid Flags"); break; case ERROR_INVALID_PARAMETER: - if(!error) + if(NULL != error) strcpy(error,"LocaleToWChar: Invalid parameter"); break; default: - if(!error) + if(NULL != error) strcpy(error,"LocaleToWChar: Unknown Translation Error"); break; }
