static void ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, u_int our_id, char channel, u_int target_id) { struct scsi_target *starget; struct ahd_initiator_tinfo *tinfo; struct ahd_tmode_tstate *tstate; int lun; tinfo = ahd_fetch_transinfo(ahd, channel, our_id, target_id, &tstate); copy_info(info, "Target %d Negotiation Settings\n", target_id); copy_info(info, "\tUser: "******"\tGoal: "); ahd_format_transinfo(info, &tinfo->goal); copy_info(info, "\tCurr: "); ahd_format_transinfo(info, &tinfo->curr); for (lun = 0; lun < AHD_NUM_LUNS; lun++) { struct scsi_device *dev; dev = scsi_device_lookup_by_target(starget, lun); if (dev == NULL) continue; ahd_dump_device_state(info, dev); } }
void file_info::copy(const file_info & p_source) { if (&p_source != this) { copy_meta(p_source); copy_info(p_source); set_length(p_source.get_length()); set_replaygain(p_source.get_replaygain()); } }
void OCIOColorSpace::_validate(bool for_real) { input0().validate(for_real); if(!m_hasColorSpaces) { error("No colorspaces available for input and/or output."); return; } int inputColorSpaceCount = static_cast<int>(m_inputColorSpaceCstrNames.size()) - 1; if(m_inputColorSpaceIndex < 0 || m_inputColorSpaceIndex >= inputColorSpaceCount) { std::ostringstream err; err << "Input colorspace index (" << m_inputColorSpaceIndex << ") out of range."; error(err.str().c_str()); return; } int outputColorSpaceCount = static_cast<int>(m_outputColorSpaceCstrNames.size()) - 1; if(m_outputColorSpaceIndex < 0 || m_outputColorSpaceIndex >= outputColorSpaceCount) { std::ostringstream err; err << "Output colorspace index (" << m_outputColorSpaceIndex << ") out of range."; error(err.str().c_str()); return; } try { const char * inputName = m_inputColorSpaceCstrNames[m_inputColorSpaceIndex]; const char * outputName = m_outputColorSpaceCstrNames[m_outputColorSpaceIndex]; OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig(); config->sanityCheck(); OCIO::ConstContextRcPtr context = getLocalContext(); m_processor = config->getProcessor(context, inputName, outputName); } catch(OCIO::Exception &e) { error(e.what()); return; } if(m_processor->isNoOp()) { // TODO or call disable() ? set_out_channels(DD::Image::Mask_None); // prevents engine() from being called copy_info(); return; } set_out_channels(DD::Image::Mask_All); DD::Image::PixelIop::_validate(for_real); }
/** * gwy_surface_new_alike: * @model: A surface to use as the template. * * Creates a new empty surface similar to another surface. * * The units of the new surface will be identical to those of @model but the * new surface will not contain any points. Use gwy_surface_duplicate() to * completely duplicate a surface including data. * * Returns: A new empty surface. * * Since: 2.45 **/ GwySurface* gwy_surface_new_alike(GwySurface *model) { GwySurface *surface; g_return_val_if_fail(GWY_IS_SURFACE(model), NULL); surface = g_object_newv(GWY_TYPE_SURFACE, 0, NULL); copy_info(surface, model); gwy_surface_invalidate(surface); return surface; }
static GObject* gwy_surface_duplicate_real(GObject *object) { GwySurface *surface, *duplicate; g_return_val_if_fail(GWY_IS_SURFACE(object), NULL); surface = GWY_SURFACE(object); duplicate = gwy_surface_new_from_data(surface->data, surface->n); copy_info(duplicate, surface); return (GObject*)duplicate; }
static void ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, u_int our_id, char channel, u_int target_id, u_int target_offset) { struct ahc_linux_target *targ; struct scsi_target *starget; struct ahc_initiator_tinfo *tinfo; struct ahc_tmode_tstate *tstate; int lun; tinfo = ahc_fetch_transinfo(ahc, channel, our_id, target_id, &tstate); if ((ahc->features & AHC_TWIN) != 0) copy_info(info, "Channel %c ", channel); copy_info(info, "Target %d Negotiation Settings\n", target_id); copy_info(info, "\tUser: "******"\tGoal: "); ahc_format_transinfo(info, &tinfo->goal); copy_info(info, "\tCurr: "); ahc_format_transinfo(info, &tinfo->curr); for (lun = 0; lun < AHC_NUM_LUNS; lun++) { struct scsi_device *sdev; sdev = targ->sdev[lun]; if (sdev == NULL) continue; ahc_dump_device_state(info, sdev); } }
void OCIOFileTransform::_validate(bool for_real) { input0().validate(for_real); if(!src) { error("The source file must be specified."); return; } try { OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig(); config->sanityCheck(); OCIO::FileTransformRcPtr transform = OCIO::FileTransform::Create(); transform->setSrc(src); // TODO: For some reason, cccid is NOT incorporated in this node's hash. // Until then, cccid is considered broken. Figure out why. transform->setCCCId(cccid.c_str()); if(dirindex == 0) transform->setDirection(OCIO::TRANSFORM_DIR_FORWARD); else transform->setDirection(OCIO::TRANSFORM_DIR_INVERSE); if(interpindex == 0) transform->setInterpolation(OCIO::INTERP_NEAREST); else transform->setInterpolation(OCIO::INTERP_LINEAR); processor = config->getProcessor(transform, OCIO::TRANSFORM_DIR_FORWARD); } catch(OCIO::Exception &e) { error(e.what()); return; } if(processor->isNoOp()) { // TODO or call disable() ? set_out_channels(DD::Image::Mask_None); // prevents engine() from being called copy_info(); return; } set_out_channels(DD::Image::Mask_All); DD::Image::PixelIop::_validate(for_real); }
static void gwy_surface_clone_real(GObject *source, GObject *copy) { GwySurface *surface, *clone; g_return_if_fail(GWY_IS_SURFACE(source)); g_return_if_fail(GWY_IS_SURFACE(copy)); surface = GWY_SURFACE(source); clone = GWY_SURFACE(copy); if (clone->n != surface->n) { clone->n = surface->n; alloc_data(clone); } gwy_assign(clone->data, surface->data, surface->n); copy_info(clone, surface); }
void ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) { u_int speed; u_int freq; u_int mb; speed = 3300; freq = 0; if (tinfo->offset != 0) { freq = ahc_calc_syncsrate(tinfo->period); speed = freq; } speed *= (0x01 << tinfo->width); mb = speed / 1000; if (mb > 0) copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); else copy_info(info, "%dKB/s transfers", speed); if (freq != 0) { copy_info(info, " (%d.%03dMHz%s, offset %d", freq / 1000, freq % 1000, (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 ? " DT" : "", tinfo->offset); } if (tinfo->width > 0) { if (freq != 0) { copy_info(info, ", "); } else { copy_info(info, " ("); } copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); } else if (freq != 0) { copy_info(info, ")"); } copy_info(info, "\n"); }
static void ahd_dump_device_state(struct info_str *info, struct scsi_device *sdev) { struct ahd_linux_device *dev = scsi_transport_device_data(sdev); copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", sdev->sdev_target->channel + 'A', sdev->sdev_target->id, sdev->lun); copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); copy_info(info, "\t\tCommands Active %d\n", dev->active); copy_info(info, "\t\tCommand Openings %d\n", dev->openings); copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); }
void OCIOCDLTransform::_validate(bool for_real) { input0().validate(for_real); try { OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig(); config->sanityCheck(); OCIO::CDLTransformRcPtr cc = OCIO::CDLTransform::Create(); cc->setSlope(m_slope); cc->setOffset(m_offset); cc->setPower(m_power); cc->setSat(m_saturation); if(m_dirindex == 0) cc->setDirection(OCIO::TRANSFORM_DIR_FORWARD); else cc->setDirection(OCIO::TRANSFORM_DIR_INVERSE); m_processor = config->getProcessor(cc); } catch(OCIO::Exception &e) { error(e.what()); return; } if(m_processor->isNoOp()) { // TODO or call disable() ? set_out_channels(DD::Image::Mask_None); // prevents engine() from being called copy_info(); return; } set_out_channels(DD::Image::Mask_All); DD::Image::PixelIop::_validate(for_real); }
void ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) { u_int speed; u_int freq; u_int mb; if (tinfo->period == AHD_PERIOD_UNKNOWN) { copy_info(info, "Renegotiation Pending\n"); return; } speed = 3300; freq = 0; if (tinfo->offset != 0) { freq = ahd_calc_syncsrate(tinfo->period); speed = freq; } speed *= (0x01 << tinfo->width); mb = speed / 1000; if (mb > 0) copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); else copy_info(info, "%dKB/s transfers", speed); if (freq != 0) { int printed_options; printed_options = 0; copy_info(info, " (%d.%03dMHz", freq / 1000, freq % 1000); if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { copy_info(info, " RDSTRM"); printed_options++; } if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { copy_info(info, "%s", printed_options ? "|DT" : " DT"); printed_options++; } if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { copy_info(info, "%s", printed_options ? "|IU" : " IU"); printed_options++; } if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { copy_info(info, "%s", printed_options ? "|RTI" : " RTI"); printed_options++; } if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { copy_info(info, "%s", printed_options ? "|QAS" : " QAS"); printed_options++; } } if (tinfo->width > 0) { if (freq != 0) { copy_info(info, ", "); } else { copy_info(info, " ("); } copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); } else if (freq != 0) { copy_info(info, ")"); } copy_info(info, "\n"); }
/* * Return information to handle /proc support for the driver. */ int ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, int inout) { struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; struct info_str info; char ahc_info[256]; u_int max_targ; u_int i; int retval; /* Has data been written to the file? */ if (inout == TRUE) { retval = ahc_proc_write_seeprom(ahc, buffer, length); goto done; } if (start) *start = buffer; info.buffer = buffer; info.length = length; info.offset = offset; info.pos = 0; copy_info(&info, "Adaptec AIC7xxx driver version: %s\n", AIC7XXX_DRIVER_VERSION); copy_info(&info, "%s\n", ahc->description); ahc_controller_info(ahc, ahc_info); copy_info(&info, "%s\n", ahc_info); copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", ahc->scb_data->numscbs, AHC_NSEG); if (ahc->seep_config == NULL) copy_info(&info, "No Serial EEPROM\n"); else { copy_info(&info, "Serial EEPROM:\n"); for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { if (((i % 8) == 0) && (i != 0)) { copy_info(&info, "\n"); } copy_info(&info, "0x%.4x ", ((uint16_t*)ahc->seep_config)[i]); } copy_info(&info, "\n"); } copy_info(&info, "\n"); max_targ = 16; if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) max_targ = 8; for (i = 0; i < max_targ; i++) { u_int our_id; u_int target_id; char channel; channel = 'A'; our_id = ahc->our_id; target_id = i; if (i > 7 && (ahc->features & AHC_TWIN) != 0) { channel = 'B'; our_id = ahc->our_id_b; target_id = i % 8; } ahc_dump_target_state(ahc, &info, our_id, channel, target_id, i); } retval = info.pos > info.offset ? info.pos - info.offset : 0; done: return (retval); }
void OCIOLookTransform::_validate(bool for_real) { input0().validate(for_real); if(!m_hasColorSpaces) { error("No colorspaces available for input and/or output."); return; } int inputColorSpaceCount = static_cast<int>(m_inputColorSpaceCstrNames.size()) - 1; if(m_inputColorSpaceIndex < 0 || m_inputColorSpaceIndex >= inputColorSpaceCount) { std::ostringstream err; err << "Input colorspace index (" << m_inputColorSpaceIndex << ") out of range."; error(err.str().c_str()); return; } int outputColorSpaceCount = static_cast<int>(m_outputColorSpaceCstrNames.size()) - 1; if(m_outputColorSpaceIndex < 0 || m_outputColorSpaceIndex >= outputColorSpaceCount) { std::ostringstream err; err << "Output colorspace index (" << m_outputColorSpaceIndex << ") out of range."; error(err.str().c_str()); return; } try { const char * inputName = m_inputColorSpaceCstrNames[m_inputColorSpaceIndex]; const char * outputName = m_outputColorSpaceCstrNames[m_outputColorSpaceIndex]; OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig(); config->sanityCheck(); OCIO::LookTransformRcPtr transform = OCIO::LookTransform::Create(); const char * look = m_lookCstrNames[m_lookIndex]; if(look != NULL) { transform->setLooks(look); } OCIO::ConstContextRcPtr context = getLocalContext(); OCIO::TransformDirection direction = OCIO::TRANSFORM_DIR_UNKNOWN; bool invertTransform = (m_dirIndex == 0) ? false : true; // Forward if(!invertTransform) { transform->setSrc(inputName); transform->setDst(outputName); direction = OCIO::TRANSFORM_DIR_FORWARD; } else { // The TRANSFORM_DIR_INVERSE applies an inverse for the end-to-end transform, // which would otherwise do dst->inv look -> src. // This is an unintuitive result for the artist (who would expect in, out to // remain unchanged), so we account for that here by flipping src/dst transform->setSrc(outputName); transform->setDst(inputName); direction = OCIO::TRANSFORM_DIR_INVERSE; } try { m_processor = config->getProcessor(context, transform, direction); } // We only catch the exceptions for missing files, and try to succeed // in this case. All other errors represent more serious problems and // should fail through. catch(const OCIO::ExceptionMissingFile &e) { if(!m_ignoreErrors) throw; m_processor = config->getProcessor(context, inputName, outputName); } } catch(const OCIO::Exception &e) { error(e.what()); return; } catch (...) { error("OCIOLookTransform: Unknown exception during _validate."); return; } if(m_processor->isNoOp()) { // TODO or call disable() ? set_out_channels(DD::Image::Mask_None); // prevents engine() from being called copy_info(); return; } set_out_channels(DD::Image::Mask_All); DD::Image::PixelIop::_validate(for_real); }
/* ================= Sys_ListFiles_r Internal function to filesystem. Conventions apply: - files should hold at least MAX_LISTED_FILES - *count_p must be initialized in range [0, MAX_LISTED_FILES - 1] - depth must be 0 on the first call ================= */ void Sys_ListFiles_r(const char *path, const char *filter, unsigned flags, size_t baselen, int *count_p, void **files, int depth) { WIN32_FIND_DATAA data; HANDLE handle; char fullpath[MAX_OSPATH], *name; size_t pathlen, len; unsigned mask; void *info; // optimize single extension search if (!(flags & FS_SEARCH_BYFILTER) && filter && !strchr(filter, ';')) { if (*filter == '.') { filter++; } len = Q_concat(fullpath, sizeof(fullpath), path, "\\*.", filter, NULL); filter = NULL; // do not check it later } else { len = Q_concat(fullpath, sizeof(fullpath), path, "\\*", NULL); } if (len >= sizeof(fullpath)) { return; } // format path to windows style // done on the first run only if (!depth) { FS_ReplaceSeparators(fullpath, '\\'); } handle = FindFirstFileA(fullpath, &data); if (handle == INVALID_HANDLE_VALUE) { return; } // make it point right after the slash pathlen = strlen(path) + 1; do { if (!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")) { continue; // ignore special entries } // construct full path len = strlen(data.cFileName); if (pathlen + len >= sizeof(fullpath)) { continue; } memcpy(fullpath + pathlen, data.cFileName, len + 1); if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { mask = FS_SEARCH_DIRSONLY; } else { mask = 0; } // pattern search implies recursive search if ((flags & FS_SEARCH_BYFILTER) && mask && depth < MAX_LISTED_DEPTH) { Sys_ListFiles_r(fullpath, filter, flags, baselen, count_p, files, depth + 1); // re-check count if (*count_p >= MAX_LISTED_FILES) { break; } } // check type if ((flags & FS_SEARCH_DIRSONLY) != mask) { continue; } // check filter if (filter) { if (flags & FS_SEARCH_BYFILTER) { if (!FS_WildCmp(filter, fullpath + baselen)) { continue; } } else { if (!FS_ExtCmp(filter, data.cFileName)) { continue; } } } // strip path if (flags & FS_SEARCH_SAVEPATH) { name = fullpath + baselen; } else { name = data.cFileName; } // reformat it back to quake filesystem style FS_ReplaceSeparators(name, '/'); // strip extension if (flags & FS_SEARCH_STRIPEXT) { *COM_FileExtension(name) = 0; if (!*name) { continue; } } // copy info off if (flags & FS_SEARCH_EXTRAINFO) { info = copy_info(name, &data); } else { info = FS_CopyString(name); } files[(*count_p)++] = info; } while (*count_p < MAX_LISTED_FILES && FindNextFileA(handle, &data) != FALSE); FindClose(handle); }
/* * Return information to handle /proc support for the driver. */ int ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, int inout) { struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; struct info_str info; char ahd_info[256]; u_int max_targ; u_int i; int retval; /* Has data been written to the file? */ if (inout == TRUE) { retval = ahd_proc_write_seeprom(ahd, buffer, length); goto done; } if (start) *start = buffer; info.buffer = buffer; info.length = length; info.offset = offset; info.pos = 0; copy_info(&info, "Adaptec AIC79xx driver version: %s\n", AIC79XX_DRIVER_VERSION); copy_info(&info, "%s\n", ahd->description); ahd_controller_info(ahd, ahd_info); copy_info(&info, "%s\n", ahd_info); copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", ahd->scb_data.numscbs, AHD_NSEG); max_targ = 15; if (ahd->seep_config == NULL) copy_info(&info, "No Serial EEPROM\n"); else { copy_info(&info, "Serial EEPROM:\n"); for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { if (((i % 8) == 0) && (i != 0)) { copy_info(&info, "\n"); } copy_info(&info, "0x%.4x ", ((uint16_t*)ahd->seep_config)[i]); } copy_info(&info, "\n"); } copy_info(&info, "\n"); if ((ahd->features & AHD_WIDE) == 0) max_targ = 7; for (i = 0; i <= max_targ; i++) { ahd_dump_target_state(ahd, &info, ahd->our_id, 'A', /*target_id*/i, /*target_offset*/i); } retval = info.pos > info.offset ? info.pos - info.offset : 0; done: return (retval); }
void retag_set_info(t_uint32 p_subsong, const file_info &p_info, abort_callback &p_abort) { copy_info(module_info.author, p_info, "composer"); copy_info(module_info.name, p_info, "title"); copy_info(module_info.date, p_info, "date"); }