Lines Matching refs:pFile
154 static osl_TStamp closeFileImpl(osl_TFile* pFile);
155 static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode);
156 static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate);
157 static osl_TStamp getFileStamp(osl_TFile* pFile);
159 static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen);
160 static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine);
175 static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile);
176 static sal_Bool storeProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile, sal_Bool bCleanup);
197 osl_TFile* pFile; in osl_openProfile() local
249 …((pFile = openFileImpl(FileName, (Flags & osl_Profile_WRITELOCK) ? sal_True : sal_False)) == NULL)) in osl_openProfile()
267 pProfile->m_pFile = pFile; in osl_openProfile()
269 pProfile->m_Stamp = getFileStamp(pFile); in osl_openProfile()
271 loadProfile(pFile, pProfile); in osl_openProfile()
274 closeFileImpl(pFile); in osl_openProfile()
376 osl_TFile* pFile; in osl_flushProfile() local
391 pFile = pProfile->m_pFile; in osl_flushProfile()
392 if ( !( pFile != 0 && pFile->m_Handle >= 0 ) ) in osl_flushProfile()
405 bRet = storeProfile(pFile,pProfile,sal_False); in osl_flushProfile()
1095 static osl_TStamp getFileStamp(osl_TFile* pFile) in getFileStamp() argument
1102 if ( (!pFile->m_Handle) || in getFileStamp()
1103 DosQueryFileInfo(pFile->m_Handle, FIL_STANDARD, &FileStatus, Bytes)) in getFileStamp()
1114 static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) in lockFile() argument
1119 if (!pFile->m_Handle) in lockFile()
1128 status = DosSetFileLocks(pFile->m_Handle, &Lock, NULL, 1000, 0); in lockFile()
1132 status = DosSetFileLocks(pFile->m_Handle, NULL, &Lock, 1000, 1); in lockFile()
1136 status = DosSetFileLocks(pFile->m_Handle, NULL, &Lock, 1000, 0); in lockFile()
1148 osl_TFile* pFile = (osl_TFile*)calloc(1, sizeof(osl_TFile)); in openFileImpl() local
1189 … if (rc = DosOpen((PCSZ)pszFileName, &pFile->m_Handle, &action, 0, flags, attributes, mode, NULL)) in openFileImpl()
1196 … rc = DosOpen((PCSZ)pszFileName, &pFile->m_Handle, &action, 0, flags, attributes, mode, NULL); in openFileImpl()
1202 free(pFile); in openFileImpl()
1209 pFile->m_pWriteBuf=0; in openFileImpl()
1210 pFile->m_nWriteBufFree=0; in openFileImpl()
1211 pFile->m_nWriteBufLen=0; in openFileImpl()
1219 lockFile(pFile, bWriteable ? write_lock : read_lock); in openFileImpl()
1226 return (pFile); in openFileImpl()
1230 static osl_TStamp closeFileImpl(osl_TFile* pFile) in closeFileImpl() argument
1234 if ( pFile == 0 ) in closeFileImpl()
1239 if (pFile->m_Handle) in closeFileImpl()
1252 stamp = getFileStamp(pFile); in closeFileImpl()
1254 lockFile(pFile, un_lock); in closeFileImpl()
1256 DosClose(pFile->m_Handle); in closeFileImpl()
1259 if ( pFile->m_pWriteBuf != 0 ) in closeFileImpl()
1261 free(pFile->m_pWriteBuf); in closeFileImpl()
1264 free(pFile); in closeFileImpl()
1269 static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate) in rewindFile() argument
1271 if (pFile->m_Handle) in rewindFile()
1288 pFile->m_pReadPtr = pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf); in rewindFile()
1290 DosSetFilePtr(pFile->m_Handle, 0, FILE_BEGIN, &Position); in rewindFile()
1293 DosSetFileSize(pFile->m_Handle, 0); in rewindFile()
1299 static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) in getLine() argument
1306 if (pFile->m_Handle == 0) in getLine()
1313 Bytes = sizeof(pFile->m_ReadBuf) - (pFile->m_pReadPtr - pFile->m_ReadBuf); in getLine()
1318 memcpy(pFile->m_ReadBuf, pFile->m_pReadPtr, Bytes); in getLine()
1319 pFile->m_pReadPtr = pFile->m_ReadBuf; in getLine()
1321 Free = sizeof(pFile->m_ReadBuf) - Bytes; in getLine()
1323 if (DosRead(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free, &Max)) in getLine()
1337 pFile->m_ReadBuf[Bytes + Max] = '\0'; in getLine()
1341 for (pChr = pFile->m_pReadPtr; in getLine()
1343 (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1)); in getLine()
1346 Max = min(pChr - pFile->m_pReadPtr, MaxLen); in getLine()
1347 memcpy(pLine, pFile->m_pReadPtr, Max); in getLine()
1351 if (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1)) in getLine()
1361 if ((pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf))) && in getLine()
1363 pChr = pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf); in getLine()
1371 pFile->m_pReadPtr = pChr; in getLine()
1378 static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) in putLine() argument
1386 if ( pFile == 0 || pFile->m_Handle < 0 ) in putLine()
1391 if ( pFile->m_pWriteBuf == 0 ) in putLine()
1393 pFile->m_pWriteBuf = (sal_Char*) malloc(Len+3); in putLine()
1394 pFile->m_nWriteBufLen = Len+3; in putLine()
1395 pFile->m_nWriteBufFree = Len+3; in putLine()
1399 if ( pFile->m_nWriteBufFree <= Len + 3 ) in putLine()
1403 pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); in putLine()
1408 pFile->m_pWriteBuf = pTmp; in putLine()
1409 pFile->m_nWriteBufFree = pFile->m_nWriteBufFree + pFile->m_nWriteBufLen + ( 2 * Len ); in putLine()
1410 pFile->m_nWriteBufLen = ( pFile->m_nWriteBufLen + Len ) * 2; in putLine()
1411 …memset( (pFile->m_pWriteBuf) + ( pFile->m_nWriteBufLen - pFile->m_nWriteBufFree ), 0, pFile->m_nWr… in putLine()
1417 memcpy(pFile->m_pWriteBuf + ( pFile->m_nWriteBufLen - pFile->m_nWriteBufFree ),pszLine,Len+1); in putLine()
1419 strLen = strlen(pFile->m_pWriteBuf); in putLine()
1421 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len]='\r'; in putLine()
1422 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len + 1]='\n'; in putLine()
1423 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len + 2]='\0'; in putLine()
1425 pFile->m_nWriteBufFree-=Len+2; in putLine()
1759 static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) in loadProfile() argument
1769 OSL_VERIFY(rewindFile(pFile, sal_False)); in loadProfile()
1771 while (getLine(pFile, Line, sizeof(Line))) in loadProfile()
1811 static sal_Bool storeProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile, sal_Bool bCleanup) in storeProfile() argument
1819 OSL_VERIFY(rewindFile(pFile, sal_True)); in storeProfile()
1822 OSL_VERIFY(putLine(pFile, pProfile->m_Lines[i])); in storeProfile()