KoGenStyles::StyleMap::iterator KoGenStyles::Private::insertStyle(const KoGenStyle &style,
                                                                  const QString& baseName, InsertionFlags flags)
{
    QString styleName(baseName);
    if (styleName.isEmpty()) {
        switch (style.type()) {
        case KoGenStyle::ParagraphAutoStyle: styleName = 'P'; break;
        case KoGenStyle::ListAutoStyle: styleName = 'L'; break;
        case KoGenStyle::TextAutoStyle: styleName = 'T'; break;
        default:
            styleName = 'A'; // for "auto".
        }
        flags &= ~DontAddNumberToName; // i.e. force numbering
    }
    styleName = makeUniqueName(styleName, style.m_familyName, flags);
    if (style.autoStyleInStylesDotXml())
        autoStylesInStylesDotXml[style.m_familyName].insert(styleName);
    else
        styleNames[style.m_familyName].insert(styleName);
    KoGenStyles::StyleMap::iterator it = styleMap.insert(style, styleName);
    NamedStyle s;
    s.style = &it.key();
    s.name = styleName;
    styleList.append(s);
    return it;
}
// CREATORS
bslmt::SemaphoreImpl<bslmt::Platform::DarwinSemaphore>::SemaphoreImpl(
                                                                     int count)
{
    bsl::string semaphoreName(
        makeUniqueName(s_semaphorePrefix,
                       reinterpret_cast<bsls::Types::UintPtr>(this)));

    do {
        // create a named semaphore with exclusive access
        d_sem_p = ::sem_open(semaphoreName.c_str(),
                             O_CREAT | O_EXCL,
                             S_IRUSR | S_IWUSR,
                             count);
    } while (d_sem_p == SEM_FAILED && (errno == EEXIST || errno == EINTR));

    BSLS_ASSERT(d_sem_p != SEM_FAILED);

    // At this point the current thread is the sole owner of the semaphore with
    // this name.  No other thread can create a semaphore with the same name
    // until we disassociate the name from the semaphore handle.  Note that
    // even though the name is unlinked from the semaphore, we still try to use
    // sufficiently unique names because if the process is killed before it
    // unlinks the name, no other process can create a semaphore with that
    // name.
    int result = ::sem_unlink(semaphoreName.c_str());

    (void) result;
    BSLS_ASSERT(result == 0);
}
Beispiel #3
0
static void resolveLabelNames( owl_file_handle file ) {
//*****************************************************

    owl_symbol_handle   sym;
    unsigned            index;

    index = 0;
    for( sym = file->symbol_table->head; sym != NULL; sym = sym->next ) {
        if( _OwlMetaSymbol( sym->type ) ) continue;
        if( sym->name == NULL ) {
            /*
             * Really checking to make sure sym has no special info attached
             * below, but for now func != NULL is good enough.
             */
            if( sym->num_relocs == 0 && sym->x.func == NULL ) {
                sym->flags |= OWL_SYM_DEAD;
                if( _OwlLinkageGlobal(sym->linkage) ) {
                    file->symbol_table->num_global_symbols--;
                } else {
                    file->symbol_table->num_local_symbols--;
                }
            } else {
                makeUniqueName( file, sym, index++ );
            }
        }
    }
}
void
ut_qtcontacts_trackerplugin_common::setTestNicknameToContact(QContact &contact,
                                                             const QString &id) const
{
    QContactNickname nicknameDetail;
    const QString nickname = makeUniqueName(id);
    nicknameDetail.setNickname(nickname);
    QVERIFY(contact.saveDetail(&nicknameDetail));
}