Bug 477508 - OS/2 breaks with enable-test in updater/test. r=pweilbacher
authorWalter Meinl <wuno@lsvw.de>
Tue, 24 Feb 2009 20:17:30 -0800
changeset 23415 1adb37c4063ed188caa4d408fff4d97f5043c0c4
parent 23414 223c4d40bb760fcd86507efaa2467d2ec5a775e6
child 23416 41404019f754110c5042730117bf295b0134e6fc
push id762
push userrstrong@mozilla.com
push dateWed, 25 Feb 2009 04:17:48 +0000
reviewerspweilbacher
bugs477508
milestone1.9.1b3pre
Bug 477508 - OS/2 breaks with enable-test in updater/test. r=pweilbacher
toolkit/mozapps/update/src/updater/Makefile.in
toolkit/mozapps/update/src/updater/readstrings.cpp
toolkit/mozapps/update/src/updater/readstrings.h
toolkit/mozapps/update/test/TestAUSReadStrings.cpp
--- a/toolkit/mozapps/update/src/updater/Makefile.in
+++ b/toolkit/mozapps/update/src/updater/Makefile.in
@@ -91,16 +91,22 @@ endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 HAVE_PROGRESSUI = 1
 CPPSRCS += readstrings.cpp
 CMMSRCS += progressui_osx.mm launchchild_osx.mm
 OS_LIBS += -framework Cocoa
 endif
 
+ifeq ($(OS_ARCH),OS2)
+CPPSRCS += \
+	readstrings.cpp \
+	$(NULL)
+endif
+
 ifndef HAVE_PROGRESSUI
 CPPSRCS += progressui_null.cpp
 endif
 
 ifndef MOZ_WINCONSOLE
 ifdef MOZ_DEBUG
 MOZ_WINCONSOLE = 1
 else
--- a/toolkit/mozapps/update/src/updater/readstrings.cpp
+++ b/toolkit/mozapps/update/src/updater/readstrings.cpp
@@ -38,17 +38,17 @@
 
 #include <limits.h>
 #include <string.h>
 #include <stdio.h>
 #include "readstrings.h"
 #include "errors.h"
 #include "prtypes.h"
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#ifdef XP_WIN
 # define NS_tfopen _wfopen
 # define OPEN_MODE L"rb"
 #else
 # define NS_tfopen fopen
 # define OPEN_MODE "r"
 #endif
 
 // stack based FILE wrapper to ensure that fclose is called.
@@ -180,18 +180,16 @@ ReadStrings(const NS_tchar *path, String
       continue;
     }
 
     char *key = token;
     char *e = NS_strtok(kEquals, &token);
     if (!e)
       continue;
 
-    // The first entry in the [Strings] section of the updater.ini must be
-    // Title and the second entry must be either Info or InfoText
     if (strcmp(key, "Title") == 0) {
       strncpy(results->title, token, MAX_TEXT_LEN - 1);
       results->title[MAX_TEXT_LEN - 1] = 0;
       read |= Title;
     }
     else if (strcmp(key, "Info") == 0 || strcmp(key, "InfoText") == 0) {
       strncpy(results->info, token, MAX_TEXT_LEN - 1);
       results->info[MAX_TEXT_LEN - 1] = 0;
--- a/toolkit/mozapps/update/src/updater/readstrings.h
+++ b/toolkit/mozapps/update/src/updater/readstrings.h
@@ -36,17 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef READSTRINGS_H__
 #define READSTRINGS_H__
 
 #define MAX_TEXT_LEN 200
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#ifdef XP_WIN
 # include <windows.h>
   typedef WCHAR NS_tchar;
 #else
   typedef char NS_tchar;
 #endif
 
 struct StringTable {
   char title[MAX_TEXT_LEN];
--- a/toolkit/mozapps/update/test/TestAUSReadStrings.cpp
+++ b/toolkit/mozapps/update/test/TestAUSReadStrings.cpp
@@ -34,31 +34,35 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /**
  * This binary tests the updater's ReadStrings ini parser and should run in a
  * directory with a Unicode character to test bug 473417.
  */
-#if defined(XP_WIN) || defined(XP_OS2)
+#ifdef XP_WIN
   #include <windows.h>
   #define NS_main wmain
   #define NS_tstrrchr wcsrchr
   #define NS_tsnprintf _snwprintf
   #define NS_T(str) L ## str
   #define PATH_SEPARATOR_CHAR L'\\'
 #else
   #include <unistd.h>
   #define NS_main main
   #define NS_tstrrchr strrchr
   #define NS_tsnprintf snprintf
   #define NS_T(str) str
+#ifdef XP_OS2
+  #define PATH_SEPARATOR_CHAR '\\'
+#else
   #define PATH_SEPARATOR_CHAR '/'
 #endif
+#endif
 
 #include <stdio.h>
 #include <string.h>
 
 #include "updater/resource.h"
 #include "updater/progressui.h"
 #include "updater/readstrings.h"
 #include "updater/errors.h"