=== modified file 'cuneiform_src/Kern/ced/sources/main/ced_func_rtf.cpp'
--- cuneiform_src/Kern/ced/sources/main/ced_func_rtf.cpp	2009-01-21 13:34:04 +0000
+++ cuneiform_src/Kern/ced/sources/main/ced_func_rtf.cpp	2009-02-21 19:31:17 +0000
@@ -1733,7 +1733,7 @@
 
    // Write the actual DIB to the rtf file
 
-   long l,height,width,width_bytes;
+   long height,width,width_bytes;
    BYTE *pMem;
    LPBITMAPINFO pInfo;
 
@@ -1766,7 +1766,7 @@
 
   pMem=(BYTE *)rtf->page->picsTable[pict].data;
    // write the picture information
-   for (l=0;l<rtf->page->picsTable[pict].len;l++) {
+   for (DWORD l(0); l < rtf->page->picsTable[pict].len; ++l) {
       if (!(result=PutRtfHexChar(rtf,pMem[l]))) break;
    }
 

=== modified file 'cuneiform_src/Kern/cpage/sources/cpp/ptrname.h'
--- cuneiform_src/Kern/cpage/sources/cpp/ptrname.h	2009-01-21 14:03:15 +0000
+++ cuneiform_src/Kern/cpage/sources/cpp/ptrname.h	2009-02-21 20:32:21 +0000
@@ -70,7 +70,9 @@
 #include "cttypes.h"
 #include "cpage.h"
 
-#define _ASSERT assert
+#ifndef _ASSERT
+#    define _ASSERT assert
+#endif // _ASSERT
 
 template<class TYPE> class PtrName
 {

=== modified file 'cuneiform_src/Kern/cstr/src/cstr.c'
--- cuneiform_src/Kern/cstr/src/cstr.c	2009-01-21 14:03:15 +0000
+++ cuneiform_src/Kern/cstr/src/cstr.c	2009-02-21 20:32:34 +0000
@@ -2011,7 +2011,7 @@
 if( line==(CSTR_line)0)
     {
     wLowRC=CSTR_ERR_NULL       ;
-    return (CSTR_line)0;
+    return 0;
     }
 
 for(rast=CSTR_GetNext(CSTR_GetFirstRaster(line));rast;rast=CSTR_GetNext(rast))
@@ -2036,7 +2036,7 @@
 if( line==(CSTR_line)0)
     {
     wLowRC=CSTR_ERR_NULL       ;
-    return (CSTR_line)0;
+    return 0;
     }
 
 for(rast=CSTR_GetNext(CSTR_GetFirstRaster(line));rast;rast=CSTR_GetNext(rast))

=== modified file 'cuneiform_src/Kern/cuneiform-cli.cpp'
--- cuneiform_src/Kern/cuneiform-cli.cpp	2009-02-03 10:43:57 +0000
+++ cuneiform_src/Kern/cuneiform-cli.cpp	2009-02-21 16:31:52 +0000
@@ -306,7 +306,21 @@
     PUMA_SetImportData(PUMA_Bool32_DotMatrix, &dotmatrix);
     PUMA_SetImportData(PUMA_Bool32_Fax100, &fax);
 
-    if(!PUMA_XOpen(dib, "none.txt")) {
+	const char* pBegName = ::strrchr(infilename, '/');
+	if (0 == pBegName) {
+		const char* pBeg2 = ::strrchr(infilename, '\\');
+		if (0 != pBeg2) {
+			pBegName = pBeg2 + 1;
+		}
+	}
+	else {
+		++pBegName;
+	}
+	if (0 == pBegName) {
+		pBegName = infilename;
+	}
+	
+	if(!PUMA_XOpen(dib, pBegName ? pBegName : "none_image_name")) {
         cerr << "PUMA_Xopen failed.\n";
         return 1;
     }

=== modified file 'cuneiform_src/Kern/hh/xfindfil.h'
--- cuneiform_src/Kern/hh/xfindfil.h	2008-09-08 13:03:28 +0000
+++ cuneiform_src/Kern/hh/xfindfil.h	2009-02-21 20:33:15 +0000
@@ -64,12 +64,30 @@
 
 #include "compat_defs.h"
 
-#define _A_ARCH 1
-#define _A_HIDDEN 2
-#define _A_NORMAL 4
-#define _A_RDONLY 8
-#define _A_SUBDIR 16
-#define _A_SYSTEM 32
+// TODO: check formats, Microsoft io.h defines other values
+#ifndef _A_ARCH
+#   define _A_ARCH 1
+#endif // _A_ARCH
+
+#ifndef _A_HIDDEN
+#   define _A_HIDDEN 2
+#endif // _A_HIDDEN
+
+#ifndef _A_NORMAL
+#   define _A_NORMAL 4
+#endif // _A_NORMAL
+
+#ifndef _A_RDONLY
+#   define _A_RDONLY 8
+#endif // _A_RDONLY
+
+#ifndef _A_SUBDIR
+#   define _A_SUBDIR 16
+#endif // _A_SUBDIR
+
+#ifndef _A_SYSTEM
+#    define _A_SYSTEM 32
+#endif // _A_SYSTEM
 
 
 class XFindFile   // xff

=== modified file 'cuneiform_src/Kern/lns32/src/myassert.cpp'
--- cuneiform_src/Kern/lns32/src/myassert.cpp	2008-09-08 09:42:04 +0000
+++ cuneiform_src/Kern/lns32/src/myassert.cpp	2009-02-21 20:41:58 +0000
@@ -85,28 +85,17 @@
 
 void my_assert_fail(const char  *__cond, const char  *__file, int __line	){
 
-   int c;
 #if defined( _Windows ) || defined( WIN32 )
 	char mess[500];
 	sprintf( mess,
         " %s file %s, line %d\n Continue (Yes),Breakpoint(No) or Cancel?",
 				__cond, __file, __line);
    OutputDebugString(mess);
-/*
-	switch( MessageBox(	NULL,
-							mess,
-								"Assertion failed:",
-                MB_YESNOCANCEL )
-			)
-   {  case 0         :
-      case IDCANCEL  :     exit(0);
-      case IDNO      :     __ASM int 3; break;
-      case IDYES     :     break;
-   };
-*/
+
    return;
 
 #else
+	int c(0);
 	printf( "\nAssertion failed: %s file %s, line %d\n", __cond, __file, __line );
 	printf( "\nPress <Space> to continue execution, <Esc> to abort" );
 

=== modified file 'cuneiform_src/Kern/r35/src/r35.c'
--- cuneiform_src/Kern/r35/src/r35.c	2009-02-16 10:36:05 +0000
+++ cuneiform_src/Kern/r35/src/r35.c	2009-02-20 21:23:26 +0000
@@ -697,8 +697,8 @@
 
 Bool32 recog_cluster(Word16 Im3x5[], Word8 let, VERSION *v)
 {
-int jm, rm, res, jold;
-elm3x5 *curr;
+int jm = 0, rm = 0, res = 0, jold = 0;
+elm3x5 *curr = 0;
 
 curr = &tab3x5 [ (jm=header3x5[ let ].numel) ];
 

=== modified file 'cuneiform_src/Kern/rblock/sources/c/ltroots.c'
--- cuneiform_src/Kern/rblock/sources/c/ltroots.c	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rblock/sources/c/ltroots.c	2009-02-21 20:58:55 +0000
@@ -118,9 +118,9 @@
 
     RootsFreeData ();
 
-    hFile = open (pFilename, O_RDONLY | O_BINARY);
+    hFile = (HANDLE)open (pFilename, O_RDONLY | O_BINARY);
 
-    if (hFile == -1)
+    if (hFile == (HANDLE)(-1))
     {
         ErrorFile ();
         return (FALSE);

=== modified file 'cuneiform_src/Kern/rblock/sources/c/ltseps.c'
--- cuneiform_src/Kern/rblock/sources/c/ltseps.c	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rblock/sources/c/ltseps.c	2009-02-21 20:57:43 +0000
@@ -95,7 +95,7 @@
 # ifdef LT_STAND_ALONE
 Bool32 DeleteSeps (int n)
 {
-	Word32 i;
+	Int32 i;
 
 	for (i = n; i < nSeps-1; i++)
 	{
@@ -128,7 +128,7 @@
 	Word32 key;
 	Word32 color;
 
-	Word32 nPics;
+	Int32 nPics;
 	POLY_  *pPics;
 //	extern Handle hUseCLine;
     Word32 size_line_com=sizeof(LINE_COM);
@@ -313,8 +313,8 @@
 		{
 			if(pSeps [i].Type == SEP_VERT && pSeps [j].Type == SEP_VERT)
 			{
-				if((abs(pSeps[i].xBegin - pSeps[j].xEnd  ) < ResolutionCoeff/2) &&
-				   (abs(pSeps[i].xEnd   - pSeps[j].xBegin) < ResolutionCoeff/2) &&
+				if((Word32)(abs(pSeps[i].xBegin - pSeps[j].xEnd  ) < ResolutionCoeff/2) &&
+				   (Word32)(abs(pSeps[i].xEnd   - pSeps[j].xBegin) < ResolutionCoeff/2) &&
 				   (pSeps[i].yBegin < pSeps[j].yBegin)	           &&
 				   (pSeps[i].yEnd   > pSeps[j].yEnd))
 				{
@@ -335,7 +335,7 @@
 			{
 				if((abs(pSeps[i].xBegin - pSeps[j].xEnd) < ABS1) &&
 				   (pSeps[i].yBegin > pSeps[j].yEnd)			 &&
-				   (pSeps[i].yBegin - pSeps[j].yEnd) < ResolutionCoeff/2)
+				   (Word32)(pSeps[i].yBegin - pSeps[j].yEnd) < ResolutionCoeff/2)
 				{
 					pSeps[i].xBegin = MIN(pSeps[i].xBegin, pSeps[j].xBegin);
 					pSeps[i].xEnd = MAX(pSeps[i].xEnd, pSeps[j].xEnd);

=== modified file 'cuneiform_src/Kern/rblock/sources/c/scalar.c'
--- cuneiform_src/Kern/rblock/sources/c/scalar.c	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rblock/sources/c/scalar.c	2009-02-21 20:49:54 +0000
@@ -85,7 +85,7 @@
  DWORD d, step, lw;
  BYTE sh;
  if ((w = n >> 16) != 0) sh = 8;
- else { w = n; sh = 0; }
+ else { w = (WORD)n; sh = 0; }
 
  if ( w & 0xff00 ) { sh +=4; w = w >> 8; }
  d = sqrt_tab[w]+1; d = d << sh; if ((d & 0xffff) == 0) return 0;

=== modified file 'cuneiform_src/Kern/rblock/sources/c/seblocks.c'
--- cuneiform_src/Kern/rblock/sources/c/seblocks.c	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rblock/sources/c/seblocks.c	2009-02-21 20:49:54 +0000
@@ -81,7 +81,8 @@
 
 void BlocksAccessTableBuild (void)
 {
-    int i, w;
+    DWORD i = 0;
+	int w = 0;
     BLOCK *p;
 
 	int PrevMin, CurrMin;

=== modified file 'cuneiform_src/Kern/rblock/sources/new_c/_loadroots.c'
--- cuneiform_src/Kern/rblock/sources/new_c/_loadroots.c	2009-01-22 15:36:16 +0000
+++ cuneiform_src/Kern/rblock/sources/new_c/_loadroots.c	2009-02-21 20:51:55 +0000
@@ -150,7 +150,7 @@
 
 Bool32 DeleteFromPics(Word32 position)
 {
-	int i;
+	Word32 i = 0;
 	nPics--;
 	for(i=position;i<nPics;i++)
 	{

=== modified file 'cuneiform_src/Kern/rblock/sources/new_c/_partlayout.c'
--- cuneiform_src/Kern/rblock/sources/new_c/_partlayout.c	2009-01-22 12:36:47 +0000
+++ cuneiform_src/Kern/rblock/sources/new_c/_partlayout.c	2009-02-21 20:51:55 +0000
@@ -647,7 +647,8 @@
 	Int16 Language;
 
 
-	int i, nRealLetters;
+	DWORD i = 0;
+	int nRealLetters = 0;
 	nAverageHeight = 0;
 
   if(nRoots == 0) return TRUE;
@@ -679,7 +680,7 @@
 			goto AGAIN_PQ;
 		}
 
-		if(p->Rect.xRight-p->Rect.xLeft < nAverageHeight)
+		if((DWORD)(p->Rect.xRight-p->Rect.xLeft) < nAverageHeight)
 		{
 			/*
 			q = p -> pNext;

=== modified file 'cuneiform_src/Kern/rling/sources/CMakeLists.txt'
--- cuneiform_src/Kern/rling/sources/CMakeLists.txt	2009-02-02 17:08:58 +0000
+++ cuneiform_src/Kern/rling/sources/CMakeLists.txt	2009-02-21 20:31:59 +0000
@@ -31,7 +31,7 @@
 c/udictini.c
 c/udictuti.c
 )
-set_property(TARGET rlings PROPERTY COMPILE_DEFINITIONS __RLINGS__)
+set_property(TARGET rlings PROPERTY COMPILE_DEFINITIONS RLING_SECONDARY)
 
 target_link_libraries(rlings cstr windummy)
 

=== modified file 'cuneiform_src/Kern/rling/sources/c/spelout.c'
--- cuneiform_src/Kern/rling/sources/c/spelout.c	2009-01-21 14:52:06 +0000
+++ cuneiform_src/Kern/rling/sources/c/spelout.c	2009-02-20 23:56:09 +0000
@@ -777,7 +777,7 @@
   }
 /*********************************************************************/
  INT setpart_blue(SOBJ *obj,INT beg, INT end)
-  { register i;
+  { register i = 0;
 #ifdef  RUS_ENG_LANG
 if (multy_language&&language==LANG_RUSSIAN)
     for(i=beg;i<end;i++)

=== modified file 'cuneiform_src/Kern/rselstr/sources/src/cpp/ltinclin.cpp'
--- cuneiform_src/Kern/rselstr/sources/src/cpp/ltinclin.cpp	2009-01-22 15:36:16 +0000
+++ cuneiform_src/Kern/rselstr/sources/src/cpp/ltinclin.cpp	2009-02-21 20:34:57 +0000
@@ -110,9 +110,7 @@
 
 void RotatePageToIdeal (void)
 {
-    int i;
-
-    for (i = 0; i < nRoots; i++)
+    for (DWORD i = 0; i < nRoots; i++)
     {
         IDEAL_XY (pRoots [i].xColumn, pRoots [i].yRow);
     }
@@ -120,9 +118,7 @@
 
 void RotatePageToReal(void)
 {
-    int i;
-
-    for (i = 0; i < nRoots; i++)
+    for (DWORD i = 0; i < nRoots; i++)
     {
         REAL_XY (pRoots [i].xColumn, pRoots [i].yRow);
     }

=== modified file 'cuneiform_src/Kern/rselstr/sources/src/cpp/ltmain.cpp'
--- cuneiform_src/Kern/rselstr/sources/src/cpp/ltmain.cpp	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rselstr/sources/src/cpp/ltmain.cpp	2009-02-21 20:35:27 +0000
@@ -156,7 +156,7 @@
 
 void PageStrings1 (void)
 {
-    int i;
+    DWORD i;
 
 # ifdef MA_DEBUG
     AllocationsAccountingOpen ();

=== modified file 'cuneiform_src/Kern/rselstr/sources/src/cpp/seblocks.cpp'
--- cuneiform_src/Kern/rselstr/sources/src/cpp/seblocks.cpp	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rselstr/sources/src/cpp/seblocks.cpp	2009-02-21 20:41:58 +0000
@@ -80,7 +80,8 @@
 
 void BlocksAccessTableBuild (void)
 {
-    int i, w;
+    DWORD i(0);
+	INT w(0);
     BLOCK *p;
 
 	int PrevMin, CurrMin;

=== modified file 'cuneiform_src/Kern/rstr/src/context.c'
--- cuneiform_src/Kern/rstr/src/context.c	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/rstr/src/context.c	2009-02-20 21:22:49 +0000
@@ -446,7 +446,7 @@
 /******************************************/
 static void check_vers( cell *curc )	   //AK 04.07.97
 {
-INT i, Let, fl;
+INT i = 0, Let = 0, fl = 0;
 
   fl = 0;
   for ( i=0; i < curc->nvers; i++ )

=== modified file 'cuneiform_src/Kern/rstr/src/rcm.c'
--- cuneiform_src/Kern/rstr/src/rcm.c	2009-01-21 14:52:06 +0000
+++ cuneiform_src/Kern/rstr/src/rcm.c	2009-02-21 21:02:04 +0000
@@ -1324,7 +1324,7 @@
 return FALSE;
 }
 
-void rstr_set_kegl(lino)
+void rstr_set_kegl(CSTR_line lino)
 {
 CSTR_rast       rst;
 CSTR_rast_attr  attr;
@@ -2593,13 +2593,13 @@
 
 		}
     case    RSTR_FNIMP_FREE:
-        my_free=pData;
+        my_free=(void*)pData;
         break;
     case    RSTR_FNIMP_ALLOC:
-        my_alloc=pData;
+        my_alloc=(void*)pData;
         break;
     case    RSTR_FNIMP_GETCOLORS:
-        my_get_colors=pData;
+        my_get_colors=(void*)pData;
         break;
 	case	RSTR_CTB_BASE_NAME:
 		if (strlen((char*)pData) > 256)

=== modified file 'cuneiform_src/Kern/std/src/stdiface.cpp'
--- cuneiform_src/Kern/std/src/stdiface.cpp	2008-07-29 09:38:01 +0000
+++ cuneiform_src/Kern/std/src/stdiface.cpp	2009-02-21 20:33:39 +0000
@@ -292,8 +292,8 @@
 {
     RECT rc={0};
     ::GetClientRect(hDlg,&rc);
-    fXScale=1000*(rc.right-rc.left)/RPD_DLG_DU_WIDTH;
-    fYScale=1000*(rc.bottom-rc.top)/RPD_DLG_DU_HEIGHT;
+    fXScale=static_cast<float>(1000.0 * (rc.right - rc.left) / RPD_DLG_DU_WIDTH);
+    fYScale=static_cast<float>(1000.0 * (rc.bottom-rc.top) / RPD_DLG_DU_HEIGHT);
     fXScale/=1000;
     fYScale/=1000;
     return TRUE;

=== modified file 'cuneiform_src/Kern/std/src/stdprt.cpp'
--- cuneiform_src/Kern/std/src/stdprt.cpp	2009-01-22 12:36:47 +0000
+++ cuneiform_src/Kern/std/src/stdprt.cpp	2009-02-21 20:33:59 +0000
@@ -155,7 +155,7 @@
    //xsTblEventData.reserve(100);
    xsTblEventData.resize(100);
    //for(int i = 0 ; i < xsTblEventData.GetCurCnt(); i++)
-   for(int i = 0 ; i < xsTblEventData.size(); i++)
+   for(size_t i = 0 ; i < xsTblEventData.size(); i++)
    {
       xsTblEventData[i].szFormat = new char[256];
       if(xsTblEventData[i].szFormat)
@@ -204,7 +204,7 @@
 CTableEvnFiller::~CTableEvnFiller()
 {
 //   for(int i = 0 ; i < xsTblEventData.GetCurCnt(); i++)
-   for(int i = 0 ; i < xsTblEventData.size(); i++)
+   for(size_t i = 0 ; i < xsTblEventData.size(); i++)
    {
       char *p = xsTblEventData[i].szFormat;
       if(p)
@@ -226,7 +226,7 @@
    char r_string[1024*4+256] = {0}; // 1024*4 - макс. размер строки в таблице
    int i = 99;
 //   for(int ii = 0 ; ii < xsTblEventData.GetCurCnt(); ii++)
-   for(int ii = 0 ; ii < xsTblEventData.size(); ii++)
+   for(size_t ii = 0 ; ii < xsTblEventData.size(); ii++)
       memset(xsTblEventData[ii].szFormat,0,256);
 
    while(fgets(r_string,(1024*4+256-1),fl))

