]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix reading catalogs with Windows line breaks.
authorVMware, Inc <>
Sat, 28 May 2011 19:51:06 +0000 (12:51 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Sat, 28 May 2011 19:51:06 +0000 (12:51 -0700)
lib/dict doesn't seem to like Windows line breaks, so fix the line breaks
to make it happy.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/libvmtools/i18n.c

index 7c7a5d4db06d66389e77723c59aac08494839342..e291cfc80a7a3bdf925f8dd9b82b618b9cfdcc87 100644 (file)
@@ -565,6 +565,17 @@ MsgLoadCatalog(const char *path)
             break;
          }
 
+         /*
+          * Fix the line break to always be Unix-style, to make lib/dict
+          * happy.
+          */
+         if (line[term] == '\r') {
+            line[term] = '\n';
+            if (len > term) {
+               line[term + 1] = '\0';
+            }
+         }
+
          /*
           * If currently name is not NULL, then check if this is a continuation
           * line and, if it is, just append the contents to the current value.