本文整理汇总了C++中FreeStrBuf函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeStrBuf函数的具体用法?C++ FreeStrBuf怎么用?C++ FreeStrBuf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeStrBuf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestEncodeEmail
static void TestEncodeEmail(void)
{
StrBuf *Target;
StrBuf *Source;
StrBuf *UserName = NewStrBuf();
StrBuf *EmailAddress = NewStrBuf();
StrBuf *EncBuf = NewStrBuf();
Source = NewStrBuf();
// Source = NewStrBufPlain(HKEY("Art Cancro <[email protected]>, Art Cancro <[email protected]>"));
Source = NewStrBufPlain(HKEY("\"Alexandra Weiz, Restless GmbH\" <[email protected]>, \"NetIN\" <[email protected]>, \" יריב ברקאי, מולטימדי\" <[email protected]>"));
Target = StrBufSanitizeEmailRecipientVector(
Source,
UserName,
EmailAddress,
EncBuf
);
TestRevalidateStrBuf(Target);
printf("the source:>%s<\n", ChrPtr(Source));
printf("the target:>%s<\n", ChrPtr(Target));
FreeStrBuf(&Target);
FreeStrBuf(&UserName);
FreeStrBuf(&EmailAddress);
FreeStrBuf(&EncBuf);
FreeStrBuf(&Source);
}
示例2: TestRFC822DecodeStdin
static void TestRFC822DecodeStdin(void)
{
int fdin = 0;// STDIN
const char *Err;
StrBuf *Target;
StrBuf *Source;
StrBuf *DefaultCharset;
StrBuf *FoundCharset;
DefaultCharset = NewStrBufPlain(HKEY("iso-8859-1"));
FoundCharset = NewStrBuf();
Source = NewStrBuf();
while (fdin == 0) {
StrBufTCP_read_line(Source, &fdin, 0, &Err);
Target = NewStrBuf();
StrBuf_RFC822_to_Utf8(Target, Source, DefaultCharset, FoundCharset);
TestRevalidateStrBuf(Target);
printf("the ugly multi:>%s<\n", ChrPtr(Target));
FreeStrBuf(&Target);
}
FreeStrBuf(&Source);
FreeStrBuf(&FoundCharset);
FreeStrBuf(&DefaultCharset);
}
示例3: StrBufRFC2047encodeMessageStdin
static void StrBufRFC2047encodeMessageStdin(void)
{
int fdin = 0;// STDIN
const char *Err;
StrBuf *Target;
StrBuf *Source;
StrBuf *Src;
Source = NewStrBuf();
Src = NewStrBuf();
printf("[");
while (fdin == 0) {
StrBufTCP_read_line(Source, &fdin, 0, &Err);
StrBufAppendBuf(Src, Source, 0);
StrBufAppendBufPlain(Src, HKEY("\n"), 0);
}
Target = StrBufRFC2047encodeMessage(Src);
printf("Target: \n%s\n", ChrPtr(Target));
FreeStrBuf(&Source);
FreeStrBuf(&Src);
FreeStrBuf(&Target);
}
示例4: TestEncodeEmailSTDIN
static void TestEncodeEmailSTDIN(void)
{
int fdin = 0;// STDIN
const char *Err;
StrBuf *Target;
StrBuf *Source;
StrBuf *UserName = NewStrBuf();
StrBuf *EmailAddress = NewStrBuf();
StrBuf *EncBuf = NewStrBuf();
Source = NewStrBuf();
while (fdin == 0) {
StrBufTCP_read_line(Source, &fdin, 0, &Err);
printf("the source:>%s<\n", ChrPtr(Source));
Target = StrBufSanitizeEmailRecipientVector(
Source,
UserName,
EmailAddress,
EncBuf
);
TestRevalidateStrBuf(Target);
printf("the target:>%s<\n", ChrPtr(Target));
FreeStrBuf(&Target);
}
FreeStrBuf(&UserName);
FreeStrBuf(&EmailAddress);
FreeStrBuf(&EncBuf);
FreeStrBuf(&Source);
}
示例5: DeleteWebcitHandler
void DeleteWebcitHandler(void *vHandler)
{
WebcitHandler *Handler = (WebcitHandler*) vHandler;
FreeStrBuf(&Handler->Name);
FreeStrBuf(&Handler->DisplayName);
free (Handler);
}
示例6: JournalBackgroundSubmit
/*
* Hand off a copy of a message to be journalized.
*/
void JournalBackgroundSubmit(struct CtdlMessage *msg,
StrBuf *saved_rfc822_version,
recptypes *recps) {
struct jnlq *jptr = NULL;
/* Avoid double journaling! */
if (!CM_IsEmpty(msg, eJournal)) {
FreeStrBuf(&saved_rfc822_version);
return;
}
jptr = (struct jnlq *)malloc(sizeof(struct jnlq));
if (jptr == NULL) {
FreeStrBuf(&saved_rfc822_version);
return;
}
memset(jptr, 0, sizeof(struct jnlq));
if (recps != NULL) memcpy(&jptr->recps, recps, sizeof(recptypes));
if (!CM_IsEmpty(msg, eAuthor)) jptr->from = strdup(msg->cm_fields[eAuthor]);
if (!CM_IsEmpty(msg, eNodeName)) jptr->node = strdup(msg->cm_fields[eNodeName]);
if (!CM_IsEmpty(msg, erFc822Addr)) jptr->rfca = strdup(msg->cm_fields[erFc822Addr]);
if (!CM_IsEmpty(msg, eMsgSubject)) jptr->subj = strdup(msg->cm_fields[eMsgSubject]);
if (!CM_IsEmpty(msg, emessageId)) jptr->msgn = strdup(msg->cm_fields[emessageId]);
jptr->rfc822 = SmashStrBuf(&saved_rfc822_version);
/* Add to the queue */
begin_critical_section(S_JOURNAL_QUEUE);
jptr->next = jnlq;
jnlq = jptr;
end_critical_section(S_JOURNAL_QUEUE);
}
示例7: HfreeFetchItem
void HfreeFetchItem(void *vItem)
{
FetchItem *Item = (FetchItem*) vItem;
FreeStrBuf(&Item->MsgUIDL);
FreeStrBuf(&Item->MsgUID);
free(Item);
}
示例8: main
int main(int argc, char* argv[])
{
StrBuf *WFBuf;
StrBuf *OutBuf;
StrBuf *Info;
int nWildfireHeaders = 0;
StartLibCitadel(8);
printf("%s == %d?\n", libcitadel_version_string(), libcitadel_version_number());
WildFireInitBacktrace(argv[0], 0);
WFBuf = NewStrBuf();
OutBuf = NewStrBuf();
Info = NewStrBufPlain(HKEY("this is just a test message"));
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
SerializeJson(WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
WildFireSerializePayload(WFBuf, OutBuf, &nWildfireHeaders, NULL);
CreateWildfireSampleMessage(OutBuf);
printf("%s\n\n", ChrPtr(OutBuf));
FreeStrBuf(&WFBuf);
FreeStrBuf(&OutBuf);
FreeStrBuf(&Info);
ShutDownLibCitadel();
return 0;
}
示例9: CreateWildfireSampleMessage
static void CreateWildfireSampleMessage(StrBuf *OutBuf)
{
JsonValue *Error;
StrBuf *Buf;
StrBuf *Header;
StrBuf *Json;
int n = 1;
Header = NewStrBuf();
Json = NewStrBuf();
Error = WildFireMessagePlain(HKEY(__FILE__), __LINE__, HKEY("Info message"), eINFO);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FlushStrBuf(Json);
FlushStrBuf(Header);
Error = WildFireMessagePlain(HKEY(__FILE__), __LINE__, HKEY("Warn message"), eWARN);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FlushStrBuf(Json);
FlushStrBuf(Header);
Error = WildFireMessagePlain(HKEY(__FILE__), __LINE__, HKEY("Error message"), eERROR);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FlushStrBuf(Json);
FlushStrBuf(Header);
Error = WildFireMessagePlain(HKEY(__FILE__), __LINE__, HKEY("Info message"), eINFO);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FlushStrBuf(Json);
FlushStrBuf(Header);
Error = WildFireMessagePlain(HKEY(__FILE__), __LINE__, HKEY("Info message"), eINFO);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FlushStrBuf(Json);
FlushStrBuf(Header);
Buf = NewStrBufPlain(HKEY("test error message"));
Error = WildFireException(HKEY(__FILE__), __LINE__, Buf, 1);
SerializeJson(Json, Error, 1);
WildFireSerializePayload(Json, Header, &n, NULL);
StrBufAppendBuf(OutBuf, Header, 0);
FreeStrBuf(&Buf);
FreeStrBuf(&Json);
FreeStrBuf(&Header);
}
示例10: DeleteConflict
void DeleteConflict(void *vConflict)
{
CalendarConflict *c = (CalendarConflict *) vConflict;
FreeStrBuf(&c->conflict_event_uid);
FreeStrBuf(&c->conflict_event_summary);
free(c);
}
示例11: do_graphics_upload
void do_graphics_upload(char *filename)
{
StrBuf *Line;
const char *MimeType;
wcsession *WCC = WC;
int bytes_remaining;
int pos = 0;
int thisblock;
bytes_remaining = WCC->upload_length;
if (havebstr("cancel_button")) {
AppendImportantMessage(_("Graphics upload has been cancelled."), -1);
display_main_menu();
return;
}
if (WCC->upload_length == 0) {
AppendImportantMessage(_("You didn't upload a file."), -1);
display_main_menu();
return;
}
MimeType = GuessMimeType(ChrPtr(WCC->upload), bytes_remaining);
serv_printf("UIMG 1|%s|%s", MimeType, filename);
Line = NewStrBuf();
StrBuf_ServGetln(Line);
if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) {
display_main_menu();
FreeStrBuf(&Line);
return;
}
while (bytes_remaining) {
thisblock = ((bytes_remaining > 4096) ? 4096 : bytes_remaining);
serv_printf("WRIT %d", thisblock);
StrBuf_ServGetln(Line);
if (GetServerStatusMsg(Line, NULL, 1, 7) != 7) {
serv_puts("UCLS 0");
StrBuf_ServGetln(Line);
display_main_menu();
FreeStrBuf(&Line);
return;
}
thisblock = extract_int(ChrPtr(Line) +4, 0);
serv_write(&ChrPtr(WCC->upload)[pos], thisblock);
pos += thisblock;
bytes_remaining -= thisblock;
}
serv_puts("UCLS 1");
StrBuf_ServGetln(Line);
if (*ChrPtr(Line) != 'x') {
display_success(ChrPtr(Line) + 4);
}
FreeStrBuf(&Line);
}
示例12: DeleteNodeConf
void DeleteNodeConf(void *vNode)
{
NodeConf *Node = (NodeConf*) vNode;
FreeStrBuf(&Node->NodeName);
FreeStrBuf(&Node->Secret);
FreeStrBuf(&Node->Host);
FreeStrBuf(&Node->Port);
free(Node);
}
示例13: FreeStrBuf
void
SessionDestroyModule_WEBCIT
(wcsession *sess)
{
FreeStrBuf(&sess->WBuf);
FreeStrBuf(&sess->HBuf);
FreeStrBuf(&sess->ImportantMsg);
FreeStrBuf(&sess->PushedDestination);
}
示例14: memset
OneQueItem *DeserializeQueueItem(StrBuf *RawQItem, long QueMsgID)
{
OneQueItem *Item;
const char *pLine = NULL;
StrBuf *Line;
StrBuf *Token;
void *v;
Item = (OneQueItem*)malloc(sizeof(OneQueItem));
memset(Item, 0, sizeof(OneQueItem));
Item->Retry = SMTP_RETRY_INTERVAL;
Item->MessageID = -1;
Item->QueMsgID = QueMsgID;
Token = NewStrBuf();
Line = NewStrBufPlain(NULL, 128);
while (pLine != StrBufNOTNULL) {
const char *pItemPart = NULL;
void *vHandler;
StrBufExtract_NextToken(Line, RawQItem, &pLine, '\n');
if (StrLength(Line) == 0) continue;
StrBufExtract_NextToken(Token, Line, &pItemPart, '|');
if (GetHash(QItemHandlers, SKEY(Token), &vHandler))
{
QItemHandlerStruct *HS;
HS = (QItemHandlerStruct*) vHandler;
HS->H(Item, Line, &pItemPart);
}
}
FreeStrBuf(&Line);
FreeStrBuf(&Token);
if (Item->Retry >= MaxRetry)
Item->FailNow = 1;
pthread_mutex_lock(&ActiveQItemsLock);
if (GetHash(ActiveQItems,
LKEY(Item->MessageID),
&v))
{
/* WHOOPS. somebody else is already working on this. */
pthread_mutex_unlock(&ActiveQItemsLock);
FreeQueItem(&Item);
return NULL;
}
else {
/* mark our claim on this. */
Put(ActiveQItems,
LKEY(Item->MessageID),
Item,
HFreeQueItem);
pthread_mutex_unlock(&ActiveQItemsLock);
}
return Item;
}
示例15: Free_ctdl_openid
void Free_ctdl_openid(ctdl_openid **FreeMe)
{
if (*FreeMe == NULL) {
return;
}
FreeStrBuf(&(*FreeMe)->op_url);
FreeStrBuf(&(*FreeMe)->claimed_id);
DeleteHash(&(*FreeMe)->sreg_keys);
free(*FreeMe);
*FreeMe = NULL;
}