本文整理汇总了C++中bstr_free函数的典型用法代码示例。如果您正苦于以下问题:C++ bstr_free函数的具体用法?C++ bstr_free怎么用?C++ bstr_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bstr_free函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: htp_mpart_part_destroy
/**
* Destroys multipart part.
*
* @param part
*/
void htp_mpart_part_destroy(htp_mpart_part_t *part) {
if (part == NULL) return;
if (part->file != NULL) {
bstr_free(&part->file->filename);
if (part->file->tmpname != NULL) {
unlink(part->file->tmpname);
free(part->file->tmpname);
}
free(part->file);
part->file = NULL;
}
bstr_free(&part->name);
bstr_free(&part->value);
if (part->headers != NULL) {
// Destroy request_headers
htp_header_t *h = NULL;
table_iterator_reset(part->headers);
while (table_iterator_next(part->headers, (void **) & h) != NULL) {
bstr_free(&h->name);
bstr_free(&h->value);
free(h);
}
table_destroy(&part->headers);
}
free(part);
}
开发者ID:AmesianX,项目名称:libhtp,代码行数:38,代码来源:htp_multipart.c
示例2: TearDown
virtual void TearDown() {
bstr_free(output);
bstr_free(o_boxing_wizards);
decompressor->destroy(decompressor);
htp_connp_destroy_all(connp);
htp_config_destroy(cfg);
}
开发者ID:B0SB05,项目名称:ironbee,代码行数:7,代码来源:test_gunzip.cpp
示例3: TEST
TEST(BstrTest, IndexOf) {
bstr *haystack = bstr_dup_mem("ABCDEFGHIJKL\000NOPQRSTUVWXYZ", 20);
bstr *p1 = bstr_dup_c("NOPQ");
bstr *p2 = bstr_dup_c("siej");
bstr *p3 = bstr_dup_c("TUVWXYZ");
bstr *p4 = bstr_dup_c("nopq");
EXPECT_EQ(13, bstr_index_of(haystack, p1));
EXPECT_EQ(-1, bstr_index_of(haystack, p2));
EXPECT_EQ(-1, bstr_index_of(haystack, p3));
EXPECT_EQ(-1, bstr_index_of(haystack, p4));
EXPECT_EQ(13, bstr_index_of_nocase(haystack, p4));
EXPECT_EQ(16, bstr_index_of_c(haystack, "QRS"));
EXPECT_EQ(-1, bstr_index_of_c(haystack, "qrs"));
EXPECT_EQ(16, bstr_index_of_c_nocase(haystack, "qrs"));
EXPECT_EQ(16, bstr_index_of_mem(haystack, "QRSSDF",3));
EXPECT_EQ(-1, bstr_index_of_mem(haystack, "qrssdf",3));
EXPECT_EQ(16, bstr_index_of_mem_nocase(haystack, "qrssdf",3));
bstr_free(p1);
bstr_free(p2);
bstr_free(p3);
bstr_free(p4);
bstr_free(haystack);
}
开发者ID:58698301,项目名称:libhtp,代码行数:27,代码来源:test_bstr.cpp
示例4: RemoveUninstall
void RemoveUninstall(char *startmenu, char *product, BOOL delexe)
{
bstr *inipath, *uninstpath, *uninstlink;
inipath = bstr_new();
uninstpath = bstr_new();
uninstlink = bstr_new();
bstr_assign(uninstlink, startmenu);
bstr_appendpath(uninstlink, "Uninstall ");
bstr_append(uninstlink, product);
bstr_append(uninstlink, ".LNK");
DeleteFile(uninstlink->text);
if (delexe) {
bstr_assign_windir(inipath);
bstr_assign(uninstpath, inipath->text);
bstr_appendpath(inipath, "wininit.ini");
bstr_appendpath(uninstpath, UninstallEXE);
if (!WritePrivateProfileString("Renane", "NUL", uninstpath->text,
inipath->text)) {
DisplayError("Cannot write to wininit.ini: ", TRUE, FALSE);
}
}
bstr_free(uninstlink, TRUE);
bstr_free(uninstpath, TRUE);
bstr_free(inipath, TRUE);
}
开发者ID:dror-g,项目名称:nn-colletion,代码行数:31,代码来源:util.c
示例5: htp_tx_res_set_header
htp_status_t htp_tx_res_set_header(htp_tx_t *tx, const char *name, size_t name_len,
const char *value, size_t value_len, enum htp_alloc_strategy_t alloc) {
if ((tx == NULL) || (name == NULL) || (value == NULL)) return HTP_ERROR;
htp_header_t *h = calloc(1, sizeof (htp_header_t));
if (h == NULL) return HTP_ERROR;
h->name = copy_or_wrap_mem(name, name_len, alloc);
if (h->name == NULL) {
free(h);
return HTP_ERROR;
}
h->value = copy_or_wrap_mem(value, value_len, alloc);
if (h->value == NULL) {
bstr_free(h->name);
free(h);
return HTP_ERROR;
}
if (htp_table_add(tx->response_headers, h->name, h) != HTP_OK) {
bstr_free(h->name);
bstr_free(h->value);
free(h);
return HTP_ERROR;
}
return HTP_OK;
}
开发者ID:strategist922,项目名称:libhtp,代码行数:30,代码来源:htp_transaction.c
示例6: htp_urlenp_destroy
/**
* Destroys an existing URLENCODED parser.
*
* @param urlenp
*/
void htp_urlenp_destroy(htp_urlenp_t **_urlenp) {
if ((_urlenp == NULL)||(*_urlenp == NULL)) return;
htp_urlenp_t *urlenp = *_urlenp;
if (urlenp->_name != NULL) {
bstr_free(&urlenp->_name);
}
bstr_builder_destroy(urlenp->_bb);
if (urlenp->params != NULL) {
// Destroy parameters
bstr *value = NULL;
table_iterator_reset(urlenp->params);
while (table_iterator_next(urlenp->params, (void **) & value) != NULL) {
bstr_free(&value);
}
table_destroy(&urlenp->params);
}
free(urlenp);
*_urlenp = NULL;
}
开发者ID:AmesianX,项目名称:libhtp,代码行数:30,代码来源:htp_urlencoded.c
示例7: TEST
TEST(UtilTest, ParseContentType6) {
bstr *i = bstr_dup_c("multipart/form-data\t boundary=X");
bstr *e = bstr_dup_c("multipart/form-data\t");
bstr *ct = NULL;
ASSERT_EQ(HTP_OK, htp_parse_ct_header(i, &ct));
ASSERT_TRUE(ct != NULL);
ASSERT_TRUE(bstr_cmp(e, ct) == 0);
bstr_free(ct);
bstr_free(e);
bstr_free(i);
}
开发者ID:brainyhung,项目名称:libhtp-1,代码行数:14,代码来源:test_utils.cpp
示例8: htp_process_request_header_generic
/**
* Extract one request header. A header can span multiple lines, in
* which case they will be folded into one before parsing is attempted.
*
* @param[in] connp
* @param[in] data
* @param[in] len
* @return HTP_OK or HTP_ERROR
*/
htp_status_t htp_process_request_header_generic(htp_connp_t *connp, unsigned char *data, size_t len) {
// Create a new header structure.
htp_header_t *h = calloc(1, sizeof (htp_header_t));
if (h == NULL) return HTP_ERROR;
// Now try to parse the header.
if (htp_parse_request_header_generic(connp, h, data, len) != HTP_OK) {
free(h);
return HTP_ERROR;
}
#ifdef HTP_DEBUG
fprint_bstr(stderr, "Header name", h->name);
fprint_bstr(stderr, "Header value", h->value);
#endif
// Do we already have a header with the same name?
htp_header_t *h_existing = htp_table_get(connp->in_tx->request_headers, h->name);
if (h_existing != NULL) {
// TODO Do we want to have a list of the headers that are
// allowed to be combined in this way?
// Add to the existing header.
bstr *new_value = bstr_expand(h_existing->value, bstr_len(h_existing->value) + 2 + bstr_len(h->value));
if (new_value == NULL) {
bstr_free(h->name);
bstr_free(h->value);
free(h);
return HTP_ERROR;
}
h_existing->value = new_value;
bstr_add_mem_noex(h_existing->value, ", ", 2);
bstr_add_noex(h_existing->value, h->value);
// The new header structure is no longer needed.
bstr_free(h->name);
bstr_free(h->value);
free(h);
// Keep track of repeated same-name headers.
h_existing->flags |= HTP_FIELD_REPEATED;
} else {
// Add as a new header.
htp_table_add(connp->in_tx->request_headers, h->name, h);
}
return HTP_OK;
}
开发者ID:yuecailing,项目名称:rep_test,代码行数:58,代码来源:htp_request_generic.c
示例9: DeleteFileList
void DeleteFileList(InstFiles *listpt, HWND hwnd, InstFiles *keepfiles)
{
bstr *str;
char *sep;
InstFiles *keeppt;
str = bstr_new();
for (; listpt; listpt = listpt->next) {
keeppt = keepfiles;
while (keeppt && strcmp(keeppt->filename, listpt->filename) != 0) {
keeppt = keeppt->next;
}
if (keeppt) {
keeppt->filesize = 1; /* Mark that this file is already
* installed */
} else {
bstr_assign(str, "Deleting file: ");
bstr_append(str, listpt->filename);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)str->text);
DeleteFile(listpt->filename);
sep = strrchr(listpt->filename, '\\');
if (sep) {
*sep = '\0';
RemoveWholeDirectory(listpt->filename);
*sep = '\\';
}
}
}
bstr_free(str, TRUE);
}
开发者ID:dror-g,项目名称:nn-colletion,代码行数:30,代码来源:util.c
示例10: htp_parse_single_cookie_v0
/**
* Parses a single v0 request cookie and places the results into tx->request_cookies.
*
* @param[in] connp
* @param[in] data
* @param[in] len
* @return HTP_OK on success, HTP_ERROR on error.
*/
int htp_parse_single_cookie_v0(htp_connp_t *connp, unsigned char *data, size_t len) {
if (len == 0) return HTP_OK;
size_t pos = 0;
// Look for '='
while ((pos < len) && (data[pos] != '=')) pos++;
if (pos == 0) return HTP_OK; // Ignore nameless cookies
bstr *name = bstr_dup_mem(data, pos);
if (name == NULL) return HTP_ERROR;
bstr *value = NULL;
if (pos == len) {
// Cookie is empty
value = bstr_dup_c("");
} else {
// Cookie is not empty
value = bstr_dup_mem(data + pos + 1, len - pos - 1);
}
if (value == NULL) {
bstr_free(name);
return HTP_ERROR;
}
// Add cookie directly
htp_table_addn(connp->in_tx->request_cookies, name, value);
return HTP_OK;
}
开发者ID:strategist922,项目名称:libhtp,代码行数:39,代码来源:htp_cookies.c
示例11: bstr_new
char *GetInstallDir(char *product)
{
HKEY key;
bstr *str;
DWORD keytype, keylen;
char *installdir;
str = bstr_new();
bstr_assign(str, UninstallKey);
bstr_appendpath(str, product);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, str->text, 0,
KEY_ALL_ACCESS, &key) != ERROR_SUCCESS) {
DisplayError("Could not open registry", FALSE, TRUE);
}
if (RegQueryValueEx(key, "InstallDirectory", NULL,
&keytype, NULL, &keylen) != ERROR_SUCCESS ||
keytype != REG_SZ) {
DisplayError("Could not query registry key", FALSE, TRUE);
}
installdir = bmalloc(keylen);
if (RegQueryValueEx(key, "InstallDirectory", NULL,
&keytype, installdir, &keylen) != ERROR_SUCCESS) {
DisplayError("Could not get registry key value", FALSE, TRUE);
}
RegCloseKey(key);
bstr_free(str, TRUE);
return installdir;
}
开发者ID:dror-g,项目名称:nn-colletion,代码行数:31,代码来源:util.c
示例12: htp_tx_state_request_complete
htp_status_t htp_tx_state_request_complete(htp_tx_t *tx) {
// Finalize request body.
if (htp_tx_req_has_body(tx)) {
int rc = htp_tx_req_process_body_data(tx, NULL, 0);
if (rc != HTP_OK) return rc;
}
// Run hook REQUEST_COMPLETE.
int rc = htp_hook_run_all(tx->connp->cfg->hook_request_complete, tx->connp);
if (rc != HTP_OK) return rc;
// Clean-up.
if (tx->connp->put_file != NULL) {
bstr_free(tx->connp->put_file->filename);
free(tx->connp->put_file);
tx->connp->put_file = NULL;
}
// Update the transaction status, but only if it did already
// move on. This may happen when we're processing a CONNECT
// request and need to wait for the response to determine how
// to continue to treat the rest of the TCP stream.
if (tx->progress < HTP_REQUEST_COMPLETE) {
tx->progress = HTP_REQUEST_COMPLETE;
}
return HTP_OK;
}
开发者ID:brainyhung,项目名称:libhtp-1,代码行数:28,代码来源:htp_transaction.c
注:本文中的bstr_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论