Lines Matching refs:pFile

148 static osl_TStamp           closeFileImpl(osl_TFile* pFile);
149 static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode);
150 static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate);
151 static osl_TStamp getFileStamp(osl_TFile* pFile);
153 static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen);
154 static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine);
169 static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile);
175 static sal_Bool writeProfileImpl (osl_TFile* pFile);
188 osl_TFile* pFile = NULL; in osl_openProfile() local
240 if ( (! (Flags & osl_Profile_SYSTEM)) && ( (pFile = openFileImpl(FileName, Flags) ) == NULL ) ) in osl_openProfile()
260 pProfile->m_pFile = pFile; in osl_openProfile()
262 pProfile->m_Stamp = getFileStamp(pFile); in osl_openProfile()
264 loadProfile(pFile, pProfile); in osl_openProfile()
267 closeFileImpl(pFile); in osl_openProfile()
370 osl_TFile* pFile; in osl_flushProfile() local
385 pFile = pProfile->m_pFile; in osl_flushProfile()
386 if ( !( pFile != 0 && pFile->m_Handle >= 0 ) ) in osl_flushProfile()
408 static sal_Bool writeProfileImpl(osl_TFile* pFile) in writeProfileImpl() argument
417 if ( !( pFile != 0 && pFile->m_Handle != INVALID_HANDLE_VALUE ) || ( pFile->m_pWriteBuf == 0 ) ) in writeProfileImpl()
430 …bRet=WriteFile(pFile->m_Handle, pFile->m_pWriteBuf, pFile->m_nWriteBufLen - pFile->m_nWriteBufFree… in writeProfileImpl()
442 free(pFile->m_pWriteBuf); in writeProfileImpl()
443 pFile->m_pWriteBuf=0; in writeProfileImpl()
444 pFile->m_nWriteBufLen=0; in writeProfileImpl()
445 pFile->m_nWriteBufFree=0; in writeProfileImpl()
1159 static osl_TStamp getFileStamp(osl_TFile* pFile) in getFileStamp() argument
1163 if ((pFile->m_Handle == INVALID_HANDLE_VALUE) || in getFileStamp()
1164 (! GetFileTime(pFile->m_Handle, NULL, NULL, &FileTime))) in getFileStamp()
1172 static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) in lockFile() argument
1177 if (pFile->m_Handle == INVALID_HANDLE_VALUE) in lockFile()
1186 pFile->m_Handle, 0, 0xFFFFFFFF, 0, &Overlapped); in lockFile()
1191 pFile->m_Handle, 0, 0, 0xFFFFFFFF, 0, &Overlapped); in lockFile()
1196 pFile->m_Handle, LOCKFILE_EXCLUSIVE_LOCK, 0, 0xFFFFFFFF, 0, in lockFile()
1259 osl_TFile* pFile = reinterpret_cast< osl_TFile*>( calloc( 1, sizeof(osl_TFile) ) ); in openFileImpl() local
1278pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENER… in openFileImpl()
1291 …if ((pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), … in openFileImpl()
1296 free(pFile); in openFileImpl()
1301 pFile->m_pWriteBuf=0; in openFileImpl()
1302 pFile->m_nWriteBufFree=0; in openFileImpl()
1303 pFile->m_nWriteBufLen=0; in openFileImpl()
1311 lockFile(pFile, bWriteable ? write_lock : read_lock); in openFileImpl()
1318 return (pFile); in openFileImpl()
1329 static osl_TStamp closeFileImpl(osl_TFile* pFile) in closeFileImpl() argument
1333 if ( pFile == 0 ) in closeFileImpl()
1338 if (pFile->m_Handle != INVALID_HANDLE_VALUE) in closeFileImpl()
1351 stamp = getFileStamp(pFile); in closeFileImpl()
1353 lockFile(pFile, un_lock); in closeFileImpl()
1355 CloseHandle(pFile->m_Handle); in closeFileImpl()
1356 pFile->m_Handle = INVALID_HANDLE_VALUE; in closeFileImpl()
1359 if ( pFile->m_pWriteBuf != 0 ) in closeFileImpl()
1361 free(pFile->m_pWriteBuf); in closeFileImpl()
1364 free(pFile); in closeFileImpl()
1376 static sal_Bool rewindFile(osl_TFile* pFile, sal_Bool bTruncate) in rewindFile() argument
1378 if (pFile->m_Handle != INVALID_HANDLE_VALUE) in rewindFile()
1393 pFile->m_pReadPtr = pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf); in rewindFile()
1395 SetFilePointer(pFile->m_Handle, 0, NULL, FILE_BEGIN); in rewindFile()
1398 SetEndOfFile(pFile->m_Handle); in rewindFile()
1413 static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen) in getLine() argument
1420 if (pFile->m_Handle == INVALID_HANDLE_VALUE) in getLine()
1427 Bytes = sizeof(pFile->m_ReadBuf) - (pFile->m_pReadPtr - pFile->m_ReadBuf); in getLine()
1432 memcpy(pFile->m_ReadBuf, pFile->m_pReadPtr, Bytes); in getLine()
1433 pFile->m_pReadPtr = pFile->m_ReadBuf; in getLine()
1435 Free = sizeof(pFile->m_ReadBuf) - Bytes; in getLine()
1437 if (! ReadFile(pFile->m_Handle, &pFile->m_ReadBuf[Bytes], Free, &Max, NULL)) in getLine()
1451 pFile->m_ReadBuf[Bytes + Max] = '\0'; in getLine()
1455 for (pChr = pFile->m_pReadPtr; in getLine()
1457 (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1)); in getLine()
1460 Max = min(pChr - pFile->m_pReadPtr, MaxLen); in getLine()
1461 memcpy(pLine, pFile->m_pReadPtr, Max); in getLine()
1465 if (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1)) in getLine()
1475 if ((pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf))) && in getLine()
1477 pChr = pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf); in getLine()
1485 pFile->m_pReadPtr = pChr; in getLine()
1501 static sal_Bool putLine(osl_TFile* pFile, const sal_Char *pszLine) in putLine() argument
1509 if ( pFile == 0 || pFile->m_Handle < 0 ) in putLine()
1514 if ( pFile->m_pWriteBuf == 0 ) in putLine()
1516 pFile->m_pWriteBuf = (sal_Char*) malloc(Len+3); in putLine()
1517 pFile->m_nWriteBufLen = Len+3; in putLine()
1518 pFile->m_nWriteBufFree = Len+3; in putLine()
1522 if ( pFile->m_nWriteBufFree <= Len + 3 ) in putLine()
1526 pTmp=(sal_Char*) realloc(pFile->m_pWriteBuf,( ( pFile->m_nWriteBufLen + Len ) * 2) ); in putLine()
1531 pFile->m_pWriteBuf = pTmp; in putLine()
1532 pFile->m_nWriteBufFree = pFile->m_nWriteBufFree + pFile->m_nWriteBufLen + ( 2 * Len ); in putLine()
1533 pFile->m_nWriteBufLen = ( pFile->m_nWriteBufLen + Len ) * 2; in putLine()
1534 …memset( (pFile->m_pWriteBuf) + ( pFile->m_nWriteBufLen - pFile->m_nWriteBufFree ), 0, pFile->m_nWr… in putLine()
1540 memcpy(pFile->m_pWriteBuf + ( pFile->m_nWriteBufLen - pFile->m_nWriteBufFree ),pszLine,Len+1); in putLine()
1542 strLen = strlen(pFile->m_pWriteBuf); in putLine()
1544 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len]='\r'; in putLine()
1545 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len + 1]='\n'; in putLine()
1546 pFile->m_pWriteBuf[pFile->m_nWriteBufLen - pFile->m_nWriteBufFree + Len + 2]='\0'; in putLine()
1548 pFile->m_nWriteBufFree-=Len+2; in putLine()
1926 static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile) in loadProfile() argument
1936 OSL_VERIFY(rewindFile(pFile, sal_False)); in loadProfile()
1938 while (getLine(pFile, Line, sizeof(Line))) in loadProfile()
2068 osl_TFile* pFile=0; in osl_openTmpProfileImpl() local
2092 pFile = openFileImpl(ustrTmpName,pProfile->m_Flags | PFlags); in osl_openTmpProfileImpl()
2096 return pFile; in osl_openTmpProfileImpl()