修复检视意见问题

This commit is contained in:
luozihao
2021-05-06 18:25:56 +08:00
parent d5672f90fb
commit ddc927a4ad
4 changed files with 16 additions and 13 deletions

View File

@ -242,8 +242,7 @@ Datum bt_page_stats(PG_FUNCTION_ARGS)
if (stat.type == 'd'){
ret = snprintf_s(values[j++], 64, 63, XID_FMT, stat.btpo.xact);
securec_check_ss(ret, "", "");
}
else {
} else {
ret = snprintf_s(values[j++], 32, 31, "%d", stat.btpo.level);
securec_check_ss(ret, "", "");
}
@ -333,7 +332,7 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
uargs->page = (char*)palloc(BLCKSZ);
int rc = memcpy_s(uargs->page, BLCKSZ, BufferGetPage(buffer), BLCKSZ);
securec_check(rc, "", "");
securec_check_c(rc, "\0", "\0");
UnlockReleaseBuffer(buffer);
relation_close(rel, AccessShareLock);
@ -398,13 +397,17 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
ptr = (char*)itup + IndexInfoFindDataOffset(itup->t_info);
dlen = IndexTupleSize(itup) - IndexInfoFindDataOffset(itup->t_info);
dump = (char*)palloc0(dlen * 3 + 1);
int length = dlen * 3 + 1;
values[j] = dump;
for (off = 0; off < dlen; off++) {
if (off > 0)
if (off > 0) {
*dump++ = ' ';
ret = sprintf_s(dump, dlen * 3 + 1, "%02x", *(ptr + off) & 0xff);
length--;
}
ret = sprintf_s(dump, length, "%02x", *(ptr + off) & 0xff);
securec_check_ss(ret, "", "");
dump += 2;
length -= 2;
}
tuple = BuildTupleFromCStrings(fctx->attinmeta, values);

View File

@ -69,7 +69,7 @@ Datum gin_metapage_info(PG_FUNCTION_ARGS)
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_ss(nRet, "", "");
securec_check_c(nRet, "\0", "\0");
values[0] = Int64GetDatum(metadata->head);
values[1] = Int64GetDatum(metadata->tail);
@ -148,7 +148,7 @@ Datum gin_page_opaque_info(PG_FUNCTION_ARGS)
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_ss(nRet, "", "");
securec_check_c(nRet, "\0", "\0");
values[0] = Int64GetDatum(opaq->rightlink);
values[1] = Int64GetDatum(opaq->maxoff);
@ -240,7 +240,7 @@ Datum gin_leafpage_items(PG_FUNCTION_ARGS)
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_ss(nRet, "", "");
securec_check_c(nRet, "\0", "\0");
values[0] = ItemPointerGetDatum(&cur->first);
values[1] = UInt16GetDatum(cur->nbytes);

View File

@ -123,7 +123,7 @@ Datum heap_page_items(PG_FUNCTION_ARGS)
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_ss(nRet, "", "");
securec_check_c(nRet, "\0", "\0");
/* Extract information from the line pointer */

View File

@ -155,7 +155,7 @@ static bytea* get_raw_page_internal(text* relname, ForkNumber forknum, BlockNumb
LockBuffer(buf, BUFFER_LOCK_SHARE);
int rc = memcpy_s(raw_page_data, BLCKSZ, BufferGetPage(buf), BLCKSZ);
securec_check(rc, "", "");
securec_check_c(rc, "\0", "\0");
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buf);
@ -307,7 +307,7 @@ Datum page_compress_meta(PG_FUNCTION_ARGS)
bytea* dumpVal = (bytea*)palloc(VARHDRSZ + output->len);
SET_VARSIZE(dumpVal, VARHDRSZ + output->len);
int rc = memcpy_s(VARDATA(dumpVal), output->len, output->data, output->len);
securec_check(rc, "", "");
securec_check_c(rc, "\0", "\0");
pfree(output->data);
pfree(output);
@ -327,7 +327,7 @@ Datum page_compress_meta_usage(PG_FUNCTION_ARGS)
bytea* dumpVal = (bytea*)palloc(VARHDRSZ + help_size);
SET_VARSIZE(dumpVal, VARHDRSZ + help_size);
int rc = memcpy_s(VARDATA(dumpVal), help_size, help, help_size);
securec_check(rc, "", "");
securec_check_c(rc, "\0", "\0");
PG_RETURN_TEXT_P(dumpVal);
}
@ -414,7 +414,7 @@ static char* read_raw_page(Relation rel, ForkNumber forknum, BlockNumber blkno)
buf = ReadBufferExtended(rel, forknum, blkno, RBM_NORMAL, NULL);
LockBuffer(buf, BUFFER_LOCK_SHARE);
int rc = memcpy_s(raw_page, BLCKSZ, BufferGetPage(buf), BLCKSZ);
securec_check(rc, "", "");
securec_check_c(rc, "\0", "\0");
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buf);