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


C++ L_ERROR函数代码示例

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


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

示例1: pixReadIndexed

/*!
 *  pixReadIndexed()
 *
 *      Input:  sarray (of full pathnames)
 *              index (into pathname array)
 *      Return: pix if OK; null if not found
 *
 *  Notes:
 *      (1) This function is useful for selecting image files from a
 *          directory, where the integer @index is embedded into
 *          the file name.
 *      (2) This is typically done by generating the sarray using
 *          getNumberedPathnamesInDirectory(), so that the @index
 *          pathname would have the number @index in it.  The size
 *          of the sarray should be the largest number (plus 1) appearing
 *          in the file names, respecting the constraints in the
 *          call to getNumberedPathnamesInDirectory().
 *      (3) Consequently, for some indices into the sarray, there may
 *          be no pathnames in the directory containing that number.
 *          By convention, we place empty C strings ("") in those
 *          locations in the sarray, and it is not an error if such
 *          a string is encountered and no pix is returned.
 *          Therefore, the caller must verify that a pix is returned.
 *      (4) See convertSegmentedPagesToPS() in src/psio1.c for an
 *          example of usage.
 */
PIX *
pixReadIndexed(SARRAY  *sa,
               l_int32  index)
{
    char    *fname;
    l_int32  n;
    PIX     *pix;

    PROCNAME("pixReadIndexed");

    if (!sa)
        return (PIX *)ERROR_PTR("sa not defined", procName, NULL);
    n = sarrayGetCount(sa);
    if (index < 0 || index >= n)
        return (PIX *)ERROR_PTR("index out of bounds", procName, NULL);

    fname = sarrayGetString(sa, index, L_NOCOPY);
    if (fname[0] == '\0')
        return NULL;

    if ((pix = pixRead(fname)) == NULL) {
        L_ERROR("pix not read from file %s\n", procName, fname);
        return NULL;
    }

    return pix;
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:53,代码来源:readfile.c

示例2: pixReadMemJp2k

/*!
 *  pixReadMemJp2k()
 *
 *      Input:  data (const; jpeg-encoded)
 *              size (of data)
 *              reduction (scaling factor: 1, 2, 4, 8)
 *              box  (<optional> for extracting a subregion), can be null
 *              hint (a bitwise OR of L_JP2K_* values; 0 for default)
 *              debug (output callback messages, etc)
 *      Return: pix, or null on error
 *
 *  Notes:
 *      (1) This crashes when reading through the fmemopen cookie.
 *          Until we can fix this, we use the file-based work-around.
 *          And fixing this may take some time, because the basic
 *          stream interface is no longer supported in openjpeg.
 *      (2) See pixReadJp2k() for usage.
 */
PIX *
pixReadMemJp2k(const l_uint8  *data,
               size_t          size,
               l_uint32        reduction,
               BOX            *box,
               l_int32         hint,
               l_int32         debug)
{
FILE     *fp;
PIX      *pix;

    PROCNAME("pixReadMemJp2k");

    if (!data)
        return (PIX *)ERROR_PTR("data not defined", procName, NULL);

#if 0  /* Avoid the crash for now */
    if ((fp = fmemopen((void *)data, size, "r")) == NULL)
        return (PIX *)ERROR_PTR("stream not opened", procName, NULL);
#else
    L_WARNING("work-around: writing to a temp file\n", procName);
    if ((fp = tmpfile()) == NULL)
        return (PIX *)ERROR_PTR("tmpfile stream not opened", procName, NULL);
    fwrite(data, 1, size, fp);
    rewind(fp);
#endif  /* HAVE_FMEMOPEN */
    pix = pixReadStreamJp2k(fp, reduction, box, hint, debug);
    fclose(fp);
    if (!pix) L_ERROR("pix not read\n", procName);
    return pix;
}
开发者ID:mehulsbhatt,项目名称:MyOCRTEST,代码行数:49,代码来源:jp2kio.c

示例3: pixReadRGBAPng

/*!
 *  pixReadRGBAPng()
 *
 *      Input:  filename (of png file)
 *      Return: pix, or null on error
 *
 *  Notes:
 *      (1) Wrapper to keep the alpha channel of a png, if it exists.
 *      (2) The default behavior of pix read functions is to ignore
 *          the alpha channel.
 *      (3) This always leaves alpha stripping in the same mode as
 *          when this function begins.  So if alpha stripping is in
 *          default mode, this disables it, reads the file (including
 *          the alpha channel), and resets back to stripping.  Otherwise,
 *          it leaves stripping disabled.
 */
PIX *
pixReadRGBAPng(const char  *filename)
{
l_int32  format;
PIX     *pix;

    PROCNAME("pixReadRGBAPng");

    if (!filename)
        return (PIX *)ERROR_PTR("filename not defined", procName, NULL);

        /* Make sure it's a png file */
    findFileFormat(filename, &format);
    if (format != IFF_PNG) {
        L_ERROR_STRING("file format is %s, not png", procName,
                       ImageFileFormatExtensions[format]);
        return NULL;
    }

        /* If alpha channel reading is enabled, just read it */
    if (var_PNG_STRIP_ALPHA == FALSE)
        return pixRead(filename);

    l_pngSetStripAlpha(0);
    pix = pixRead(filename);
    l_pngSetStripAlpha(1);  /* reset to default */
    if (!pix) L_ERROR("pix not read", procName);
    return pix;
}
开发者ID:Strongc,项目名称:Tesseract_Ocr,代码行数:45,代码来源:pngio.c

示例4: recogaReadStream

/*!
 *  recogaReadStream()
 *
 *      Input:  stream
 *      Return: recog, or null on error
 */
L_RECOGA *
recogaReadStream(FILE  *fp)
{
l_int32    version, i, nrec, ignore;
L_RECOG   *recog;
L_RECOGA  *recoga;

    PROCNAME("recogaReadStream");

    if (!fp)
        return (L_RECOGA *)ERROR_PTR("stream not defined", procName, NULL);

    if (fscanf(fp, "\nRecoga Version %d\n", &version) != 1)
        return (L_RECOGA *)ERROR_PTR("not a recog file", procName, NULL);
    if (version != RECOG_VERSION_NUMBER)
        return (L_RECOGA *)ERROR_PTR("invalid recog version", procName, NULL);
    if (fscanf(fp, "Number of recognizers = %d\n\n", &nrec) != 1)
        return (L_RECOGA *)ERROR_PTR("nrec not read", procName, NULL);

    recoga = recogaCreate(nrec);
    for (i = 0; i < nrec; i++) {
        ignore = fscanf(fp, "==============================\n");
        if (fscanf(fp, "Recognizer %d\n", &ignore) != 1)
            return (L_RECOGA *)ERROR_PTR("malformed file", procName, NULL);
        if ((recog = recogReadStream(fp)) == NULL) {
            recogaDestroy(&recoga);
            L_ERROR("recog read failed for recog %d\n", procName, i);
            return NULL;
        }
        ignore = fscanf(fp, "\n");
        recogaAddRecog(recoga, recog);
    }
    return recoga;
}
开发者ID:Android-BD,项目名称:tess-two,代码行数:40,代码来源:recogbasic.c

示例5: PqxxConnection

/**
 * Creates a new instance of the DataAccess class. Only one static connection
 * is made to the database in each program using this class, which is shared by
 * all instances. It is important to abort or commit transactions when they are
 * finished with to prevent database deadlock.
 */
DataAccess::DataAccess() {
    const char* routine = "DataAccess::DataAccess";

	// For each instance increment counter. We can only close the connection
	// when the last instance is destroyed.
    DataAccess::instanceCount++;

	// If this is the first instance create the connection to database
    if (DataAccess::instanceCount == 1) {
        try {
			// Create connection
			C = new PqxxConnection( getConnectionString() );
            L_INFO(LOG_DB,"Connected to database " + std::string(C->dbname()));
            L_INFO(LOG_DB," -> Backend version: " 
                            + dps_itoa(C->server_version()));
            L_INFO(LOG_DB," -> Protocal version: " 
                            + dps_itoa(C->protocol_version()));
			// Init the transaction mutex
            t_routine_mutex = new pthread_mutex_t;
            pthread_mutex_init(t_routine_mutex,NULL);
			W = 0;
        }
        catch (const std::exception &e) {
            L_ERROR(LOG_DB,"Exception: " + std::string(e.what()));
            throw;
        }
        catch (...) {
			// Whoops! We can't connect to the DB
            L_CRITICAL(LOG_DB,"An unexpected error occured");
            throw;
        }
    }
}
开发者ID:radiowarwick,项目名称:digiplay_legacy,代码行数:39,代码来源:DataAccess.cpp

示例6: pixReadMemJpeg

/*!
 * \brief   pixReadMemJpeg()
 *
 * \param[in]    data const; jpeg-encoded
 * \param[in]    size of data
 * \param[in]    cmflag colormap flag 0 means return RGB image if color;
 *                      1 means create a colormap and return
 *                      an 8 bpp colormapped image if color
 * \param[in]    reduction scaling factor: 1, 2, 4 or 8
 * \param[out]   pnwarn [optional] number of warnings
 * \param[in]    hint a bitwise OR of L_JPEG_* values; 0 for default
 * \return  pix, or NULL on error
 *
 * <pre>
 * Notes:
 *      (1) The %size byte of %data must be a null character.
 *      (2) The only hint flag so far is L_JPEG_READ_LUMINANCE,
 *          given in the enum in imageio.h.
 *      (3) See pixReadJpeg() for usage.
 * </pre>
 */
PIX *
pixReadMemJpeg(const l_uint8  *data,
               size_t          size,
               l_int32         cmflag,
               l_int32         reduction,
               l_int32        *pnwarn,
               l_int32         hint)
{
l_int32   ret;
l_uint8  *comment;
FILE     *fp;
PIX      *pix;

    PROCNAME("pixReadMemJpeg");

    if (pnwarn) *pnwarn = 0;
    if (!data)
        return (PIX *)ERROR_PTR("data not defined", procName, NULL);

    if ((fp = fopenReadFromMemory(data, size)) == NULL)
        return (PIX *)ERROR_PTR("stream not opened", procName, NULL);
    pix = pixReadStreamJpeg(fp, cmflag, reduction, pnwarn, hint);
    if (pix) {
        ret = fgetJpegComment(fp, &comment);
        if (!ret && comment) {
            pixSetText(pix, (char *)comment);
            LEPT_FREE(comment);
        }
    }
    fclose(fp);
    if (!pix) L_ERROR("pix not read\n", procName);
    return pix;
}
开发者ID:ConfusedReality,项目名称:pkg_images_leptonica,代码行数:54,代码来源:jpegio.c

示例7: kernelNormalize

/*!
 *  kernelNormalize()
 *
 *      Input:  kels (source kel, to be normalized)
 *              normsum (desired sum of elements in keld)
 *      Return: keld (normalized version of kels), or null on error
 *                   or if sum of elements is very close to 0)
 *
 *  Notes:
 *      (1) If the sum of kernel elements is close to 0, do not
 *          try to calculate the normalized kernel.  Instead,
 *          return a copy of the input kernel, with an error message.
 */
L_KERNEL *
kernelNormalize(L_KERNEL  *kels,
                l_float32  normsum)
{
l_int32    i, j, sx, sy, cx, cy;
l_float32  sum, factor;
L_KERNEL  *keld;

    PROCNAME("kernelNormalize");

    if (!kels)
        return (L_KERNEL *)ERROR_PTR("kels not defined", procName, NULL);

    kernelGetSum(kels, &sum);
    if (L_ABS(sum) < 0.01) {
        L_ERROR("null sum; not normalizing; returning a copy", procName);
        return kernelCopy(kels);
    }

    kernelGetParameters(kels, &sy, &sx, &cy, &cx);
    if ((keld = kernelCreate(sy, sx)) == NULL)
        return (L_KERNEL *)ERROR_PTR("keld not made", procName, NULL);
    keld->cy = cy;
    keld->cx = cx;

    factor = normsum / sum;
    for (i = 0; i < sy; i++)
        for (j = 0; j < sx; j++)
            keld->data[i][j] = factor * kels->data[i][j];

    return keld;
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:45,代码来源:kernel.c

示例8: L_ERROR

static node *uncle(node *n) {
    if (!n || !n->parent || !n->parent->parent) {
        L_ERROR("root and child of root have no uncle\n", "uncle");
        return NULL;
    }
    return sibling(n->parent);
}
开发者ID:chewi,项目名称:leptonica,代码行数:7,代码来源:rbtree.c

示例9: pixReadStreamGif

/*!
 * \brief   pixReadStreamGif()
 *
 * \param[in]    fp file stream
 * \return  pix, or NULL on error
 */
PIX *
pixReadStreamGif(FILE  *fp)
{
l_int32          fd;
GifFileType     *gif;

    PROCNAME("pixReadStreamGif");

#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 1 && GIFLIB_RELEASE == 2  /* 5.1.2 */
    L_ERROR("Can't use giflib-5.1.2; suggest 5.1.1 or earlier\n", procName);
    return NULL;
#endif  /* 5.1.2 */

    if ((fd = fileno(fp)) < 0)
        return (PIX *)ERROR_PTR("invalid file descriptor", procName, NULL);
#ifdef _WIN32
    fd = _dup(fd);
#endif /* _WIN32 */

#ifndef _MSC_VER
    lseek(fd, 0, SEEK_SET);
#else
    _lseek(fd, 0, SEEK_SET);
#endif  /* _MSC_VER */

    if ((gif = DGifOpenFileHandle(fd, NULL)) == NULL)
        return (PIX *)ERROR_PTR("invalid file or file not found",
                                procName, NULL);

    return gifToPix(gif);
}
开发者ID:MaTriXy,项目名称:tess-two,代码行数:37,代码来源:gifio.c

示例10: L_FUNC

void Task::init()
{
  L_FUNC("");

  L_INFO("+++ test Logger");
  L_FATAL("L_FATAL");
  L_ERROR("L_ERROR");
  L_WARN("L_WARN");
  L_INFO("L_INFO");
  L_DEBUG("L_DEBUG");
  L_INFO("--- test Logger");

  L_INFO(QString()); // --> "?"
  L_INFO(" \n Trimmed \n\n"); // --> whitespace removed from start and end
  L_INFO("UTF-8 Unicode text: äöü àéè");

  QString formattedOutput1 = "JSON output 1:\n"
    "{\n"
    "  \"firstName\": \"Mario\",\n"
    "  \"age\": 44\n"
    "}"
  ;
  L_INFO(formattedOutput1);

  QString formattedOutput2 = "{<br>  \"firstName\": \"Mario\",<br>  \"age\": 44<br>}";
  L_INFO(formattedOutput2.prepend("JSON output 2:<br>").replace("<br>", "\n"));

  QTimer::singleShot(1000, this, SLOT(slotRun()));
  QTimer::singleShot(1000, this, SLOT(slotRun()));
  QTimer::singleShot(3000, this, SLOT(slotRun()));
  QTimer::singleShot(6000, this, SLOT(theEnd()));
}
开发者ID:darongE,项目名称:SimpleQtLogger,代码行数:32,代码来源:task.cpp

示例11: d_queue_pop

/** copies data from the head of the queue into passed buffer.
 *
 * if data from the head of the queue copied successfully
 * removes head of the queue. \n
 * if head of the queue was not removed successfully
 * logs warning.
 *
 * @param _root root node of the queue
 * @param _data buffer in which head's data would be copied
 * @param _size passed buffer size
 *
 * @return #true if successfully poped \n
 *			#false otherwise
 *
 *	@see d_list_get_head
 *	@see d_list_remove_head
 */
bool d_queue_pop(QUEUE_ROOT* _root, void* _data, size_t _size)
{
/* #ifdef _DEBUG */
/* 	L_DEBUG( "0x%08x\n", _root ); */
/* #endif */
	
	if ( !_root )
	{
		L_ERROR( "_root == NULL\n", "" );

		return false;
	}

	if ( d_list_get_head((LIST_ROOT*)_root, _data, _size) )
	{
		if ( !d_list_remove_head((LIST_ROOT*)_root) )
		{
			// pointer moved anyway
			// just let developers know that here is memleaks
			L_WARN( "unable to remove QUEUE_HEAD\n", "" );
		}

		return true;
	}

	return false;
}
开发者ID:ilardm,项目名称:tsync,代码行数:44,代码来源:data.c

示例12: recogStringToIndex

/*!
 *  recogStringToIndex()
 *
 *      Input:  recog
 *              text (text string for some class)
 *              &index (<return> index for that class; -1 if not found)
 *      Return: 0 if OK, 1 on error (not finding the string is an error)
 */
l_int32
recogStringToIndex(L_RECOG  *recog,
                   char     *text,
                   l_int32  *pindex)
{
char    *charstr;
l_int32  i, n, diff;

    PROCNAME("recogStringtoIndex");

    if (!pindex)
        return ERROR_INT("&index not defined", procName, 1);
    *pindex = -1;
    if (!recog)
        return ERROR_INT("recog not defined", procName, 1);
    if (!text)
        return ERROR_INT("text not defined", procName, 1);

        /* Search existing characters */
    n = recog->setsize;
    for (i = 0; i < n; i++) {
        recogGetClassString(recog, i, &charstr);
        if (!charstr) {
            L_ERROR("string not found for index %d\n", procName, i);
            continue;
        }
        diff = strcmp(text, charstr);
        FREE(charstr);
        if (diff) continue;
        *pindex = i;
        return 0;
    }

    return 1;  /* not found */
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:43,代码来源:recogbasic.c

示例13: d_list_deinit

/** deinitializes #LIST_ROOT.
 *
 * removes all nodes in the list (by calling #d_list_remove_head)
 * and zeroes passed pointer to the #LIST_ROOT
 *
 * logs warning if #d_list_remove_head was not successfully done
 *
 * @param _root pointer to the root node
 *
 * @return currently #true in case of non-null pointer \n
 *			#false otherwise
 */
bool d_list_deinit(LIST_ROOT* _root)
{
/* #ifdef _DEBUG */
/* 	L_DEBUG( "0x%08x\n", _root ); */
/* #endif */
	
	if ( !_root )
	{
		L_ERROR( "_root == NULL\n", "" );

		return false;
	}

	bool clr = true;
	while ( _root->count )
	{
		clr &= d_list_remove_head( _root );
	}

	if ( !clr )
	{
		L_WARN( "memleaks are possible\n", "" );
	}

	memset( _root, 0, sizeof(_root) );

	return true;
}
开发者ID:ilardm,项目名称:tsync,代码行数:40,代码来源:data.c

示例14: boxaEncapsulateAligned

/*!
 *  boxaEncapsulateAligned()
 *
 *      Input:  boxa
 *              num (number put into each boxa in the baa)
 *              copyflag  (L_COPY or L_CLONE)
 *      Return: boxaa, or null on error
 *
 *  Notes:
 *      (1) This puts @num boxes from the input @boxa into each of a
 *          set of boxa within an output boxaa.
 *      (2) This assumes that the boxes in @boxa are in sets of @num each.
 */
BOXAA *
boxaEncapsulateAligned(BOXA    *boxa,
                       l_int32  num,
                       l_int32  copyflag)
{
l_int32  i, j, n, nbaa, index;
BOX     *box;
BOXA    *boxat;
BOXAA   *baa;

    PROCNAME("boxaEncapsulateAligned");

    if (!boxa)
        return (BOXAA *)ERROR_PTR("boxa not defined", procName, NULL);
    if (copyflag != L_COPY && copyflag != L_CLONE)
        return (BOXAA *)ERROR_PTR("invalid copyflag", procName, NULL);

    n = boxaGetCount(boxa);
    nbaa = (n + num - 1) / num;
    if (n / num != nbaa)
        L_ERROR("inconsistent alignment: n / num not an integer", procName);
    baa = boxaaCreate(nbaa);
    for (i = 0, index = 0; i < nbaa; i++) {
        boxat = boxaCreate(num);
        for (j = 0; j < num; j++, index++) {
            box = boxaGetBox(boxa, index, copyflag);
            boxaAddBox(boxat, box, L_INSERT);
        }
        boxaaAddBoxa(baa, boxat, L_INSERT);
    }

    return baa;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:46,代码来源:boxfunc2.c

示例15: recogaDestroy

/*!
 *  recogaDestroy()
 *
 *      Input:  &recoga (<will be set to null before returning>)
 *      Return: void
 *
 *  Notes:
 *      (1) If a recog has a parent, the parent owns it.  To destroy
 *          a recog, it must first be "orphaned".
 */
void
recogaDestroy(L_RECOGA  **precoga)
{
l_int32    i;
L_RECOG   *recog;
L_RECOGA  *recoga;

    PROCNAME("recogaDestroy");

    if (precoga == NULL) {
        L_WARNING("ptr address is null!\n", procName);
        return;
    }

    if ((recoga = *precoga) == NULL)
        return;

    rchaDestroy(&recoga->rcha);
    for (i = 0; i < recoga->n; i++) {
        if ((recog = recoga->recog[i]) == NULL) {
            L_ERROR("recog not found for index %d\n", procName, i);
            continue;
        }
        recog->parent = NULL;  /* orphan it */
        recogDestroy(&recog);
    }
    LEPT_FREE(recoga->recog);
    LEPT_FREE(recoga);
    *precoga = NULL;
    return;
}
开发者ID:Android-BD,项目名称:tess-two,代码行数:41,代码来源:recogbasic.c


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