Commit 6071beb4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix-warnings' into 'develop'

Fixing compilation warnings and enhance CI scripts

See merge request oai/cn5g/oai-cn5g-amf!26
parents 415a6342 b3571957
...@@ -36,6 +36,7 @@ source $THIS_SCRIPT_PATH/build_helper.fb_folly ...@@ -36,6 +36,7 @@ source $THIS_SCRIPT_PATH/build_helper.fb_folly
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_cpprestsdk_from_git() { install_cpprestsdk_from_git() {
echo "Starting to install cpprestsdk"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install C++ REST SDK ? <y/N> " prompt read -p "Do you want to install C++ REST SDK ? <y/N> " prompt
OPTION="-y" OPTION="-y"
...@@ -73,6 +74,7 @@ install_cpprestsdk_from_git() { ...@@ -73,6 +74,7 @@ install_cpprestsdk_from_git() {
$SUDO ldconfig -v $SUDO ldconfig -v
popd popd
fi fi
echo "cpprestsdk installation complete"
return 0 return 0
} }
...@@ -80,6 +82,7 @@ install_cpprestsdk_from_git() { ...@@ -80,6 +82,7 @@ install_cpprestsdk_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_fmt() { install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -108,6 +111,7 @@ install_fmt() { ...@@ -108,6 +111,7 @@ install_fmt() {
cd /tmp cd /tmp
rm -rf /tmp/fmt* rm -rf /tmp/fmt*
fi fi
echo "fmt installation complete"
return 0 return 0
} }
...@@ -115,6 +119,7 @@ install_fmt() { ...@@ -115,6 +119,7 @@ install_fmt() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() { install_spdlog_from_git() {
echo "Starting to install spdlog"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -147,6 +152,7 @@ install_spdlog_from_git() { ...@@ -147,6 +152,7 @@ install_spdlog_from_git() {
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd popd
fi fi
echo "spdlog installation complete"
return 0 return 0
} }
...@@ -154,6 +160,7 @@ install_spdlog_from_git() { ...@@ -154,6 +160,7 @@ install_spdlog_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_pistache_from_git() { install_pistache_from_git() {
echo "Starting to install pistache"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install Pistache ? <y/N> " prompt read -p "Do you want to install Pistache ? <y/N> " prompt
OPTION="-y" OPTION="-y"
...@@ -196,6 +203,7 @@ install_pistache_from_git() { ...@@ -196,6 +203,7 @@ install_pistache_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo "pistache installation complete"
return 0 return 0
} }
...@@ -203,6 +211,7 @@ install_pistache_from_git() { ...@@ -203,6 +211,7 @@ install_pistache_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_nlohmann_from_git() { install_nlohmann_from_git() {
echo "Starting to install Nlohmann Json"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install Nlohmann Json ? <y/N> " prompt read -p "Do you want to install Nlohmann Json ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -241,6 +250,7 @@ install_nlohmann_from_git() { ...@@ -241,6 +250,7 @@ install_nlohmann_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo "Nlohmann Json installation complete"
return 0 return 0
} }
...@@ -380,6 +390,7 @@ check_install_amf_deps(){ ...@@ -380,6 +390,7 @@ check_install_amf_deps(){
echo "Install distro libs" echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST $SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
install_cpprestsdk_from_git $1 $2 install_cpprestsdk_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
......
...@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper ...@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){ install_fb_folly_from_source(){
echo "Starting to install folly"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
OPTION="" OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
...@@ -49,7 +50,9 @@ install_fb_folly_from_source(){ ...@@ -49,7 +50,9 @@ install_fb_folly_from_source(){
then then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \ $SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \ $CMAKE \
make \
boost-devel \ boost-devel \
libevent-devel \ libevent-devel \
double-conversion-devel \ double-conversion-devel \
...@@ -136,6 +139,6 @@ install_fb_folly_from_source(){ ...@@ -136,6 +139,6 @@ install_fb_folly_from_source(){
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo_success "End of folly installation" echo_success "folly installation complete"
return 0 return 0
} }
...@@ -375,7 +375,7 @@ class HtmlReport(): ...@@ -375,7 +375,7 @@ class HtmlReport():
def buildSummaryFooter(self): def buildSummaryFooter(self):
self.file.write(' </table>\n') self.file.write(' </table>\n')
self.file.write(' <br>\n') self.file.write(' <br>\n')
if self.nb_warnings > 0: if len(self.warning_rows) > 0:
self.file.write(' <h3>Compilation Warnings Details</h3>\n') self.file.write(' <h3>Compilation Warnings Details</h3>\n')
self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n') self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n')
self.file.write(' <div id="oai-compilation-details" class="collapse">\n') self.file.write(' <div id="oai-compilation-details" class="collapse">\n')
...@@ -471,6 +471,8 @@ class HtmlReport(): ...@@ -471,6 +471,8 @@ class HtmlReport():
pistache_build_status = False pistache_build_status = False
json_build_start = False json_build_start = False
json_build_status = False json_build_status = False
cpprest_build_start = False
cpprest_build_status = False
base_image = False base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile: for line in logfile:
...@@ -487,33 +489,43 @@ class HtmlReport(): ...@@ -487,33 +489,43 @@ class HtmlReport():
result = re.search('AMF deps installation successful', line) result = re.search('AMF deps installation successful', line)
if result is not None: if result is not None:
status = True status = True
result = re.search('Install fmt from source', line) result = re.search('distro libs installation complete', line)
if result is not None: if result is not None:
package_install = True package_install = True
fmt_build_start = True result = re.search('Starting to install cpprestsdk', line)
result = re.search('Installing: /usr/local/lib/pkgconfig/fmt.pc', line) if result is not None:
cpprest_build_start = True
result = re.search('cpprestsdk installation complete', line)
if result is not None and cpprest_build_start:
cpprest_build_status = True
result = re.search('Starting to install fmt', line)
if result is not None: if result is not None:
fmt_build_start = True
result = re.search('fmt installation complete', line)
if result is not None and fmt_build_start:
fmt_build_status = True fmt_build_status = True
result = re.search('Cloning into \'folly\'', line) result = re.search('Starting to install folly', line)
if result is not None: if result is not None:
folly_build_start = True folly_build_start = True
result = re.search('Installing: /usr/local/lib/libfollybenchmark.a', line) result = re.search('folly installation complete', line)
if result is not None: if result is not None and folly_build_start:
folly_build_status = True folly_build_status = True
result = re.search('Install spdlog from', line) result = re.search('Starting to install spdlog', line)
if result is not None: if result is not None:
spdlog_build_start = True spdlog_build_start = True
result = re.search('Install Pistache from', line) result = re.search('spdlog installation complete', line)
if result is not None: if result is not None and spdlog_build_start:
spdlog_build_status = True spdlog_build_status = True
pistache_build_start = True result = re.search('Starting to install pistache', line)
result = re.search('Installing: /usr/local/lib/libpistache.a', line)
if result is not None: if result is not None:
pistache_build_start = True
result = re.search('pistache installation complete', line)
if result is not None and pistache_build_start:
pistache_build_status = True pistache_build_status = True
result = re.search('Install Nlohmann Json', line) result = re.search('Starting to install Nlohmann Json', line)
if result is not None: if result is not None:
json_build_status = True json_build_status = True
result = re.search('Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake', line) result = re.search('Nlohmann Json installation complete', line)
if result is not None: if result is not None:
json_build_status = True json_build_status = True
logfile.close() logfile.close()
...@@ -533,6 +545,12 @@ class HtmlReport(): ...@@ -533,6 +545,12 @@ class HtmlReport():
cell_msg += ' ** Packages Installation: OK\n' cell_msg += ' ** Packages Installation: OK\n'
else: else:
cell_msg += ' ** Packages Installation: KO\n' cell_msg += ' ** Packages Installation: KO\n'
if base_image:
cell_msg += ' ** cpprestsdk Installation: N/A\n'
elif cpprest_build_status:
cell_msg += ' ** cpprestsdk Installation: OK\n'
else:
cell_msg += ' ** cpprestsdk Installation: KO\n'
if base_image: if base_image:
cell_msg += ' ** fmt Installation: N/A\n' cell_msg += ' ** fmt Installation: N/A\n'
elif fmt_build_status: elif fmt_build_status:
...@@ -668,6 +686,11 @@ class HtmlReport(): ...@@ -668,6 +686,11 @@ class HtmlReport():
linenumber = re.sub(':[0-9]*:',"", linenumber) linenumber = re.sub(':[0-9]*:',"", linenumber)
error_warning_status = re.sub(':',"", wordsList[1]) error_warning_status = re.sub(':',"", wordsList[1])
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine) error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
if nb_warnings == 0 and variant == 'docker':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>Ubuntu 18</b></td></tr>\n'
if nb_warnings == 0 and variant == 'podman':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>RHEL 8</b></td></tr>\n'
nb_warnings += 1 nb_warnings += 1
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n' self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close() logfile.close()
......
...@@ -59,15 +59,6 @@ RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.pr ...@@ -59,15 +59,6 @@ RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.pr
RUN git config --global https.postBuffer 123289600 RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false RUN git config --global http.sslverify false
# cpprest package install
RUN git clone https://github.com/Microsoft/cpprestsdk.git
RUN cd cpprestsdk && \
git submodule update --init && \
mkdir build && cd build && \
cmake3 -G Ninja .. -DCMAKE_BUILD_TYPE=Release && \
ninja install && \
ldconfig -v
# Copying source code # Copying source code
WORKDIR /openair-amf/ WORKDIR /openair-amf/
COPY . /openair-amf COPY . /openair-amf
......
...@@ -47,7 +47,7 @@ class ABBA { ...@@ -47,7 +47,7 @@ class ABBA {
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _length; uint8_t _length;
uint8_t _value[255]; uint8_t _value[256];
}; };
} // namespace nas } // namespace nas
......
...@@ -73,30 +73,30 @@ static const asn_ioc_cell_t ...@@ -73,30 +73,30 @@ static const asn_ioc_cell_t
static const asn_ioc_set_t static const asn_ioc_set_t
asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1[] = { asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1[] = {
{6, 4, asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1_rows}}; {6, 4, asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1_rows}};
static const long asn_VAL_7_Ngap_id_PDUSessionAggregateMaximumBitRate = 130; static const long asn_VAL_7_Ngap_id_PDUSessionAggregateMaximumBitRate = 130;
static const long asn_VAL_7_Ngap_reject = 0; static const long asn_VAL_7_Ngap_reject = 0;
static const long asn_VAL_7_Ngap_optional = 0; static const long asn_VAL_7_Ngap_optional = 0;
static const long asn_VAL_8_Ngap_id_UL_NGU_UP_TNLInformation = 139; static const long asn_VAL_8_Ngap_id_UL_NGU_UP_TNLInformation = 139;
static const long asn_VAL_8_Ngap_reject = 0; static const long asn_VAL_8_Ngap_reject = 0;
static const long asn_VAL_8_Ngap_mandatory = 2; static const long asn_VAL_8_Ngap_mandatory = 2;
static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126; // static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126;
static const long asn_VAL_9_Ngap_reject = 0; // static const long asn_VAL_9_Ngap_reject = 0;
static const long asn_VAL_9_Ngap_optional = 0; // static const long asn_VAL_9_Ngap_optional = 0;
static const long asn_VAL_10_Ngap_id_DataForwardingNotPossible = 127; static const long asn_VAL_10_Ngap_id_DataForwardingNotPossible = 127;
static const long asn_VAL_10_Ngap_reject = 0; static const long asn_VAL_10_Ngap_reject = 0;
static const long asn_VAL_10_Ngap_optional = 0; static const long asn_VAL_10_Ngap_optional = 0;
static const long asn_VAL_11_Ngap_id_PDUSessionType = 134; static const long asn_VAL_11_Ngap_id_PDUSessionType = 134;
static const long asn_VAL_11_Ngap_reject = 0; static const long asn_VAL_11_Ngap_reject = 0;
static const long asn_VAL_11_Ngap_mandatory = 2; static const long asn_VAL_11_Ngap_mandatory = 2;
static const long asn_VAL_12_Ngap_id_SecurityIndication = 138; static const long asn_VAL_12_Ngap_id_SecurityIndication = 138;
static const long asn_VAL_12_Ngap_reject = 0; static const long asn_VAL_12_Ngap_reject = 0;
static const long asn_VAL_12_Ngap_optional = 0; static const long asn_VAL_12_Ngap_optional = 0;
static const long asn_VAL_13_Ngap_id_NetworkInstance = 129; static const long asn_VAL_13_Ngap_id_NetworkInstance = 129;
static const long asn_VAL_13_Ngap_reject = 0; static const long asn_VAL_13_Ngap_reject = 0;
static const long asn_VAL_13_Ngap_optional = 0; static const long asn_VAL_13_Ngap_optional = 0;
static const long asn_VAL_14_Ngap_id_QosFlowSetupRequestList = 136; static const long asn_VAL_14_Ngap_id_QosFlowSetupRequestList = 136;
static const long asn_VAL_14_Ngap_reject = 0; static const long asn_VAL_14_Ngap_reject = 0;
static const long asn_VAL_14_Ngap_mandatory = 2; static const long asn_VAL_14_Ngap_mandatory = 2;
static const asn_ioc_cell_t static const asn_ioc_cell_t
asn_IOS_Ngap_PDUSessionResourceSetupRequestTransferIEs_1_rows[] = { asn_IOS_Ngap_PDUSessionResourceSetupRequestTransferIEs_1_rows[] = {
{"&id", aioc__value, &asn_DEF_Ngap_ProtocolIE_ID, {"&id", aioc__value, &asn_DEF_Ngap_ProtocolIE_ID,
...@@ -1146,7 +1146,7 @@ asn_enc_rval_t CHOICE_encode_aper( ...@@ -1146,7 +1146,7 @@ asn_enc_rval_t CHOICE_encode_aper(
return elm->type->op->aper_encoder( return elm->type->op->aper_encoder(
elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po); elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po);
} else { } else if (ct) {
asn_enc_rval_t rval; asn_enc_rval_t rval;
if (specs->ext_start == -1) ASN__ENCODE_FAILED; if (specs->ext_start == -1) ASN__ENCODE_FAILED;
if (aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start)) if (aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start))
...@@ -1156,6 +1156,8 @@ asn_enc_rval_t CHOICE_encode_aper( ...@@ -1156,6 +1156,8 @@ asn_enc_rval_t CHOICE_encode_aper(
ASN__ENCODE_FAILED; ASN__ENCODE_FAILED;
rval.encoded = 0; rval.encoded = 0;
ASN__ENCODED_OK(rval); ASN__ENCODED_OK(rval);
} else {
ASN__ENCODE_FAILED;
} }
} }
......
...@@ -122,6 +122,7 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -122,6 +122,7 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t UEContextReleaseCompleteMsg::getRanUeNgapId() const { uint32_t UEContextReleaseCompleteMsg::getRanUeNgapId() const {
if (ranUeNgapId) return ranUeNgapId->getRanUeNgapId(); if (ranUeNgapId) return ranUeNgapId->getRanUeNgapId();
return (uint32_t) 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -164,7 +164,8 @@ int balloc(bstring b, int olen) { ...@@ -164,7 +164,8 @@ int balloc(bstring b, int olen) {
#if defined(BSTRLIB_TEST_CANARY) #if defined(BSTRLIB_TEST_CANARY)
if (len > b->slen + 1) { if (len > b->slen + 1) {
memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1)); if ((memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1))) == NULL)
return BSTR_ERR;
} }
#endif #endif
} }
...@@ -218,7 +219,8 @@ bstring bfromcstr(const char* str) { ...@@ -218,7 +219,8 @@ bstring bfromcstr(const char* str) {
b = (bstring) bstr__alloc(sizeof(struct tagbstring)); b = (bstring) bstr__alloc(sizeof(struct tagbstring));
if (NULL == b) return NULL; if (NULL == b) return NULL;
b->slen = (int) j; b->slen = (int) j;
if (NULL == (b->data = (unsigned char*) bstr__alloc(b->mlen = i))) { b->data = (unsigned char*) bstr__alloc(b->mlen = i);
if (b->data == NULL) {
bstr__free(b); bstr__free(b);
return NULL; return NULL;
} }
...@@ -1588,7 +1590,8 @@ int binsertblk( ...@@ -1588,7 +1590,8 @@ int binsertblk(
/* Aliasing case */ /* Aliasing case */
if (((size_t)((unsigned char*) blk + len)) >= ((size_t) b->data) && if (((size_t)((unsigned char*) blk + len)) >= ((size_t) b->data) &&
((size_t) blk) < ((size_t)(b->data + b->mlen))) { ((size_t) blk) < ((size_t)(b->data + b->mlen))) {
if (NULL == (aux = (unsigned char*) bstr__alloc(len))) return BSTR_ERR; aux = (unsigned char*) bstr__alloc(len);
if (aux == NULL) return BSTR_ERR;
bstr__memcpy(aux, blk, len); bstr__memcpy(aux, blk, len);
} }
...@@ -2133,6 +2136,9 @@ int bsreadlna(bstring r, struct bStream* s, char terminator) { ...@@ -2133,6 +2136,9 @@ int bsreadlna(bstring r, struct bStream* s, char terminator) {
int i, l, ret, rlo; int i, l, ret, rlo;
char* b; char* b;
struct tagbstring x; struct tagbstring x;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 || if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 ||
r->slen < 0 || r->mlen < r->slen) r->slen < 0 || r->mlen < r->slen)
...@@ -2201,6 +2207,9 @@ int bsreadlnsa(bstring r, struct bStream* s, const_bstring term) { ...@@ -2201,6 +2207,9 @@ int bsreadlnsa(bstring r, struct bStream* s, const_bstring term) {
unsigned char* b; unsigned char* b;
struct tagbstring x; struct tagbstring x;
struct charField cf; struct charField cf;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || term == NULL || if (s == NULL || s->buff == NULL || r == NULL || term == NULL ||
term->data == NULL || r->mlen <= 0 || r->slen < 0 || r->mlen < r->slen) term->data == NULL || r->mlen <= 0 || r->slen < 0 || r->mlen < r->slen)
...@@ -2470,7 +2479,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) { ...@@ -2470,7 +2479,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) {
* NULL is returned, otherwise a bstring with the correct result is returned. * NULL is returned, otherwise a bstring with the correct result is returned.
*/ */
bstring bjoin(const struct bstrList* bl, const_bstring sep) { bstring bjoin(const struct bstrList* bl, const_bstring sep) {
if (sep != NULL && (sep->slen < 0 || sep->data == NULL)) return NULL; if (sep == NULL)
return NULL;
else if (sep->slen < 0 || sep->data == NULL)
return NULL;
return bjoinblk(bl, sep->data, sep->slen); return bjoinblk(bl, sep->data, sep->slen);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment