static int upstream_open(struct filter_ctx *fc) { struct protocol_ctx *proto = protocol_open(fc->url, &fc->media); if (!proto) { loge("open protocol %s failed!\n", fc->url); return -1; } struct upstream_ctx *uc = CALLOC(1, struct upstream_ctx); if (!uc) { loge("malloc upstream_ctx failed!\n"); goto failed; } uc->proto = proto; fc->rfd = -1; fc->wfd = -1; fc->priv = uc; return 0; failed: if (proto) { protocol_close(proto); } if (uc) { free(uc); } return -1; }
STDMETHODIMP CImpAscExtension::ImportASC (char *pFile) { strcpy (cbInFile, pFile); // für FehlerMeldung sichern protocol_open (pFile); yyin = fopen (pFile, "r"); if (yyin == NULL) return ResultFromScode (STG_E_PATHNOTFOUND); HRESULT hr = NOERROR; fseek (yyin, 0L, SEEK_END); // Dateilänge bestimmen long lLen = ftell (yyin); if (lLen > 0) { ErrInstall EI ((ErrCode)ESYNTX, esyntx); string strFile = pFile; string str = get_name (strFile) + get_ext(strFile); g_pDlg -> FInit (lLen, str.c_str()); g_pDlg -> Update(); fseek (yyin, 0L, SEEK_SET); // wieder am Anfang InitAllEnvironment(); g_lTime = timeGetTime(); // Zeit für diese Datei hr = yyparse() ? S_OK : S_FALSE; g_lFullTime += timeGetTime() - g_lTime; } fclose (yyin); // MCodeMap leeren g_MCodes.clear(); // evtl. Protokolldatei schließen if (fpProt) { fclose (fpProt); fpProt = NULL; } // GeoDB neu initialisieren DEXN_ReScale(); DEXN_ReReadIdents(); DEXN_ReReadContainer(); return hr; }