Пример #1
0
void Compiler::setInputFile( std::string& name )
{
    std::wstring* wname( new std::wstring() );
    mbtowstring( name, *wname );
    wname = addFileName( wname );
    inFiles.push_back( new IpfFile( wname ) );
}
Пример #2
0
bool DbExcel::Open(const char *filename)
{
    CString wname(filename);
#if defined(UNICODE)
    return Open(wname);
#else
    return Open(AnsiStrToWideStr(wname));
#endif
}
Пример #3
0
Dir*
wdirstat(char *fn)
{
	Dir *d;

	fn = wname(fn);
	d = dirstat(fn);
	free(fn);
	return d;
}
Пример #4
0
int
waccess(char *fn, int mode)
{
	int rv;

	fn = wname(fn);
	rv = access(fn, mode);
	free(fn);
	return rv;
}
Пример #5
0
Biobuf*
wBopen(char *fn, int mode)
{
	Biobuf *rv;

	fn = wname(fn);
	rv = Bopen(fn, mode);
	free(fn);
	return rv;
}
Пример #6
0
int
wcreate(char *fn, int mode, int32_t perm)
{
	int rv;

	fn = wname(fn);
	rv = create(fn, mode, perm);
	free(fn);
	return rv;
}
Пример #7
0
int
wopen(char *fn, int mode)
{
	int rv;

	fn = wname(fn);
	rv = open(fn, mode);
	free(fn);
	return rv;
}
Пример #8
0
//------------------------------------------------------------------------------
bool set_env(const char* name, const char* value)
{
    wstr<32> wname(name);

    wstr<64> wvalue;
    if (value != nullptr)
        wvalue = value;

    const wchar_t* value_arg = (value != nullptr) ? wvalue.c_str() : nullptr;
    return (SetEnvironmentVariableW(wname.c_str(), value_arg) != 0);
}
Пример #9
0
/** 
 * @brief Constructor
 * 
 * @param igcFile IGC file to analyse
 * @param handicap Glider handicap
 * @param startAltitudeLoss The loss of altitude needed to detect the start of powerless flight
 * @param interruptFix GPS fix at which a test should be interrupted
 */
CTestContest::CTestContest(const std::string &igcFile, unsigned handicap, unsigned startAltitudeLoss, unsigned interruptFix):
  _igcFile(igcFile),
  _handicap(handicap),
  _replay(CReplayLogger::Instance()),
  _kml(igcFile + ".kml"),
  _contestMgr(handicap, startAltitudeLoss),
  _interruptFix(interruptFix),
  _maxIterProcessPeriod(0),
  _maxIterProcessTime(0)
{
  std::wstring wname(_igcFile.begin(), _igcFile.end());
  _replay.Filename(wname.c_str());
  _replay.Register(this, GPSHandler);
}
Пример #10
0
//------------------------------------------------------------------------------
bool get_env(const char* name, str_base& out)
{
    wstr<32> wname(name);

    int len = GetEnvironmentVariableW(wname.c_str(), nullptr, 0);
    if (!len)
        return false;

    wstr<> wvalue;
    wvalue.reserve(len);
    len = GetEnvironmentVariableW(wname.c_str(), wvalue.data(), wvalue.size());

    out.reserve(len);
    out = wvalue.c_str();
    return true;
}
Пример #11
0
bool XMLParser::getProperties(_xmlAttr * properties, map<wstring, wstring> & attrMap)
{
	for(_xmlAttr * childprop = properties;
		childprop;
		childprop = childprop->next)
	{
		
		for(xmlNode * child = childprop->children;
			child;
			child = child->next)
		{
			string name = (char*)childprop->name;
			string content = (char*)childprop->children->content;
			wstring wname(name.begin(), name.end());
			wstring wcontent(content.begin(), content.end());
			attrMap[wname] = wcontent;
		}
	}
	return true;
}
Пример #12
0
void MaxExportPlugin::ProcessTriObjects()
{
	for (int i = 0; i < triObjects.size(); i++)
	{
		TriObject* TObj = triObjects[i];
		INode* node = nodeList[i];

		std::vector<indexed_vertex> indOut;		//Финальный набор вершин (индексированых)
		bool hasColor = false, hasTex = false;
		std::vector<indexed_vertex> indVerts = GetIndexedVerts(&(TObj->mesh), hasTex, hasColor);
		std::vector<unsigned int> indices = InitIndices(indVerts.size());

		//Отмечаем дупликаты вершин
		std::vector<bool> vertDupes;
		vertDupes.resize(indVerts.size());
		std::fill(vertDupes.begin(), vertDupes.end(), false);
		for (int i = 0; i < indVerts.size(); i++)
		{
			if (!vertDupes[i])
			{
				for (int j = i + 1; j < indVerts.size(); j++)
				{
					if (indVerts[i].pos == indVerts[j].pos
						&& indVerts[i].col == indVerts[j].col
						&& indVerts[i].tex == indVerts[j].tex)
					{
						vertDupes[j] = true;
						indices[j] = i;
					}
				}
			}
		}
		
		std::vector<unsigned int> newVertPos;
		newVertPos.resize(indVerts.size());

		for (int i = 0; i < indVerts.size(); i++)
		{
			if (!vertDupes[i])
			{
				newVertPos[i] = indOut.size();
				indOut.push_back(indVerts[i]);
			}
		}
		
		for (int i = 0; i < indices.size(); i++)
		{
			indices[i] = newVertPos[indices[i]];
		}

		MeshIO::Mesh mesh;
		std::wstring wname(node->GetName());
		std::string cname(wname.begin(), wname.end());
		mesh.name = cname;

		//Вертексы
		for (int i = 0; i < indOut.size(); i++)
		{
			Point3 v = TObj->mesh.verts[indOut[i].pos];
			mesh.verts.insert(mesh.verts.end(), MeshIO::vec3(v.x, v.y, v.z));
		}

		//Индексы
		for (int i = 0; i < indices.size(); i++)
		{
			mesh.faces.insert(mesh.faces.end(), indices[i]);
		}

		//Цвет
		if (hasColor)
		{
			for (int i = 0; i < indOut.size(); i++)
			{
				Point3 v = TObj->mesh.vertCol[indOut[i].col];
				mesh.color.insert(mesh.color.end(), MeshIO::vec3(v.x, v.y, v.z));
			}
		}

		//Текстурные координаты
		if (hasTex)
		{
			mesh.uvw.insert(mesh.uvw.end(), std::vector<MeshIO::vec3>());
			for (int i = 0; i < indOut.size(); i++)
			{
				Point3 v = TObj->mesh.tVerts[indOut[i].tex];
				mesh.uvw[0].insert(mesh.uvw[0].end(), MeshIO::vec3(v.x, v.y, v.z));
			}
		}
		meshFile->meshes.insert(meshFile->meshes.end(), mesh);
	}

	for (int i = 0; i < triObjects.size(); i++)
	{
		if (deleteTriObj[i])
			triObjects[i]->DeleteMe();
	}
}
Пример #13
0
BOOL Cfg::ReadIni(WCHAR *user_dir, WCHAR *virtual_dir)
{
	if (!Init(user_dir, virtual_dir)) return FALSE;

	int		i, j;
	char	section[100], key[100], *p;
	DynBuf	buf(MAX_HISTORY_CHAR_BUF);
	Wstr	wbuf(MAX_HISTORY_CHAR_BUF);
	char	*section_array[] = {	SRC_HISTORY, DST_HISTORY, DEL_HISTORY,
									INC_HISTORY, EXC_HISTORY,
									FROMDATE_HISTORY, TODATE_HISTORY,
									MINSIZE_HISTORY, MAXSIZE_HISTORY };
	bool	is_filter_array[] = {	false, false, false,
									true, true,
									false, false,
									false, false };
	WCHAR	***history_array[] = {	&srcPathHistory, &dstPathHistory, &delPathHistory,
									&includeHistory, &excludeHistory,
									&fromDateHistory, &toDateHistory,
									&minSizeHistory, &maxSizeHistory };

/*
	WCHAR	wtestbuf[MAX_HISTORY_CHAR_BUF];
	WCHAR	*wtest[] = {
							L"12345",
							L"abc\\[abc\\]\\",
							L"aaa\\aaa",
							L"abc[\\ax]",
							L"abc[\\ax]\\",
							L"12[[]345",
							L"12[[]345\\",
							L"12\\a3\\[45\\",
							L"12345",
							NULL };


	for (int i=0; wtest[i]; i++) GetFilterStrCore(wtest[i], wtestbuf);
*/
	srcPathHistory	= NULL;
	dstPathHistory	= NULL;
	delPathHistory	= NULL;
	includeHistory	= NULL;
	excludeHistory	= NULL;

	jobArray = NULL;
	jobMax = 0;

	finActArray = NULL;
	finActMax = 0;

	ini.SetSection(MAIN_SECTION);
	iniVersion		= ini.GetInt(INI_VERSION_KEY, CUR_INI_VERSION);
	bufSize			= ini.GetInt(BUFSIZE_KEY, DEFAULT_BUFSIZE);
	maxRunNum		= ini.GetInt(MAXRUNNUM_KEY, DEFAULT_MAXRUNNUM);
	maxTransSize	= ini.GetInt(MAXTRANSSIZE_KEY, DEFAULT_MAXTRANSSIZE);
	maxOvlNum		= ini.GetInt(MAXOVLNUM_KEY, DEFAULT_MAXOVLNUM);
	maxOvlSize		= ini.GetInt(MAXOVLSIZE_KEY, -1);
	if ((maxTransSize % maxOvlNum)) {
		maxTransSize = (maxTransSize + maxOvlNum - 1) / maxOvlNum * maxOvlNum;
	}
	if (bufSize < maxTransSize * BUFIO_SIZERATIO) {
		bufSize = maxTransSize * BUFIO_SIZERATIO;
	}
	maxOpenFiles	= ini.GetInt(MAXOPENFILES_KEY, DEFAULT_MAXOPENFILES);
	maxAttrSize		= ini.GetInt(MAXATTRSIZE_KEY, DEFAULT_MAXATTRSIZE);
	maxDirSize		= ini.GetInt(MAXDIRSIZE_KEY, DEFAULT_MAXDIRSIZE);
	nbMinSizeNtfs	= ini.GetInt(NONBUFMINSIZENTFS_KEY, DEFAULT_NBMINSIZE_NTFS);
	nbMinSizeFat	= ini.GetInt(NONBUFMINSIZEFAT_KEY, DEFAULT_NBMINSIZE_FAT);
	timeDiffGrace	= ini.GetInt(TIMEDIFFGRACE_KEY, 0);

	isReadOsBuf		= ini.GetInt(ISREADOSBUF_KEY, FALSE);
	isWShareOpen	= ini.GetInt(WRITESHAREOPEN_KEY, FALSE);
	maxHistoryNext	= maxHistory = ini.GetInt(MAX_HISTORY_KEY, DEFAULT_MAX_HISTORY);
	copyMode		= ini.GetInt(COPYMODE_KEY, DEFAULT_COPYMODE);
	copyFlags		= ini.GetInt(COPYFLAGS_KEY, DEFAULT_COPYFLAGS);
	copyUnFlags		= ini.GetInt(COPYUNFLAGS_KEY, DEFAULT_COPYUNFLAGS);

	skipEmptyDir	= ini.GetInt(SKIPEMPTYDIR_KEY, DEFAULT_EMPTYDIR);
	forceStart		= ini.GetInt(FORCESTART_KEY, DEFAULT_FORCESTART);
	ignoreErr		= ini.GetInt(IGNORE_ERR_KEY, TRUE);
	estimateMode	= ini.GetInt(ESTIMATE_KEY, 0);
	diskMode		= ini.GetInt(DISKMODE_KEY, 0);
	netDrvMode		= ini.GetInt(NETDRVMODE_KEY, 0);
	aclReset		= ini.GetInt(ACLRESET_KEY, 0);
	isTopLevel		= ini.GetInt(ISTOPLEVEL_KEY, FALSE);
	isErrLog		= ini.GetInt(ISERRLOG_KEY, TRUE);
	isUtf8Log		= ini.GetInt(ISUTF8LOG_KEY, TRUE);
	fileLogMode		= ini.GetInt(FILELOGMODE_KEY, 0);
	fileLogFlags	= ini.GetInt(FILELOGFLAGS_KEY, 0);
	aclErrLog		= ini.GetInt(ACLERRLOG_KEY, FALSE);
	streamErrLog	= ini.GetInt(STREAMERRLOG_KEY, FALSE);
	debugFlags		= ini.GetInt(DEBUGFLAGS_KEY, 0);
	isRunasButton	= ini.GetInt(ISRUNASBUTTON_KEY, FALSE);
	isSameDirRename	= ini.GetInt(ISSAMEDIRRENAME_KEY, TRUE);
	shextAutoClose	= ini.GetInt(SHEXTAUTOCLOSE_KEY, TRUE);
	shextTaskTray	= ini.GetInt(SHEXTTASKTRAY_KEY, FALSE);
	shextNoConfirm	= ini.GetInt(SHEXTNOCONFIRM_KEY, FALSE);
	shextNoConfirmDel = ini.GetInt(SHEXTNOCONFIRMDEL_KEY, FALSE);
	execConfirm		= ini.GetInt(EXECCONRIM_KEY, FALSE);
	lcid			= ini.GetInt(LCID_KEY, -1);
	waitTick		= ini.GetInt(WAITTICK_KEY, DEFAULT_WAITTICK);
	isAutoSlowIo	= ini.GetInt(ISAUTOSLOWIO_KEY, TRUE);
	speedLevel		= ini.GetInt(SPEEDLEVEL_KEY, SPEED_FULL);
	alwaysLowIo		= ini.GetInt(ALWAYSLOWIO_KEY, FALSE);
	enableOwdel		= ini.GetInt(OWDEL_KEY, FALSE);
	enableAcl		= ini.GetInt(ACL_KEY, FALSE);
	enableStream	= ini.GetInt(STREAM_KEY, FALSE);
	enableVerify	= ini.GetInt(VERIFY_KEY, FALSE);
	useOverlapIo	= ini.GetInt(USEOVERLAPIO_KEY, TRUE);
	usingMD5		= ini.GetInt(USEMD5_KEY, TRUE);
	enableNSA		= ini.GetInt(NSA_KEY, FALSE);
	delDirWithFilter= ini.GetInt(DELDIR_KEY, FALSE);
	enableMoveAttr	= ini.GetInt(MOVEATTR_KEY, FALSE);
	serialMove		= ini.GetInt(SERIALMOVE_KEY, TRUE);
	serialVerifyMove = ini.GetInt(SERIALVERIFYMOVE_KEY, TRUE);
	isReparse		= ini.GetInt(REPARSE_KEY, TRUE);
	isLinkDest		= ini.GetInt(LINKDEST_KEY, FALSE);
	maxLinkHash		= ini.GetInt(MAXLINKHASH_KEY, DEFAULT_LINKHASH);
	allowContFsize	= ini.GetInt(ALLOWCONTFSIZE_KEY, DEFAULT_ALLOWCONTFSIZE);
	isReCreate		= ini.GetInt(RECREATE_KEY, FALSE);
	isExtendFilter	= ini.GetInt(EXTENDFILTER_KEY, FALSE);
	taskbarMode		= ini.GetInt(TASKBARMODE_KEY, 0);
	finishNotify	= ini.GetInt(FINISHNOTIFY_KEY, 1);
	finishNotifyTout = ini.GetInt(FINISHNOTIFYTOUT_KEY, FINISH_NOTIFY_DEFAULT);

	infoSpan		= ini.GetInt(INFOSPAN_KEY, DEFAULT_INFOSPAN);
	if (infoSpan < 0 || infoSpan > 2) infoSpan = DEFAULT_INFOSPAN;

	ini.GetStr(WINPOS_KEY, buf, MAX_PATH, "");
	winpos.x   =      (p = strtok(buf,  ", \t")) ? atoi(p) : INVALID_POINTVAL;
	winpos.y   = p && (p = strtok(NULL, ", \t")) ? atoi(p) : INVALID_POINTVAL;
	winsize.cx = p && (p = strtok(NULL, ", \t")) ? atoi(p) : INVALID_SIZEVAL;
	winsize.cy = p && (p = strtok(NULL, ", \t")) ? atoi(p) : INVALID_SIZEVAL;

	ini.GetStr(DRIVEMAP_KEY, driveMap, sizeof(driveMap), "");

	ini.GetStr(STATUSFONT_KEY, buf, MAX_HISTORY_CHAR_BUF, "");
	IniStrToW(buf, statusFont);
	statusFontSize = ini.GetInt(STATUSFONTSIZE_KEY, 0);

/* logfile */
	ini.GetStr(LOGFILE_KEY, buf, MAX_PATH, DEFAULT_FASTCOPYLOG);
	IniStrToW(buf, wbuf.Buf());
	if (wcschr(wbuf.s(), '\\') == NULL) {
		Wstr	wname(wbuf);
		MakePathW(wbuf.Buf(), userDir, wname.s());
	}
	errLogPath = wcsdup(wbuf.s());

/* History */
	for (i=0; i < sizeof(section_array) / sizeof(char *); i++) {
		char	*section_p = section_array[i];
		bool	&is_filter = is_filter_array[i];
		WCHAR	**&history = *history_array[i];

		ini.SetSection(section_p);
		history = (WCHAR **)calloc(maxHistory, sizeof(WCHAR *));
		for (j=0; j < maxHistory + 30; j++) {
			wsprintf(key, "%d", j);
			if (j < maxHistory) {
				if (is_filter) {
					GetFilterStr(key, buf, wbuf.Buf());
				} else {
					ini.GetStr(key, buf, MAX_HISTORY_CHAR_BUF);
					IniStrToW(buf, wbuf.Buf());
				}
				history[j] = wcsdup(wbuf.s());
			}
			else if (!ini.DelKey(key))
				break;
		}
	}

/* Job */
	for (i=0; i < JOB_MAX; i++) {
		Job		job;

		wsprintf(section, FMT_JOB_KEY, i);
		ini.SetSection(section);

		if (ini.GetStr(TITLE_KEY, buf, MAX_HISTORY_CHAR_BUF) <= 0)
			break;
		IniStrToW(buf, wbuf.Buf());
		job.title = wcsdup(wbuf.s());

		ini.GetStr(SRC_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.src = wcsdup(wbuf.s());

		ini.GetStr(DST_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.dst = wcsdup(wbuf.s());

		ini.GetStr(CMD_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.cmd = wcsdup(wbuf.s());

		GetFilterStr(INCLUDE_KEY, buf, wbuf.Buf());
		job.includeFilter = wcsdup(wbuf.s());
		GetFilterStr(EXCLUDE_KEY, buf, wbuf.Buf());
		job.excludeFilter = wcsdup(wbuf.s());

		ini.GetStr(FROMDATE_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.fromDateFilter = wcsdup(wbuf.s());
		ini.GetStr(TODATE_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.toDateFilter = wcsdup(wbuf.s());

		ini.GetStr(MINSIZE_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.minSizeFilter = wcsdup(wbuf.s());
		ini.GetStr(MAXSIZE_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		job.maxSizeFilter = wcsdup(wbuf.s());

		job.estimateMode = ini.GetInt(ESTIMATE_KEY, 0);
		job.diskMode = ini.GetInt(DISKMODE_KEY, 0);
		job.ignoreErr = ini.GetInt(IGNORE_ERR_KEY, TRUE);
		job.enableOwdel = ini.GetInt(OWDEL_KEY, FALSE);
		job.enableAcl = ini.GetInt(ACL_KEY, FALSE);
		job.enableStream = ini.GetInt(STREAM_KEY, FALSE);
		job.enableVerify = ini.GetInt(VERIFY_KEY, FALSE);
		job.isFilter = ini.GetInt(FILTER_KEY, FALSE);
		job.bufSize = ini.GetInt(BUFSIZE_KEY, DEFAULT_BUFSIZE);
		if (job.bufSize < maxTransSize * BUFIO_SIZERATIO) {
			job.bufSize = maxTransSize * BUFIO_SIZERATIO;
		}

		AddJobW(&job);
	}

/* FinAct */
	for (i=0; i < FINACT_MAX; i++) {
		FinAct	act;

		wsprintf(buf, FMT_FINACT_KEY, i);
		ini.SetSection(buf);

		if (ini.GetStr(TITLE_KEY, buf, MAX_HISTORY_CHAR_BUF) <= 0)
			break;
		IniStrToW(buf, wbuf.Buf());
		act.title = wcsdup(wbuf.Buf());

		ini.GetStr(SOUND_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		act.sound = wcsdup(wbuf.s());

		ini.GetStr(CMD_KEY, buf, MAX_HISTORY_CHAR_BUF);
		IniStrToW(buf, wbuf.Buf());
		act.command = wcsdup(wbuf.s());

		act.flags = ini.GetInt(FLAGS_KEY, 0);

		if (ini.GetStr(SHUTDOWNTIME_KEY, buf, MAX_HISTORY_CHAR_BUF) > 0) {
			act.shutdownTime = strtol(buf, 0, 10);
		}
		AddFinActW(&act);
	}

	if (::GetFileAttributesW(ini.GetIniFileNameW()) == 0xffffffff) {
		WriteIni();
	}
	needIniConvert = FALSE;

	return	TRUE;
}