~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/dom/XMLTokenizerLibxml2.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
// --------------------------------
327
327
 
328
328
static int globalDescriptor = 0;
329
 
static ThreadIdentifier libxmlLoaderThread = 0;
 
329
 
 
330
static ThreadIdentifier& libxmlLoaderThread() {
 
331
    DEFINE_STATIC_LOCAL(ThreadIdentifier, staticLibxmlLoaderThread, ());
 
332
    return staticLibxmlLoaderThread;
 
333
}
330
334
 
331
335
static int matchFunc(const char*)
332
336
{
333
337
    // Only match loads initiated due to uses of libxml2 from within XMLTokenizer to avoid
334
338
    // interfering with client applications that also use libxml2.  http://bugs.webkit.org/show_bug.cgi?id=17353
335
 
    return XMLTokenizerScope::currentDocLoader && currentThread() == libxmlLoaderThread;
 
339
    return XMLTokenizerScope::currentDocLoader && currentThread() == libxmlLoaderThread();
336
340
}
337
341
 
338
342
class OffsetBuffer {
393
397
static void* openFunc(const char* uri)
394
398
{
395
399
    ASSERT(XMLTokenizerScope::currentDocLoader);
396
 
    ASSERT(currentThread() == libxmlLoaderThread);
 
400
    ASSERT(currentThread() == libxmlLoaderThread());
397
401
 
398
402
    KURL url(KURL(), uri);
399
403
 
462
466
        xmlInitParser();
463
467
        xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc);
464
468
        xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc);
465
 
        libxmlLoaderThread = currentThread();
 
469
        libxmlLoaderThread() = currentThread();
466
470
        didInit = true;
467
471
    }
468
472
 
484
488
        xmlInitParser();
485
489
        xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc);
486
490
        xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc);
487
 
        libxmlLoaderThread = currentThread();
 
491
        libxmlLoaderThread() = currentThread();
488
492
        didInit = true;
489
493
    }
490
494
 
1292
1296
 
1293
1297
    XMLTokenizer tokenizer(fragment, parent);
1294
1298
    
1295
 
    tokenizer.initializeParserContext(chunk.utf8().data());
 
1299
    CString chunkAsUtf8 = chunk.utf8();
 
1300
    tokenizer.initializeParserContext(chunkAsUtf8.data());
1296
1301
 
1297
1302
    xmlParseContent(tokenizer.m_context);
1298
1303
 
1300
1305
 
1301
1306
    // Check if all the chunk has been processed.
1302
1307
    long bytesProcessed = xmlByteConsumed(tokenizer.m_context);
1303
 
    if (bytesProcessed == -1 || ((unsigned long)bytesProcessed) == sizeof(UChar) * chunk.length())
 
1308
    if (bytesProcessed == -1 || ((unsigned long)bytesProcessed) != chunkAsUtf8.length())
1304
1309
        return false;
1305
1310
 
1306
1311
    // No error if the chunk is well formed or it is not but we have no error.