TSend::TSend(Track* track, AudioBus* bus) : m_track(track) { m_bus = bus; m_id = create_id(); init(); }
SSID_t StoreSet::create_set(AddrType PC) /* create_set {{{1 */ { SSID_t SSID = create_id(); ID(SSID_t oldSSID = get_SSID(PC)); //I(LFST[SSID]==0); set_SSID(PC, SSID); LFST[SSID] = NULL; I(SSID < StoreSetSize); IS(if(isValidSSID(oldSSID)) { LFST[oldSSID] = NULL; }); //debug only
unsigned int *read_id_table(int fd, struct squashfs_super_block *sBlk) { int indexes = SQUASHFS_ID_BLOCKS(sBlk->no_ids); long long index[indexes]; int bytes = SQUASHFS_ID_BYTES(sBlk->no_ids); unsigned int *id_table; int res, i; id_table = malloc(bytes); if(id_table == NULL) MEM_ERROR(); res = read_fs_bytes(fd, sBlk->id_table_start, SQUASHFS_ID_BLOCK_BYTES(sBlk->no_ids), index); if(res == 0) { ERROR("Failed to read id table index\n"); ERROR("Filesystem corrupted?\n"); free(id_table); return NULL; } SQUASHFS_INSWAP_ID_BLOCKS(index, indexes); for(i = 0; i < indexes; i++) { int expected = (i + 1) != indexes ? SQUASHFS_METADATA_SIZE : bytes & (SQUASHFS_METADATA_SIZE - 1); int length = read_block(fd, index[i], NULL, expected, ((unsigned char *) id_table) + (i * SQUASHFS_METADATA_SIZE)); TRACE("Read id table block %d, from 0x%llx, length %d\n", i, index[i], length); if(length == 0) { ERROR("Failed to read id table block %d, from 0x%llx, " "length %d\n", i, index[i], length); ERROR("Filesystem corrupted?\n"); free(id_table); return NULL; } } SQUASHFS_INSWAP_INTS(id_table, sBlk->no_ids); for(i = 0; i < sBlk->no_ids; i++) { TRACE("Adding id %d to id tables\n", id_table[i]); create_id(id_table[i]); } return id_table; }
AudioTrack::AudioTrack(Sheet* sheet, const QString& name, int height ) : Track(sheet) , m_sheet(sheet) { PENTERCONS; m_id = create_id(); m_name = name; sheet->set_track_height(m_id, height); m_pan = m_numtakes = 0; m_showClipVolumeAutomation = false; m_busInName = "Capture 1-2"; init(); }
AudioChannel::AudioChannel(const QString& name, uint channelNumber, int type, qint64 id) { m_name = name; m_number = channelNumber; m_type = type; m_monitoring = true; m_buffer = 0; m_bufferSize = 0; mlocked = 0; if (id == 0) { m_id = create_id(); } else { m_id = id; } }
TBusTrack::TBusTrack(TSession* session, const QString& name, int channelCount) : Track(session) { QObject::tr("Bus Track"); m_id = create_id(); m_name = name; m_channelCount = channelCount; m_fader->set_gain(1.0); create_process_bus(); m_processBus->set_id(m_id); m_processBus->set_name(m_name); session->set_track_height(m_id, INITIAL_HEIGHT); }
} END_TEST START_TEST (test_create_id_MNID_ID) { struct MAPINAMEID nameid = {0}; uint16_t mapped_id = 42; nameid.ulKind = MNID_ID; nameid.kind.lid = 42; int ret = create_id(g_nprops, nameid, mapped_id); ck_assert_int_eq(ret, MAPISTORE_SUCCESS); mapped_id = 0; ret = get_mapped_id(g_nprops, nameid, &mapped_id); ck_assert_int_eq(ret, MAPISTORE_SUCCESS); ck_assert_int_eq(mapped_id, 42); } END_TEST
Method* Profiler::find_method(Env* env, rmethod cm, rsymbol container, rsymbol name, Kind kind) { method_id id = create_id(env, cm, container, name, kind); Method* method; MethodMap::iterator iter = methods_.find(id); if(iter == methods_.end()) { method = new Method(id, name, container, kind); methods_[method->id()] = method; } else { method = iter->second; } return method; }
} END_TEST START_TEST (test_create_id_MNID_STRING) { struct MAPINAMEID nameid = {0}; uint16_t mapped_id = 41; TALLOC_CTX *local_mem_ctx = talloc(NULL, TALLOC_CTX); nameid.ulKind = MNID_STRING; nameid.kind.lpwstr.Name = talloc_strdup(local_mem_ctx, "foobar"); int ret = create_id(g_nprops, nameid, mapped_id); ck_assert_int_eq(ret, MAPISTORE_SUCCESS); mapped_id = 0; ret = get_mapped_id(g_nprops, nameid, &mapped_id); ck_assert_int_eq(ret, MAPISTORE_SUCCESS); ck_assert_int_eq(mapped_id, 41); talloc_free(local_mem_ctx); } END_TEST
/** Attach to an already existing shared matrix */ bool MatrixDouble::attach(const char* file) { width=height=0; data = 0; bOwner = false; this->id = create_id(file); key = ftok(id.c_str(), 1); if(key==-1) return false; size_t* _data = NULL; try{ _data = (size_t*)attach_shared_mem(key, &_shmid); }catch(...){} if(!_data) return false; width = *_data++; height = *_data++; data = (double*)_data; bShared = true; cout << "Found shared matrix : " << file << "\n"; return true; }
MidiPort::MidiPort() : _state("not configured") { _defaultInChannels = 0; _defaultOutChannels = 0; _device = 0; _instrument = 0; _controller = new MidiCtrlValListList(); _foundInSongFile = false; _patchSequences = QList<PatchSequence*>(); m_portId = create_id(); // // create minimum set of managed controllers // to make midi mixer operational // for (int i = 0; i < kMaxMidiChannels; ++i) { addManagedController(i, CTRL_PROGRAM); addManagedController(i, CTRL_VOLUME); addManagedController(i, CTRL_PANPOT); } }
static int process(struct cmd_line_options* cmd_line_options) { int result = EXIT_FAILURE; uint32_t entries; struct state state; param_t *par; CSPSA_Handle_t handle; char idstr[BUFSIZ]; int i; int cspsa_written = 0; memset(&state, 0, sizeof(state)); if (cmd_line_options->debug) { printf(PROGRAM ": Processing %s (only stuff below", cmd_line_options->inpath); for (i = 0; i < cmd_line_options->subpaths; i++) printf(" %s", cmd_line_options->subpath[i]); printf("), writing to %s.\n", cmd_line_options->area); } result = init_cspsa(cmd_line_options->area, &handle); if (result != EXIT_SUCCESS) goto error_exit; /* unit id 0 is reserved for the number of entries */ state.entries = 1; /* create entries in a linked list for each file * or directory in the input directory tree */ if (cmd_line_options->subpaths) { for (i = 0; i < cmd_line_options->subpaths; i++) { result |= process_dirtree(cmd_line_options, cmd_line_options->inpath, "/", cmd_line_options->subpath[i], &state); } } else { result = process_dirtree(cmd_line_options, cmd_line_options->inpath, "/", NULL, &state); } if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* Create small header */ result = create_id(PROGRAM, STRINGIFY(VERSION), idstr, BUFSIZ); if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* Wipe key 0, we have no parameter entries in CSPSA yet */ entries = 0; cspsa_written = 1; result = emit_parameter_to_cspsa(cmd_line_options, &handle, 0, sizeof (entries), (unsigned char *) &entries); if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* Make sure key 0 hits storage */ result = flush_cspsa(&handle); if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* Write header */ result = emit_parameter_to_cspsa(cmd_line_options, &handle, MAX_FILES + 1, strlen(idstr) + 1, (unsigned char *) idstr); if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* Dump the stuff, par points to head of linked list */ par = state.par; while (par != NULL) { result = emit_parameter_to_cspsa(cmd_line_options, &handle, par->key, par->size, par->data); if (result != EXIT_SUCCESS) goto error_exit; par = next_param(par); } /* Make sure the parameters hit storage before key 0 */ result = flush_cspsa(&handle); if (result != EXIT_SUCCESS) { fprintf(stderr, ERRORSTR_INTERNAL, __LINE__); goto error_exit; } /* a unit id 0 output the number of files+dirs */ entries = state.entries - 1; result = emit_parameter_to_cspsa(cmd_line_options, &handle, 0, sizeof (entries), (unsigned char *) &entries); printf(PROGRAM ": Read %d entries from %s, wrote to %s\n", entries, cmd_line_options->inpath, cmd_line_options->area); error_exit: if (state.par) free_param(state.par); result |= exit_cspsa(&handle); if (result != EXIT_SUCCESS) { if (cspsa_written) fprintf(stderr, ERRORSTR PROGRAM ": WARNING: CSPSA was most likely modified!\n"); else fprintf(stderr, ERRORSTR PROGRAM ": CSPSA was NOT modified.\n"); } return result; }
int main(int argc, char *argv[]) { iksid *myjabberid = NULL; char *jabberid = NULL; char *resource = NULL; int state,args; int port = 0; if(argc > 2) { for (args=1; args < argc; args++) { if(!strncmp(argv[args], "-u", sizeof(argv[args]))) { jabberid = argv[args+1]; #ifdef DEBUG puts((char *) jabberid); #endif } else { if(!strncmp(argv[args], "-p", sizeof(argv[args]))) { port = atoi(argv[args+1]); if(port == 0) if(error("can't bind to this port")) return 1; #ifdef DEBUG printf("port: %i\n", port); #endif } if(!strncmp(argv[args],"-r",sizeof(argv[args]))){ resource = argv[args+1]; #ifdef DEBUG printf("resource: %s\n",resource); #endif } } } } /* * initialising the struct net of the type netdata */ struct netdata net; /* * create a new SAX parser */ net.parser = iks_sax_new(NULL, tagHook, cdataHook); /* * check if the parser is valid */ if(!net.parser) error("f**k off damn bastard."); /* * create a new stream on the parser */ net.parser = iks_stream_new(IKS_NS_CLIENT, &net, (iksStreamHook *) tagHook); #ifdef DEBUG if(net.parser) puts("net.parser initiated."); #endif /* * copy the new jabberid to the net struct */ net.id = create_id(jabberid, &net); /* * just a boring message.. ;-) */ printf("Connecting to '%s'...", net.id->server); /* * try to connect to the remote server */ if(port == 0) state = iks_connect_tcp(net.parser, net.id->server, IKS_JABBER_PORT); else state = iks_connect_tcp(net.parser, net.id->server, port); /* * check wether the connection is established or not. */ switch (state) { case IKS_OK: /* * everything is OK! ;-) */ puts("OK"); break; case IKS_NET_NODNS: /* * hostname could not be resolved */ if(error("hostname lookup failed") == 1) return 1; case IKS_NET_NOSOCK: /* * socket descriptor cannot be created */ if(error("socket cannot be created") == 1) return 1; case IKS_NET_NOCONN: /* * the connection cannot be established.. * this could have several sources. */ if(error("connection failed") == 1) return 1; default: /* * everything else. */ if(error("io error") == 1) return 1; } /* * setting the resource */ if(!net.id->resource) net.id->resource = RESOURCE; #ifdef DEBUG printf ("username: %s\nserver: %s\nresource: %s\npartial: %s\nfull: %s\n", net.id->user, net.id->server, net.id->resource, net.id->partial, net.id->full); #endif /* * disconnect the parser. */ iks_disconnect(net.parser); /* * delete the parser.. */ iks_parser_delete(net.parser); return 0; }