Example #1
0
int __cdecl main(int argc, char *argv[])
{
    int neg = -42;
    int pos = 0x1234ab;
    INT64 l = 0x1234567887654321;

    if (PAL_Initialize(argc, argv) != 0)
    {
        return(FAIL);
    }

    DoNumTest(convert("foo %x"), pos, convert("foo 1234ab"));
    DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab"));
    DoNumTest(convert("foo %hx"), pos, convert("foo 34ab"));
    DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab"));
    DoI64NumTest(convert("foo %I64x"), l, "0x1234567887654321",
        convert("foo 1234567887654321"));
    DoNumTest(convert("foo %7x"), pos, convert("foo  1234ab"));
    DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab "));
    DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab"));
    DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab"));
    DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab"));
    DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab"));
    DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab"));
    DoNumTest(convert("foo % x"), pos, convert("foo 1234ab"));
    DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6"));
    DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6"));

    PAL_Terminate();
    return PASS;
}
CoordinateGps CoordinateConverter::convert(const QVector3D &c) const
{
    return convert(Ogre::Vector3(c.x(), c.y(), c.z()));
}
QMessageAccountId QMessageAccount::id() const
{
    return convert(d_ptr->_account.id());
}
Example #4
0
 void ParseCommandLine(const TCHAR *_cmdline) {
   WideToACPConverter convert(_cmdline);
   ParseCommandLine(convert);
 }
void PackedArgb::setArgb(const VectorArgb &argb)
{
	m_argb = convert(argb.a, argb.r, argb.g, argb.b);
}
Example #6
0
 /// Starts of integer variable going to zero
 inline int * toZero() const
 { convert(); return toZero_;}
Example #7
0
int __cdecl main(int argc, char *argv[])
{
     
    BOOL  success = TRUE;  /* assume success */
    DWORD dwRet;
    DWORD dwProcessId;
    char szEventName[MAX_LONGPATH];
    PWCHAR uniString;

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return FAIL;
    }

    /* Open the event to let test thread tell us to get started. */
    uniString = convert(szcHelperProcessStartEvName);
    hProcessStartEvent = OpenEventW(EVENT_ALL_ACCESS, 0, uniString);
    free(uniString);
    if (!hProcessStartEvent) 
    {
        Fail("helper.main: OpenEvent of '%S' failed (%u). "
             "(the event should already exist!)\n", 
             szcHelperProcessStartEvName, GetLastError());
    }

    /* Wait for signal from test thread. */
    dwRet = WaitForSingleObject(hProcessStartEvent, TIMEOUT);
    if (dwRet != WAIT_OBJECT_0)
    {
        Fail("helper.main: WaitForSingleObject '%s' failed\n"
                "LastError:(%u)\n", szcHelperProcessStartEvName, GetLastError());
    }

    dwProcessId = GetCurrentProcessId();
    
    if ( 0 >= dwProcessId ) 
    {
        Fail ("helper.main: %s has invalid pid %d\n", argv[0], dwProcessId );
    }

    /* Open the event to tell test thread we are ready. */
    if (sprintf_s(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessReadyEvName, dwProcessId) < 0)
    {
        Fail ("helper.main: Insufficient event name string length for pid=%d\n", dwProcessId);
    }

    uniString = convert(szEventName);

    hProcessReadyEvent = OpenEventW(EVENT_ALL_ACCESS, 0, uniString);
    free(uniString);
    if (!hProcessReadyEvent) 
    {
        Fail("helper.main: OpenEvent of '%s' failed (%u). "
             "(the event should already exist!)\n", 
             szEventName, GetLastError());
    }

    /* Open the event to let test thread tell us to exit. */
    if (sprintf_s(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessFinishEvName, dwProcessId) < 0)
    {
        Fail ("helper.main: Insufficient event name string length for pid=%d\n", dwProcessId);
    }

    uniString = convert(szEventName);

    hProcessFinishEvent = OpenEventW(EVENT_ALL_ACCESS, 0, uniString);
    free(uniString);
    if (!hProcessFinishEvent) 
    {
        Fail("helper.main: OpenEvent of '%s' failed LastError:(%u).\n",
             szEventName, GetLastError());
    }

    /* Tell the test thread we are ready. */
    if (!SetEvent(hProcessReadyEvent))
    {
        Fail("helper.main: SetEvent '%s' failed LastError:(%u)\n",
            hProcessReadyEvent, GetLastError());
    }

    /* Wait for signal from test thread before exit. */
    dwRet = WaitForSingleObject(hProcessFinishEvent, TIMEOUT);
    if (WAIT_OBJECT_0 != dwRet)
    {
        Fail("helper.main: WaitForSingleObject '%s' failed pid=%d\n"
            "LastError:(%u)\n", 
            szcHelperProcessFinishEvName, dwProcessId, GetLastError());
    }

    PEDANTIC(CloseHandle, (hProcessStartEvent));
    PEDANTIC(CloseHandle, (hProcessReadyEvent));
    PEDANTIC(CloseHandle, (hProcessFinishEvent));

    PAL_Terminate();

    return success ? PASS : FAIL;
}
Example #8
0
long L6470::getPos(){
	unsigned long position = GetParam(ABS_POS);
	return convert(position);
}
Example #9
0
int
main(
	int	argc,
	char	*argv[]
)
{
	FILE	*fp;
	int	i, j;

	progname = argv[0];
	i = 1;
	while (i < argc && argv[i][0] == '-') {
		do {
			switch (argv[i][1]) {
			case 'i':
				marker[nmarkers].usetype = USE_INSTANCE;
				marker[nmarkers].objname = argv[++i];
				break;
			case 'I':
				marker[nmarkers].usetype = USE_MESH;
				marker[nmarkers].objname = argv[++i];
				break;
			case 'x':
				marker[nmarkers].usetype = USE_XFORM;
				marker[nmarkers].objname = argv[++i];
				break;
			case 'e':
				expand = 1;
				break;
			case 'm':
				marker[nmarkers].modout = argv[++i];
				break;
			case 's':
				marker[nmarkers].mscale = atof(argv[++i]);
				break;
			default:
				goto userr;
			}
			if (++i >= argc)
				goto userr;
		} while (argv[i][0] == '-');
		if (marker[nmarkers].objname == NULL)
			goto userr;
		if (nmarkers >= MAXMARK) {
			fprintf(stderr, "%s: too many markers\n", progname);
			return 1;
		}
		marker[nmarkers++].modin = argv[i++];
		marker[nmarkers].mscale = marker[nmarkers-1].mscale;
	}
	if (nmarkers == 0)
		goto userr;
					/* simple header */
	putchar('#');
	for (j = 0; j < i; j++) {
		putchar(' ');
		fputs(argv[j], stdout);
	}
	putchar('\n');
	if (i == argc)
		convert("<stdin>", stdin);
	else
		for ( ; i < argc; i++) {
			if ((fp = fopen(argv[i], "r")) == NULL) {
				perror(argv[i]);
				exit(1);
			}
			convert(argv[i], fp);
			fclose(fp);
		}
	return 0;
userr:
	fprintf(stderr,
"Usage: %s [-e][-s size][-m modout] {-x objfile|-i octree|-I mesh} modname .. [file ..]\n",
		progname);
	return 1;
}
void
VectorArrayAPI<T>::get_entry_mpz_class(int r, int c, mpz_class& value) const
{
    convert(data[r][c], value);
}
DeviceNameList DevicesI::getDevicelist(devicetype type,
			const Ice::Current& /* current */) {
	astro::module::Devices::devicelist	devicelist
		= _devices.getDevicelist(convert(type));
	return convert(devicelist);
}
void
VectorArrayAPI<T>::set_entry_mpz_class(int r, int c, const mpz_class& value)
{
    convert(value, data[r][c]);
}
void
VectorArrayAPI<T>::get_entry_int64_t(int r, int c, _4ti2_int64_t& value) const
{
    convert(data[r][c], value);
}
void
VectorArrayAPI<T>::set_entry_int64_t(int r, int c, const _4ti2_int64_t& value)
{
    convert(value, data[r][c]);
}
Example #15
0
int main(int argc, char **argv)
{
    const char *szTestFile;
    FILE *f;

    if (argc != 2) {
        fprintf(stderr, "%s <test file>\n", argv[0]);
        EXIT(1);
    }
    CRYPTO_malloc_debug_init();
    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

    szTestFile = argv[1];

    f = fopen(szTestFile, "r");
    if (!f) {
        perror(szTestFile);
        EXIT(2);
    }
    ERR_load_crypto_strings();
    /* Load up the software EVP_CIPHER and EVP_MD definitions */
    OpenSSL_add_all_ciphers();
    OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
    /* Load all compiled-in ENGINEs */
    ENGINE_load_builtin_engines();
#endif
#if 0
    OPENSSL_config();
#endif
#ifndef OPENSSL_NO_ENGINE
    /*
     * Register all available ENGINE implementations of ciphers and digests.
     * This could perhaps be changed to "ENGINE_register_all_complete()"?
     */
    ENGINE_register_all_ciphers();
    ENGINE_register_all_digests();
    /*
     * If we add command-line options, this statement should be switchable.
     * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use
     * if they weren't already initialised.
     */
    /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
#endif

    for (;;) {
        char line[4096];
        char *p;
        char *cipher;
        unsigned char *iv, *key, *plaintext, *ciphertext, *aad, *tag;
        int encdec;
        int kn, in, pn, cn;
        int an = 0;
        int tn = 0;

        if (!fgets((char *)line, sizeof line, f))
            break;
        if (line[0] == '#' || line[0] == '\n')
            continue;
        p = line;
        cipher = sstrsep(&p, ":");
        key = ustrsep(&p, ":");
        iv = ustrsep(&p, ":");
        plaintext = ustrsep(&p, ":");
        ciphertext = ustrsep(&p, ":");
        if (p[-1] == '\n') {
            encdec = -1;
            p[-1] = '\0';
            tag = aad = NULL;
            an = tn = 0;
        } else {
            aad = ustrsep(&p, ":");
            tag = ustrsep(&p, ":");
            if (tag == NULL) {
                p = (char *)aad;
                tag = aad = NULL;
                an = tn = 0;
            }
            if (p[-1] == '\n') {
                encdec = -1;
                p[-1] = '\0';
            } else
                encdec = atoi(sstrsep(&p, "\n"));
        }

        kn = convert(key);
        in = convert(iv);
        pn = convert(plaintext);
        cn = convert(ciphertext);
        if (aad) {
            an = convert(aad);
            tn = convert(tag);
        }

        if (!test_cipher
            (cipher, key, kn, iv, in, plaintext, pn, ciphertext, cn, aad, an,
             tag, tn, encdec)
            && !test_digest(cipher, plaintext, pn, ciphertext, cn)) {
#ifdef OPENSSL_NO_AES
            if (strstr(cipher, "AES") == cipher) {
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
                continue;
            }
#endif
#ifdef OPENSSL_NO_DES
            if (strstr(cipher, "DES") == cipher) {
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
                continue;
            }
#endif
#ifdef OPENSSL_NO_RC4
            if (strstr(cipher, "RC4") == cipher) {
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
                continue;
            }
#endif
#ifdef OPENSSL_NO_CAMELLIA
            if (strstr(cipher, "CAMELLIA") == cipher) {
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
                continue;
            }
#endif
#ifdef OPENSSL_NO_SEED
            if (strstr(cipher, "SEED") == cipher) {
                fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
                continue;
            }
#endif
            fprintf(stderr, "Can't find %s\n", cipher);
            EXIT(3);
        }
    }
    fclose(f);

#ifndef OPENSSL_NO_ENGINE
    ENGINE_cleanup();
#endif
    EVP_cleanup();
    CRYPTO_cleanup_all_ex_data();
    ERR_remove_thread_state(NULL);
    ERR_free_strings();
    CRYPTO_mem_leaks_fp(stderr);

    return 0;
}
void cpp_typecheckt::convert(cpp_namespace_spect &namespace_spec)
{
  // save the scope
  cpp_save_scopet saved_scope(cpp_scopes);

  const irep_idt &name=namespace_spec.get_namespace();

  if(name=="")
  {
    // "unique namespace"
    err_location(namespace_spec);
    throw "unique namespace not supported yet";
  }

  irep_idt final_name(name);

  std::string identifier=
    cpp_identifier_prefix(current_mode)+"::"+
    cpp_scopes.current_scope().prefix+id2string(final_name);

  contextt::symbolst::const_iterator it=
    context.symbols.find(identifier);

  if(it!=context.symbols.end())
  {
    if(namespace_spec.alias().is_not_nil())
    {
      err_location(namespace_spec);
      str << "namespace alias `" << final_name
          << "' previously declared" << std::endl;
      str << "location of previous declaration: "
          << it->second.location;
      throw 0;
    }

    if(it->second.type.id()!="namespace")
    {
      err_location(namespace_spec);
      str << "namespace `" << final_name
          << "' previously declared" << std::endl;
      str << "location of previous declaration: "
          << it->second.location;
      throw 0;
    }

    // enter that scope
    cpp_scopes.set_scope(it->first);
  }
  else
  {
    symbolt symbol;

    symbol.name=identifier;
    symbol.base_name=final_name;
    symbol.value.make_nil();
    symbol.location=namespace_spec.location();
    symbol.mode=current_mode;
    symbol.module=module;
    symbol.type=typet("namespace");

    if(context.move(symbol))
      throw "cpp_typecheckt::convert_namespace: context.move() failed";

    cpp_scopes.new_namespace(final_name);
  }

  /*if(namespace_spec.alias().is_not_nil())
  {
    cpp_typecheck_resolvet resolver(*this);
    cpp_scopet &s=resolver.resolve_namespace(namespace_spec.alias());
    cpp_scopes.current_scope().add_using_scope(s);
  }
  else
  {*/
    // do the declarations
    for(cpp_namespace_spect::itemst::iterator
        it=namespace_spec.items().begin();
        it!=namespace_spec.items().end();
        it++)
      convert(*it);
//  }
}
Example #17
0
 /// Entries for fixing variables
 inline cliqueEntry * fixEntries() const
 { convert(); return fixEntry_;}
Example #18
0
int main(int argc, char **argv)
{
  GDALAllRegister();
  
  try
  {
    boost::timer::cpu_timer timer;
    
    input_arguments parsed_args;
    
    boost::program_options::options_description options_all("Fire Points to SciDB's Multidimensional Array Conversion Options");
    
    options_all.add_options()
    ("version", "Print Fire Points to SciDB conversion tool version.\n")
    ("help", "Prints help message.\n")
    ("verbose", "Turns on verbose mode: prints timing and some more information about the conversion progress.\n")
    ("f", boost::program_options::value<std::string>(&parsed_args.source_file_name), "The source TIFF file to convert to SciDB's load format.\n")
    ("o", boost::program_options::value<std::string>(&parsed_args.target_file_name), "The target folder to store SciDB data file.\n")
    ("t", boost::program_options::value<int16_t>(&parsed_args.time_point), "The timeline position for the dataset.\n")
    ;
    
    boost::program_options::variables_map options;
    
    boost::program_options::store(boost::program_options::parse_command_line(argc, argv, options_all), options);
    
    boost::program_options::notify(options);
    
    if(options.count("help"))
    {
      std::cout << options_all << std::endl;
      
      return EXIT_SUCCESS;
    }
    
    if(options.count("version"))
    {
      std::cout << "\n\nfocos2scidb version: " SCIETL_VERSION_STRING "\n" << std::endl;
      
      return EXIT_SUCCESS;
    }
    
    parsed_args.verbose = options.count("verbose") ? true : false;
    
    valid_args(parsed_args);
    
    if(parsed_args.verbose)
      std::cout << "\nfocos2scidb started\n" << std::endl;
    
    convert(parsed_args);
    
    if(parsed_args.verbose)
      std::cout << "\n\nfocos2scidb finished successfully!\n" << std::endl;
  }
  catch(const std::exception& e)
  {
    std::cerr << "\n\nfocos2scidb finished with errors!\n";
    
    if(e.what() != 0)
      std::cerr << "\nAn unexpected error has occurried: " << e.what() << "\n";
    
    std::cerr << "\nPlease, report it to [email protected].\n" << std::endl;
    
    return EXIT_FAILURE;
  }
  catch(...)
  {
    std::cerr << "\n\nAn unexpected error has occurried with no additional information.\n" << std::endl;
    
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}
Example #19
0
 /// Starts of integer variable going to one
 inline int * toOne() const
 { convert(); return toOne_;}
Example #20
0
BOOL test1()
{
   int pos = 0x1234ab;

   wsprintf(buf, convert("foo %X"), pos);
   if (memcmp(buf, convert("foo 1234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 1) Failed. The correct string is"
                      " 'foo 1234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %lX"), pos);
   if (memcmp(buf, convert("foo 1234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 2) Failed. The correct string is"
                      " 'foo 1234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %7X"), pos);
   if (memcmp(buf, convert("foo  1234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 3) Failed. The correct string is"
                      " 'foo 1234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %-7X"), pos);
   if (memcmp(buf, convert("foo 1234AB "), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 4) Failed. The correct string is"
                      " 'foo 1234AB ' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %.1X"), pos);
   if (memcmp(buf, convert("foo 1234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 5) Failed. The correct string is"
                      " 'foo 1234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %.7X"), pos);
   if (memcmp(buf, convert("foo 01234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 6) Failed. The correct string is"
                      " 'foo 01234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %07X"), pos);
   if (memcmp(buf, convert("foo 01234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 7) Failed. The correct string is"
                      " 'foo 01234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   wsprintf(buf, convert("foo %#X"), pos);
   if (memcmp(buf, convert("foo 0X1234AB"), wcslen(buf)*2 + 2) != 0)
   {
       ErrorMessage = "ERROR: (Test 8) Failed. The correct string is"
                      " 'foo 0X1234AB' and the result returned was ";
       BadResult = buf;
       return FAIL;
   }

   return PASS;
}
Example #21
0
void boolbvt::convert_with_array(
  const array_typet &type,
  const exprt &op1,
  const exprt &op2,
  const bvt &prev_bv,
  bvt &next_bv)
{
  if(is_unbounded_array(type))
  {
    // can't do this
    error().source_location=type.source_location();
    error() << "convert_with_array called for unbounded array" << eom;
    throw 0;
  }

  const exprt &array_size=type.size();

  mp_integer size;

  if(to_integer(array_size, size))
  {
    error().source_location=type.source_location();
    error() << "convert_with_array expects constant array size" << eom;
    throw 0;
  }

  const bvt &op2_bv=convert_bv(op2);

  if(size*op2_bv.size()!=prev_bv.size())
  {
    error().source_location=type.source_location();
    error() << "convert_with_array: unexpected operand 2 width" << eom;
    throw 0;
  }

  // Is the index a constant?
  mp_integer op1_value;
  if(!to_integer(op1, op1_value))
  {
    // Yes, it is!
    next_bv=prev_bv;

    if(op1_value>=0 && op1_value<size) // bounds check
    {
      std::size_t offset=integer2unsigned(op1_value*op2_bv.size());

      for(std::size_t j=0; j<op2_bv.size(); j++)
        next_bv[offset+j]=op2_bv[j];
    }

    return;
  }

  typet counter_type=op1.type();

  for(mp_integer i=0; i<size; i=i+1)
  {
    exprt counter=from_integer(i, counter_type);

    literalt eq_lit=convert(equal_exprt(op1, counter));

    std::size_t offset=integer2unsigned(i*op2_bv.size());

    for(std::size_t j=0; j<op2_bv.size(); j++)
      next_bv[offset+j]=
        prop.lselect(eq_lit, op2_bv[j], prev_bv[offset+j]);
  }
}
Example #22
0
flint::fmpqxx URatPSeriesFlint::convert(const Rational &x)
{
    return convert(x.as_mpq());
}
Example #23
0
PackedArgb::PackedArgb(const VectorArgb &argb)
: m_argb(convert(argb.a, argb.r, argb.g, argb.b))
{
}
Example #24
0
static void
filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
	       char **outbuf, size_t *outlen, size_t *outprespace)
{
	convert (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace, FALSE);
}
module_type parse(std::istream &stream) {
	return convert(parse_intermediate(stream));
}
Example #26
0
static void 
filter_complete (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
		 char **outbuf, size_t *outlen, size_t *outprespace)
{
	convert (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace, TRUE);
}
void BServerSocket::onReadyRead()
{
	QSocket *s = (QSocket *)sender();
	if (s->canReadLine())
	{
		QString line = s->readLine();
		qDebug(line);
		line.remove("\n");
		line.remove("\r");
		if (line == "ping")
			writeLineToSocket("pong",s);

		QSqlQuery query(db);
		QString sql;
		QString ipaddress;
		QString username;
		QStringList tokens = QStringList::split(" ",line);
		QString iptablescmd = "iptables ";
		switch (convert(tokens[0]))
		{
		case SN_1 :
			// tokens[1] -> ip / user@ip, tokens[2]-> menit (15,30,60,90,120,99999999), tokens[3]-> tipe (INT,KTK)
			//masukkan ke database karena ada yang login
			//cek disini validitas data klo sala kembalikan pesan error ER_1 / "ER01"
			//send ke client OK_1 / "OK01"
			
			if (tokens[1].contains("@"))
			{
				username = tokens[1].section("@",0,0);
				ipaddress = tokens[1].section("@",1,1); 
				if (tokens[3]=="INT")
				{	
					//iptablescmd += "-D -o $FREEBILLING_IFACE -p tcp -m owner --uid-owner=";
					//iptablescmd += username; /* ganti ke uid */ 
					//iptablescms += " -j DROP";
					//printf("%s\n",iptablescmd.ascii());
					//system (iptablescmd);
				} else
				{
					
					//iptablescmd += "-A -o $FREEBILLING_IFACE -p tcp -m owner --uid-owner=";
					//iptablescmd += username; /* ganti ke uid */ 
					//iptablescmd += " -j DROP";	
					//printf("%s\n",iptablescmd.ascii());
					//system (iptablescmd);
				}


			} else
			{
				
				ipaddress = tokens[1];
				if (tokens[3]=="INT")
				{	
					iptablescmd += "-A POSTROUTING -t nat -s ";
					iptablescmd += ipaddress;
					iptablescmd += " -o $FREEBILLING_IFACE -j MASQUERADE";
					printf("%s\n",iptablescmd.ascii());
					system (iptablescmd);
				} else
				{
					iptablescmd += "-D POSTROUTING -t nat -s ";
					iptablescmd += ipaddress;
					iptablescmd += " -o $FREEBILLING_IFACE -j MASQUERADE";	
					printf("%s\n",iptablescmd.ascii());
					system (iptablescmd);
				}
			}
			
			s->setName(ipaddress);
			
			sql = "SELECT computer_login('" + ipaddress + "','" + tokens[3] + "'," + tokens[2] + ");";

			query.exec(sql);	
			
			writeLineToSocket("OK01",s);
		break;
		case SN_4 :
			query.exec(QString("SELECT computer_logout('") + s->name() + QString("');"));
			s->close();
			s->deleteLater();
		break;
		case CS_1 :
			//resend this message to client
			this->writeLineToSocket("CS01",(QSocket *)this->child(tokens[1]));
			s->close();
			s->deleteLater();
		break;
		}
	}
}
Example #28
0
int __cdecl main(int argc, char *argv[])
{
    int neg = -42;
    int pos = 0x1234ab;
    INT64 l = I64(0x1234567887654321);

    if (PAL_Initialize(argc, argv) != 0)
        return(FAIL);

    DoNumTest(convert("foo %X"), pos, convert("foo 1234AB"));
    DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB"));
    DoNumTest(convert("foo %hX"), pos, convert("foo 34AB"));
    DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB"));
    DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321", 
        convert("foo 1234567887654321"));
    DoNumTest(convert("foo %7X"), pos, convert("foo  1234AB"));
    DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB "));
    DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB"));
    DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB"));
    DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB"));
    DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB"));
    DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB"));
    DoNumTest(convert("foo % X"), pos, convert("foo 1234AB"));
    DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6"));
    DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6"));

    PAL_Terminate();
    return PASS;
}
QMessage::TypeFlags QMessageAccount::messageTypes() const
{
    return convert(d_ptr->_account.messageType());
}
QMessageAccountFilter QMessageAccountFilter::byName(const QString &value, QMessageDataComparator::InclusionComparator cmp)
{
    QMessageAccountFilter result;
    result.d_ptr->_key = QMailAccountKey::name(value, convert(cmp));
    return result;
}