Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/plugin/qlibrary.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    296296#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_PLUGIN_CHECK)
    297297
    298 #if defined(Q_OS_FREEBSD) || defined(Q_OS_LINUX)
    299 #  define USE_MMAP
    300 QT_BEGIN_INCLUDE_NAMESPACE
    301 #  include <sys/types.h>
    302 #  include <sys/mman.h>
    303 QT_END_INCLUDE_NAMESPACE
    304 #endif // Q_OS_FREEBSD || Q_OS_LINUX
    305 
    306298static long qt_find_pattern(const char *s, ulong s_len,
    307299                             const char *pattern, ulong p_len)
     
    364356
    365357    QByteArray data;
    366     char *filedata = 0;
    367     ulong fdlen = 0;
    368 
    369 # ifdef USE_MMAP
    370     char *mapaddr = 0;
    371     size_t maplen = file.size();
    372     mapaddr = (char *) mmap(mapaddr, maplen, PROT_READ, MAP_PRIVATE, file.handle(), 0);
    373     if (mapaddr != MAP_FAILED) {
    374         // mmap succeeded
    375         filedata = mapaddr;
    376         fdlen = maplen;
    377     } else {
    378         // mmap failed
    379         if (qt_debug_component()) {
    380             qWarning("mmap: %s", qPrintable(qt_error_string(errno)));
    381         }
    382         if (lib)
    383             lib->errorString = QLibrary::tr("Could not mmap '%1': %2")
    384                 .arg(library)
    385                 .arg(qt_error_string());
    386 # endif // USE_MMAP
     358    const char *filedata = 0;
     359    ulong fdlen = file.size();
     360    filedata = (char *) file.map(0, fdlen);
     361    if (filedata == 0) {
    387362        // try reading the data into memory instead
    388363        data = file.readAll();
    389         filedata = data.data();
     364        filedata = data.ata();
    390365        fdlen = data.size();
    391 # ifdef USE_MMAP
    392     }
    393 # endif // USE_MMAP
     366    }
    394367
    395368    // verify that the pattern is present in the plugin
     
    404377    if (!ret && lib)
    405378        lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library);
    406 # ifdef USE_MMAP
    407     if (mapaddr != MAP_FAILED && munmap(mapaddr, maplen) != 0) {
    408         if (qt_debug_component())
    409             qWarning("munmap: %s", qPrintable(qt_error_string(errno)));
    410         if (lib)
    411             lib->errorString = QLibrary::tr("Could not unmap '%1': %2")
    412                 .arg(library)
    413                 .arg( qt_error_string() );
    414     }
    415 # endif // USE_MMAP
    416 
    417379    file.close();
    418380    return ret;
     
    621583    bool success = false;
    622584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
    623599    QFileInfo fileinfo(fileName);
    624600
     
    631607                     .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false"))
    632608                     .arg(fileName);
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
    633625    QStringList reg;
    634626#ifndef QT_NO_SETTINGS
     
    761753            .arg(debug ? QLatin1String("debug") : QLatin1String("release"));
    762754    } else if (key != QT_BUILD_KEY
     755
    763756#ifdef QT_BUILD_KEY_COMPAT
    764                // be sure to load plugins using an older but compatible build key
    765757               && key != QT_BUILD_KEY_COMPAT
     758
     759
     760
    766761#endif
    767762               ) {
Note: See TracChangeset for help on using the changeset viewer.