当前位置: 首页>>代码示例>>C++>>正文


C++ ENC函数代码示例

本文整理汇总了C++中ENC函数的典型用法代码示例。如果您正苦于以下问题:C++ ENC函数的具体用法?C++ ENC怎么用?C++ ENC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ENC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QApplication

qPBReader::qPBReader(int & argc, char ** argv) :
   QApplication(argc, argv),
   _bGlobalConfMode(false),
   _pViewer(0),
   _pConfigDialog(0)
{
   TRSCOPE(app, "qPBReader::qPBReader");

   if (TRACEON)
   {
      TRACE << "Current dir " << ENC(QDir::currentPath()) << endl;
      TRACE << "argc=" << argc << endl;

      for (int idx = 0; idx < argc; idx++)
      {
         TRACE << idx << ": " << ENC(argv[idx]) << endl;
      }
   }

   QString sLangFile = QCoreApplication::applicationFilePath() +
                       "_" +
                       qPBReaderConfig::GetApplicationLanguage();
   TRACE << VAR(sLangFile) << endl;
   _translator.load(sLangFile);
   installTranslator(&_translator);
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:26,代码来源:qPBReader.cpp

示例2: dss_openssh_fmtkey

static int dss_openssh_fmtkey(void *key, unsigned char *blob, int len)
{
    struct dss_key *dss = (struct dss_key *) key;
    int bloblen, i;

    bloblen =
	ssh2_bignum_length(dss->p) +
	ssh2_bignum_length(dss->q) +
	ssh2_bignum_length(dss->g) +
	ssh2_bignum_length(dss->y) +
	ssh2_bignum_length(dss->x);

    if (bloblen > len)
	return bloblen;

    bloblen = 0;
#define ENC(x) \
    PUT_32BIT(blob+bloblen, ssh2_bignum_length((x))-4); bloblen += 4; \
    for (i = ssh2_bignum_length((x))-4; i-- ;) blob[bloblen++]=bignum_byte((x),i);
    ENC(dss->p);
    ENC(dss->q);
    ENC(dss->g);
    ENC(dss->y);
    ENC(dss->x);

    return bloblen;
}
开发者ID:AshKash,项目名称:kit-sink,代码行数:27,代码来源:sshdss.c

示例3: test_destructor

static void test_destructor(
  sqlite3_context *pCtx, 
  int nArg,
  sqlite3_value **argv
){
  char *zVal;
  int len;
  sqlite3 *db = sqlite3_user_data(pCtx);
 
  test_destructor_count_var++;
  assert( nArg==1 );
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  len = sqlite3ValueBytes(argv[0], ENC(db)); 
  zVal = sqliteMalloc(len+3);
  zVal[len] = 0;
  zVal[len-1] = 0;
  assert( zVal );
  zVal++;
  memcpy(zVal, sqlite3ValueText(argv[0], ENC(db)), len);
  if( ENC(db)==SQLITE_UTF8 ){
    sqlite3_result_text(pCtx, zVal, -1, destructor);
#ifndef SQLITE_OMIT_UTF16
  }else if( ENC(db)==SQLITE_UTF16LE ){
    sqlite3_result_text16le(pCtx, zVal, -1, destructor);
  }else{
    sqlite3_result_text16be(pCtx, zVal, -1, destructor);
#endif /* SQLITE_OMIT_UTF16 */
  }
}
开发者ID:f059074251,项目名称:interested,代码行数:29,代码来源:func.c

示例4: sqlite3FindCollSeq

/*
** This function is responsible for invoking the collation factory callback
** or substituting a collation sequence of a different encoding when the
** requested collation sequence is not available in the database native
** encoding.
** 
** If it is not NULL, then pColl must point to the database native encoding 
** collation sequence with name zName, length nName.
**
** The return value is either the collation sequence to be used in database
** db for collation type name zName, length nName, or NULL, if no collation
** sequence can be found.
*/
CollSeq *sqlite3GetCollSeq(
  sqlite3* db, 
  CollSeq *pColl, 
  const char *zName, 
  int nName
){
  CollSeq *p;

  p = pColl;
  if( !p ){
    p = sqlite3FindCollSeq(db, ENC(db), zName, nName, 0);
  }
  if( !p || !p->xCmp ){
    /* No collation sequence of this type for this encoding is registered.
    ** Call the collation factory to see if it can supply us with one.
    */
    callCollNeeded(db, zName, nName);
    p = sqlite3FindCollSeq(db, ENC(db), zName, nName, 0);
  }
  if( p && !p->xCmp && synthCollSeq(db, p) ){
    p = 0;
  }
  assert( !p || p->xCmp );
  return p;
}
开发者ID:DoganA,项目名称:nightingale-deps,代码行数:38,代码来源:callback.c

示例5: sqlite3Stat4ProbeSetValue

/*
 ** This function is used to allocate and populate UnpackedRecord
 ** structures intended to be compared against sample index keys stored
 ** in the sqlite_stat4 table.
 **
 ** A single call to this function attempts to populates field iVal (leftmost
 ** is 0 etc.) of the unpacked record with a value extracted from expression
 ** pExpr. Extraction of values is possible if:
 **
 **  * (pExpr==0). In this case the value is assumed to be an SQL NULL,
 **
 **  * The expression is a bound variable, and this is a reprepare, or
 **
 **  * The sqlite3ValueFromExpr() function is able to extract a value
 **    from the expression (i.e. the expression is a literal value).
 **
 ** If a value can be extracted, the affinity passed as the 5th argument
 ** is applied to it before it is copied into the UnpackedRecord. Output
 ** parameter *pbOk is set to true if a value is extracted, or false 
 ** otherwise.
 **
 ** When this function is called, *ppRec must either point to an object
 ** allocated by an earlier call to this function, or must be NULL. If it
 ** is NULL and a value can be successfully extracted, a new UnpackedRecord
 ** is allocated (and *ppRec set to point to it) before returning.
 **
 ** Unless an error is encountered, SQLITE_OK is returned. It is not an
 ** error if a value cannot be extracted from pExpr. If an error does
 ** occur, an SQLite error code is returned.
 */
SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(
                                             Parse *pParse,                  /* Parse context */
                                             Index *pIdx,                    /* Index being probed */
                                             UnpackedRecord **ppRec,         /* IN/OUT: Probe record */
                                             Expr *pExpr,                    /* The expression to extract a value from */
                                             u8 affinity,                    /* Affinity to use */
                                             int iVal,                       /* Array element to populate */
                                             int *pbOk                       /* OUT: True if value was extracted */
){
    int rc = SQLITE_OK;
    sqlite3_value *pVal = 0;
    sqlite3 *db = pParse->db;
    
    
    struct ValueNewStat4Ctx alloc;
    alloc.pParse = pParse;
    alloc.pIdx = pIdx;
    alloc.ppRec = ppRec;
    alloc.iVal = iVal;
    
    /* Skip over any TK_COLLATE nodes */
    pExpr = sqlite3ExprSkipCollate(pExpr);
    
    if( !pExpr ){
        pVal = valueNew(db, &alloc);
        if( pVal ){
            sqlite3VdbeMemSetNull((Mem*)pVal);
            *pbOk = 1;
        }
    }else if( pExpr->op==TK_VARIABLE
             || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)
             ){
        Vdbe *v;
        int iBindVar = pExpr->iColumn;
        sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);
        if( (v = pParse->pReprepare)!=0 ){
            pVal = valueNew(db, &alloc);
            if( pVal ){
                rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
                if( rc==SQLITE_OK ){
                    sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
                }
                pVal->db = pParse->db;
                *pbOk = 1;
                sqlite3VdbeMemStoreType((Mem*)pVal);
            }
        }else{
            *pbOk = 0;
        }
    }else{
        rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc);
        *pbOk = (pVal!=0);
    }
    
    assert( pVal==0 || pVal->db==db );
    return rc;
}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:87,代码来源:vdbemem.c

示例6: bindText

/*
** Bind a text or BLOB value.
*/
static int bindText(
  sqlite3_stmt *pStmt, 
  int i, 
  const void *zData, 
  int nData, 
  void (*xDel)(void*),
  int encoding
){
  Vdbe *p = (Vdbe *)pStmt;
  Mem *pVar;
  int rc;

  rc = vdbeUnbind(p, i);
  if( rc || zData==0 ){
    return rc;
  }
  pVar = &p->aVar[i-1];
  rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
  if( rc==SQLITE_OK && encoding!=0 ){
    rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
  }

  sqlite3Error(((Vdbe *)pStmt)->db, rc, 0);
  return sqlite3ApiExit(((Vdbe *)pStmt)->db, rc);
}
开发者ID:Bracket-,项目名称:psp-ports,代码行数:28,代码来源:vdbeapi.c

示例7: TRSCOPE

void qPBReaderPlatform::ReaderApplicationStarted(const QString & isBookFile)
{
   TRSCOPE(pb, "qPBReaderPlatform::ReaderApplicationStarted");
#ifdef Q_OS_POCKETBOOK

   TRACE << "Declaring " << ENC(isBookFile) << endl;

   // set application icon
   // taskmgr looks for app_%s_icon.bmp file in theme, %s being the
   // task name. Since I have not found another way to provide an icon at
   // runtime, setting task name to "reader" does the job.

   int task = ::GetCurrentTask();
   taskinfo * pTask = ::GetTaskInfo(GetCurrentTask());

   if (pTask)
   {
      int rc = ::SetTaskParameters(task, "reader", 0, 0, pTask->flags);
      TRACE << "SetTaskParameters " << VAR(rc) << endl;
   }

   // switch to reading mode, seems to change panel appearance

   SetReadingMode(true);

   // and register book as read by this program

   ::BookReady(isBookFile.toUtf8().data());
#else

   Q_UNUSED(isBookFile);
#endif
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:33,代码来源:qPBReaderPlatform.cpp

示例8: TRSCOPE

int qPBReaderDictionaryDialog::InternalDicProcHandler(int type, int par1,
      int par2)
{
   TRSCOPE(dic, "qPBReaderDictionaryDialog::InternalDicProcHandler");

   int rc = 0;

#ifdef Q_OS_POCKETBOOK
   assert(_pDicInternalProc != 0);

   TRACE << type << " " << ENC(iv_evttype(type)) << " " << par1 << " " << par2 <<
         endl;

   TRACE << "thread id=" << (int)syscall(SYS_gettid) << endl;

   rc = _pDicInternalProc(type, par1, par2);
   TRACE << "_pDicInternalProc rc=" << rc << endl;

   if (!rc && !Instance()._bReenter && !ISKEYEVENT(type))
   {
      assert(_pOrgProc != 0);
      TRACE << "Calling _pOrgProc" << endl;
      rc = _pOrgProc(type, par1, par2);
   }

#else
   Q_UNUSED(type);
   Q_UNUSED(par1);
   Q_UNUSED(par2);

#endif
   return rc;
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:33,代码来源:qPBReaderDictionaryDialog.cpp

示例9: bindText

/*
** Bind a text or BLOB value.
*/
static int bindText(
  sqlite3_stmt *pStmt,   /* The statement to bind against */
  int i,                 /* Index of the parameter to bind */
  const void *zData,     /* Pointer to the data to be bound */
  int nData,             /* Number of bytes of data to be bound */
  void (*xDel)(void*),   /* Destructor for the data */
  u8 encoding            /* Encoding for the data */
){
  Vdbe *p = (Vdbe *)pStmt;
  Mem *pVar;
  int rc;

  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    if( zData!=0 ){
      pVar = &p->aVar[i-1];
      rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
      if( rc==SQLITE_OK && encoding!=0 ){
        rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
      }
      sqlite3Error(p->db, rc);
      rc = sqlite3ApiExit(p->db, rc);
    }
    sqlite3_mutex_leave(p->db->mutex);
  }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
    xDel((void*)zData);
  }
  return rc;
}
开发者ID:Farteen,项目名称:firefox-ios,代码行数:32,代码来源:vdbeapi.c

示例10: _p

qPBReaderJSLoader::qPBReaderJSLoader(QWebPage * p) :
   _p(p)
{
   TRSCOPE(js, "qPBReaderJSLoader::qPBReaderJSLoader");

   // hard-coded module list, keep in synch with aliases in qrc file

   _lNames.append("jquery");
   _lNames.append("jquery_scrollTo");
   _lNames.append("bookmarks");
   _lNames.append("referencing");
   _lNames.append("images");
   _lNames.append("hyphenation");
   _lNames.append("Hyphenator");
   _lNames.append("utils");
   _lNames.append("cfi");
   _lNames.append("indexing");
   _lNames.append("paged");
   _lNames.append("full_screen");
   _lNames.append("mathjax");
   _lNames.append("extract");
   _lNames.append("qPBReader");

   // load resource

   for (int idx = 0; idx < _lNames.size(); idx++)
   {
      QByteArray ba;
      LoadResource(_lNames[idx], ba);
      _lSrc.append(QString::fromUtf8(ba.data(), ba.size()));
      TRACE << "Loaded " << ENC(_lNames[idx]) << ", length=" << _lSrc[idx].size() <<
            endl;
   }

}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:35,代码来源:qPBReaderJSLoader.cpp

示例11: rl_analyze_ucs

/*
 * Determine for a character is display string and columns width
 */
static void rl_analyze_ucs (wint_tt ucs, const char **display, UWORD *columns)
{
   char *utf = NULL;
#if HAVE_WCWIDTH
   int width;
#endif
  
   utf = strdup (ConvUTF8 (ucs));
   *display = ConvTo (utf, ENC(enc_loc))->txt;

    if (ucs < 32 || ucs == 127 || ucs == 173) /* control code */
    {
        *display = s_sprintf ("%s^%c%s", COLINVCHAR, (char)((ucs - 1 + 'A') & 0x7f), COLNONE);
        *columns = 2;
    }
    else if (ucs < 127)
        *columns = 1;
#if HAVE_WCWIDTH
    else if (!prG->locale_broken && (width = rl_wcwidth (ucs, *display)) != -1)
        *columns = 256 | width;
#else
    else if (ucs >= 160) /* no way I'll hard-code double-width or combining marks here */
        *columns = 257;
#endif
    else if (prG->locale_broken && !strcmp (ConvFrom (ConvTo (utf, ENC(enc_loc)), ENC(enc_loc))->txt, utf))
        *columns = 257;
    else if (!(ucs & 0xffff0000)) /* more control code, or unknown */
    {
        *display = s_sprintf ("%s\\u%c%c%c%c%s", COLINVCHAR,
           rl_hex (ucs / 4096), rl_hex (ucs /  256),
           rl_hex (ucs /   16), rl_hex (ucs),
           COLNONE);
        *columns = 6;
    }
    else /* unknown stellar planes */
    {
        *display = s_sprintf ("%s\\U%c%c%c%c%c%c%c%c%s", COLINVCHAR,
           rl_hex (ucs / 268435456), rl_hex (ucs /  16777216),
           rl_hex (ucs /   1048576), rl_hex (ucs /     65536),
           rl_hex (ucs /      4096), rl_hex (ucs /       256),
           rl_hex (ucs /        16), rl_hex (ucs),
           COLNONE);
        *columns = 10;
    }
    free (utf);
}
开发者ID:egphilippov,项目名称:buguldey-ai-foss,代码行数:49,代码来源:util_rl.c

示例12: lightmac

void lightmac(void *data, u32 len, void *tag, void *key) {
    int  i;
    u8   m[BLK_LEN], v[TAG_LEN]; 
    u8   *t=(u8*)tag, *k=(u8*)key, *p=(u8*)data;
    
    union {
      u8  b[8];
      u64 q;
    } s;
    
    // 1. zero initialize V
    for(i=0;i<TAG_LEN;i++) v[i] = 0;

    // 2. set protected counter sum to 1
    s.q = 1;
    
    // 3. while we have blocks of data equal to (n - s)
    while (len >= MSG_LEN) {
      // 4. add counter s to M in big endian byte order
      for(i=0;i<CTR_LEN;i++) {
        m[CTR_LEN-i-1] = s.b[i];
      }
      // 5. add data to M
      for(i=0;i<MSG_LEN;i++) {
        m[CTR_LEN+i] = p[i];
      }
      // 6. encrypt M with K1
      ENC(k, m);
      // 7. update V
      for(i=0;i<TAG_LEN;i++) v[i] ^= m[i];
      // 8. decrease length and advance data pointer
      len -= MSG_LEN;
      p += MSG_LEN;
      // 9. update counter
      s.q++;
    }
    // 10. absorb any data less than (n - s)
    for(i=0;i<len;i++) v[i] ^= p[i];
    // 11. add end bit
    v[i] ^= 0x80;
    // 12. encrypt V with K2
    k += BC_KEY_LEN;
    ENC(k, v);
    // 13. return V in T
    for(i=0;i<TAG_LEN;i++) t[i] = v[i];
}
开发者ID:odzhan,项目名称:tinycrypt,代码行数:46,代码来源:lightmac.c

示例13: TRSCOPE

void qPBReaderJSLoader::Load(const QString & isHyphenLang)
{
   TRSCOPE(js, "qPBReaderJSLoader::Load");

   if (_p)
   {
      for (int idx = 0; idx < _lNames.size(); idx++)
      {
         TRACE << "injecting " << ENC(_lNames[idx]) <<  " (" << _lSrc[idx].length() <<
               ")" << endl;
         _p->mainFrame()->evaluateJavaScript(_lSrc[idx]);
      }

      // if hyphenation is required

      if (!isHyphenLang.isEmpty())
      {
         // if pattern lang has changed

         if (isHyphenLang != _sLang)
         {
            // load it from resources

            TRACE << "Loading pattern script" << ENC(isHyphenLang) << endl;
            QByteArray ba;
            LoadResource("patterns/" + isHyphenLang, ba);

            // store lang and corresponding script

            _sLang = isHyphenLang;
            _sPattern = QString::fromUtf8(ba.data(), ba.size());

            TRACE << "Loaded " << ENC(isHyphenLang) << ", length=" << _sLang.size() << endl;
         }
         else
         {
            TRACE << "Pattern script" << ENC(_sLang) << "already loaded" << endl;
         }

         // and load it into page

         TRACE << "injecting hyphens pattern script" << endl;
         _p->mainFrame()->evaluateJavaScript(_sPattern);
      }
   }
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:46,代码来源:qPBReaderJSLoader.cpp

示例14: TRSCOPE

bool qPBReaderEpub::Open()
{
   TRSCOPE(epub, "qPBReaderEpub::Open");

   Clean();

   // compute MD5 to get config file and temporary directory

   _sMD5 = qPBReaderUtils::MD5(_sFile);

   bool bOk = !_sMD5.isEmpty();

   if (bOk)
   {
      _sTempDir = qPBReaderConfig::GetTempDir() + "/" + _sMD5;
      TRACE << "temp dir " << ENC(_sTempDir) << endl;

      bOk = InitSettings(qPBReaderConfig::GetDataDir() + "/" + _sMD5 + ".cfg");
   }

   // extract epub file

   if (bOk && qgetenv("qPBReaderDisableEpubExtraction").isEmpty())
   {
      bOk = qPBReaderUnzip::ExtractAllTo(_sFile, _sTempDir);
   }

   // analyze epub. Won't be completely performed if settings are present.

   if (bOk)
   {
      bOk = AnalyzeDocStructure();
   }

   // keep the input file name in config, useful when data
   // will be checked for entries to removed
   // will avoid deleting file if epub has been moved and reopened
   // since first open

   if (bOk)
   {
      QFile f(_sFile);
      _pSettings->SaveEpubFileName(QFileInfo(f).absoluteFilePath());
   }

   // don't stay partially initialized in case of error

   if (!bOk)
   {
      Clean();
   }

   TRACE << TRANAME << " " << VAR(bOk) << endl;

   return bOk;
}
开发者ID:m4mmon,项目名称:qPBReader,代码行数:56,代码来源:qPBReaderEpub.cpp

示例15: ReadLinePromptSet

/*
 * Sets the prompt
 */
void ReadLinePromptSet (const char *prompt)
{
    rl_prompt_time = time (NULL);
    s_init (&rl_prompt, COLSERVER, 0);
    s_cat  (&rl_prompt, ConvTo (prompt, ENC(enc_loc))->txt);
    s_cat  (&rl_prompt, COLNONE);
    s_catc (&rl_prompt, ' ');
    if (rl_prompt_stat != 0)
        rl_prompt_stat = 2;
}
开发者ID:egphilippov,项目名称:buguldey-ai-foss,代码行数:13,代码来源:util_rl.c


注:本文中的ENC函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。