[liblouis-liblouisxml] [liblouis] r635 committed - Cosmetic touches; looking for cause of crashing in OpenOffice.

  • From: liblouis@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Sat, 19 May 2012 12:34:22 +0000

Revision: 635
Author:   john.boyer@xxxxxxxxxxxxxxxxx
Date:     Sat May 19 05:34:17 2012
Log:      Cosmetic touches; looking for cause of crashing in OpenOffice.
http://code.google.com/p/liblouis/source/detail?r=635

Modified:
 /trunk/liblouis/compileTranslationTable.c
 /trunk/liblouis/lou_translateString.c

=======================================
--- /trunk/liblouis/compileTranslationTable.c   Mon May 14 05:12:03 2012
+++ /trunk/liblouis/compileTranslationTable.c   Sat May 19 05:34:17 2012
@@ -3047,7 +3047,7 @@
       /* Compile action part */
       while (passLinepos < passLine.length &&
             passLine.chars[passLinepos] <= 32)
-            passLinepos++;
+       passLinepos++;
       while (passLinepos < passLine.length &&
             passLine.chars[passLinepos] > 32)
        {
@@ -4924,8 +4924,7 @@
 {
   if (lastTrans == NULL)
     return NULL;
-  strncpy (scratchBuf, lastTrans->tableList,
-    lastTrans->tableListLength);
+  strncpy (scratchBuf, lastTrans->tableList, lastTrans->tableListLength);
   scratchBuf[lastTrans->tableListLength] = 0;
   return scratchBuf;
 }
@@ -5106,7 +5105,7 @@
       }
       return srcMapping;
     case alloc_prevSrcMapping:
-         {
+      {
        int mapSize;
        if (srcmax >= destmax)
          mapSize = srcmax;
@@ -5114,13 +5113,13 @@
          mapSize = destmax;
        if (mapSize > sizePrevSrcMapping)
          {
-               if (prevSrcMapping != NULL)
-                 free (prevSrcMapping);
-               prevSrcMapping = malloc ((mapSize + 4) * sizeof (int));
-               sizePrevSrcMapping = mapSize;
-         }
-         }
-         return prevSrcMapping;
+           if (prevSrcMapping != NULL)
+             free (prevSrcMapping);
+           prevSrcMapping = malloc ((mapSize + 4) * sizeof (int));
+           sizePrevSrcMapping = mapSize;
+         }
+      }
+      return prevSrcMapping;
     default:
       return NULL;
     }
@@ -5133,18 +5132,19 @@
   ChainEntry *previousEntry;
   if (logFile != NULL)
     fclose (logFile);
-  if (tableChain == NULL)
-    return;
-  currentEntry = tableChain;
-  while (currentEntry)
-    {
-      free (currentEntry->table);
-      previousEntry = currentEntry;
-      currentEntry = currentEntry->next;
-      free (previousEntry);
-    }
-  tableChain = NULL;
-  lastTrans = NULL;
+  if (tableChain != NULL)
+    {
+      currentEntry = tableChain;
+      while (currentEntry)
+       {
+         free (currentEntry->table);
+         previousEntry = currentEntry;
+         currentEntry = currentEntry->next;
+         free (previousEntry);
+       }
+      tableChain = NULL;
+      lastTrans = NULL;
+    }
   if (typebuf != NULL)
     free (typebuf);
   typebuf = NULL;
@@ -5164,10 +5164,10 @@
   if (srcMapping != NULL)
     free (srcMapping);
   srcMapping = NULL;
+  sizeSrcMapping = 0;
   if (prevSrcMapping != NULL)
     free (prevSrcMapping);
   prevSrcMapping = NULL;
-  sizeSrcMapping = 0;
   sizePrevSrcMapping = 0;
   opcodeLengths[0] = 0;
 }
=======================================
--- /trunk/liblouis/lou_translateString.c       Mon May 14 05:12:03 2012
+++ /trunk/liblouis/lou_translateString.c       Sat May 19 05:34:17 2012
@@ -124,8 +124,10 @@
     return 0;
if (!(srcMapping = liblouis_allocMem (alloc_srcMapping, srcmax, destmax)))
     return 0;
- if (!(prevSrcMapping = liblouis_allocMem (alloc_prevSrcMapping, srcmax, destmax)))
-      return 0;
+  if (!
+      (prevSrcMapping =
+       liblouis_allocMem (alloc_prevSrcMapping, srcmax, destmax)))
+    return 0;
   for (k = 0; k <= srcmax; k++)
     srcMapping[k] = k;
   srcMapping[srcmax] = srcmax;
@@ -151,7 +153,7 @@
     }
   while (currentPass <= table->numPasses && goodTrans)
     {
-         memcpy(prevSrcMapping, srcMapping, destmax * sizeof(int));
+      memcpy (prevSrcMapping, srcMapping, destmax * sizeof (int));
       switch (currentPass)
        {
        case 0:
@@ -214,7 +216,7 @@
       *inlen = srcMapping[realInlen];
       *outlen = dest;
       if (inputPositions != NULL)
-          memcpy(inputPositions, srcMapping, destmax * sizeof(int));
+       memcpy (inputPositions, srcMapping, destmax * sizeof (int));
       if (outputPos != NULL)
        {
          int lastpos = 0;
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] [liblouis] r635 committed - Cosmetic touches; looking for cause of crashing in OpenOffice. - liblouis