Example #1
0
void createIndexFile(const char *path, char *inputMapping, char *indxName) {
    char *inputFileMapping = inputMapping;
    char name[50];
    selectName(path, name);
    char dir[50];
    selectDir(path, dir);
//    int len = strlen(name);
    sprintf(indxName, "%s.%s.indx", dir, name);
    int size = readInt(&inputFileMapping);
    DWORD fsLow = size * sizeof(Record);
    FileMapping map = createSizedFileMapping(indxName, CREATE_ALWAYS, fsLow);
    Record *records = (Record *)map.pObjFile;
    int skipped;
    inputFileMapping = skipUntilNewLine(inputFileMapping, &skipped);
    for (int i = 0; i < size; i++) {
        int key = readInt(&inputFileMapping);
        inputFileMapping++;
        size_t offset = inputFileMapping - _BASE_STR;
        inputFileMapping = skipUntilNewLine(inputFileMapping, &skipped);
        BasedStr based = {offset, skipped - 2};
        Record rec = {key, based};
        records[i] = rec;
    }
    removeFileMapping(map);
}
Example #2
0
KisRecordedShapePaintAction::KisRecordedShapePaintAction(
    const KisNodeQueryPath& path,
    const KisPaintOpPresetSP preset,
    Shape shape,
    const QRectF& rect)
        : KisRecordedPaintAction("ShapePaintAction", selectName(shape), path, preset)
        , d(new Private)
{
    d->shape = shape;
    d->rectangle = rect;
}