TInt CTestWideApi :: wremove_val2() { wchar_t *dirName = L"C:\\wremoveDir1"; wchar_t *fileName1 = L"C:\\wremoveDir1\\file1.txt"; //file doesnot exist TInt ret = -1; errno = 0; if(wmkdir(dirName ,S_IWUSR) < 0) { INFO_PRINTF1(_L("Failed to create the parent directory")); return KErrGeneral ; } ret = wremove(fileName1); if(ret != -1 && errno == 0) { INFO_PRINTF1(_L("wremove failed")); return KErrGeneral; } ret = wremove(dirName); if(ret != 0) { INFO_PRINTF1(_L("wremove failed")); return KErrGeneral; } return KErrNone ; }
TInt CTestWideApi::wremove_val1() { wchar_t *dirName = L"C:\\wremoveDir"; wchar_t *fileName1 = L"C:\\wremoveDir\\file1.txt"; wchar_t *fileName2 = L"C:\\wremoveDir\\file2.txt"; TInt ret = -1; errno = 0; if(wmkdir(dirName ,S_IWUSR) < 0) { INFO_PRINTF1(_L("Failed to create the parent directory")); return KErrGeneral ; } FILE *fp = wfopen(fileName1, (wchar_t *)"w"); if(fp == NULL) { INFO_PRINTF1(_L("Failed to create the child directory")); return KErrGeneral ; } fclose(fp); fp = wfopen(fileName2, (wchar_t *)"w"); if(fp == NULL) { INFO_PRINTF1(_L("Failed to create the child directory")); return KErrGeneral ; } fclose(fp); ret = wremove(fileName1); if(ret != 0) { INFO_PRINTF1(_L("wremove failed")); wunlink(fileName1); return KErrGeneral; } ret = wremove(fileName2); if(ret != 0) { INFO_PRINTF1(_L("wremove failed")); wunlink(fileName2); return KErrGeneral; } ret = wremove(dirName); if(ret != 0) { INFO_PRINTF1(_L("wremove failed")); return KErrGeneral; } return KErrNone ; }
TInt CTestWideApi :: wremove_null() { int ret = wremove(NULL); if(ret < 0) { return KErrNone ; } return KErrGeneral; }
TInt CTestWideApi::wremove_val3() { TInt nameRead; TInt retnVal; int retn = KErrGeneral; _LIT( Klen, "Parameter1" ); TBool res = GetIntFromConfig(ConfigSection(), Klen, nameRead); if(!res) { _LIT(Kerr , "Failed to read the value") ; INFO_PRINTF1(Kerr) ; return KErrGeneral ; } _LIT( Klen2, "Parameter2" ); res = GetIntFromConfig(ConfigSection(), Klen2, retnVal); if(!res) { _LIT(Kerr , "Failed to read the value") ; INFO_PRINTF1(Kerr) ; return KErrGeneral ; } wchar_t* dirName = L"C:\\wremoveDir3"; int ret1 = wmkdir(dirName, S_IWUSR); if(!ret1) { int ret = wremove(dirName); if(!ret && !retnVal) { INFO_PRINTF1( _L("Passed...")); retn = KErrNone; } else if(ret && retnVal) { INFO_PRINTF1( _L("Passed...")); retn = KErrNone; } else { INFO_PRINTF1( _L("Failed...")); } } else { if(retnVal) { INFO_PRINTF1( _L("Passed...")); retn = KErrNone; } else { INFO_PRINTF1( _L("Failed...")); } } return retn; }
OMRawStorage* OMXMLStorage::openNewDataStream(const wchar_t* uri) { TRACE("OMXMLStorage::openNewDataStream"); PRECONDITION("XML document raw storage has filename", _storage->fileName() != 0); // uri is assumed to be 'stream directory' / 'stream file name' as // created in getDataStreamEntityValue() OMDiskRawStorage* storage = 0; wchar_t* base = getBaseFilePath(_storage->fileName()); // start by creating the directory wchar_t* workBuffer = new wchar_t[wcslen(uri) + 1]; wcscpy(workBuffer, uri); wchar_t* sep = wmemchr(workBuffer, L'/', wcslen(uri)); ASSERT("New DataStream uri starts with a directory", sep != 0); *sep = L'\0'; wchar_t* filepath = new wchar_t[wcslen(workBuffer) + 1]; wcsconvertURItoFilepath(workBuffer, filepath); wchar_t* fullFilepath = new wchar_t[wcslen(base) + wcslen(filepath) + 1]; wcscpy(fullFilepath, base); wcscat(fullFilepath, filepath); wmkdir(fullFilepath); delete [] workBuffer; delete [] filepath; delete [] fullFilepath; // remove the file and then open new modify filepath = new wchar_t[wcslen(uri) + 1]; wcsconvertURItoFilepath(uri, filepath); fullFilepath = new wchar_t[wcslen(base) + wcslen(filepath) + 1]; wcscpy(fullFilepath, base); wcscat(fullFilepath, filepath); wremove(fullFilepath); try { storage = OMDiskRawStorage::openNewModify(fullFilepath); } catch (...) { storage = 0; } delete [] filepath; delete [] fullFilepath; delete [] base; return storage; }
bheur4() { int *p1, *p2, ploc, i; if(amp[-1] != 1) return(0); ploc = amp[-3]; if(board[ploc] == 1) return(0); if(xheur(ploc)) return(0); p1 = lmp; p2 = p1; wagen(); i = 0; while(p2 != lmp) { p2++; wmove(*p2++); i = xheur(ploc); wremove(); if(i) break; } lmp = p1; return(-i); }