aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/rssutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dutil/rssutil.cpp125
1 files changed, 70 insertions, 55 deletions
diff --git a/src/dutil/rssutil.cpp b/src/dutil/rssutil.cpp
index db49d954..8f994dfc 100644
--- a/src/dutil/rssutil.cpp
+++ b/src/dutil/rssutil.cpp
@@ -2,6 +2,21 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5
6// Exit macros
7#define RssExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
8#define RssExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
9#define RssExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
10#define RssExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
11#define RssExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
12#define RssExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_RSSUTIL, x, s, __VA_ARGS__)
13#define RssExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_RSSUTIL, p, x, e, s, __VA_ARGS__)
14#define RssExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_RSSUTIL, p, x, s, __VA_ARGS__)
15#define RssExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_RSSUTIL, p, x, e, s, __VA_ARGS__)
16#define RssExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_RSSUTIL, p, x, s, __VA_ARGS__)
17#define RssExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_RSSUTIL, e, x, s, __VA_ARGS__)
18#define RssExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_RSSUTIL, g, x, s, __VA_ARGS__)
19
5static HRESULT ParseRssDocument( 20static HRESULT ParseRssDocument(
6 __in IXMLDOMDocument *pixd, 21 __in IXMLDOMDocument *pixd,
7 __out RSS_CHANNEL **ppChannel 22 __out RSS_CHANNEL **ppChannel
@@ -68,10 +83,10 @@ extern "C" HRESULT DAPI RssParseFromString(
68 IXMLDOMDocument *pixdRss = NULL; 83 IXMLDOMDocument *pixdRss = NULL;
69 84
70 hr = XmlLoadDocument(wzRssString, &pixdRss); 85 hr = XmlLoadDocument(wzRssString, &pixdRss);
71 ExitOnFailure(hr, "Failed to load RSS string as XML document."); 86 RssExitOnFailure(hr, "Failed to load RSS string as XML document.");
72 87
73 hr = ParseRssDocument(pixdRss, &pNewChannel); 88 hr = ParseRssDocument(pixdRss, &pNewChannel);
74 ExitOnFailure(hr, "Failed to parse RSS document."); 89 RssExitOnFailure(hr, "Failed to parse RSS document.");
75 90
76 *ppChannel = pNewChannel; 91 *ppChannel = pNewChannel;
77 pNewChannel = NULL; 92 pNewChannel = NULL;
@@ -102,10 +117,10 @@ extern "C" HRESULT DAPI RssParseFromFile(
102 IXMLDOMDocument *pixdRss = NULL; 117 IXMLDOMDocument *pixdRss = NULL;
103 118
104 hr = XmlLoadDocumentFromFile(wzRssFile, &pixdRss); 119 hr = XmlLoadDocumentFromFile(wzRssFile, &pixdRss);
105 ExitOnFailure(hr, "Failed to load RSS string as XML document."); 120 RssExitOnFailure(hr, "Failed to load RSS string as XML document.");
106 121
107 hr = ParseRssDocument(pixdRss, &pNewChannel); 122 hr = ParseRssDocument(pixdRss, &pNewChannel);
108 ExitOnFailure(hr, "Failed to parse RSS document."); 123 RssExitOnFailure(hr, "Failed to parse RSS document.");
109 124
110 *ppChannel = pNewChannel; 125 *ppChannel = pNewChannel;
111 pNewChannel = NULL; 126 pNewChannel = NULL;
@@ -175,17 +190,17 @@ static HRESULT ParseRssDocument(
175 // Get the document element and start processing channels. 190 // Get the document element and start processing channels.
176 // 191 //
177 hr = pixd ->get_documentElement(&pRssElement); 192 hr = pixd ->get_documentElement(&pRssElement);
178 ExitOnFailure(hr, "failed get_documentElement in ParseRssDocument"); 193 RssExitOnFailure(hr, "failed get_documentElement in ParseRssDocument");
179 194
180 hr = pRssElement->get_childNodes(&pChannelNodes); 195 hr = pRssElement->get_childNodes(&pChannelNodes);
181 ExitOnFailure(hr, "Failed to get child nodes of Rss Document element."); 196 RssExitOnFailure(hr, "Failed to get child nodes of Rss Document element.");
182 197
183 while (S_OK == (hr = XmlNextElement(pChannelNodes, &pNode, &bstrNodeName))) 198 while (S_OK == (hr = XmlNextElement(pChannelNodes, &pNode, &bstrNodeName)))
184 { 199 {
185 if (0 == lstrcmpW(bstrNodeName, L"channel")) 200 if (0 == lstrcmpW(bstrNodeName, L"channel"))
186 { 201 {
187 hr = ParseRssChannel(pNode, &pNewChannel); 202 hr = ParseRssChannel(pNode, &pNewChannel);
188 ExitOnFailure(hr, "Failed to parse RSS channel."); 203 RssExitOnFailure(hr, "Failed to parse RSS channel.");
189 } 204 }
190 else if (0 == lstrcmpW(bstrNodeName, L"link")) 205 else if (0 == lstrcmpW(bstrNodeName, L"link"))
191 { 206 {
@@ -242,13 +257,13 @@ static HRESULT ParseRssChannel(
242 // the RSS_CHANNEL structure 257 // the RSS_CHANNEL structure
243 // 258 //
244 hr = XmlSelectNodes(pixnChannel, L"item", &pNodeList); 259 hr = XmlSelectNodes(pixnChannel, L"item", &pNodeList);
245 ExitOnFailure(hr, "Failed to select all RSS items in an RSS channel."); 260 RssExitOnFailure(hr, "Failed to select all RSS items in an RSS channel.");
246 261
247 hr = pNodeList->get_length(&cItems); 262 hr = pNodeList->get_length(&cItems);
248 ExitOnFailure(hr, "Failed to count the number of RSS items in RSS channel."); 263 RssExitOnFailure(hr, "Failed to count the number of RSS items in RSS channel.");
249 264
250 pNewChannel = static_cast<RSS_CHANNEL*>(MemAlloc(sizeof(RSS_CHANNEL) + sizeof(RSS_ITEM) * cItems, TRUE)); 265 pNewChannel = static_cast<RSS_CHANNEL*>(MemAlloc(sizeof(RSS_CHANNEL) + sizeof(RSS_ITEM) * cItems, TRUE));
251 ExitOnNull(pNewChannel, hr, E_OUTOFMEMORY, "Failed to allocate RSS channel structure."); 266 RssExitOnNull(pNewChannel, hr, E_OUTOFMEMORY, "Failed to allocate RSS channel structure.");
252 267
253 pNewChannel->cItems = cItems; 268 pNewChannel->cItems = cItems;
254 269
@@ -256,7 +271,7 @@ static HRESULT ParseRssChannel(
256 // Process the elements under a channel now. 271 // Process the elements under a channel now.
257 // 272 //
258 hr = pixnChannel->get_childNodes(&pNodeList); 273 hr = pixnChannel->get_childNodes(&pNodeList);
259 ExitOnFailure(hr, "Failed to get child nodes of RSS channel element."); 274 RssExitOnFailure(hr, "Failed to get child nodes of RSS channel element.");
260 275
261 cItems = 0; // reset the counter and use this to walk through the channel items 276 cItems = 0; // reset the counter and use this to walk through the channel items
262 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, &bstrNodeName))) 277 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, &bstrNodeName)))
@@ -264,45 +279,45 @@ static HRESULT ParseRssChannel(
264 if (0 == lstrcmpW(bstrNodeName, L"title")) 279 if (0 == lstrcmpW(bstrNodeName, L"title"))
265 { 280 {
266 hr = XmlGetText(pNode, &bstrNodeValue); 281 hr = XmlGetText(pNode, &bstrNodeValue);
267 ExitOnFailure(hr, "Failed to get RSS channel title."); 282 RssExitOnFailure(hr, "Failed to get RSS channel title.");
268 283
269 hr = StrAllocString(&pNewChannel->wzTitle, bstrNodeValue, 0); 284 hr = StrAllocString(&pNewChannel->wzTitle, bstrNodeValue, 0);
270 ExitOnFailure(hr, "Failed to allocate RSS channel title."); 285 RssExitOnFailure(hr, "Failed to allocate RSS channel title.");
271 } 286 }
272 else if (0 == lstrcmpW(bstrNodeName, L"link")) 287 else if (0 == lstrcmpW(bstrNodeName, L"link"))
273 { 288 {
274 hr = XmlGetText(pNode, &bstrNodeValue); 289 hr = XmlGetText(pNode, &bstrNodeValue);
275 ExitOnFailure(hr, "Failed to get RSS channel link."); 290 RssExitOnFailure(hr, "Failed to get RSS channel link.");
276 291
277 hr = StrAllocString(&pNewChannel->wzLink, bstrNodeValue, 0); 292 hr = StrAllocString(&pNewChannel->wzLink, bstrNodeValue, 0);
278 ExitOnFailure(hr, "Failed to allocate RSS channel link."); 293 RssExitOnFailure(hr, "Failed to allocate RSS channel link.");
279 } 294 }
280 else if (0 == lstrcmpW(bstrNodeName, L"description")) 295 else if (0 == lstrcmpW(bstrNodeName, L"description"))
281 { 296 {
282 hr = XmlGetText(pNode, &bstrNodeValue); 297 hr = XmlGetText(pNode, &bstrNodeValue);
283 ExitOnFailure(hr, "Failed to get RSS channel description."); 298 RssExitOnFailure(hr, "Failed to get RSS channel description.");
284 299
285 hr = StrAllocString(&pNewChannel->wzDescription, bstrNodeValue, 0); 300 hr = StrAllocString(&pNewChannel->wzDescription, bstrNodeValue, 0);
286 ExitOnFailure(hr, "Failed to allocate RSS channel description."); 301 RssExitOnFailure(hr, "Failed to allocate RSS channel description.");
287 } 302 }
288 else if (0 == lstrcmpW(bstrNodeName, L"ttl")) 303 else if (0 == lstrcmpW(bstrNodeName, L"ttl"))
289 { 304 {
290 hr = XmlGetText(pNode, &bstrNodeValue); 305 hr = XmlGetText(pNode, &bstrNodeValue);
291 ExitOnFailure(hr, "Failed to get RSS channel description."); 306 RssExitOnFailure(hr, "Failed to get RSS channel description.");
292 307
293 pNewChannel->dwTimeToLive = (DWORD)wcstoul(bstrNodeValue, NULL, 10); 308 pNewChannel->dwTimeToLive = (DWORD)wcstoul(bstrNodeValue, NULL, 10);
294 } 309 }
295 else if (0 == lstrcmpW(bstrNodeName, L"item")) 310 else if (0 == lstrcmpW(bstrNodeName, L"item"))
296 { 311 {
297 hr = ParseRssItem(pNode, cItems, pNewChannel); 312 hr = ParseRssItem(pNode, cItems, pNewChannel);
298 ExitOnFailure(hr, "Failed to parse RSS item."); 313 RssExitOnFailure(hr, "Failed to parse RSS item.");
299 314
300 ++cItems; 315 ++cItems;
301 } 316 }
302 else 317 else
303 { 318 {
304 hr = ParseRssUnknownElement(pNode, &pNewChannel->pUnknownElements); 319 hr = ParseRssUnknownElement(pNode, &pNewChannel->pUnknownElements);
305 ExitOnFailure(hr, "Failed to parse unknown RSS channel element: %ls", bstrNodeName); 320 RssExitOnFailure(hr, "Failed to parse unknown RSS channel element: %ls", bstrNodeName);
306 } 321 }
307 322
308 ReleaseNullBSTR(bstrNodeValue); 323 ReleaseNullBSTR(bstrNodeValue);
@@ -349,7 +364,7 @@ static HRESULT ParseRssItem(
349 if (pChannel->cItems <= cItem) 364 if (pChannel->cItems <= cItem)
350 { 365 {
351 hr = E_UNEXPECTED; 366 hr = E_UNEXPECTED;
352 ExitOnFailure(hr, "Unexpected number of items parsed."); 367 RssExitOnFailure(hr, "Unexpected number of items parsed.");
353 } 368 }
354 369
355 pItem = pChannel->rgItems + cItem; 370 pItem = pChannel->rgItems + cItem;
@@ -358,71 +373,71 @@ static HRESULT ParseRssItem(
358 // Process the elements under an item now. 373 // Process the elements under an item now.
359 // 374 //
360 hr = pixnItem->get_childNodes(&pNodeList); 375 hr = pixnItem->get_childNodes(&pNodeList);
361 ExitOnFailure(hr, "Failed to get child nodes of RSS item element."); 376 RssExitOnFailure(hr, "Failed to get child nodes of RSS item element.");
362 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, &bstrNodeName))) 377 while (S_OK == (hr = XmlNextElement(pNodeList, &pNode, &bstrNodeName)))
363 { 378 {
364 if (0 == lstrcmpW(bstrNodeName, L"title")) 379 if (0 == lstrcmpW(bstrNodeName, L"title"))
365 { 380 {
366 hr = XmlGetText(pNode, &bstrNodeValue); 381 hr = XmlGetText(pNode, &bstrNodeValue);
367 ExitOnFailure(hr, "Failed to get RSS channel title."); 382 RssExitOnFailure(hr, "Failed to get RSS channel title.");
368 383
369 hr = StrAllocString(&pItem->wzTitle, bstrNodeValue, 0); 384 hr = StrAllocString(&pItem->wzTitle, bstrNodeValue, 0);
370 ExitOnFailure(hr, "Failed to allocate RSS item title."); 385 RssExitOnFailure(hr, "Failed to allocate RSS item title.");
371 } 386 }
372 else if (0 == lstrcmpW(bstrNodeName, L"link")) 387 else if (0 == lstrcmpW(bstrNodeName, L"link"))
373 { 388 {
374 hr = XmlGetText(pNode, &bstrNodeValue); 389 hr = XmlGetText(pNode, &bstrNodeValue);
375 ExitOnFailure(hr, "Failed to get RSS channel link."); 390 RssExitOnFailure(hr, "Failed to get RSS channel link.");
376 391
377 hr = StrAllocString(&pItem->wzLink, bstrNodeValue, 0); 392 hr = StrAllocString(&pItem->wzLink, bstrNodeValue, 0);
378 ExitOnFailure(hr, "Failed to allocate RSS item link."); 393 RssExitOnFailure(hr, "Failed to allocate RSS item link.");
379 } 394 }
380 else if (0 == lstrcmpW(bstrNodeName, L"description")) 395 else if (0 == lstrcmpW(bstrNodeName, L"description"))
381 { 396 {
382 hr = XmlGetText(pNode, &bstrNodeValue); 397 hr = XmlGetText(pNode, &bstrNodeValue);
383 ExitOnFailure(hr, "Failed to get RSS item description."); 398 RssExitOnFailure(hr, "Failed to get RSS item description.");
384 399
385 hr = StrAllocString(&pItem->wzDescription, bstrNodeValue, 0); 400 hr = StrAllocString(&pItem->wzDescription, bstrNodeValue, 0);
386 ExitOnFailure(hr, "Failed to allocate RSS item description."); 401 RssExitOnFailure(hr, "Failed to allocate RSS item description.");
387 } 402 }
388 else if (0 == lstrcmpW(bstrNodeName, L"guid")) 403 else if (0 == lstrcmpW(bstrNodeName, L"guid"))
389 { 404 {
390 hr = XmlGetText(pNode, &bstrNodeValue); 405 hr = XmlGetText(pNode, &bstrNodeValue);
391 ExitOnFailure(hr, "Failed to get RSS item guid."); 406 RssExitOnFailure(hr, "Failed to get RSS item guid.");
392 407
393 hr = StrAllocString(&pItem->wzGuid, bstrNodeValue, 0); 408 hr = StrAllocString(&pItem->wzGuid, bstrNodeValue, 0);
394 ExitOnFailure(hr, "Failed to allocate RSS item guid."); 409 RssExitOnFailure(hr, "Failed to allocate RSS item guid.");
395 } 410 }
396 else if (0 == lstrcmpW(bstrNodeName, L"pubDate")) 411 else if (0 == lstrcmpW(bstrNodeName, L"pubDate"))
397 { 412 {
398 hr = XmlGetText(pNode, &bstrNodeValue); 413 hr = XmlGetText(pNode, &bstrNodeValue);
399 ExitOnFailure(hr, "Failed to get RSS item guid."); 414 RssExitOnFailure(hr, "Failed to get RSS item guid.");
400 415
401 hr = TimeFromString(bstrNodeValue, &pItem->ftPublished); 416 hr = TimeFromString(bstrNodeValue, &pItem->ftPublished);
402 ExitOnFailure(hr, "Failed to convert RSS item time."); 417 RssExitOnFailure(hr, "Failed to convert RSS item time.");
403 } 418 }
404 else if (0 == lstrcmpW(bstrNodeName, L"enclosure")) 419 else if (0 == lstrcmpW(bstrNodeName, L"enclosure"))
405 { 420 {
406 hr = XmlGetAttribute(pNode, L"url", &bstrNodeValue); 421 hr = XmlGetAttribute(pNode, L"url", &bstrNodeValue);
407 ExitOnFailure(hr, "Failed to get RSS item enclosure url."); 422 RssExitOnFailure(hr, "Failed to get RSS item enclosure url.");
408 423
409 hr = StrAllocString(&pItem->wzEnclosureUrl, bstrNodeValue, 0); 424 hr = StrAllocString(&pItem->wzEnclosureUrl, bstrNodeValue, 0);
410 ExitOnFailure(hr, "Failed to allocate RSS item enclosure url."); 425 RssExitOnFailure(hr, "Failed to allocate RSS item enclosure url.");
411 ReleaseNullBSTR(bstrNodeValue); 426 ReleaseNullBSTR(bstrNodeValue);
412 427
413 hr = XmlGetAttributeNumber(pNode, L"length", &pItem->dwEnclosureSize); 428 hr = XmlGetAttributeNumber(pNode, L"length", &pItem->dwEnclosureSize);
414 ExitOnFailure(hr, "Failed to get RSS item enclosure length."); 429 RssExitOnFailure(hr, "Failed to get RSS item enclosure length.");
415 430
416 hr = XmlGetAttribute(pNode, L"type", &bstrNodeValue); 431 hr = XmlGetAttribute(pNode, L"type", &bstrNodeValue);
417 ExitOnFailure(hr, "Failed to get RSS item enclosure type."); 432 RssExitOnFailure(hr, "Failed to get RSS item enclosure type.");
418 433
419 hr = StrAllocString(&pItem->wzEnclosureType, bstrNodeValue, 0); 434 hr = StrAllocString(&pItem->wzEnclosureType, bstrNodeValue, 0);
420 ExitOnFailure(hr, "Failed to allocate RSS item enclosure type."); 435 RssExitOnFailure(hr, "Failed to allocate RSS item enclosure type.");
421 } 436 }
422 else 437 else
423 { 438 {
424 hr = ParseRssUnknownElement(pNode, &pItem->pUnknownElements); 439 hr = ParseRssUnknownElement(pNode, &pItem->pUnknownElements);
425 ExitOnFailure(hr, "Failed to parse unknown RSS item element: %ls", bstrNodeName); 440 RssExitOnFailure(hr, "Failed to parse unknown RSS item element: %ls", bstrNodeName);
426 } 441 }
427 442
428 ReleaseNullBSTR(bstrNodeValue); 443 ReleaseNullBSTR(bstrNodeValue);
@@ -460,39 +475,39 @@ static HRESULT ParseRssUnknownElement(
460 RSS_UNKNOWN_ELEMENT* pNewUnknownElement; 475 RSS_UNKNOWN_ELEMENT* pNewUnknownElement;
461 476
462 pNewUnknownElement = static_cast<RSS_UNKNOWN_ELEMENT*>(MemAlloc(sizeof(RSS_UNKNOWN_ELEMENT), TRUE)); 477 pNewUnknownElement = static_cast<RSS_UNKNOWN_ELEMENT*>(MemAlloc(sizeof(RSS_UNKNOWN_ELEMENT), TRUE));
463 ExitOnNull(pNewUnknownElement, hr, E_OUTOFMEMORY, "Failed to allocate unknown element."); 478 RssExitOnNull(pNewUnknownElement, hr, E_OUTOFMEMORY, "Failed to allocate unknown element.");
464 479
465 hr = pNode->get_namespaceURI(&bstrNodeNamespace); 480 hr = pNode->get_namespaceURI(&bstrNodeNamespace);
466 if (S_OK == hr) 481 if (S_OK == hr)
467 { 482 {
468 hr = StrAllocString(&pNewUnknownElement->wzNamespace, bstrNodeNamespace, 0); 483 hr = StrAllocString(&pNewUnknownElement->wzNamespace, bstrNodeNamespace, 0);
469 ExitOnFailure(hr, "Failed to allocate RSS unknown element namespace."); 484 RssExitOnFailure(hr, "Failed to allocate RSS unknown element namespace.");
470 } 485 }
471 else if (S_FALSE == hr) 486 else if (S_FALSE == hr)
472 { 487 {
473 hr = S_OK; 488 hr = S_OK;
474 } 489 }
475 ExitOnFailure(hr, "Failed to get unknown element namespace."); 490 RssExitOnFailure(hr, "Failed to get unknown element namespace.");
476 491
477 hr = pNode->get_baseName(&bstrNodeName); 492 hr = pNode->get_baseName(&bstrNodeName);
478 ExitOnFailure(hr, "Failed to get unknown element name."); 493 RssExitOnFailure(hr, "Failed to get unknown element name.");
479 494
480 hr = StrAllocString(&pNewUnknownElement->wzElement, bstrNodeName, 0); 495 hr = StrAllocString(&pNewUnknownElement->wzElement, bstrNodeName, 0);
481 ExitOnFailure(hr, "Failed to allocate RSS unknown element name."); 496 RssExitOnFailure(hr, "Failed to allocate RSS unknown element name.");
482 497
483 hr = XmlGetText(pNode, &bstrNodeValue); 498 hr = XmlGetText(pNode, &bstrNodeValue);
484 ExitOnFailure(hr, "Failed to get unknown element value."); 499 RssExitOnFailure(hr, "Failed to get unknown element value.");
485 500
486 hr = StrAllocString(&pNewUnknownElement->wzValue, bstrNodeValue, 0); 501 hr = StrAllocString(&pNewUnknownElement->wzValue, bstrNodeValue, 0);
487 ExitOnFailure(hr, "Failed to allocate RSS unknown element value."); 502 RssExitOnFailure(hr, "Failed to allocate RSS unknown element value.");
488 503
489 hr = pNode->get_attributes(&pixnnmAttributes); 504 hr = pNode->get_attributes(&pixnnmAttributes);
490 ExitOnFailure(hr, "Failed get attributes on RSS unknown element."); 505 RssExitOnFailure(hr, "Failed get attributes on RSS unknown element.");
491 506
492 while (S_OK == (hr = pixnnmAttributes->nextNode(&pixnAttribute))) 507 while (S_OK == (hr = pixnnmAttributes->nextNode(&pixnAttribute)))
493 { 508 {
494 hr = ParseRssUnknownAttribute(pixnAttribute, &pNewUnknownElement->pAttributes); 509 hr = ParseRssUnknownAttribute(pixnAttribute, &pNewUnknownElement->pAttributes);
495 ExitOnFailure(hr, "Failed to parse attribute on RSS unknown element."); 510 RssExitOnFailure(hr, "Failed to parse attribute on RSS unknown element.");
496 511
497 ReleaseNullObject(pixnAttribute); 512 ReleaseNullObject(pixnAttribute);
498 } 513 }
@@ -501,7 +516,7 @@ static HRESULT ParseRssUnknownElement(
501 { 516 {
502 hr = S_OK; 517 hr = S_OK;
503 } 518 }
504 ExitOnFailure(hr, "Failed to enumerate all attributes on RSS unknown element."); 519 RssExitOnFailure(hr, "Failed to enumerate all attributes on RSS unknown element.");
505 520
506 RSS_UNKNOWN_ELEMENT** ppTail = ppUnknownElement; 521 RSS_UNKNOWN_ELEMENT** ppTail = ppUnknownElement;
507 while (*ppTail) 522 while (*ppTail)
@@ -543,31 +558,31 @@ static HRESULT ParseRssUnknownAttribute(
543 RSS_UNKNOWN_ATTRIBUTE* pNewUnknownAttribute; 558 RSS_UNKNOWN_ATTRIBUTE* pNewUnknownAttribute;
544 559
545 pNewUnknownAttribute = static_cast<RSS_UNKNOWN_ATTRIBUTE*>(MemAlloc(sizeof(RSS_UNKNOWN_ATTRIBUTE), TRUE)); 560 pNewUnknownAttribute = static_cast<RSS_UNKNOWN_ATTRIBUTE*>(MemAlloc(sizeof(RSS_UNKNOWN_ATTRIBUTE), TRUE));
546 ExitOnNull(pNewUnknownAttribute, hr, E_OUTOFMEMORY, "Failed to allocate unknown attribute."); 561 RssExitOnNull(pNewUnknownAttribute, hr, E_OUTOFMEMORY, "Failed to allocate unknown attribute.");
547 562
548 hr = pNode->get_namespaceURI(&bstrNodeNamespace); 563 hr = pNode->get_namespaceURI(&bstrNodeNamespace);
549 if (S_OK == hr) 564 if (S_OK == hr)
550 { 565 {
551 hr = StrAllocString(&pNewUnknownAttribute->wzNamespace, bstrNodeNamespace, 0); 566 hr = StrAllocString(&pNewUnknownAttribute->wzNamespace, bstrNodeNamespace, 0);
552 ExitOnFailure(hr, "Failed to allocate RSS unknown attribute namespace."); 567 RssExitOnFailure(hr, "Failed to allocate RSS unknown attribute namespace.");
553 } 568 }
554 else if (S_FALSE == hr) 569 else if (S_FALSE == hr)
555 { 570 {
556 hr = S_OK; 571 hr = S_OK;
557 } 572 }
558 ExitOnFailure(hr, "Failed to get unknown attribute namespace."); 573 RssExitOnFailure(hr, "Failed to get unknown attribute namespace.");
559 574
560 hr = pNode->get_baseName(&bstrNodeName); 575 hr = pNode->get_baseName(&bstrNodeName);
561 ExitOnFailure(hr, "Failed to get unknown attribute name."); 576 RssExitOnFailure(hr, "Failed to get unknown attribute name.");
562 577
563 hr = StrAllocString(&pNewUnknownAttribute->wzAttribute, bstrNodeName, 0); 578 hr = StrAllocString(&pNewUnknownAttribute->wzAttribute, bstrNodeName, 0);
564 ExitOnFailure(hr, "Failed to allocate RSS unknown attribute name."); 579 RssExitOnFailure(hr, "Failed to allocate RSS unknown attribute name.");
565 580
566 hr = XmlGetText(pNode, &bstrNodeValue); 581 hr = XmlGetText(pNode, &bstrNodeValue);
567 ExitOnFailure(hr, "Failed to get unknown attribute value."); 582 RssExitOnFailure(hr, "Failed to get unknown attribute value.");
568 583
569 hr = StrAllocString(&pNewUnknownAttribute->wzValue, bstrNodeValue, 0); 584 hr = StrAllocString(&pNewUnknownAttribute->wzValue, bstrNodeValue, 0);
570 ExitOnFailure(hr, "Failed to allocate RSS unknown attribute value."); 585 RssExitOnFailure(hr, "Failed to allocate RSS unknown attribute value.");
571 586
572 RSS_UNKNOWN_ATTRIBUTE** ppTail = ppUnknownAttribute; 587 RSS_UNKNOWN_ATTRIBUTE** ppTail = ppUnknownAttribute;
573 while (*ppTail) 588 while (*ppTail)