Esempio n. 1
0
MCryptHandle::MCryptHandle(const std::string& algo, const std::string& mode):
  algo_( copyStr(algo) ),
  mode_( copyStr(mode) ),
  td_( mcrypt_module_open(algo_.get(), nullptr, mode_.get(), nullptr) )
{
  if(td_==MCRYPT_FAILED)
    throw std::runtime_error("mcrypt_module_open(): failed to open cypher");
}
Esempio n. 2
0
N_NIMCALL(NimStringDesc*, shortendir_114403)(NimStringDesc* dir) {
	NimStringDesc* result;
	NimStringDesc* prefix;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	NimStringDesc* LOC8;
	nimfr("shortenDir", "options.nim")
	result = 0;
	nimln(196, "options.nim");
	nimln(196, "options.nim");
	LOC1 = 0;
	nimln(196, "options.nim");
	LOC2 = 0;
	LOC2 = getprefixdir_114311();
	LOC1 = rawNewString(LOC2->Sup.len + 1);
appendString(LOC1, LOC2);
appendChar(LOC1, 47);
	prefix = LOC1;
	nimln(197, "options.nim");
	{
		NIM_BOOL LOC5;
		nimln(197, "options.nim");
		LOC5 = 0;
		LOC5 = nsuStartsWith(dir, prefix);
		if (!LOC5) goto LA6;
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		nimln(198, "options.nim");
		result = copyStr(dir, prefix->Sup.len);
		goto BeforeRet;
	}	LA6: ;
	nimln(199, "options.nim");
	nimln(199, "options.nim");
	LOC8 = 0;
	LOC8 = rawNewString(gprojectpath_114198->Sup.len + 1);
appendString(LOC8, gprojectpath_114198);
appendChar(LOC8, 47);
	prefix = LOC8;
	nimln(200, "options.nim");
	{
		NIM_BOOL LOC11;
		nimln(200, "options.nim");
		LOC11 = 0;
		LOC11 = nsuStartsWith(dir, prefix);
		if (!LOC11) goto LA12;
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		nimln(201, "options.nim");
		result = copyStr(dir, prefix->Sup.len);
		goto BeforeRet;
	}	LA12: ;
	nimln(202, "options.nim");
	result = copyString(dir);
	BeforeRet: ;	popFrame();
	return result;
}
Esempio n. 3
0
N_NIMCALL(NimStringDesc*, Shortendir_41200)(NimStringDesc* Dir_41202) {
    NimStringDesc* Result_41203;
    NimStringDesc* Prefix_41204;
    NimStringDesc* LOC1;
    NimStringDesc* LOC2;
    NIM_BOOL LOC4;
    NimStringDesc* LOC7;
    NimStringDesc* LOC8;
    NIM_BOOL LOC10;
    NimStringDesc* LOC13;
    NIM_BOOL LOC15;
    Result_41203 = 0;
    Prefix_41204 = 0;
    LOC1 = 0;
    LOC2 = 0;
    LOC2 = Getprefixdir_41109();
    LOC1 = rawNewString(LOC2->Sup.len + 1);
    appendString(LOC1, LOC2);
    appendChar(LOC1, 92);
    Prefix_41204 = LOC1;
    LOC4 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC4) goto LA5;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA5:
    ;
    LOC7 = 0;
    LOC8 = 0;
    LOC8 = nosgetCurrentDir();
    LOC7 = rawNewString(LOC8->Sup.len + 1);
    appendString(LOC7, LOC8);
    appendChar(LOC7, 92);
    Prefix_41204 = LOC7;
    LOC10 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC10) goto LA11;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA11:
    ;
    LOC13 = 0;
    LOC13 = rawNewString(Projectpath_41113->Sup.len + 1);
    appendString(LOC13, Projectpath_41113);
    appendChar(LOC13, 92);
    Prefix_41204 = LOC13;
    LOC15 = nsuStartsWith(Dir_41202, Prefix_41204);
    if (!LOC15) goto LA16;
    Result_41203 = copyStr(Dir_41202, Prefix_41204->Sup.len);
    goto BeforeRet;
LA16:
    ;
    Result_41203 = copyString(Dir_41202);
BeforeRet:
    ;
    return Result_41203;
}
Esempio n. 4
0
static std::unique_ptr<char[]> CopyToUniqueStr(char *str)
{
	size_t len = strlen(str);
	std::unique_ptr<char[]> copyStr(new char[len + 1]);
	strcpy_s(copyStr.get(), len + 1, str);
	return copyStr;
}
N_NIMCALL(void, addpackage_277083_1623492514)(Stringtableobj152608* packages0, NimStringDesc* p0) {
	NI x0;
	NimStringDesc* name0;
	x0 = versionsplitpos_277007_1623492514(p0);
	name0 = copyStrLast(p0, ((NI) 0), (NI)(x0 - ((NI) 1)));
	{
		NimStringDesc* version0;
		if (!(x0 < (p0 ? p0->Sup.len : 0))) goto LA3;
		version0 = copyStr(p0, (NI)(x0 + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = (NimStringDesc*)0;
			LOC7 = getordefault_153214_603679043(packages0, name0);
			LOC8 = (NIM_BOOL)0;
			LOC8 = HEX3CHEX2E_277033_1623492514(LOC7, version0);
			if (!LOC8) goto LA9;
			nstPut(packages0, name0, version0);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages0, name0, ((NimStringDesc*) &T1623492514_5));
	}
	LA1: ;
}
Esempio n. 6
0
N_NIMCALL(void, addpackage_196084)(Stringtableobj140209* packages, NimStringDesc* p) {
	NI x;
	NimStringDesc* name;
	x = versionsplitpos_196008(p);
	name = copyStrLast(p, ((NI) 0), (NI)(x - ((NI) 1)));
	{
		NimStringDesc* version;
		if (!(x < (p ? p->Sup.len : 0))) goto LA3;
		version = copyStr(p, (NI)(x + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = 0;
			LOC7 = getordefault_140814(packages, name);
			LOC8 = 0;
			LOC8 = HEX3CHEX2E_196034(LOC7, version);
			if (!LOC8) goto LA9;
			nstPut(packages, name, version);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages, name, ((NimStringDesc*) &TMP1794));
	}
	LA1: ;
}
Esempio n. 7
0
QCpacket QCXB::readNextPacket() {
    XBpacket received = xb.receiveMessage();
    QCpacket result;
    result.command = -1;
    if (received.type != PACKET_RECEIVE)
        return result;

    result.command = (uint8_t)received.message[0];
    result.ID = twoBytesToUInt(received.message[1], received.message[2]);
    result.length = twoBytesToUInt(received.message[3], received.message[4]);
    if (result.length > QCPACKET_MAX_DATA_SIZE)
        result.length = QCPACKET_MAX_DATA_SIZE;
    copyStr(received.message, result.data, 5, 0, result.length);

    // TODO: calculate the checksum for the received bytes and compare with result.hash.
    // Perhaps output a byte for good checksum, and take QCpacket* as an argument that can be edited? Callback functions??
    // FUNDAMENTAL PROBLEM: how should we output multiple values from a function? Pairs? Tuples?
    result.hash = (received.message[5 + result.length] << 24) |
                  (received.message[6 + result.length] << 16) |
                  (received.message[7 + result.length] << 8) |
                  (received.message[8 + result.length]);

    // Note: srcAddr and RSSI are going to waste. Any way to output these? Perhaps maintain an instance variable called "last srcAddr" and "last RSSI"? Maybe we should do this for XB too and restructure XBpacket? I.e. no address fields and no RSSI field
    return result;
}
Esempio n. 8
0
N_NIMCALL(void, addpackage_172126)(Stringtableobj133012* packages, NimStringDesc* p) {
	NI x;
	NimStringDesc* name;
	x = versionsplitpos_172023(p);
	name = copyStrLast(p, ((NI) 0), (NI)(x - ((NI) 1)));
	{
		NimStringDesc* version;
		if (!(x < (p ? p->Sup.len : 0))) goto LA3;
		version = copyStr(p, (NI)(x + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = 0;
			LOC7 = nstGet(packages, name);
			LOC8 = 0;
			LOC8 = HEX3CHEX2E_172064(LOC7, version);
			if (!LOC8) goto LA9;
			nstPut(packages, name, version);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages, name, ((NimStringDesc*) &TMP1660));
	}
	LA1: ;
}
Esempio n. 9
0
N_NIMCALL(Tnode192813*, parsepipe_220170)(NimStringDesc* filename, Tllstream179204* inputstream) {
	Tnode192813* result;
	Tllstream179204* s;
	result = 0;
	result = emptynode_193807;
	s = llstreamopen_179256(filename, ((NU8) 0));
	{
		NimStringDesc* line;
		NIM_BOOL LOC5;
		NI i;
		if (!!((s == NIM_NIL))) goto LA3;
		line = rawNewString(((NI) 80));
		LOC5 = 0;
		LOC5 = llstreamreadline_179610(s, (&line));
		i = utf8bom_220122(line);
		{
			NIM_BOOL LOC8;
			NIM_BOOL LOC11;
			LOC8 = 0;
			LOC8 = containsshebang_220132(line, i);
			if (!LOC8) goto LA9;
			LOC11 = 0;
			LOC11 = llstreamreadline_179610(s, (&line));
			i = ((NI) 0);
		}
		LA9: ;
		{
			NIM_BOOL LOC14;
			Tparser208205 q;
			NimStringDesc* LOC20;
			Tllstream179204* LOC21;
			LOC14 = 0;
			LOC14 = ((NU8)(line->data[i]) == (NU8)(35));
			if (!(LOC14)) goto LA15;
			LOC14 = ((NU8)(line->data[(NI)(i + ((NI) 1))]) == (NU8)(33));
			LA15: ;
			if (!LOC14) goto LA16;
			i += ((NI) 2);
			{
				while (1) {
					if (!(((NU8)(line->data[i])) == ((NU8)(32)) || ((NU8)(line->data[i])) == ((NU8)(9)) || ((NU8)(line->data[i])) == ((NU8)(11)) || ((NU8)(line->data[i])) == ((NU8)(13)) || ((NU8)(line->data[i])) == ((NU8)(10)) || ((NU8)(line->data[i])) == ((NU8)(12)))) goto LA19;
					i += ((NI) 1);
				} LA19: ;
			}
			memset((void*)(&q), 0, sizeof(q));
			objectInit((&q), (&NTI208205));
			LOC20 = 0;
			LOC20 = copyStr(line, i);
			LOC21 = 0;
			LOC21 = llstreamopen_179220(LOC20);
			openparser_208417((&q), filename, LOC21, NIM_FALSE);
			result = parseall_208216((&q));
			closeparser_208223((&q));
		}
		LA16: ;
		llstreamclose_179310(s);
	}
	LA3: ;
	return result;
}
Esempio n. 10
0
N_NIMCALL(void, addpackage_mPfTsfux8gBVeyQ8xwDYTQ)(Stringtableobj_DKRIdH9c9cKI7YpQb9c0wKlEw* packages0, NimStringDesc* p0) {
	NI x0;
	NimStringDesc* name0;
	x0 = versionsplitpos_0bw6GOnkbOdW19ciUnT3QEw(p0);
	name0 = copyStrLast(p0, ((NI) 0), (NI)(x0 - ((NI) 1)));
	{
		NimStringDesc* version0;
		if (!(x0 < (p0 ? p0->Sup.len : 0))) goto LA3;
		version0 = copyStr(p0, (NI)(x0 + ((NI) 1)));
		{
			NimStringDesc* LOC7;
			NIM_BOOL LOC8;
			LOC7 = (NimStringDesc*)0;
			LOC7 = getordefault_puv5W0GXw9aUdLJI2i8WreQ(packages0, name0);
			LOC8 = (NIM_BOOL)0;
			LOC8 = HEX3CHEX2E_T3MrVNu6QdhxPeHWeI9a9bIg(LOC7, version0);
			if (!LOC8) goto LA9;
			nstPut(packages0, name0, version0);
		}
		LA9: ;
	}
	goto LA1;
	LA3: ;
	{
		nstPut(packages0, name0, ((NimStringDesc*) &T_asNQM9aynXXg9ccUABbReyew_5));
	}
	LA1: ;
}
Esempio n. 11
0
N_NIMCALL(NimStringDesc*, getenv_121644)(NimStringDesc* key) {
	NimStringDesc* result;
	NI i;
{	result = 0;
	i = findenvvar_121605(key);
	{
		NI LOC5;
		if (!(((NI) 0) <= i)) goto LA3;
		LOC5 = 0;
		LOC5 = nsuFindChar(environment_121009->data[i], 61, ((NI) 0));
		result = copyStr(environment_121009->data[i], (NI)(LOC5 + ((NI) 1)));
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		NCSTRING env;
		env = getenv(key->data);
		{
			if (!(env == NIM_NIL)) goto LA9;
			result = copyString(((NimStringDesc*) &TMP136));
			goto BeforeRet;
		}
		LA9: ;
		result = cstrToNimstr(env);
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}
Esempio n. 12
0
	Token& Token::operator=( const Token& tok )
	{
	  module = tok.module;
	  id = tok.id;
	  type = tok.type;
	  precedence = tok.precedence;
	  deprecated = tok.deprecated;

	  nulStr();
      ownsStr = false;
	  if ( tok.token )
	  {
		if ( !tok.ownsStr )
		  setStr( tok.token );
		else
		  copyStr( tok.token );
	  }
	  dval = tok.dval;
	  lval = tok.lval;

	  dbg_filenum = tok.dbg_filenum;
	  dbg_linenum = tok.dbg_linenum;

	  userfunc = tok.userfunc;

	  return *this;
	}
Esempio n. 13
0
N_NIMCALL(NimStringDesc*, canondynlibname_154459)(NimStringDesc* s) {
	NimStringDesc* result;
	NI start;
	NI ende;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = nsuStartsWith(s, ((NimStringDesc*) &TMP1863));
		if (!LOC3) goto LA4;
		start = ((NI) 3);
	}
	goto LA1;
	LA4: ;
	{
		start = ((NI) 0);
	}
	LA1: ;
	ende = nsuFindCharSet(s, TMP1864, ((NI) 0));
	{
		if (!(((NI) 0) <= ende)) goto LA9;
		result = copyStrLast(s, start, (NI)(ende - ((NI) 1)));
	}
	goto LA7;
	LA9: ;
	{
		result = copyStr(s, start);
	}
	LA7: ;
	return result;
}
char * stringHelper::genCharArrays(string* strPtr, int num, int *strLen){
    *strLen = getMaxStrLen(strPtr, num) + 1;
    // allocate maxLen * strNum chars to store the strings
    // using an one-dimentional array to ensure the allocated space is continuous
    char *buf = new char[num * (*strLen)];
    for(int i = 0; i < num; i++){
        copyStr(buf + i*(*strLen), *strLen, strPtr[i]);
    }
    return buf;
}
Esempio n. 15
0
static char *maybeTruncateString(char *s) {
    int len = strlen(s);
    if (len > 10) {
        char *res = (char *)tlMalloc(14);
        memcpy(res, s, 10);
        res[10] = 0;
        strcat(res, "...");
        return res;
    }
    return copyStr(s);
}
Esempio n. 16
0
// Deletes a file using the shell (SHFileOperation)
// This is required as sometimes RemoveDirectory (and rm) report access is denied but the shell can delete it
static int DeleteWithSH(const TCHAR *f) {
	int retval;
	SHFILEOPSTRUCT op;
	ZeroMemory(&op, sizeof(SHFILEOPSTRUCT));
	op.wFunc = FO_DELETE;
	op.fFlags = FOF_NO_UI;
	op.pFrom = copyStr(f); // needs to be double null terminated (taken care of by copyStr)
	retval = SHFileOperation(&op);
	free((LPVOID)op.pFrom);
	return retval;
}
Esempio n. 17
0
long getIntId(char *s) {
    long res = (long)hashTableGet(idToIntMap, s);
    if (!res) {
        void *key = copyStr(s);
        void *value = (void *)(idToIntMap->size + 1L);
        hashTablePut(idToIntMap, key, value);
        hashTablePut(intToIdMap, value, key);
        res = idToIntMap->size;
    }
    return res;
}
Esempio n. 18
0
N_NIMCALL(NimStringDesc*, shortendir_153407)(NimStringDesc* dir) {
	NimStringDesc* result;
	NimStringDesc* prefix;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	NimStringDesc* LOC8;
{	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = getprefixdir_153371();
	LOC1 = rawNewString(LOC2->Sup.len + 1);
appendString(LOC1, LOC2);
appendChar(LOC1, 47);
	prefix = LOC1;
	{
		NIM_BOOL LOC5;
		LOC5 = 0;
		LOC5 = nsuStartsWith(dir, prefix);
		if (!LOC5) goto LA6;
		result = copyStr(dir, (prefix ? prefix->Sup.len : 0));
		goto BeforeRet;
	}
	LA6: ;
	LOC8 = 0;
	LOC8 = rawNewString(gprojectpath_153235->Sup.len + 1);
appendString(LOC8, gprojectpath_153235);
appendChar(LOC8, 47);
	prefix = LOC8;
	{
		NIM_BOOL LOC11;
		LOC11 = 0;
		LOC11 = nsuStartsWith(dir, prefix);
		if (!LOC11) goto LA12;
		result = copyStr(dir, (prefix ? prefix->Sup.len : 0));
		goto BeforeRet;
	}
	LA12: ;
	result = copyString(dir);
	}BeforeRet: ;
	return result;
}
Esempio n. 19
0
N_NIMCALL(void, addpackage_175137)(tstringtable123810* packages, NimStringDesc* p) {
    NI x;
    NimStringDesc* name;
    NI TMP1418;
    nimfr("addPackage", "babelcmd.nim")
    nimln(47, "babelcmd.nim");
    x = versionsplitpos_175014(p);
    nimln(48, "babelcmd.nim");
    nimln(48, "babelcmd.nim");
    nimln(48, "babelcmd.nim");
    TMP1418 = subInt(x, 1);
    name = copyStrLast(p, 0, (NI32)(TMP1418));
    nimln(49, "babelcmd.nim");
    {
        NimStringDesc* version;
        NI TMP1419;
        nimln(49, "babelcmd.nim");
        nimln(49, "babelcmd.nim");
        if (!(x < p->Sup.len)) goto LA3;
        nimln(50, "babelcmd.nim");
        nimln(50, "babelcmd.nim");
        nimln(50, "babelcmd.nim");
        TMP1419 = addInt(x, 1);
        version = copyStr(p, (NI32)(TMP1419));
        nimln(51, "babelcmd.nim");
        {
            NimStringDesc* LOC7;
            NIM_BOOL LOC8;
            nimln(51, "babelcmd.nim");
            nimln(51, "babelcmd.nim");
            LOC7 = 0;
            LOC7 = nstGet(packages, name);
            LOC8 = 0;
            LOC8 = HEX3CHEX2E_175054(LOC7, version);
            if (!LOC8) goto LA9;
            nimln(52, "babelcmd.nim");
            nstPut(packages, name, version);
        }
LA9:
        ;
    }
    goto LA1;
LA3:
    ;
    {
        nimln(54, "babelcmd.nim");
        nstPut(packages, name, ((NimStringDesc*) &TMP1417));
    }
LA1:
    ;
    popFrame();
}
Esempio n. 20
0
int _tmain(int argc, _TCHAR* argv[])
{
	char* smol = "qwertyuiopasdfghjklzxcvbnm";
	FILE* fp = 0;
	fopen_s(&fp, "XD_fail.txt", "r");
	char output[51];
	char** aw = new char*[100];
	int nw = 0, ni = 0;//ni число слов содержащие не только маленькие буквы буквы
	do{
		fgets(output, 50, fp);
		if (feof(fp)) break;  //Истинный выход
		if (output[strlen(output) - 1] == '\n')    	output[strlen(output) - 1] = '\0';
		char* next_p;
		char p = strtok_s(output, " ,.-?!()#[]<>{};*=", &next_p);
		while (p){
				//	cout << p << endl;
			aw[nw] = new char[strlen(p)];
			for (int i = 0; i <= strlen(p); ++i)
				aw[nw][i] = p[i];
			nw++;
			int a=0, b=0;
			for (int i = 0; i < strlen(p); i++)
			{
				char* SmolCh = copyStr(p, i, 1);
				if (strstr(smol, SmolCh))a++; else b++;
			}
			if ((a != 0)&(b != 0)) ni++;
				p = strtok_s(0, " ,.-?!()#[]<>{};*=", &next_p);
		}
	} while (true);
	
	fclose(fp);
	cout << "**** Result ****" << endl;
	_itoa_s(ni, output, 50, 10);
	aw[nw] = output;
	for (int i = 0; i < nw; ++i) cout << aw[i] << endl;
	fp = 0;
	
	fopen_s(&fp, "XD_fail.txt", "a");
fputs(aw[nw], fp); fputs("\n", fp);
	fclose(fp);
	/*char str[10];
	ifstream b_file("XD_fail.txt");
	while (!b_file.eof())
	{
		b_file >> str;
		cout << str << " ";
	}
	cin.get();*/

	return 0;
}
int main()
{
	int len = 0;
	while((len = getLine()) >0 ){
		if(len > max ){
			max = len; 
			copyStr();
		}
	}
	printf("longest line \n");
	printf("%s",longest);
	return 0;
}
Esempio n. 22
0
int isPalindrome(char *str)
{
	char temp[MAX_SIZE];

	cleanStr(str);
	copyStr(str, temp);
	reverseStr(temp);

	if(isEqual(str, temp)){
		return 1;
	}

	return 0;
}
Esempio n. 23
0
void reverseStr(char *src)
{
	char temp[MAX_SIZE];
	int i, len;

	len = getLen(src);

	for(i = 0; i < len; i++){
		temp[len - 1 - i] = src[i];
	}

	temp[i] = '\0';

	copyStr(temp, src);
}
int main(int argc, char ** argv){
	int max = 0; 
	int len; 
	char str[MAX_LEN];
	char longest[MAX_LEN];
	while((len = getLine(str, MAX_LEN)) > 0){
		if(len > max){
			max = len;
			copyStr(str,longest);
		}
	}
	if(max > 0){
		printf("the longest str is \n");
		printf("%s\n", longest );
	}
}
Esempio n. 25
0
N_NIMCALL(TY55526*, Parsepipe_92122)(NimStringDesc* Filename_92124, TY75204* Inputstream_92125) {
TY55526* Result_92126;
TY75204* S_92127;
NimStringDesc* Line_92139;
NI I_92140;
NIM_BOOL LOC5;
NIM_BOOL LOC9;
TY81011 Q_92180;
NimStringDesc* LOC14;
TY75204* LOC15;
Result_92126 = 0;
Result_92126 = Emptynode_55858;
S_92127 = 0;
S_92127 = Llstreamopen_75224(Filename_92124, ((NU8) 0));
if (!!((S_92127 == NIM_NIL))) goto LA2;
Line_92139 = 0;
Line_92139 = Llstreamreadline_75240(S_92127);
I_92140 = 0;
I_92140 = Utf8bom_92077(Line_92139);
LOC5 = Containsshebang_92087(Line_92139, I_92140);
if (!LOC5) goto LA6;
Line_92139 = Llstreamreadline_75240(S_92127);
I_92140 = 0;
LA6: ;
LOC9 = ((NU8)(Line_92139->data[I_92140]) == (NU8)(35));
if (!(LOC9)) goto LA10;
LOC9 = ((NU8)(Line_92139->data[(NI32)(I_92140 + 1)]) == (NU8)(33));
LA10: ;
if (!LOC9) goto LA11;
I_92140 += 2;
while (1) {
if (!(((NU8)(Line_92139->data[I_92140])) == ((NU8)(32)) || ((NU8)(Line_92139->data[I_92140])) == ((NU8)(9)) || ((NU8)(Line_92139->data[I_92140])) == ((NU8)(11)) || ((NU8)(Line_92139->data[I_92140])) == ((NU8)(13)) || ((NU8)(Line_92139->data[I_92140])) == ((NU8)(10)) || ((NU8)(Line_92139->data[I_92140])) == ((NU8)(12)))) goto LA13;
I_92140 += 1;
} LA13: ;
memset((void*)&Q_92180, 0, sizeof(Q_92180));
LOC14 = 0;
LOC14 = copyStr(Line_92139, I_92140);
LOC15 = 0;
LOC15 = Llstreamopen_75217(LOC14);
Openparser_81018(&Q_92180, Filename_92124, LOC15);
Result_92126 = Parseall_81014(&Q_92180);
Closeparser_81024(&Q_92180);
LA11: ;
Llstreamclose_75232(S_92127);
LA2: ;
return Result_92126;
}
Esempio n. 26
0
// 'Corrects' the security on a file by taking ownership of it and giving the current user full control
// For directories these will do a complete recursive correction.
static void CorrectSecurity(TCHAR *f, DWORD attrib, BOOL takeownership, PSID sid, PACL acl, BOOL oneVolumeOnly) {
	BY_HANDLE_FILE_INFORMATION info;
	if (attrib != INVALID_FILE_ATTRIBUTES) {
		DWORD err;
		if (sid && takeownership) {
			err = SetNamedSecurityInfo(f, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION, sid, NULL, NULL, NULL);
			if (err != ERROR_SUCCESS) { LogFileError(TEXT("SetNamedSecurityInfo (change owner)"), f, err); }
		}
		if (sid && acl) {
			err = SetNamedSecurityInfo(f, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, acl, NULL);
			if (err != ERROR_SUCCESS) { LogFileError(TEXT("SetNamedSecurityInfo (change DACL)"), f, err); }
		}
		if ((attrib & FILE_ATTRIBUTE_DIRECTORY) && !(oneVolumeOnly && FileChangesVolume(f))) {
			// Recursively go through the directories
			WIN32_FIND_DATA ffd;
			TCHAR full[BIG_PATH+5], *file = copyStr(f);
			HANDLE hFind;
			DWORD dwError;
			DWORD len = _tcslen(file);
			while (len > 0 && file[len-1] == L'\\')
				file[--len] = 0;
			file[len  ] = TEXT('\\');
			file[len+1] = TEXT('*');
			file[len+2] = 0;
			hFind = FindFirstFileEx(file, FindExInfoBasic, &ffd, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
			if (hFind == INVALID_HANDLE_VALUE) {
				dwError = GetLastError();
				if (dwError != ERROR_FILE_NOT_FOUND && dwError != ERROR_ACCESS_DENIED)
					LogFileError(TEXT("FindFirstFileEx in CorrectSecurity failed for"), file, dwError);
			} else {
				do {
					if (_tcscmp(ffd.cFileName, TEXT("..")) == 0 || _tcscmp(ffd.cFileName, TEXT(".")) == 0)
						continue;
					CorrectSecurity(makeFullPath(f, ffd.cFileName, full), ffd.dwFileAttributes, takeownership, sid, acl, oneVolumeOnly);
				} while (FindNextFile(hFind, &ffd) != 0);
				dwError = GetLastError();
				if (dwError != ERROR_NO_MORE_FILES)
					LogError(TEXT("FindNextFile in CorrectSecurity"), dwError);
				FindClose(hFind);
			}
			free(file);
		}
		if (attrib & FILE_ATTRIBUTE_READONLY) { // Remove the read-only attribute
			SetFileAttributes(f, attrib&!FILE_ATTRIBUTE_READONLY);
		}
	}
}
Esempio n. 27
0
void cleanStr(char *src)
{
	char temp[MAX_SIZE];
	int len, newLen = 0, i;

	len = getLen(src);

	for(i = 0; i < len; i++){
		if(isalpha(src[i])){
			temp[newLen++] = tolower(src[i]);
		}
	}

	temp[newLen] = '\0';

	copyStr(temp, src);
}
Esempio n. 28
0
N_NIMCALL(NimStringDesc*, canondynlibname_137360)(NimStringDesc* s) {
	NimStringDesc* result;
	NI start;
	NI ende;
	nimfr("canonDynlibName", "options.nim")
	result = 0;
	nimln(356, "options.nim");
	nimln(356, "options.nim");
	{
		NIM_BOOL LOC3;
		nimln(356, "options.nim");
		LOC3 = 0;
		LOC3 = nsuStartsWith(s, ((NimStringDesc*) &TMP442));
		if (!LOC3) goto LA4;
		start = 3;
	}
	goto LA1;
	LA4: ;
	{
		start = 0;
	}
	LA1: ;
	nimln(357, "options.nim");
	ende = nsuFindCharSet(s, TMP443, 0);
	nimln(358, "options.nim");
	{
		NI TMP444;
		nimln(358, "options.nim");
		if (!(0 <= ende)) goto LA9;
		nimln(359, "options.nim");
		nimln(359, "options.nim");
		nimln(359, "options.nim");
		TMP444 = subInt(ende, 1);
		result = copyStrLast(s, start, (NI32)(TMP444));
	}
	goto LA7;
	LA9: ;
	{
		nimln(361, "options.nim");
		nimln(361, "options.nim");
		result = copyStr(s, start);
	}
	LA7: ;
	popFrame();
	return result;
}
Esempio n. 29
0
QString findModule(const QString &module)
{
   // If the module is a legal filename, return the module name.
   if( module.contains(QRegExp(".*\\.js$"))) {
      if( QFile::exists(module) ) return module;
   }

   // Search through the libraries to see if the module is found.  The
   // namespace separators are replaced with '/' and the postfix '.js'
   // is added.
   foreach( const QString &path, QCoreApplication::libraryPaths() ) {
      QString copyStr(module);
      QString const file = path + "/" + copyStr.replace(QChar('.'), QChar('/')) + ".js";

      if( QFile::exists(file) ) {
   return file;
      }
   }
Esempio n. 30
0
int
initFile(char *file)
{
    if (he_file)
        HDfree(he_file);
    he_file = copyStr(file);

    if (updateDesc() < 0)
        return FAIL;

    /* if there are groups in this file, go to the first group tag */
    /* otherwise, just go to the first element */
    if (he_numGrp > 0)
        he_currDesc = he_grp[0].desc;
    else
        he_currDesc = 0;

    return resetPred();
}