Fixed name collisions mostly with stl

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@46 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2007-05-16 01:39:03 +00:00
parent 3914aca603
commit 816d440462
4 changed files with 43 additions and 43 deletions

View File

@ -45,7 +45,7 @@ UINT16 R_BITSTREAM::open( //open for read
bufsize = read (fd, (char *) bitbuf, BITBUFSIZE * sizeof (UINT8));
//fill buffer
if (bufsize < 0) {
READFAILED.error ("R_BITSTREAM::open", LOG, NULL);
READFAILED.error ("R_BITSTREAM::open", TESSLOG, NULL);
return 0;
}
bitword = bitbuf[0] | (bitbuf[1] << 8);
@ -74,7 +74,7 @@ UINT16 R_BITSTREAM::read_code( //take code out
bufsize =
read (bitfd, (char *) bitbuf, BITBUFSIZE * sizeof (UINT8));
if (bufsize < 0) {
READFAILED.error ("R_BITSTREAM::read_code", LOG, NULL);
READFAILED.error ("R_BITSTREAM::read_code", TESSLOG, NULL);
return 0;
}
bitindex = 0; //newly filled buffer
@ -131,7 +131,7 @@ INT8 W_BITSTREAM::write_code( //take code out
if ((bitindex > 0) &&
(write (bitfd, (char *) bitbuf, bitindex * sizeof (UINT8)) !=
(INT32) (bitindex * sizeof (UINT8)))) {
WRITEFAILED.error ("W_BITSTREAM::write_code", LOG, "Flushing");
WRITEFAILED.error ("W_BITSTREAM::write_code", TESSLOG, "Flushing");
return -1;
}
}
@ -146,7 +146,7 @@ INT8 W_BITSTREAM::write_code( //take code out
if (bitindex >= BITBUFSIZE) {
if (write (bitfd, (char *) bitbuf, bitindex * sizeof (UINT8))
!= (INT32) (bitindex * sizeof (UINT8))) {
WRITEFAILED.error ("W_BITSTREAM::write_code", LOG, NULL);
WRITEFAILED.error ("W_BITSTREAM::write_code", TESSLOG, NULL);
return -1;
}
bitindex = 0; //newly filled buffer

View File

@ -98,7 +98,7 @@ static INT8 name_to_image_type( //get image type
for (type = 0; type < MAXIMAGETYPES && strcmp (imagetypes[type].string, nametype); type++);
if (type >= MAXIMAGETYPES) {
//unrecognized type
BADIMAGETYPE.error ("name_to_image_type", LOG, name);
BADIMAGETYPE.error ("name_to_image_type", TESSLOG, name);
return -1;
}
return type;
@ -121,7 +121,7 @@ INT8 IMAGE::read_header( //get file header
//get type
type = name_to_image_type (name);
if (type < 0 || imagetypes[type].opener == NULL) {
CANTREADIMAGETYPE.error ("IMAGE::read_header", LOG, name);
CANTREADIMAGETYPE.error ("IMAGE::read_header", TESSLOG, name);
return -1; //read not supported
}
#ifdef __UNIX__
@ -131,7 +131,7 @@ INT8 IMAGE::read_header( //get file header
if ((fd = open (name, O_RDONLY | O_BINARY)) < 0)
#endif
{
CANTOPENFILE.error ("IMAGE::read_header", LOG, name);
CANTOPENFILE.error ("IMAGE::read_header", TESSLOG, name);
return -1; //failed
}
lineskip =
@ -140,7 +140,7 @@ INT8 IMAGE::read_header( //get file header
if (lineskip == -1) {
//get header
bpp = 0; //still empty
close(fd);
close(fd);
fd = -1;
return -1; //failed
}
@ -186,8 +186,8 @@ INT8 IMAGE::read( //get rest of image
image =
(UINT8 *) alloc_big_mem ((size_t) (xdim * bufheight * sizeof (UINT8)));
if (image == NULL) {
MEMORY_OUT.error ("IMAGE::read", LOG, NULL);
destroy();
MEMORY_OUT.error ("IMAGE::read", TESSLOG, NULL);
destroy();
return -1;
}
captured = FALSE;
@ -208,8 +208,8 @@ INT8 IMAGE::read( //get rest of image
}
}
if (failed) {
READFAILED.error ("IMAGE::read", LOG, NULL);
destroy();
READFAILED.error ("IMAGE::read", TESSLOG, NULL);
destroy();
return -1; //read failed
}
if (ymin <= 0) {
@ -259,7 +259,7 @@ INT8 IMAGE::bufread( //read more into buffer
}
}
if (failed) {
READFAILED.error ("IMAGE::bufread", LOG, NULL);
READFAILED.error ("IMAGE::bufread", TESSLOG, NULL);
return -1; //read failed
}
if (ymin <= 0) {
@ -290,7 +290,7 @@ INT8 IMAGE::write( //write image
//get image type
type = name_to_image_type (name);
if (type < 0 || imagetypes[type].writer == NULL) {
CANTWRITEIMAGETYPE.error ("IMAGE::write", LOG, name);
CANTWRITEIMAGETYPE.error ("IMAGE::write", TESSLOG, name);
return -1; //write not supported
}
#ifdef __UNIX__
@ -303,7 +303,7 @@ INT8 IMAGE::write( //write image
if ((fd = creat (name, O_WRONLY | O_BINARY)) < 0)
#endif
{
CANTCREATEFILE.error ("IMAGE::write", LOG, name);
CANTCREATEFILE.error ("IMAGE::write", TESSLOG, name);
return -1; //failed
}
if (res <= 0)
@ -312,8 +312,8 @@ INT8 IMAGE::write( //write image
res) < 0) {
//get header
//write failed
WRITEFAILED.error ("IMAGE::write", LOG, name);
close(fd);
WRITEFAILED.error ("IMAGE::write", TESSLOG, name);
close(fd);
fd = -1;
return -1; //failed
}

View File

@ -77,7 +77,7 @@ IMAGE::IMAGE() { //construct an image
IMAGE & IMAGE::operator= ( //assignment
IMAGE & source //source image
) {
destroy();
destroy();
bpp = source.bpp;
photo_interp = source.photo_interp;
bps = source.bps;
@ -139,11 +139,11 @@ INT8 IMAGE::create( //get rest of image
void IMAGE::destroy() { //get rid of image
if (image != NULL && !captured) {
free_big_mem(image);
free_big_mem(image);
}
image = NULL;
if (fd >= 0) {
close(fd);
close(fd);
fd = -1;
}
bpp = 0;
@ -163,7 +163,7 @@ INT8 IMAGE::capture( //get rest of image
INT32 y, //ysize required
INT8 bits_per_pixel //bpp required
) {
destroy();
destroy();
xdim = check_legal_image_size (x, y, bits_per_pixel);
if (xdim < 0)
return -1;
@ -233,13 +233,13 @@ INT32 check_legal_image_size( //get rest of image
INT8 bits_per_pixel //bpp required
) {
if (x <= 0 || y <= 0) {
BADIMAGESIZE.error ("check_legal_image_size", LOG, "(%d,%d)", x, y);
BADIMAGESIZE.error ("check_legal_image_size", TESSLOG, "(%d,%d)", x, y);
return -1; //failed
}
if (bits_per_pixel != 1 && bits_per_pixel != 2
&& bits_per_pixel != 4 && bits_per_pixel != 5
&& bits_per_pixel != 6 && bits_per_pixel != 8 && bits_per_pixel != 24) {
BADBPP.error ("check_legal_image_size", LOG, "%d", bits_per_pixel);
BADBPP.error ("check_legal_image_size", TESSLOG, "%d", bits_per_pixel);
return -1;
}
//bytes per line
@ -970,7 +970,7 @@ void IMAGE::fast_get_line( //get image line
IMAGELINE *linebuf //line to copy to
) {
if (width > 0 && bpp > 4) {
check_legal_access(x, y, width);
check_legal_access(x, y, width);
//get pointer only
linebuf->pixels = image + xdim * (ymax - 1 - y) + x * bytespp;
}
@ -1606,7 +1606,7 @@ UINT8 * result) //Ptr to result pix
//Move along rows
}
convolve(window, bytespp, win_width, win_height, white, pix);
convolve(window, bytespp, win_width, win_height, white, pix);
pix += bytespp;
current_col++;
}

View File

@ -193,24 +193,24 @@ INT8 open_tif_image( //read header
resoffset = -1;
if (read (fd, (char *) &filetype, sizeof filetype) != sizeof filetype
|| filetype != INTEL && filetype != MOTO) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Filetype");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Filetype");
return -1;
}
lseek (fd, 4L, 0);
if (read (fd, (char *) &start, sizeof start) != sizeof start) {
READFAILED.error ("read_tif_image", LOG, "Start of tag table");
READFAILED.error ("read_tif_image", TESSLOG, "Start of tag table");
return -1;
}
if (filetype != __NATIVE__)
start = reverse32 (start);
if (start <= 0) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Start of tag table");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Start of tag table");
return -1;
}
lseek (fd, start, 0);
if (read (fd, (char *) &entries, sizeof (INT16)) != sizeof (INT16)) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Size of tag table");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Size of tag table");
return -1;
}
if (filetype != __NATIVE__)
@ -221,7 +221,7 @@ INT8 open_tif_image( //read header
for (; entries-- > 0;) {
if (read (fd, (char *) &tiffentry, sizeof tiffentry) !=
sizeof tiffentry) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Tag table entry");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Tag table entry");
return -1;
}
if (filetype != __NATIVE__) {
@ -274,7 +274,7 @@ INT8 open_tif_image( //read header
compressed = TRUE;
}
else if (tiffentry.value != 1) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Compression");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Compression");
return -1;
}
break;
@ -289,7 +289,7 @@ INT8 open_tif_image( //read header
} //endswitch
}
if (*xsize <= 0 || *ysize <= 0 || *bpp > 24 || imagestart <= 0) {
BADIMAGEFORMAT.error ("read_tif_image", LOG, "Vital tag");
BADIMAGEFORMAT.error ("read_tif_image", TESSLOG, "Vital tag");
return -1;
}
tprintf ("Image has %d bit%c per pixel and size (%d,%d)\n",
@ -297,7 +297,7 @@ INT8 open_tif_image( //read header
if (resoffset >= 0) {
lseek (fd, resoffset, 0);
if (read (fd, (char *) &resinfo, sizeof (resinfo)) != sizeof (resinfo)) {
READFAILED.error ("read_tif_image", LOG, "Resolution");
READFAILED.error ("read_tif_image", TESSLOG, "Resolution");
return -1;
}
if (filetype != __NATIVE__) {
@ -311,7 +311,7 @@ INT8 open_tif_image( //read header
if (strips) {
if (read (fd, (char *) &imagestart, sizeof (imagestart)) !=
sizeof (imagestart)) {
READFAILED.error ("read_tif_image", LOG, "Strip offset");
READFAILED.error ("read_tif_image", TESSLOG, "Strip offset");
return -1;
}
if (filetype != __NATIVE__)
@ -567,7 +567,7 @@ INT8 write_tif_image( //write whole image
resolution.bottom = 1;
if (write (fd, (char *) &type, sizeof type) != sizeof type
|| type != INTEL && type != MOTO) {
WRITEFAILED.error ("write_tif_image", LOG, "Filetype");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Filetype");
return -1;
}
start = START;
@ -575,13 +575,13 @@ INT8 write_tif_image( //write whole image
if (type != __NATIVE__)
entries = reverse16 (entries);
if (write (fd, (char *) &entries, sizeof entries) != sizeof entries) {
WRITEFAILED.error ("write_tif_image", LOG, "Version");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Version");
return -1;
}
if (type != __NATIVE__)
start = reverse32 (start);
if (write (fd, (char *) &start, sizeof start) != sizeof start) {
WRITEFAILED.error ("write_tif_image", LOG, "Start");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Start");
return -1;
}
lseek (fd, (long) START, 0);
@ -589,7 +589,7 @@ INT8 write_tif_image( //write whole image
if (type != __NATIVE__)
entries = reverse16 (entries);
if (write (fd, (char *) &entries, sizeof entries) != sizeof entries) {
WRITEFAILED.error ("write_tif_image", LOG, "Entries");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Entries");
return -1;
}
//line length
@ -650,12 +650,12 @@ INT8 write_tif_image( //write whole image
}
if (write (fd, (char *) &entry, sizeof (TIFFENTRY)) !=
sizeof (TIFFENTRY)) {
WRITEFAILED.error ("write_tif_image", LOG, "Tag Table");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Tag Table");
return -1;
}
}
if (write (fd, (char *) &zero, sizeof zero) != sizeof zero) {
WRITEFAILED.error ("write_tif_image", LOG, "Tag table Terminator");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Tag table Terminator");
return -1;
}
if (type != __NATIVE__) {
@ -665,14 +665,14 @@ INT8 write_tif_image( //write whole image
if (write (fd, (char *) &resolution, sizeof resolution) != sizeof resolution
|| write (fd, (char *) &resolution,
sizeof resolution) != sizeof resolution) {
WRITEFAILED.error ("write_tif_image", LOG, "Resolution");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Resolution");
return -1;
}
if (write (fd, (char *) pixels, (size_t) size) != size) {
WRITEFAILED.error ("write_tif_image", LOG, "Image");
WRITEFAILED.error ("write_tif_image", TESSLOG, "Image");
return -1;
}
close(fd);
close(fd);
return 0;
}