static int valid_for_h323( const struct PluginCodec_Definition * codec, void * context, const char * key, void * parm , unsigned * parmLen) { if (parmLen == NULL || parm == NULL || *parmLen != sizeof(char *)) return 0; return (STRCMPI((const char *)parm, "h.323") == 0 || STRCMPI((const char *)parm, "h323") == 0) ? 1 : 0; }
BOOL Chk4Debug( LPTSTR lpd ) { BOOL bret = FALSE; LPTSTR ptmp = gszDiag; LPTSTR p; DWORD dwi; strcpy(ptmp, lpd); dwi = strlen(ptmp); if(dwi) { dwi--; if(ptmp[dwi] == '\\') { ptmp[dwi] = 0; p = strrchr(ptmp, '\\'); if(p) { p++; if( STRCMPI(p, "DEBUG") == 0 ) { *p = 0; strcpy(lpd,ptmp); // use this bret = TRUE; } } } } return bret; }
static int to_normalised_options(const struct PluginCodec_Definition * defn, void * context, const char * name, void * parm, unsigned * parmLen) { char frameTime[20], frameSize[20], newMode[20]; const char * const * option; if (parmLen == NULL || parm == NULL || *parmLen != sizeof(char ***)) return 0; frameTime[0] = frameSize[0] = newMode[0] = '\0'; for (option = *(const char * const * *)parm; *option != NULL; option += 2) { if (STRCMPI(option[0], PreferredModeStr) == 0) { int mode = get_mode(option[1]); sprintf(frameTime, "%i", mode == 30 ? BLOCKL_30MS : BLOCKL_20MS); sprintf(frameSize, "%i", mode == 30 ? NO_OF_BYTES_30MS : NO_OF_BYTES_20MS); sprintf(newMode, "%i", mode); } } if (frameTime[0] != '\0') { char ** options = (char **)calloc(7, sizeof(char *)); *(char ***)parm = options; if (options == NULL) return 0; options[0] = strdup(PLUGINCODEC_OPTION_FRAME_TIME); options[1] = strdup(frameTime); options[2] = strdup(PLUGINCODEC_OPTION_MAX_FRAME_SIZE); options[3] = strdup(frameSize); options[4] = strdup(PreferredModeStr); options[5] = strdup(newMode); } return 1; }
static int set_codec_options(const struct PluginCodec_Definition * defn, void * context, const char * name, void * parm, unsigned * parmLen) { const char * const * option; if (context == NULL || parm == NULL || parmLen == NULL || *parmLen != sizeof(const char **)) return 0; for (option = (const char * const *)parm; *option != NULL; option += 2) { if (STRCMPI(option[0], PreferredModeStr) == 0) { unsigned mode = get_mode(option[1]); if (defn->destFormat[0] == 'L') initDecode(context, mode, 0); else initEncode(context, mode); } } return 1; }
void ODBDirDlg::OnUnzip() { CString fullPath, filename; int sel = m_filesLB.GetCurSel(); if (sel == LB_ERR) return; m_filesLB.GetText(sel, filename); if (filename.Left(1) == "[") { filename.Remove('['); filename.Remove(']'); if (filename.Left(1) == "-") { filename.Remove('-'); m_dir = filename; m_dir += ":\\"; UpdateData(FALSE); FillFileList(); return; } fullPath = m_dir; if (fullPath.Right(1) != "\\") fullPath += "\\"; fullPath += filename; char oldPath[MAX_PATH]; ::GetCurrentDirectory(MAX_PATH, oldPath); if (!::SetCurrentDirectory(fullPath)) return; char newPath[MAX_PATH]; ::GetCurrentDirectory(MAX_PATH, newPath); m_dir = newPath; ::SetCurrentDirectory(oldPath); UpdateData(FALSE); FillFileList(); return; } fullPath = m_dir; if (fullPath.Right(1) != "\\") fullPath += "\\"; fullPath += filename; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; _splitpath( fullPath, drive, dir, fname, ext ); // path in quotes to allow blank names etc... CString commandLine; if (!STRCMPI(ext,".zip") || !STRCMPI(ext, ".gz")) { // By default gunzip does not recognize .zip files as valid input. // The -S param tells gunzip to recognize the given extension. // The default extension .gz remains recognized as well. commandLine.Format("gunzip -f -S .zip \"%s\" ", fullPath); DWORD exitCode; int stat = ExecAndWait(commandLine, SW_HIDE, &exitCode); if (stat != 0 || exitCode != 0) { CString tmp; tmp.Format("There was an error using gunzip.exe.\nUse Windows Explorer to unzip this archive.\n"); ErrorMessage(tmp, "Gunzip Error"); return; } } else if (!STRCMPI(ext,".tar")) { commandLine.Format("tar -x -f \"%s\" -C \"%s%s\"", fullPath, drive, make_unix_name(dir)); if (ExecAndWait(commandLine, SW_HIDE, NULL)) { CString tmp; tmp.Format("%s\nThere was an error using tar.exe.", commandLine); ErrorMessage(tmp, "Tar Error"); return; } } else if (!STRCMPI(ext,".tgz")) { // this unzips from tgz to tar commandLine.Format("gunzip -f \"%s\"", fullPath); if (ExecAndWait(commandLine, SW_HIDE, NULL)) { CString tmp; tmp.Format("%s\nThere was an error using gunzip.exe.", commandLine); ErrorMessage(tmp, "Gtz Error"); return; } commandLine.Format("tar -xf \"%s%s%s.tar\" -C \"%s%s\"", drive, dir, fname, drive, make_unix_name(dir)); if (ExecAndWait(commandLine, SW_HIDE, NULL)) { CString tmp; tmp.Format("%s\nThere was an error using tar.exe.", commandLine); ErrorMessage(tmp, "Tar Error"); return; } } else { CString tmp; tmp.Format("The file extension [%s] is unknown to the supported extract functions!", ext); ErrorMessage(tmp, "Can not Extraxt Extension"); } FillFileList(); return; }
void PCB_Grid::LoadGridSettings(CString fileName, BOOL warnFileOpen) { char line[255]; char *lp; FILE *fp; if ((fp = fopen(fileName,"rt")) == NULL) { if (warnFileOpen) ErrorMessage(fileName, "Unable to Open File!", MB_ICONEXCLAMATION | MB_OK); return; } double scale = 1; int decimal = GetDecimals(doc->getSettings().getPageUnits()); while (fgets(line,255,fp)) { if ((lp = get_string(line," \t\n")) == NULL) continue; if (lp[0] != '.') continue; if (!STRCMPI(lp,".Units")) { if ((lp = get_string(NULL," \t\n")) == NULL) continue; int units = GetUnitIndex(lp); if (units > -1) { m_pageUnits = units; scale = Units_Factor(units, doc->getSettings().getPageUnits()); } else { // unit error } } else if (!STRCMPI(lp,".Horizontal")) { if ((lp = get_string(NULL," \t\n")) == NULL) continue; m_horz = atoi(lp); if ((lp = get_string(NULL," \t\n")) == NULL) continue; m_hSteps = atoi(lp); if ((lp = get_string(NULL," \t\n")) == NULL) continue; setHSizePageUnits(atof(lp)); } else if (!STRCMPI(lp,".Vertical")) { if ((lp = get_string(NULL," \t\n")) == NULL) continue; m_vert = atoi(lp); if ((lp = get_string(NULL," \t\n")) == NULL) continue; m_vSteps = atoi(lp); if ((lp = get_string(NULL," \t\n")) == NULL) continue; setVSizePageUnits(atof(lp)); } else if (!STRCMPI(lp,".Thickness")) { if ((lp = get_string(NULL," \t\n")) == NULL) continue; m_gridThickness = atof(lp); } } fclose(fp); UpdateData(FALSE); }
u16 ui_video_m_get_video_icon(u16 *p_filename) { u16 id = IM_M_ICON_AVI; u16 *p_tip = NULL; u8 *p_ext = NULL; if(NULL == p_filename) { return id; } p_tip = uni_strrchr(p_filename, char_asc2uni('.')); if(NULL == p_tip) { return id; } p_ext = (u8 *)mtos_malloc(uni_strlen(p_tip) + 1); str_uni2asc(p_ext, p_tip); if(STRCMPI(p_ext, ".AVI") == 0) { id = IM_M_ICON_AVI; } else if(STRCMPI(p_ext, ".MKV") == 0) { id = IM_M_ICON_MKV; } else if(STRCMPI(p_ext, ".MP4") == 0) { id = IM_M_ICON_MP4; } else if(STRCMPI(p_ext, ".M2TS") == 0) { id = IM_M_ICON_M2TS; } else if(STRCMPI(p_ext, ".F4V") == 0) { id = IM_M_ICON_F4V; } else if(STRCMPI(p_ext, ".3GP") == 0) { id = IM_M_ICON_3GP; } else if(STRCMPI(p_ext, ".MOV") == 0) { id = IM_M_ICON_MOV; } else if(STRCMPI(p_ext, ".FLV") == 0) { id = IM_M_ICON_FLV; } else if(STRCMPI(p_ext, ".TS") == 0) { id = IM_M_ICON_TS; } else if(STRCMPI(p_ext, ".MPG") == 0) { id = IM_M_ICON_MPG; } mtos_free(p_ext); return id; }
// Tango allows layers from 0 = top to 22 void wtan_Graph_Level(const char *l) { if (l == NULL) return; if (!isdigit(l[0]) && l[0] != '-') { // here are layer names if (!STRCMPI(l,"TOPLAYER")) cur_layer = 0; else if (!STRCMPI(l,"BOTTOMLAYER")) cur_layer = 1; else if (!STRCMPI(l,"POWERLAYER")) cur_layer = 2; else if (!STRCMPI(l,"GROUNDLAYER")) cur_layer = 3; else if (!STRCMPI(l,"MID1LAYER")) cur_layer = 4; else if (!STRCMPI(l,"MID2LAYER")) cur_layer = 5; else if (!STRCMPI(l,"MID3LAYER")) cur_layer = 6; else if (!STRCMPI(l,"MID4LAYER")) cur_layer = 7; else if (!STRCMPI(l,"TOPSILKLAYER")) cur_layer = 8; else if (!STRCMPI(l,"BOTTOMSILKLAYER")) cur_layer = 9; else if (!STRCMPI(l,"TOPSOLDERLAYER")) cur_layer = 10; else if (!STRCMPI(l,"BOTTOMSOLDERLAYER")) cur_layer = 11; else if (!STRCMPI(l,"TOPASSLAYER")) cur_layer = 12; else if (!STRCMPI(l,"BOTTOMASSLAYER")) cur_layer = 13; else if (!STRCMPI(l,"BOARDLAYER")) cur_layer = 14; else if (!STRCMPI(l,"CONNECTLAYER")) cur_layer = 15; else if (!STRCMPI(l,"DRILLLAYER")) cur_layer = 16; else if (!STRCMPI(l,"KEEPOUTLAYER")) cur_layer = 17; else if (!STRCMPI(l,"TITLELAYER")) cur_layer = 18; else if (!STRCMPI(l,"MID5LAYER")) cur_layer = 19; else if (!STRCMPI(l,"MID6LAYER")) cur_layer = 20; else if (!STRCMPI(l,"MID7LAYER")) cur_layer = 21; else if (!STRCMPI(l,"MID8LAYER")) cur_layer = 22; else if (!STRCMPI(l,"ALL")) cur_layer = -1; // this is for all pins } else { cur_layer = atoi(l); if (cur_layer < 0) cur_layer = 0; if (cur_layer > 22) cur_layer = 22; } }
void LoadLayerTypeInfo(CCEtoODBDoc *doc, const char *filename) { CWaitCursor(); // try reading an xml layertype file first LayerTypeXMLReader reader(*doc); FileStatusTag retval = reader.open(filename); // if not successful, then assume its the old one if (retval == statusSucceeded) { // init for (int i=0; i<MAX_LAYERSETS; i++) { for (int j=0; j<MAX_LAYTYPE; j++) { doc->LayerTypeArray[i][j].color = RGB(255, 255, 255); doc->LayerTypeArray[i][j].show = false; } } //reader.setDoc(doc); retval = reader.parse(); return; } FILE *stream; if ((stream = fopen(filename, "rt")) == NULL) { ErrorMessage(filename, "Unable to open file"); return; } char line[500], *tok; int i, j; int version = 1; if (fgets(line,500,stream) == NULL) return; if (strcmp(line, "! Layertype Information\n")) { if (!strcmp(line, "! Layertype Information V2\n")) { version = 2; } else if (!strcmp(line, "! Layertype Information V3\n")) { version = 3; } else { ErrorMessage("This is not a Layertype Information File"); return; } } // init for (i=0; i<MAX_LAYERSETS; i++) { for (j=0; j<MAX_LAYTYPE; j++) { doc->LayerTypeArray[i][j].color = RGB(255, 255, 255); doc->LayerTypeArray[i][j].show = false; } } if (version == 1) { int red, green, blue; for (i=0; i<MAX_LAYERSETS; i++) // Normal, Top, Bottom, Cust 1, 2, 3, 4, 5 { j=0; while (j<31) // this was 31 before version 2 { if (fgets(line,500,stream) == NULL) return; if (line[0] == '!' || line[0] == '\n') continue; // remark if ((tok = strtok(line, " \t\n(),")) == NULL) continue; doc->LayerTypeArray[i][j].show = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; red = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; green = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; blue = atoi(tok); doc->LayerTypeArray[i][j].color = RGB(red, green, blue); j++; } } } else if (version >= 2) { int red, green, blue; while (fgets(line,500,stream) != NULL) { if (line[0] == '!' || line[0] == '\n') continue; // remark if ((tok = strtok(line, " \t\n(),")) == NULL) continue; if (!STRCMPI(tok,".NAME")) { CString colorsetname; if ((tok = strtok(NULL, " \t")) == NULL) continue; int id = atoi(tok); if ((tok = strtok(NULL, "\n")) == NULL) continue; colorsetname = tok; colorsetname = tok; colorsetname.TrimLeft(); colorsetname.TrimRight(); doc->CustomLayersetNames.SetAt(id, tok); } else { i = atoi(tok); if (i >= MAX_LAYERSETS) continue; if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; j = atoi(tok); if (j >= MAX_LAYTYPE) continue; if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; doc->LayerTypeArray[i][j].show = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; red = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; green = atoi(tok); if ((tok = strtok(NULL, " \t\n(),")) == NULL) continue; blue = atoi(tok); doc->LayerTypeArray[i][j].color = RGB(red, green, blue); } } } fclose(stream); }