]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Internal branch sync. Included in this change:
authorVMware, Inc <>
Thu, 15 Oct 2009 22:07:01 +0000 (15:07 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 15 Oct 2009 22:07:01 +0000 (15:07 -0700)
. Changes in shared code that don't affect open-vm-tools functionality.

. Refactoring of functions from lib/user to lib/misc.

. guest_os: Use the official defines instead of simple strings.

. code cleanup and code-style related changes.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
21 files changed:
open-vm-tools/lib/file/fileIO.c
open-vm-tools/lib/include/guest_os.h
open-vm-tools/lib/include/vixOpenSource.h
open-vm-tools/lib/misc/base64.c
open-vm-tools/lib/misc/codesetOld.c
open-vm-tools/lib/misc/escape.c
open-vm-tools/lib/misc/hashTable.c
open-vm-tools/lib/misc/hostinfoPosix.c
open-vm-tools/lib/misc/iovector.c
open-vm-tools/lib/misc/machineID.c
open-vm-tools/lib/misc/miscSolaris.c
open-vm-tools/lib/misc/random.c
open-vm-tools/lib/misc/strutil.c
open-vm-tools/lib/misc/timeutil.c
open-vm-tools/lib/misc/util_misc.c
open-vm-tools/lib/misc/vmstdio.c
open-vm-tools/lib/string/convertutf.h
open-vm-tools/lib/stubs/stub-user-msg.c
open-vm-tools/lib/system/systemLinux.c
open-vm-tools/lib/user/Makefile.am
open-vm-tools/lib/user/hostinfoPosix2.c [deleted file]

index 9f7380a1546fbfda77b2b37d0d576187e10856ac..450b6933ae1a3c51918f0a800e6aba4424f61161 100644 (file)
@@ -98,7 +98,7 @@ FileIO_MsgError(FileIOResult status) // IN
        * because you don't want to display error messages after a user has
        * cancelled an operation.
        */
-      result = MSGID(fileio.cancel) "The operation was cancelled by the user";
+      result = MSGID(fileio.cancel) "The operation was canceled by the user";
       break;
 
    case FILEIO_ERROR:
index 9601edc36e15e8da405bbebd834f5081bb38db24..2e1ab9a05814c9b84e3af43f1f08d1e3bc42f651 100644 (file)
@@ -171,132 +171,132 @@ typedef enum GuestOSFamilyType {
  */
 
 /* Linux */
-#define STR_OS_ANNVIX "Annvix" 
-#define STR_OS_ARCH "Arch" 
-#define STR_OS_ARKLINUX "Arklinux" 
-#define STR_OS_ASIANUX_3                "asianux3"
-#define STR_OS_ASIANUX_4                "asianux4"
-#define STR_OS_AUROX "Aurox" 
-#define STR_OS_ASIANUX "asianux" 
-#define STR_OS_BLACKCAT "BlackCat" 
-#define STR_OS_COBALT "Cobalt" 
-#define STR_OS_CONECTIVA "Conectiva" 
-#define STR_OS_DEBIAN                   "Debian"
-#define STR_OS_DEBIAN_4                 "debian4"
-#define STR_OS_DEBIAN_5                 "debian5"
-#define STR_OS_FEDORA "Fedora" 
-#define STR_OS_GENTOO "Gentoo" 
-#define STR_OS_IMMUNIX "Immunix" 
-#define STR_OS_LINUX "linux" 
+#define STR_OS_ANNVIX              "Annvix" 
+#define STR_OS_ARCH                "Arch" 
+#define STR_OS_ARKLINUX            "Arklinux" 
+#define STR_OS_ASIANUX_3           "asianux3"
+#define STR_OS_ASIANUX_4           "asianux4"
+#define STR_OS_AUROX               "Aurox" 
+#define STR_OS_ASIANUX             "asianux" 
+#define STR_OS_BLACKCAT            "BlackCat" 
+#define STR_OS_COBALT              "Cobalt" 
+#define STR_OS_CONECTIVA           "Conectiva" 
+#define STR_OS_DEBIAN              "Debian"
+#define STR_OS_DEBIAN_4            "debian4"
+#define STR_OS_DEBIAN_5            "debian5"
+#define STR_OS_FEDORA              "Fedora" 
+#define STR_OS_GENTOO              "Gentoo" 
+#define STR_OS_IMMUNIX             "Immunix" 
+#define STR_OS_LINUX               "linux" 
 #define STR_OS_LINUX_FROM_SCRATCH "Linux-From-Scratch" 
-#define STR_OS_LINUX_FULL "Other Linux"
-#define STR_OS_LINUX_PPC "Linux-PPC" 
-#define STR_OS_MANDRAKE "mandrake" 
-#define STR_OS_MANDRAKE_FULL "Mandrake Linux"   
-#define STR_OS_MANDRIVA "mandriva"    
-#define STR_OS_MKLINUX "MkLinux"    
-#define STR_OS_NOVELL "nld9"    
-#define STR_OS_NOVELL_FULL "Novell Linux Desktop 9" 
-#define STR_OS_OTHER "otherlinux"    
-#define STR_OS_OTHER_24 "other24xlinux"    
-#define STR_OS_OTHER_24_FULL "Other Linux 2.4.x kernel" 
-#define STR_OS_OTHER_26 "other26xlinux"    
-#define STR_OS_OTHER_26_FULL "Other Linux 2.6.x kernel" 
-#define STR_OS_OTHER_FULL "Other Linux"   
-#define STR_OS_PLD "PLD"    
-#define STR_OS_RED_HAT  "redhat"   
-#define STR_OS_RED_HAT_EN "rhel"    
-#define STR_OS_RED_HAT_EN_2 "rhel2"    
-#define STR_OS_RED_HAT_EN_2_FULL "Red Hat Enterprise Linux 2"
-#define STR_OS_RED_HAT_EN_3 "rhel3"    
-#define STR_OS_RED_HAT_EN_3_FULL "Red Hat Enterprise Linux 3"
-#define STR_OS_RED_HAT_EN_4 "rhel4"    
-#define STR_OS_RED_HAT_EN_4_FULL "Red Hat Enterprise Linux 4"
-#define STR_OS_RED_HAT_FULL "Red Hat Linux"  
-#define STR_OS_SLACKWARE "Slackware"    
-#define STR_OS_SLES_10                  "sles10"
-#define STR_OS_SLES_10_FULL             "SUSE Linux Enterprise Server 10"
-#define STR_OS_SLES_11                  "sles11"
-#define STR_OS_SLES_11_FULL             "SUSE Linux Enterprise Server 11"
-#define STR_OS_SMESERVER "SMEServer"    
-#define STR_OS_SUN_DESK "sjds"    
-#define STR_OS_SUN_DESK_FULL "Sun Java Desktop System" 
-#define STR_OS_SUSE "suse"    
-#define STR_OS_SUSE_EN "sles"    
-#define STR_OS_SUSE_EN_FULL "SUSE Linux Enterprise Server" 
-#define STR_OS_SUSE_FULL "SUSE Linux"
-#define STR_OS_TINYSOFA "Tiny Sofa"   
-#define STR_OS_TURBO "turbolinux"    
-#define STR_OS_TURBO_FULL "Turbolinux"    
-#define STR_OS_UBUNTU "Ubuntu" 
-#define STR_OS_ULTRAPENGUIN "UltraPenguin" 
-#define STR_OS_UNITEDLINUX "UnitedLinux" 
-#define STR_OS_VALINUX "VALinux" 
-#define STR_OS_YELLOW_DOG "Yellow Dog"
+#define STR_OS_LINUX_FULL         "Other Linux"
+#define STR_OS_LINUX_PPC          "Linux-PPC" 
+#define STR_OS_MANDRAKE           "mandrake" 
+#define STR_OS_MANDRAKE_FULL      "Mandrake Linux"   
+#define STR_OS_MANDRIVA           "mandriva"    
+#define STR_OS_MKLINUX            "MkLinux"    
+#define STR_OS_NOVELL             "nld9"    
+#define STR_OS_NOVELL_FULL        "Novell Linux Desktop 9" 
+#define STR_OS_OTHER              "otherlinux"    
+#define STR_OS_OTHER_24           "other24xlinux"    
+#define STR_OS_OTHER_24_FULL      "Other Linux 2.4.x kernel" 
+#define STR_OS_OTHER_26           "other26xlinux"    
+#define STR_OS_OTHER_26_FULL      "Other Linux 2.6.x kernel" 
+#define STR_OS_OTHER_FULL         "Other Linux"   
+#define STR_OS_PLD                "PLD"    
+#define STR_OS_RED_HAT            "redhat"   
+#define STR_OS_RED_HAT_EN         "rhel"    
+#define STR_OS_RED_HAT_EN_2       "rhel2"    
+#define STR_OS_RED_HAT_EN_2_FULL  "Red Hat Enterprise Linux 2"
+#define STR_OS_RED_HAT_EN_3       "rhel3"    
+#define STR_OS_RED_HAT_EN_3_FULL  "Red Hat Enterprise Linux 3"
+#define STR_OS_RED_HAT_EN_4       "rhel4"    
+#define STR_OS_RED_HAT_EN_4_FULL  "Red Hat Enterprise Linux 4"
+#define STR_OS_RED_HAT_FULL       "Red Hat Linux"  
+#define STR_OS_SLACKWARE          "Slackware"    
+#define STR_OS_SLES_10            "sles10"
+#define STR_OS_SLES_10_FULL       "SUSE Linux Enterprise Server 10"
+#define STR_OS_SLES_11            "sles11"
+#define STR_OS_SLES_11_FULL       "SUSE Linux Enterprise Server 11"
+#define STR_OS_SMESERVER          "SMEServer"    
+#define STR_OS_SUN_DESK           "sjds"    
+#define STR_OS_SUN_DESK_FULL      "Sun Java Desktop System" 
+#define STR_OS_SUSE               "suse"    
+#define STR_OS_SUSE_EN            "sles"    
+#define STR_OS_SUSE_EN_FULL       "SUSE Linux Enterprise Server" 
+#define STR_OS_SUSE_FULL          "SUSE Linux"
+#define STR_OS_TINYSOFA           "Tiny Sofa"   
+#define STR_OS_TURBO              "turbolinux"    
+#define STR_OS_TURBO_FULL         "Turbolinux"    
+#define STR_OS_UBUNTU             "Ubuntu" 
+#define STR_OS_ULTRAPENGUIN       "UltraPenguin" 
+#define STR_OS_UNITEDLINUX        "UnitedLinux" 
+#define STR_OS_VALINUX            "VALinux" 
+#define STR_OS_YELLOW_DOG         "Yellow Dog"
 
 /* Windows */
-#define STR_OS_WIN_31 "win31"
-#define STR_OS_WIN_31_FULL "Windows 3.1"
-#define STR_OS_WIN_95 "win95"
-#define STR_OS_WIN_95_FULL "Windows 95"
-#define STR_OS_WIN_98 "win98"
-#define STR_OS_WIN_98_FULL "Windows 98"
-#define STR_OS_WIN_ME "winMe"
-#define STR_OS_WIN_ME_FULL "Windows Me"
-#define STR_OS_WIN_NT "winNT"
-#define STR_OS_WIN_NT_FULL "Windows NT"
-#define STR_OS_WIN_2000_PRO "win2000Pro"
-#define STR_OS_WIN_2000_PRO_FULL "Windows 2000 Professional"
-#define STR_OS_WIN_2000_SERV   "win2000Serv"
-#define STR_OS_WIN_2000_SERV_FULL "Windows 2000 Server"
-#define STR_OS_WIN_2000_ADV_SERV "win2000AdvServ"
-#define STR_OS_WIN_2000_ADV_SERV_FULL "Windows 2000 Advanced Server"
-#define STR_OS_WIN_2000_DATACENT_SERV "win2000DataCentServ"
+#define STR_OS_WIN_31                   "win31"
+#define STR_OS_WIN_31_FULL              "Windows 3.1"
+#define STR_OS_WIN_95                   "win95"
+#define STR_OS_WIN_95_FULL              "Windows 95"
+#define STR_OS_WIN_98                   "win98"
+#define STR_OS_WIN_98_FULL              "Windows 98"
+#define STR_OS_WIN_ME                   "winMe"
+#define STR_OS_WIN_ME_FULL              "Windows Me"
+#define STR_OS_WIN_NT                   "winNT"
+#define STR_OS_WIN_NT_FULL              "Windows NT"
+#define STR_OS_WIN_2000_PRO             "win2000Pro"
+#define STR_OS_WIN_2000_PRO_FULL        "Windows 2000 Professional"
+#define STR_OS_WIN_2000_SERV            "win2000Serv"
+#define STR_OS_WIN_2000_SERV_FULL       "Windows 2000 Server"
+#define STR_OS_WIN_2000_ADV_SERV        "win2000AdvServ"
+#define STR_OS_WIN_2000_ADV_SERV_FULL   "Windows 2000 Advanced Server"
+#define STR_OS_WIN_2000_DATACENT_SERV   "win2000DataCentServ"
 #define STR_OS_WIN_2000_DATACENT_SERV_FULL "Windows 2000 Data Center Server"
-#define STR_OS_WIN_XP_HOME "winXPHome"
-#define STR_OS_WIN_XP_HOME_FULL "Windows XP Home Edition"
-#define STR_OS_WIN_XP_PRO   "winXPPro"
-#define STR_OS_WIN_XP_PRO_FULL "Windows XP Professional"
-#define STR_OS_WIN_XP_PRO_X64   "winXPPro-64"
-#define STR_OS_WIN_XP_PRO_X64_FULL "Windows XP Professional x64 Edition"
-#define STR_OS_WIN_NET_WEB  "winNetWeb" 
-#define STR_OS_WIN_NET_WEB_FULL "Windows Server 2003 Web Edition"
-#define STR_OS_WIN_NET_ST "winNetStandard"
-#define STR_OS_WIN_NET_ST_FULL "Windows Server 2003 Standard Edition"
-#define STR_OS_WIN_NET_EN "winNetEnterprise"
-#define STR_OS_WIN_NET_EN_FULL "Windows Server 2003 Enterprise Edition"
-#define STR_OS_WIN_NET_BUS "winNetBusiness"
-#define STR_OS_WIN_NET_BUS_FULL "Windows Server 2003 Small Business"
-#define STR_OS_WIN_NET_COMPCLUSTER "winNetComputeCluster"
+#define STR_OS_WIN_XP_HOME              "winXPHome"
+#define STR_OS_WIN_XP_HOME_FULL         "Windows XP Home Edition"
+#define STR_OS_WIN_XP_PRO               "winXPPro"
+#define STR_OS_WIN_XP_PRO_FULL          "Windows XP Professional"
+#define STR_OS_WIN_XP_PRO_X64           "winXPPro-64"
+#define STR_OS_WIN_XP_PRO_X64_FULL      "Windows XP Professional x64 Edition"
+#define STR_OS_WIN_NET_WEB              "winNetWeb" 
+#define STR_OS_WIN_NET_WEB_FULL         "Windows Server 2003 Web Edition"
+#define STR_OS_WIN_NET_ST               "winNetStandard"
+#define STR_OS_WIN_NET_ST_FULL          "Windows Server 2003 Standard Edition"
+#define STR_OS_WIN_NET_EN               "winNetEnterprise"
+#define STR_OS_WIN_NET_EN_FULL         "Windows Server 2003 Enterprise Edition"
+#define STR_OS_WIN_NET_BUS              "winNetBusiness"
+#define STR_OS_WIN_NET_BUS_FULL         "Windows Server 2003 Small Business"
+#define STR_OS_WIN_NET_COMPCLUSTER      "winNetComputeCluster"
 #define STR_OS_WIN_NET_COMPCLUSTER_FULL "Windows Server 2003 Compute Cluster Edition"
-#define STR_OS_WIN_NET_STORAGESERVER "winNetStorageSvr"
+#define STR_OS_WIN_NET_STORAGESERVER    "winNetStorageSvr"
 #define STR_OS_WIN_NET_STORAGESERVER_FULL "Windows Storage Server 2003"
-#define STR_OS_WIN_NET_DC_FULL "Windows Server 2003 Datacenter Edition"
-#define STR_OS_WIN_NET_DC "winNetDatacenter"
-#define STR_OS_WIN_LONG "longhorn"
-#define STR_OS_WIN_VISTA "winVista"
-#define STR_OS_WIN_VISTA_FULL "Windows Vista"
-#define STR_OS_WIN_VISTA_X64 "winVista-64"
-#define STR_OS_WIN_VISTA_X64_FULL "Windows Vista x64 Edition"
-#define STR_OS_WIN_VISTA_ULTIMATE "winVistaUltimate-32"
-#define STR_OS_WIN_VISTA_ULTIMATE_FULL "Windows Vista Ultimate Edition"
-#define STR_OS_WIN_VISTA_HOME_PREMIUM "winVistaHomePremium-32"
+#define STR_OS_WIN_NET_DC_FULL         "Windows Server 2003 Datacenter Edition"
+#define STR_OS_WIN_NET_DC               "winNetDatacenter"
+#define STR_OS_WIN_LONG                 "longhorn"
+#define STR_OS_WIN_VISTA                "winVista"
+#define STR_OS_WIN_VISTA_FULL           "Windows Vista"
+#define STR_OS_WIN_VISTA_X64            "winVista-64"
+#define STR_OS_WIN_VISTA_X64_FULL       "Windows Vista x64 Edition"
+#define STR_OS_WIN_VISTA_ULTIMATE       "winVistaUltimate-32"
+#define STR_OS_WIN_VISTA_ULTIMATE_FULL  "Windows Vista Ultimate Edition"
+#define STR_OS_WIN_VISTA_HOME_PREMIUM   "winVistaHomePremium-32"
 #define STR_OS_WIN_VISTA_HOME_PREMIUM_FULL "Windows Vista Home Premium Edition"
-#define STR_OS_WIN_VISTA_HOME_BASIC "winVistaHomeBasic-32"
+#define STR_OS_WIN_VISTA_HOME_BASIC     "winVistaHomeBasic-32"
 #define STR_OS_WIN_VISTA_HOME_BASIC_FULL "Windows Vista Home Basic Edition"
-#define STR_OS_WIN_VISTA_ENTERPRISE "winVistaEnterprise-32"
+#define STR_OS_WIN_VISTA_ENTERPRISE     "winVistaEnterprise-32"
 #define STR_OS_WIN_VISTA_ENTERPRISE_FULL "Windows Vista Enterprise Edition"
-#define STR_OS_WIN_VISTA_BUSINESS "winVistaBusiness-32"
-#define STR_OS_WIN_VISTA_BUSINESS_FULL "Windows Vista Business Edition"
-#define STR_OS_WIN_VISTA_STARTER "winVistaStarter-32"
-#define STR_OS_WIN_VISTA_STARTER_FULL "Windows Vista Starter Edition"
-#define STR_OS_WIN_2008_CLUSTER "winServer2008Cluster-32"
+#define STR_OS_WIN_VISTA_BUSINESS       "winVistaBusiness-32"
+#define STR_OS_WIN_VISTA_BUSINESS_FULL  "Windows Vista Business Edition"
+#define STR_OS_WIN_VISTA_STARTER        "winVistaStarter-32"
+#define STR_OS_WIN_VISTA_STARTER_FULL   "Windows Vista Starter Edition"
+#define STR_OS_WIN_2008_CLUSTER         "winServer2008Cluster-32"
 #define STR_OS_WIN_2008_CLUSTER_FULL "Windows Server 2008 Cluster Server Edition"
-#define STR_OS_WIN_2008_DATACENTER "winServer2008Datacenter-32"
+#define STR_OS_WIN_2008_DATACENTER      "winServer2008Datacenter-32"
 #define STR_OS_WIN_2008_DATACENTER_FULL "Windows Server 2008 Datacenter Edition"
 #define STR_OS_WIN_2008_DATACENTER_CORE "winServer2008DatacenterCore-32"
 #define STR_OS_WIN_2008_DATACENTER_CORE_FULL "Windows Server 2008 Datacenter Edition (core installation)"
-#define STR_OS_WIN_2008_ENTERPRISE "winServer2008Enterprise-32"
+#define STR_OS_WIN_2008_ENTERPRISE      "winServer2008Enterprise-32"
 #define STR_OS_WIN_2008_ENTERPRISE_FULL "Windows Server 2008 Enterprise Edition"
 #define STR_OS_WIN_2008_ENTERPRISE_CORE "winServer2008EnterpriseCore-32"
 #define STR_OS_WIN_2008_ENTERPRISE_CORE_FULL "Windows Server 2008 Enterprise Edition (core installation)"
@@ -330,31 +330,31 @@ typedef enum GuestOSFamilyType {
 #define STR_OS_WIN_2008_WEB_SERVER_FULL "Windows Server 2008 Web Server Edition"
 
 /* Windows 64-bit */
-#define STR_OS_WIN_VISTA_ULTIMATE_X64 "winVistaUltimate-64"
-#define STR_OS_WIN_VISTA_HOME_PREMIUM_X64 "winVistaHomePremium-64"
-#define STR_OS_WIN_VISTA_HOME_BASIC_X64 "winVistaHomeBasic-64"
-#define STR_OS_WIN_VISTA_ENTERPRISE_X64 "winVistaEnterprise-64"
-#define STR_OS_WIN_VISTA_BUSINESS_X64 "winVistaBusiness-64"
-#define STR_OS_WIN_VISTA_STARTER_X64 "winVistaStarter-64"
-#define STR_OS_WIN_2008_CLUSTER_X64 "winServer2008Cluster-64"
-#define STR_OS_WIN_2008_DATACENTER_X64 "winServer2008Datacenter-64"
-#define STR_OS_WIN_2008_DATACENTER_CORE_X64 "winServer2008DatacenterCore-64"
-#define STR_OS_WIN_2008_ENTERPRISE_X64 "winServer2008Enterprise-64"
-#define STR_OS_WIN_2008_ENTERPRISE_CORE_X64 "winServer2008EnterpriseCore-64"
+#define STR_OS_WIN_VISTA_ULTIMATE_X64         "winVistaUltimate-64"
+#define STR_OS_WIN_VISTA_HOME_PREMIUM_X64     "winVistaHomePremium-64"
+#define STR_OS_WIN_VISTA_HOME_BASIC_X64       "winVistaHomeBasic-64"
+#define STR_OS_WIN_VISTA_ENTERPRISE_X64       "winVistaEnterprise-64"
+#define STR_OS_WIN_VISTA_BUSINESS_X64         "winVistaBusiness-64"
+#define STR_OS_WIN_VISTA_STARTER_X64          "winVistaStarter-64"
+#define STR_OS_WIN_2008_CLUSTER_X64           "winServer2008Cluster-64"
+#define STR_OS_WIN_2008_DATACENTER_X64        "winServer2008Datacenter-64"
+#define STR_OS_WIN_2008_DATACENTER_CORE_X64   "winServer2008DatacenterCore-64"
+#define STR_OS_WIN_2008_ENTERPRISE_X64        "winServer2008Enterprise-64"
+#define STR_OS_WIN_2008_ENTERPRISE_CORE_X64   "winServer2008EnterpriseCore-64"
 #define STR_OS_WIN_2008_ENTERPRISE_ITANIUM_X64 "winServer2008EnterpriseItanium-64"
 #define STR_OS_WIN_2008_MEDIUM_MANAGEMENT_X64 "winServer2008MediumManagement-64"
-#define STR_OS_WIN_2008_MEDIUM_MESSAGING_X64 "winServer2008MediumMessaging-64"
-#define STR_OS_WIN_2008_MEDIUM_SECURITY_X64 "winServer2008MediumSecurity-64"
+#define STR_OS_WIN_2008_MEDIUM_MESSAGING_X64  "winServer2008MediumMessaging-64"
+#define STR_OS_WIN_2008_MEDIUM_SECURITY_X64   "winServer2008MediumSecurity-64"
 #define STR_OS_WIN_2008_SERVER_FOR_SMALLBUSINESS_X64 "winServer2008ForSmallBusiness-64"
-#define STR_OS_WIN_2008_SMALL_BUSINESS_X64 "winServer2008SmallBusiness-64"
+#define STR_OS_WIN_2008_SMALL_BUSINESS_X64    "winServer2008SmallBusiness-64"
 #define STR_OS_WIN_2008_SMALL_BUSINESS_PREMIUM_X64 "winServer2008SmallBusinessPremium-64"
-#define STR_OS_WIN_2008_STANDARD_X64 "winServer2008Standard-64"
-#define STR_OS_WIN_2008_STANDARD_CORE_X64 "winServer2008StandardCore-64"
+#define STR_OS_WIN_2008_STANDARD_X64          "winServer2008Standard-64"
+#define STR_OS_WIN_2008_STANDARD_CORE_X64     "winServer2008StandardCore-64"
 #define STR_OS_WIN_2008_STORAGE_ENTERPRISE_X64 "winServer2008StorageEnterprise-64"
-#define STR_OS_WIN_2008_STORAGE_EXPRESS_X64 "winServer2008StorageExpress-64"
-#define STR_OS_WIN_2008_STORAGE_STANDARD_X64 "winServer2008StorageStandard-64"
+#define STR_OS_WIN_2008_STORAGE_EXPRESS_X64   "winServer2008StorageExpress-64"
+#define STR_OS_WIN_2008_STORAGE_STANDARD_X64  "winServer2008StorageStandard-64"
 #define STR_OS_WIN_2008_STORAGE_WORKGROUP_X64 "winServer2008StorageWorkgroup-64"
-#define STR_OS_WIN_2008_WEB_SERVER_X64 "winServer2008Web-64"
+#define STR_OS_WIN_2008_WEB_SERVER_X64        "winServer2008Web-64"
 
 /* Windows 7 */
 
index ba24e240a4ec900a348c902278d4f4f2bd5c55db..abd65faddb846ebc87a9fed5ca9c98e397306d26 100644 (file)
@@ -88,6 +88,8 @@ VixError Vix_TranslateCryptoError(CryptoError cryptoError);
 VixError Vix_TranslateCOMError(HRESULT comError);
 #endif
 
+#endif // VIX_HIDE_BORA_DEPENDENCIES
+
 /*
  * This defines additional error codes.
  * The public error codes are defined in vix.h
@@ -101,10 +103,6 @@ enum {
    /* WARNING. Do not exceed 2**16 */
 };
 
-#endif // VIX_HIDE_BORA_DEPENDENCIES
-
-
-
 /*
  *-----------------------------------------------------------------------------
  *
index 8946da2c78eef53487e04b724e7152ca8233c39a..8cfc7ac25d774d6547efac7bdb7c748c79e3a2a8 100644 (file)
@@ -191,20 +191,22 @@ static const char base64Reverse[256] = {
  */
 
 Bool
-Base64_Encode(uint8 const *src,        // IN
-              size_t       srcSize,    // IN
-              char        *dst,        // OUT
-              size_t       dstMax,     // IN: max result length, including NUL byte
-              size_t      *dstSize)    // OUT: result length, may be NULL
+Base64_Encode(uint8 const *src,  // IN:
+              size_t srcSize,    // IN:
+              char *dst,         // OUT:
+              size_t dstMax,     // IN: max result length, including NUL byte
+              size_t *dstSize)   // OUT: result length, may be NULL
 {
    char *dst0 = dst;
+
    ASSERT(src || srcSize == 0);
    ASSERT(dst);
 
-   if (4 * ((srcSize+2) / 3) >= dstMax) {
+   if (4 * ((srcSize + 2) / 3) >= dstMax) {
       if (dstSize) {
          *dstSize = 0;
       }
+
       return FALSE;
    }
 
@@ -234,9 +236,11 @@ Base64_Encode(uint8 const *src,        // IN
    if (dstSize) {
       *dstSize = dst - dst0;
    }
+
    return TRUE;
 }
 
+
 #ifdef __I_WANT_TO_TEST_THIS__
 main()
 {
@@ -308,6 +312,7 @@ main()
 }
 #endif
 
+
 /*
  *----------------------------------------------------------------------------
  *
@@ -328,10 +333,10 @@ main()
  */
 
 Bool
-Base64_Decode(char const *in,         // IN
-              uint8      *out,        // OUT
-              size_t      outSize,    // IN
-              size_t     *dataLength) // OUT
+Base64_Decode(char const *in,      // IN:
+              uint8 *out,          // OUT:
+              size_t outSize,      // IN:
+              size_t *dataLength)  // OUT:
 {
    uint32 b = 0;
    int n = 0;
@@ -385,10 +390,11 @@ Base64_Decode(char const *in,         // IN
  */
 
 Bool
-Base64_ValidEncoding(char const *src, // IN
-                     size_t srcLength) // IN
+Base64_ValidEncoding(char const *src,   // IN:
+                     size_t srcLength)  // IN:
 {
    size_t i;
+
    ASSERT(src);
    for (i = 0; i < srcLength; i++) {
       uint8 c = src[i]; /* MSVC CRT will die on negative arguments to is* */
@@ -398,6 +404,7 @@ Base64_ValidEncoding(char const *src, // IN
          return FALSE;
       }
    }
+
    return TRUE;
 }
 
@@ -419,7 +426,9 @@ Base64_ValidEncoding(char const *src, // IN
  */
 
 size_t
-Base64_EncodedLength(uint8 const *src, size_t srcLength) {
+Base64_EncodedLength(uint8 const *src,  // IN:
+                     size_t srcLength)  // IN:
+{
    return ((srcLength + 2) / 3 * 4) + 1;
 }
 
@@ -444,7 +453,9 @@ Base64_EncodedLength(uint8 const *src, size_t srcLength) {
  */
 
 size_t
-Base64_DecodedLength(char const *src, size_t srcLength) {
+Base64_DecodedLength(char const *src,   // IN:
+                     size_t srcLength)  // IN:
+{
    size_t length;
 
    ASSERT(src);
index e6fccb2ddc2509db9c33fd65a6ae2b30239b44d1..dbddf7b1a76aa9e58708fd1c8807d5557ffa62b6 100644 (file)
@@ -30,7 +30,7 @@
 #   include <str.h>
 #else
 #   if defined(__linux__)
-#      define _GNU_SOURCE      // see nl_langinfo_l explanation below
+#      define _GNU_SOURCE   // see nl_langinfo_l explanation below
 #   endif
 #   include <string.h>
 #   include <stdlib.h>
@@ -90,7 +90,7 @@ static Bool CodeSetOldIso88591ToUtf8Db(char const *bufIn, size_t sizeIn,
  *
  * Results:
  *      0 on failure.
- *     Length of sequence and Unicode character in *uchar on success.
+ *      Length of sequence and Unicode character in *uchar on success.
  *
  * Side effects:
  *      None.
@@ -99,9 +99,9 @@ static Bool CodeSetOldIso88591ToUtf8Db(char const *bufIn, size_t sizeIn,
  */
 
 static INLINE int
-CodeSetOldGetUtf8(const char *string,  // IN: string
-                  const char *end,     // IN: end of string
-                  uint32 *uchar)       // OUT: the Unicode character
+CodeSetOldGetUtf8(const char *string,  // IN: string
+                  const char *end,     // IN: end of string
+                  uint32 *uchar)       // OUT: the Unicode character
 {
    uint8 *p = (uint8 *) string;
    uint8 *e;
@@ -145,8 +145,8 @@ CodeSetOldGetUtf8(const char *string,       // IN: string
 
    while (++p < e) {
       if ((*p & 0xc0) != 0x80) {
-        // bad trailing byte
-        return 0;
+         // bad trailing byte
+         return 0;
       }
       c <<= 6;
       c += *p - 0x80;
@@ -171,6 +171,7 @@ out:
    if (uchar != NULL) {
       *uchar = c;
    }
+
    return len;
 }
 
@@ -201,10 +202,10 @@ out:
  */
 
 static Bool
-CodeSetOldDuplicateStr(const char   *bufIn,    // IN: Input string
-                       size_t  sizeIn,   // IN: Input string length
-                       char        **bufOut,   // OUT: "Converted" string
-                       size_t *sizeOut)  // OUT: Length of string
+CodeSetOldDuplicateStr(const char   *bufIn,  // IN: Input string
+                       size_t  sizeIn,       // IN: Input string length
+                       char **bufOut,        // OUT: "Converted" string
+                       size_t *sizeOut)      // OUT: Length of string
 {
    char *myBufOut;
 
@@ -220,6 +221,7 @@ CodeSetOldDuplicateStr(const char   *bufIn,    // IN: Input string
    if (sizeOut) {
       *sizeOut = sizeIn;
    }
+
    return TRUE;
 }
 #endif
@@ -245,13 +247,14 @@ CodeSetOldDuplicateStr(const char   *bufIn,    // IN: Input string
  */
 
 static Bool
-CodeSetOldDynBufFinalize(Bool          ok,       // IN: Earlier steps succeeded
-                         DynBuf       *db,       // IN: Buffer with converted string
-                         char        **bufOut,   // OUT: Converted string
+CodeSetOldDynBufFinalize(Bool ok,          // IN: Earlier steps succeeded
+                         DynBuf *db,       // IN: Buffer with converted string
+                         char **bufOut,    // OUT: Converted string
                          size_t *sizeOut)  // OUT: Length of string in bytes
 {
    if (!ok || !DynBuf_Append(db, &nul, sizeof nul) || !DynBuf_Trim(db)) {
       DynBuf_Destroy(db);
+
       return FALSE;
    }
 
@@ -259,6 +262,7 @@ CodeSetOldDynBufFinalize(Bool          ok,       // IN: Earlier steps succeeded
    if (sizeOut) {
       *sizeOut = DynBuf_GetSize(db) - sizeof nul;
    }
+
    return TRUE;
 }
 
@@ -282,9 +286,9 @@ CodeSetOldDynBufFinalize(Bool          ok,       // IN: Earlier steps succeeded
  */
 
 static Bool
-CodeSetOldUtf8ToUtf16leDb(const char *bufIn,  // IN
-                          size_t      sizeIn, // IN
-                          DynBuf     *db)     // IN
+CodeSetOldUtf8ToUtf16leDb(const char *bufIn,   // IN:
+                          size_t      sizeIn,  // IN:
+                          DynBuf     *db)      // IN:
 {
    const char *bufEnd = bufIn + sizeIn;
    size_t currentSize;
@@ -300,7 +304,7 @@ CodeSetOldUtf8ToUtf16leDb(const char *bufIn,  // IN
       int n = CodeSetOldGetUtf8(bufIn, bufEnd, &uniChar);
 
       if (n <= 0) {
-        return FALSE;
+         return FALSE;
       }
       bufIn += n;
 
@@ -339,6 +343,7 @@ CodeSetOldUtf8ToUtf16leDb(const char *bufIn,  // IN
    }
    /* All went fine, update buffer size. */
    DynBuf_SetSize(db, currentSize);
+
    return TRUE;
 }
 
@@ -381,16 +386,17 @@ static DWORD GetInvalidCharsFlag(void);
  */
 
 static Bool
-CodeSetOldGenericToUtf16leDb(UINT codeIn,         // IN
-                             char const *bufIn,   // IN
-                             size_t sizeIn,       // IN
-                             DynBuf *db)          // IN
+CodeSetOldGenericToUtf16leDb(UINT codeIn,        // IN:
+                             char const *bufIn,  // IN:
+                             size_t sizeIn,      // IN:
+                             DynBuf *db)         // IN:
 {
    /*
     * Undocumented: calling MultiByteToWideChar() with sizeIn == 0 returns 0
     * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API
     * robust? --hpreg
     */
+
    if (sizeIn) {
       size_t initialSize;
       DWORD flags = GetInvalidCharsFlag();
@@ -411,10 +417,7 @@ CodeSetOldGenericToUtf16leDb(UINT codeIn,         // IN
           * So MB_ERR_INVALID_CHARS added, otherwise can
           * lead to security issues see bug 154114.
           */
-         result = MultiByteToWideChar(codeIn,
-                     flags,
-                     bufIn,
-                     sizeIn,
+         result = MultiByteToWideChar(codeIn, flags, bufIn, sizeIn,
                      (wchar_t *)((char *)DynBuf_Get(db) + initialSize),
                      (DynBuf_GetAllocatedSize(db) - initialSize) /
                                       sizeof(wchar_t));
@@ -435,6 +438,7 @@ CodeSetOldGenericToUtf16leDb(UINT codeIn,         // IN
           * yields the same string size that was passed in.
           * If not, then dropped characters so fail.
           */
+
          if (!invalidCharsCheck) {
             resultReverse = WideCharToMultiByte(codeIn, 0,
                             (wchar_t *)((char *)DynBuf_Get(db) + initialSize),
@@ -484,16 +488,17 @@ CodeSetOldGenericToUtf16leDb(UINT codeIn,         // IN
  */
 
 static Bool
-CodeSetOldUtf16leToGeneric(char const *bufIn,   // IN
-                           size_t sizeIn,       // IN
-                           UINT codeOut,        // IN
-                           DynBuf *db)          // IN
+CodeSetOldUtf16leToGeneric(char const *bufIn,  // IN:
+                           size_t sizeIn,      // IN:
+                           UINT codeOut,       // IN:
+                           DynBuf *db)         // IN:
 {
    /*
     * Undocumented: calling WideCharToMultiByte() with sizeIn == 0 returns 0
     * with GetLastError() set to ERROR_INVALID_PARAMETER. Isn't this API
     * robust? --hpreg
     */
+
    if (sizeIn) {
       size_t initialSize;
       Bool canHaveSubstitution = codeOut != CP_UTF8 && codeOut != CP_UTF7;
@@ -543,6 +548,7 @@ CodeSetOldUtf16leToGeneric(char const *bufIn,   // IN
     * Undocumented: if the input buffer is not NUL-terminated, the output
     * buffer will not be NUL-terminated either --hpreg
     */
+
    return TRUE;
 }
 
@@ -568,10 +574,10 @@ CodeSetOldUtf16leToGeneric(char const *bufIn,   // IN
  */
 
 static Bool
-CodeSetOldUtf16leToCurrent(char const *bufIn,     // IN
-                           size_t sizeIn,   // IN
-                           char **bufOut,         // OUT
-                           size_t *sizeOut) // OUT
+CodeSetOldUtf16leToCurrent(char const *bufIn,  // IN:
+                           size_t sizeIn,      // IN:
+                           char **bufOut,      // OUT:
+                           size_t *sizeOut)    // OUT:
 {
    DynBuf db;
    Bool ok;
@@ -579,6 +585,7 @@ CodeSetOldUtf16leToCurrent(char const *bufIn,     // IN
    DynBuf_Init(&db);
    /* XXX We should probably use CP_THREAD_ACP on Windows 2000/XP --hpreg */
    ok = CodeSetOldUtf16leToGeneric(bufIn, sizeIn, CP_ACP, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -608,10 +615,10 @@ CodeSetOldUtf16leToCurrent(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf8Normalize(char const *bufIn,     // IN
-                         size_t sizeIn,         // IN
-                         Bool precomposed,      // IN
-                         DynBuf *db)            // OUT
+CodeSetOld_Utf8Normalize(char const *bufIn,  // IN:
+                         size_t sizeIn,      // IN:
+                         Bool precomposed,   // IN:
+                         DynBuf *db)         // OUT:
 {
    Bool ok = FALSE;
    CFStringRef str = NULL;
@@ -619,9 +626,7 @@ CodeSetOld_Utf8Normalize(char const *bufIn,     // IN
    CFIndex len, lenMut;
    size_t initialSize = DynBuf_GetSize(db);
 
-   str = CFStringCreateWithCString(NULL,
-                                   bufIn,
-                                   kCFStringEncodingUTF8);
+   str = CFStringCreateWithCString(NULL, bufIn, kCFStringEncodingUTF8);
    if (str == NULL) {
       goto exit;
    }
@@ -634,14 +639,15 @@ CodeSetOld_Utf8Normalize(char const *bufIn,     // IN
    /*
     * Normalize the string, Form C - precomposed or D, not.
     */
-   CFStringNormalize(mutStr, 
-                     (precomposed ? kCFStringNormalizationFormC :
-                     kCFStringNormalizationFormD));
+
+   CFStringNormalize(mutStr, (precomposed ? kCFStringNormalizationFormC :
+                                            kCFStringNormalizationFormD));
 
    /* 
     * Get the number (in terms of UTF-16 code units) 
     * of characters in a string.
     */
+
    lenMut = CFStringGetLength(mutStr);
 
    /*
@@ -649,8 +655,8 @@ CodeSetOld_Utf8Normalize(char const *bufIn,     // IN
     * specified length (in UTF-16 code units) will take up 
     * if encoded in a specified encoding.
     */
-   len = CFStringGetMaximumSizeForEncoding(lenMut,
-                                           kCFStringEncodingUTF8);
+
+   len = CFStringGetMaximumSizeForEncoding(lenMut, kCFStringEncodingUTF8);
    if (len + 1 > initialSize) {
       if (DynBuf_Enlarge(db, len + 1 - initialSize) == FALSE) {
          ok = FALSE;
@@ -662,10 +668,9 @@ CodeSetOld_Utf8Normalize(char const *bufIn,     // IN
     * Copies the character contents of a string to a local C 
     * string buffer after converting the characters to UTF-8.
     */
-   ok = CFStringGetCString(mutStr, 
-                           (char *)DynBuf_Get(db),
-                           len + 1, 
-                           kCFStringEncodingUTF8);
+
+   ok = CFStringGetCString(mutStr, (char *)DynBuf_Get(db),
+                           len + 1, kCFStringEncodingUTF8);
    if (ok) {
       /* Remove the NUL terminator that the above includes. */
       DynBuf_SetSize(db, strlen((char *)DynBuf_Get(db)));
@@ -742,6 +747,7 @@ CodeSetOldGetCodeSetFromLocale(void)
 #elif defined(sun)
 
    char *locale = setlocale(LC_CTYPE, NULL);
+
    if (!setlocale(LC_CTYPE, "")) {
       /*
        * If the machine is configured incorrectly (no current locale),
@@ -837,14 +843,17 @@ CodeSetOld_GetCurrentCodeSet(void)
          if (!strcmp(gFilenameEncoding, "@locale")) {
             free(gFilenameEncoding);
             cachedCodeset = CodeSetOldGetCodeSetFromLocale();
+
             return cachedCodeset;
          }
          cachedCodeset = gFilenameEncoding;
+
          return cachedCodeset;
       }
 
       if (getenv("G_BROKEN_FILENAMES")) {
          cachedCodeset = CodeSetOldGetCodeSetFromLocale();
+
          return cachedCodeset;
       }
 
@@ -880,9 +889,9 @@ CodeSetOld_GetCurrentCodeSet(void)
  */
 
 static INLINE_SINGLE_CALLER iconv_t
-CodeSetOldIconvOpen(const char  *codeIn,  // IN
-                    const char  *codeOut, // IN
-                    unsigned int flags)   // IN
+CodeSetOldIconvOpen(const char  *codeIn,   // IN:
+                    const char  *codeOut,  // IN:
+                    unsigned int flags)    // IN:
 {
 #ifdef __linux__
    if (flags) {
@@ -897,6 +906,7 @@ CodeSetOldIconvOpen(const char  *codeIn,  // IN
        * only use TRANSLIT and bail out after the first non-translitible
        * character.
        */
+
       codeOutExt = Str_Asprintf(NULL, "%s//TRANSLIT", codeOut);
       if (codeOutExt) {
          iconv_t cd = iconv_open(codeOutExt, codeIn);
@@ -907,6 +917,7 @@ CodeSetOldIconvOpen(const char  *codeIn,  // IN
       }
    }
 #endif
+
    return iconv_open(codeOut, codeIn);
 }
 
@@ -930,12 +941,12 @@ CodeSetOldIconvOpen(const char  *codeIn,  // IN
  */
 
 Bool
-CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
-                              char const *bufIn,   // IN
-                              size_t sizeIn,       // IN
-                              char const *codeOut, // IN
-                              unsigned int flags,  // IN
-                              DynBuf *db)          // IN/OUT
+CodeSetOld_GenericToGenericDb(char const *codeIn,   // IN:
+                              char const *bufIn,    // IN:
+                              size_t sizeIn,        // IN:
+                              char const *codeOut,  // IN:
+                              unsigned int flags,   // IN:
+                              DynBuf *db)           // IN/OUT:
 {
    iconv_t cd;
 
@@ -974,6 +985,7 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
        * can be sure that at least one character is
        * converted each call to iconv().
        */
+
       size = DynBuf_GetSize(db);
       if (DynBuf_Enlarge(db, size + 4) == FALSE) {
          goto error;
@@ -988,6 +1000,7 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
        * in the standard. However, the implementation of iconv doesn't
        * change bufIn so a simple cast is safe. --plangdale
        */
+
 #if defined(GLIBC_VERSION_22)
       status = iconv(cd, (char **)&bufIn, &sizeIn, &out, &outLeft);
 #else
@@ -1007,6 +1020,7 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
        * characters were transliterated) or even -1 with errno set to
        * EILSEQ (if some characters were ignored).
        */
+
       if (sizeIn == 0) {
          break;
       }
@@ -1014,18 +1028,20 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
          if (status != -1) {
             goto error;
          }
-        /*
-         * Some libc implementations (one on ESX3, and one on Ganesh's
-         * box) silently ignore //IGNORE.  So if caller asked for
-         * getting conversion done at any cost, just return success
-         * even if failure occured.  User will get truncated
-         * message, but that's our best.  We have no idea whether
-         * incoming encoding is 8bit, 16bit, or what, so we cannot
-         * skip over characters in input stream and recover :-(
-         */
-        if ((flags & CSGTG_IGNORE) && errno == EILSEQ) {
-           break;
-        }
+
+         /*
+          * Some libc implementations (one on ESX3, and one on Ganesh's
+          * box) silently ignore //IGNORE.  So if caller asked for
+          * getting conversion done at any cost, just return success
+          * even if failure occured.  User will get truncated
+          * message, but that's our best.  We have no idea whether
+          * incoming encoding is 8bit, 16bit, or what, so we cannot
+          * skip over characters in input stream and recover :-(
+          */
+
+         if ((flags & CSGTG_IGNORE) && errno == EILSEQ) {
+            break;
+         }
          if (errno != E2BIG) {
             goto error;
          }
@@ -1065,12 +1081,12 @@ error:
  */
 
 Bool
-CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
-                              char const *bufIn,   // IN
-                              size_t sizeIn,       // IN
-                              char const *codeOut, // IN
-                              unsigned int flags,  // IN
-                              DynBuf *db)          // IN/OUT
+CodeSetOld_GenericToGenericDb(char const *codeIn,   // IN:
+                              char const *bufIn,    // IN:
+                              size_t sizeIn,        // IN:
+                              char const *codeOut,  // IN:
+                              unsigned int flags,   // IN:
+                              DynBuf *db)           // IN/OUT:
 {
    Bool ret = FALSE;
    StringEncoding encIn = Unicode_EncodingNameToEnum(codeIn);
@@ -1137,9 +1153,9 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
             goto exit;
          }
       } else if (STRING_ENCODING_US_ASCII == encOut) {
-        if (!CodeSetOld_Utf8ToAsciiDb(bufIn, sizeIn, flags, db)) {
-           goto exit;
-        }
+         if (!CodeSetOld_Utf8ToAsciiDb(bufIn, sizeIn, flags, db)) {
+            goto exit;
+         }
       } else {
          goto exit;
       }
@@ -1169,9 +1185,9 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
       }
    } else if (STRING_ENCODING_US_ASCII == encIn) {
       if (STRING_ENCODING_UTF8 == encOut) {
-        if (!CodeSetOld_AsciiToUtf8Db(bufIn, sizeIn, flags, db)) {
-           goto exit;
-        }
+         if (!CodeSetOld_AsciiToUtf8Db(bufIn, sizeIn, flags, db)) {
+            goto exit;
+         }
       } else {
          goto exit;
       }
@@ -1189,12 +1205,12 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
 
    if (bufOut != NULL) {
       if (DynBuf_GetSize(db) == 0) {
-        DynBuf_Attach(db, sizeOut, bufOut);
-        bufOut = NULL;
+         DynBuf_Attach(db, sizeOut, bufOut);
+         bufOut = NULL;
       } else {
-        if (!DynBuf_Append(db, bufOut, sizeOut)) {
-           goto exit;
-        }
+         if (!DynBuf_Append(db, bufOut, sizeOut)) {
+            goto exit;
+         }
       }
    }
 
@@ -1202,6 +1218,7 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
 
   exit:
    free(bufOut);
+
    return ret;
 }
 
@@ -1225,20 +1242,21 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,  // IN
  */
 
 Bool
-CodeSetOld_GenericToGeneric(const char *codeIn,  // IN
-                            const char *bufIn,   // IN
-                            size_t sizeIn,       // IN
-                            const char *codeOut, // IN
-                            unsigned int flags,  // IN
-                            char **bufOut,       // OUT
-                            size_t *sizeOut)     // OUT
+CodeSetOld_GenericToGeneric(const char *codeIn,   // IN:
+                            const char *bufIn,    // IN:
+                            size_t sizeIn,        // IN:
+                            const char *codeOut,  // IN:
+                            unsigned int flags,   // IN:
+                            char **bufOut,        // OUT:
+                            size_t *sizeOut)      // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOld_GenericToGenericDb(codeIn, bufIn, sizeIn,
-                                     codeOut, flags, &db);
+                                      codeOut, flags, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1307,10 +1325,10 @@ CodeSetOld_GenericToGeneric(const char *codeIn,  // IN
  */
 
 Bool
-CodeSetOld_Utf8ToCurrent(char const *bufIn,     // IN
-                         size_t sizeIn,   // IN
-                         char **bufOut,         // OUT
-                         size_t *sizeOut) // OUT
+CodeSetOld_Utf8ToCurrent(char const *bufIn,  // IN:
+                         size_t sizeIn,      // IN:
+                         char **bufOut,      // OUT:
+                         size_t *sizeOut)    // OUT:
 {
 #if defined(CURRENT_IS_UTF8)
    return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut);
@@ -1322,6 +1340,7 @@ CodeSetOld_Utf8ToCurrent(char const *bufIn,     // IN
    ok = CodeSetOld_GenericToGenericDb("UTF-8", bufIn, sizeIn,
                                       CodeSetOld_GetCurrentCodeSet(),
                                       0, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #elif defined(_WIN32)
    char *buf;
@@ -1363,10 +1382,10 @@ CodeSetOld_Utf8ToCurrent(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_CurrentToUtf8(char const *bufIn,     // IN
-                      size_t sizeIn,   // IN
-                      char **bufOut,         // OUT
-                      size_t *sizeOut) // OUT
+CodeSetOld_CurrentToUtf8(char const *bufIn,  // IN:
+                      size_t sizeIn,         // IN:
+                      char **bufOut,         // OUT:
+                      size_t *sizeOut)       // OUT:
 {
 #if defined(CURRENT_IS_UTF8)
    return CodeSetOldDuplicateStr(bufIn, sizeIn, bufOut, sizeOut);
@@ -1377,6 +1396,7 @@ CodeSetOld_CurrentToUtf8(char const *bufIn,     // IN
    DynBuf_Init(&db);
    ok = CodeSetOld_GenericToGenericDb(CodeSetOld_GetCurrentCodeSet(), bufIn,
                                       sizeIn, "UTF-8", 0, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #elif defined(_WIN32)
    char *buf;
@@ -1389,6 +1409,7 @@ CodeSetOld_CurrentToUtf8(char const *bufIn,     // IN
 
    status = CodeSetOld_Utf16leToUtf8(buf, size, bufOut, sizeOut);
    free(buf);
+
    return status;
 #else
 #error
@@ -1415,9 +1436,9 @@ CodeSetOld_CurrentToUtf8(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
-                           size_t sizeIn, // IN
-                           DynBuf *db)          // IN
+CodeSetOld_Utf16leToUtf8Db(char const *bufIn,  // IN
+                           size_t sizeIn,      // IN
+                           DynBuf *db)         // IN
 {
    const uint16 *utf16In;
    size_t numCodeUnits;
@@ -1435,13 +1456,13 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
       uint8 *dbBytes;
       size_t size;
 
-      if (   utf16In[codeUnitIndex] < 0xD800
-          || utf16In[codeUnitIndex] > 0xDFFF) {
+      if (utf16In[codeUnitIndex] < 0xD800 ||
+          utf16In[codeUnitIndex] > 0xDFFF) {
          // Non-surrogate UTF-16 code units directly represent a code point.
          codePoint = utf16In[codeUnitIndex];
       } else {
          static const uint32 SURROGATE_OFFSET =
-            (0xD800 << 10UL) + 0xDC00 - 0x10000;
+                                        (0xD800 << 10UL) + 0xDC00 - 0x10000;
 
          uint16 surrogateLead = utf16In[codeUnitIndex];
          uint16 surrogateTrail;
@@ -1455,9 +1476,9 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
          surrogateTrail = utf16In[codeUnitIndex];
 
          // Ensure we have a lead surrogate followed by a trail surrogate.
-         if (   surrogateLead > 0xDBFF
-             || surrogateTrail < 0xDC00
-             || surrogateTrail > 0xDFFF) {
+         if (surrogateLead > 0xDBFF ||
+             surrogateTrail < 0xDC00 ||
+             surrogateTrail > 0xDFFF) {
             return FALSE;
          }
 
@@ -1480,7 +1501,7 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
           *    -> result [0x10000, 0x10FFFF]
           */
          codePoint = ((uint32)surrogateLead << 10UL) +
-            (uint32)surrogateTrail - SURROGATE_OFFSET;
+                                    (uint32)surrogateTrail - SURROGATE_OFFSET;
 
          ASSERT(codePoint >= 0x10000 && codePoint <= 0x10FFFF);
       }
@@ -1488,8 +1509,8 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
       size = DynBuf_GetSize(db);
 
       // We'll need at most 4 more bytes for this code point.
-      if (   DynBuf_GetAllocatedSize(db) < size + 4
-          && DynBuf_Enlarge(db, size + 4) == FALSE) {
+      if (DynBuf_GetAllocatedSize(db) < size + 4 &&
+          DynBuf_Enlarge(db, size + 4) == FALSE) {
          return FALSE;
       }
 
@@ -1518,6 +1539,7 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
           * See the surrogate pair handling block above for the math
           * that ensures we're in the range [0x10000, 0x10FFFF] here.
           */
+
          ASSERT(codePoint <= 0x10FFFF);
          dbBytes[0] = 0xF0 | (codePoint >> 18);
          dbBytes[1] = 0x80 | ((codePoint >> 12) & 0x3F);
@@ -1556,16 +1578,17 @@ CodeSetOld_Utf16leToUtf8Db(char const *bufIn,   // IN
  */
 
 Bool
-CodeSetOld_Utf16leToUtf8(char const *bufIn,     // IN
-                         size_t sizeIn,   // IN
-                         char **bufOut,         // OUT
-                         size_t *sizeOut) // OUT
+CodeSetOld_Utf16leToUtf8(char const *bufIn,  // IN:
+                         size_t sizeIn,      // IN:
+                         char **bufOut,      // OUT:
+                         size_t *sizeOut)    // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOld_Utf16leToUtf8Db(bufIn, sizeIn, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1593,16 +1616,17 @@ CodeSetOld_Utf16leToUtf8(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf8ToUtf16le(char const *bufIn,     // IN
-                         size_t sizeIn,   // IN
-                         char **bufOut,         // OUT
-                         size_t *sizeOut) // OUT
+CodeSetOld_Utf8ToUtf16le(char const *bufIn,  // IN:
+                         size_t sizeIn,      // IN:
+                         char **bufOut,      // OUT:
+                         size_t *sizeOut)    // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOldUtf8ToUtf16leDb(bufIn, sizeIn, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1630,16 +1654,17 @@ CodeSetOld_Utf8ToUtf16le(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf8FormDToUtf8FormC(char const *bufIn,     // IN
-                                size_t sizeIn,         // IN
-                                char **bufOut,         // OUT
-                                size_t *sizeOut)       // OUT
+CodeSetOld_Utf8FormDToUtf8FormC(char const *bufIn,  // IN:
+                                size_t sizeIn,      // IN:
+                                char **bufOut,      // OUT:
+                                size_t *sizeOut)    // OUT:
 {
 #if defined(__APPLE__)
    DynBuf db;
    Bool ok;
    DynBuf_Init(&db);
    ok = CodeSetOld_Utf8Normalize(bufIn, sizeIn, TRUE, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #else
    NOT_IMPLEMENTED();
@@ -1670,16 +1695,17 @@ CodeSetOld_Utf8FormDToUtf8FormC(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf8FormCToUtf8FormD(char const *bufIn,     // IN
-                                size_t sizeIn,         // IN
-                                char **bufOut,         // OUT
-                                size_t *sizeOut)       // OUT
+CodeSetOld_Utf8FormCToUtf8FormD(char const *bufIn,  // IN:
+                                size_t sizeIn,      // IN:
+                                char **bufOut,      // OUT:
+                                size_t *sizeOut)    // OUT:
 {
 #if defined(__APPLE__)
    DynBuf db;
    Bool ok;
    DynBuf_Init(&db);
    ok = CodeSetOld_Utf8Normalize(bufIn, sizeIn, FALSE, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #else
    NOT_IMPLEMENTED();
@@ -1708,10 +1734,10 @@ CodeSetOld_Utf8FormCToUtf8FormD(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_CurrentToUtf16le(char const *bufIn,     // IN
-                            size_t sizeIn,    // IN
-                            char **bufOut,          // OUT
-                            size_t *sizeOut)  // OUT
+CodeSetOld_CurrentToUtf16le(char const *bufIn,  // IN:
+                            size_t sizeIn,      // IN:
+                            char **bufOut,      // OUT:
+                            size_t *sizeOut)    // OUT:
 {
    DynBuf db;
    Bool ok;
@@ -1728,6 +1754,7 @@ CodeSetOld_CurrentToUtf16le(char const *bufIn,     // IN
 #else
 #error
 #endif
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1753,10 +1780,10 @@ CodeSetOld_CurrentToUtf16le(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf16leToCurrent(char const *bufIn,     // IN
-                            size_t sizeIn,   // IN
-                            char **bufOut,         // OUT
-                            size_t *sizeOut) // OUT
+CodeSetOld_Utf16leToCurrent(char const *bufIn,  // IN:
+                            size_t sizeIn,      // IN:
+                            char **bufOut,      // OUT:
+                            size_t *sizeOut)    // OUT:
 {
 #if defined(CURRENT_IS_UTF8)
    return CodeSetOld_Utf16leToUtf8(bufIn, sizeIn, bufOut, sizeOut);
@@ -1767,6 +1794,7 @@ CodeSetOld_Utf16leToCurrent(char const *bufIn,     // IN
    DynBuf_Init(&db);
    ok = CodeSetOld_GenericToGenericDb("UTF-16LE", bufIn, sizeIn,
                                       CodeSetOld_GetCurrentCodeSet(), 0, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #elif defined(_WIN32)
    return CodeSetOldUtf16leToCurrent(bufIn, sizeIn, bufOut, sizeOut);
@@ -1797,10 +1825,10 @@ CodeSetOld_Utf16leToCurrent(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf16beToCurrent(char const *bufIn,     // IN
-                            size_t sizeIn,   // IN
-                            char **bufOut,         // OUT
-                            size_t *sizeOut) // OUT
+CodeSetOld_Utf16beToCurrent(char const *bufIn,  // IN:
+                            size_t sizeIn,      // IN:
+                            char **bufOut,      // OUT:
+                            size_t *sizeOut)    // OUT:
 {
 #if defined(CURRENT_IS_UTF8)
    Bool status;
@@ -1814,6 +1842,7 @@ CodeSetOld_Utf16beToCurrent(char const *bufIn,     // IN
    swab(bufIn, temp, sizeIn);
    status = CodeSetOld_Utf16leToUtf8(temp, sizeIn, bufOut, sizeOut);
    free(temp);
+
    return status;
 #elif defined(USE_ICONV)
    DynBuf db;
@@ -1822,6 +1851,7 @@ CodeSetOld_Utf16beToCurrent(char const *bufIn,     // IN
    DynBuf_Init(&db);
    ok = CodeSetOld_GenericToGenericDb("UTF-16BE", bufIn, sizeIn,
                                       CodeSetOld_GetCurrentCodeSet(), 0, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 #elif defined(_WIN32)
    char c;
@@ -1852,6 +1882,7 @@ CodeSetOld_Utf16beToCurrent(char const *bufIn,     // IN
 
   error:
    free(bufIn_dup);
+
    return status;
 #else
 #error
@@ -1880,16 +1911,17 @@ CodeSetOld_Utf16beToCurrent(char const *bufIn,     // IN
  */
 
 Bool
-CodeSetOld_Utf16beToUtf8(char const *bufIn, // IN
-                         size_t sizeIn,     // IN
-                         char **bufOut,     // OUT
-                         size_t *sizeOut)   // OUT
+CodeSetOld_Utf16beToUtf8(char const *bufIn,  // IN:
+                         size_t sizeIn,      // IN:
+                         char **bufOut,      // OUT:
+                         size_t *sizeOut)    // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOld_Utf16beToUtf8Db(bufIn, sizeIn, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1913,13 +1945,14 @@ CodeSetOld_Utf16beToUtf8(char const *bufIn, // IN
  */
 
 Bool
-CodeSetOld_Utf16beToUtf8Db(char const *bufIn, // IN
-                           size_t sizeIn,     // IN
-                           DynBuf *db)        // IN
+CodeSetOld_Utf16beToUtf8Db(char const *bufIn,  // IN:
+                           size_t sizeIn,      // IN:
+                           DynBuf *db)         // IN:
 {
    int i;
    char *temp;
    Bool ret = FALSE;
+
    if ((temp = malloc(sizeIn)) == NULL) {
       return ret;
    }
@@ -1933,6 +1966,7 @@ CodeSetOld_Utf16beToUtf8Db(char const *bufIn, // IN
 
    ret = CodeSetOld_Utf16leToUtf8Db(temp, sizeIn, db);
    free(temp);
+
    return ret;
 }
 
@@ -1954,17 +1988,18 @@ CodeSetOld_Utf16beToUtf8Db(char const *bufIn, // IN
  */
 
 Bool
-CodeSetOld_AsciiToUtf8(const char *bufIn,   // IN
-                       size_t sizeIn,       // IN
-                       unsigned int flags,  // IN
-                       char **bufOut,       // OUT
-                       size_t *sizeOut)     // OUT
+CodeSetOld_AsciiToUtf8(const char *bufIn,   // IN:
+                       size_t sizeIn,       // IN:
+                       unsigned int flags,  // IN:
+                       char **bufOut,       // OUT:
+                       size_t *sizeOut)     // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOld_AsciiToUtf8Db(bufIn, sizeIn, flags, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -1986,10 +2021,10 @@ CodeSetOld_AsciiToUtf8(const char *bufIn,   // IN
  */
 
 Bool
-CodeSetOld_AsciiToUtf8Db(char const *bufIn,   // IN
-                         size_t sizeIn,       // IN
-                         unsigned int flags,  // IN
-                         DynBuf *db)          // OUT
+CodeSetOld_AsciiToUtf8Db(char const *bufIn,   // IN:
+                         size_t sizeIn,       // IN:
+                         unsigned int flags,  // IN:
+                         DynBuf *db)          // OUT:
 {
    size_t oldSize = DynBuf_GetSize(db);
    size_t i;
@@ -1997,15 +2032,16 @@ CodeSetOld_AsciiToUtf8Db(char const *bufIn,   // IN
 
    for (i = 0; i < sizeIn; i++) {
       if (UNLIKELY((unsigned char) bufIn[i] >= 0x80)) {
-        if (flags == 0) {
-           DynBuf_SetSize(db, oldSize);
-           return FALSE;
-        }
-        DynBuf_Append(db, bufIn + last, i - last);
-        if ((flags & CSGTG_TRANSLIT) != 0) {
-           DynBuf_Append(db, "\xef\xbf\xbd", 3);
-        }
-        last = i + 1;
+         if (flags == 0) {
+            DynBuf_SetSize(db, oldSize);
+
+            return FALSE;
+         }
+         DynBuf_Append(db, bufIn + last, i - last);
+         if ((flags & CSGTG_TRANSLIT) != 0) {
+            DynBuf_Append(db, "\xef\xbf\xbd", 3);
+         }
+         last = i + 1;
       }
    }
    DynBuf_Append(db, bufIn + last, i - last);
@@ -2031,17 +2067,18 @@ CodeSetOld_AsciiToUtf8Db(char const *bufIn,   // IN
  */
 
 Bool
-CodeSetOld_Utf8ToAscii(const char *bufIn,   // IN
-                       size_t sizeIn,       // IN
-                       unsigned int flags,  // IN
-                       char **bufOut,       // OUT
-                       size_t *sizeOut)     // OUT
+CodeSetOld_Utf8ToAscii(const char *bufIn,   // IN:
+                       size_t sizeIn,       // IN:
+                       unsigned int flags,  // IN:
+                       char **bufOut,       // OUT:
+                       size_t *sizeOut)     // OUT:
 {
    DynBuf db;
    Bool ok;
 
    DynBuf_Init(&db);
    ok = CodeSetOld_Utf8ToAsciiDb(bufIn, sizeIn, flags, &db);
+
    return CodeSetOldDynBufFinalize(ok, &db, bufOut, sizeOut);
 }
 
@@ -2063,10 +2100,10 @@ CodeSetOld_Utf8ToAscii(const char *bufIn,   // IN
  */
 
 Bool
-CodeSetOld_Utf8ToAsciiDb(char const *bufIn,   // IN
-                         size_t sizeIn,       // IN
-                         unsigned int flags,  // IN
-                         DynBuf *db)          // OUT
+CodeSetOld_Utf8ToAsciiDb(char const *bufIn,   // IN:
+                         size_t sizeIn,       // IN:
+                         unsigned int flags,  // IN:
+                         DynBuf *db)          // OUT:
 {
    size_t oldSize = DynBuf_GetSize(db);
    uint8 *p = (uint8 *) bufIn;
@@ -2075,20 +2112,21 @@ CodeSetOld_Utf8ToAsciiDb(char const *bufIn,   // IN
 
    for (; p < end; p++) {
       if (UNLIKELY(*p >= 0x80)) {
-        int n;
-
-        if (flags == 0) {
-           DynBuf_SetSize(db, oldSize);
-           return FALSE;
-        }
-        DynBuf_Append(db, last, p - last);
-        if ((flags & CSGTG_TRANSLIT) != 0) {
-           DynBuf_Append(db, "\x1a", 1);
-        }
-        if ((n = CodeSetOldGetUtf8((char *)p, (char *)end, NULL)) > 0) {
-           p += n - 1;
-        }
-        last = p + 1;
+         int n;
+
+         if (flags == 0) {
+            DynBuf_SetSize(db, oldSize);
+
+            return FALSE;
+         }
+         DynBuf_Append(db, last, p - last);
+         if ((flags & CSGTG_TRANSLIT) != 0) {
+            DynBuf_Append(db, "\x1a", 1);
+         }
+         if ((n = CodeSetOldGetUtf8((char *)p, (char *)end, NULL)) > 0) {
+            p += n - 1;
+         }
+         last = p + 1;
       }
    }
    DynBuf_Append(db, last, p - last);
@@ -2115,27 +2153,29 @@ CodeSetOld_Utf8ToAsciiDb(char const *bufIn,   // IN
  */
 
 static Bool
-CodeSetOldIso88591ToUtf8Db(char const *bufIn,   // IN
-                           size_t sizeIn,       // IN
-                           unsigned int flags,  // IN
-                           DynBuf *db)          // OUT
+CodeSetOldIso88591ToUtf8Db(char const *bufIn,   // IN:
+                           size_t sizeIn,       // IN:
+                           unsigned int flags,  // IN:
+                           DynBuf *db)          // OUT:
 {
    size_t i;
    size_t last = 0;
 
    for (i = 0; i < sizeIn; i++) {
       unsigned int c = (unsigned char)bufIn[i];
+
       if (UNLIKELY(c >= 0x80)) {
          unsigned char buf[2];
 
          buf[0] = 0xC0 | (c >> 6);
          buf[1] = 0x80 | (c & 0x3F);
-        DynBuf_Append(db, bufIn + last, i - last);
+         DynBuf_Append(db, bufIn + last, i - last);
          DynBuf_Append(db, buf, sizeof buf);
-        last = i + 1;
+         last = i + 1;
       }
    }
    DynBuf_Append(db, bufIn + last, i - last);
+
    return TRUE;
 }
 #endif
@@ -2186,8 +2226,10 @@ GetInvalidCharsFlag(void)
        * If GetVersionEx failed, we are running something earlier than NT4+SP6,
        * thus we cannot use MB_ERR_INVALID_CHARS
        */
+
        retval = 0;
        bFirstCall = FALSE;
+
        return retval;
    }
 
@@ -2204,6 +2246,7 @@ GetInvalidCharsFlag(void)
    }
 
    bFirstCall = FALSE;
+
    return retval;
 }
 #endif
@@ -2231,9 +2274,10 @@ GetInvalidCharsFlag(void)
  */
 
 Bool
-CodeSetOld_IsEncodingSupported(const char *name) // IN
+CodeSetOld_IsEncodingSupported(const char *name)  // IN:
 {
    ASSERT(name);
+
    return (STRING_ENCODING_UNKNOWN != Unicode_EncodingNameToEnum(name));
 }
 
@@ -2269,8 +2313,9 @@ CodeSetOld_Validate(const char *buf,   // IN: the string
 
    DynBuf_Init(&db);
    ok = CodeSetOld_GenericToGenericDb(code, buf, size, "UTF-8",
-                                     CSGTG_NORMAL, &db);
+                                      CSGTG_NORMAL, &db);
    DynBuf_Destroy(&db);
+
    return ok;
 }
 
@@ -2292,7 +2337,7 @@ CodeSetOld_Validate(const char *buf,   // IN: the string
  */
 
 Bool
-CodeSetOld_Init(UNUSED_PARAM(const char *dataDir))
+CodeSetOld_Init(UNUSED_PARAM(const char *dataDir))  // IN:
 {
    return TRUE;
 }
index 6a141ee27e10dec165b35ea54727f22cdf248c20..f6b526d1abc5678119411f5364061c00a9540009 100644 (file)
@@ -35,6 +35,7 @@
  * decimal number. If the input is not an hexadecimal digit character, the
  * output is -1 --hpreg
  */
+
 static int const Hex2Dec[] = {
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -59,6 +60,7 @@ static int const Hex2Dec[] = {
  * Table to use to quickly convert a decimal number into an ASCII hexadecimal
  * digit character --hpreg
  */
+
 static char const Dec2Hex[] = {
    '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
@@ -121,23 +123,23 @@ Escape_DoString(const char *escStr,    // IN
          /* We must escape that byte --hpreg */
 
          escSeq[0] = Dec2Hex[ubyte >> 4];
-    escSeq[1] = Dec2Hex[ubyte & 0xF];
-         if (   DynBuf_Append(&b, &buf[startUnescaped],
-                   index - startUnescaped) == FALSE
-             || DynBuf_Append(&b, escStr, escStrLen) == FALSE
-             || DynBuf_Append(&b, escSeq, sizeof escSeq) == FALSE) {
+         escSeq[1] = Dec2Hex[ubyte & 0xF];
+         if (DynBuf_Append(&b, &buf[startUnescaped],
+                           index - startUnescaped) == FALSE ||
+             DynBuf_Append(&b, escStr, escStrLen) == FALSE ||
+             DynBuf_Append(&b, escSeq, sizeof escSeq) == FALSE) {
             goto nem;
          }
          startUnescaped = index + 1;
       }
    }
 
-   if (   /* Last unescaped chunk (if any) --hpreg */
-          DynBuf_Append(&b, &buf[startUnescaped],
-             index - startUnescaped) == FALSE
-          /* NUL terminator --hpreg */
-       || DynBuf_Append(&b, "", 1) == FALSE
-       || DynBuf_Trim(&b) == FALSE) {
+   if (/* Last unescaped chunk (if any) --hpreg */
+       DynBuf_Append(&b, &buf[startUnescaped],
+                     index - startUnescaped) == FALSE ||
+       /* NUL terminator --hpreg */
+       DynBuf_Append(&b, "", 1) == FALSE ||
+       DynBuf_Trim(&b) == FALSE) {
       goto nem;
    }
 
@@ -249,9 +251,9 @@ Escape_Undo(char escByte,      // IN
             char escaped;
 
             escaped = h << 4 | l;
-            if (   DynBuf_Append(&b, &buf[startUnescaped],
-                                        index - 2 - startUnescaped) == FALSE
-                || DynBuf_Append(&b, &escaped, 1) == FALSE) {
+            if (DynBuf_Append(&b, &buf[startUnescaped],
+                              index - 2 - startUnescaped) == FALSE ||
+                DynBuf_Append(&b, &escaped, 1) == FALSE) {
                goto nem;
             }
             startUnescaped = index + 1;
@@ -265,12 +267,12 @@ Escape_Undo(char escByte,      // IN
       }
    }
 
-   if (   /* Last unescaped chunk (if any) --hpreg */
-          DynBuf_Append(&b, &buf[startUnescaped],
-                               index - startUnescaped) == FALSE
-          /* NUL terminator --hpreg */
-       || DynBuf_Append(&b, "", 1) == FALSE
-       || DynBuf_Trim(&b) == FALSE) {
+   if (/* Last unescaped chunk (if any) --hpreg */
+       DynBuf_Append(&b, &buf[startUnescaped],
+                     index - startUnescaped) == FALSE ||
+       /* NUL terminator --hpreg */
+       DynBuf_Append(&b, "", 1) == FALSE ||
+       DynBuf_Trim(&b) == FALSE) {
       goto nem;
    }
 
@@ -328,6 +330,7 @@ Escape_AnsiToUnix(void const *bufIn, // IN
     * Identify all chunks in buf (\r\n being the chunk separator), and copy
     * them into b --hpreg
     */
+
    for (index = 0; index < sizeIn; index++) {
       char byte;
 
@@ -337,7 +340,7 @@ Escape_AnsiToUnix(void const *bufIn, // IN
          state = 0;
          if (byte == '\n') {
             if (DynBuf_Append(&b, &buf[startUnescaped],
-                                        index - 1 - startUnescaped) == FALSE) {
+                              index - 1 - startUnescaped) == FALSE) {
                goto nem;
             }
             startUnescaped = index;
@@ -357,12 +360,12 @@ Escape_AnsiToUnix(void const *bufIn, // IN
       }
    }
 
-   if (   /* Last unescaped chunk (if any) --hpreg */
-          DynBuf_Append(&b, &buf[startUnescaped], index - startUnescaped)
-             == FALSE
-          /* NUL terminator --hpreg */
-       || DynBuf_Append(&b, "", 1) == FALSE
-       || DynBuf_Trim(&b) == FALSE) {
+   if (/* Last unescaped chunk (if any) --hpreg */
+       DynBuf_Append(&b, &buf[startUnescaped],
+                     index - startUnescaped) == FALSE ||
+       /* NUL terminator --hpreg */
+       DynBuf_Append(&b, "", 1) == FALSE ||
+       DynBuf_Trim(&b) == FALSE) {
       goto nem;
    }
 
@@ -465,23 +468,22 @@ Escape_Sh(void const *bufIn, // IN
       if (buf[index] == '\'') {
          /* We must escape that byte --hpreg */
 
-         if (   DynBuf_Append(&b, &buf[startUnescaped],
-                   index - startUnescaped) == FALSE
-             || DynBuf_Append(&b, escSeq,
-                   sizeof(escSeq)) == FALSE) {
+         if (DynBuf_Append(&b, &buf[startUnescaped],
+                           index - startUnescaped) == FALSE ||
+             DynBuf_Append(&b, escSeq, sizeof(escSeq)) == FALSE) {
             goto nem;
          }
          startUnescaped = index;
       }
    }
 
-   if (   /* Last unescaped chunk (if any) --hpreg */
-          DynBuf_Append(&b, &buf[startUnescaped],
-             index - startUnescaped) == FALSE
-       || DynBuf_Append(&b, be, sizeof(be)) == FALSE
-          /* NUL terminator --hpreg */
-       || DynBuf_Append(&b, "", 1) == FALSE
-       || DynBuf_Trim(&b) == FALSE) {
+   if (/* Last unescaped chunk (if any) --hpreg */
+       DynBuf_Append(&b, &buf[startUnescaped],
+                     index - startUnescaped) == FALSE ||
+       DynBuf_Append(&b, be, sizeof(be)) == FALSE ||
+       /* NUL terminator --hpreg */
+       DynBuf_Append(&b, "", 1) == FALSE ||
+       DynBuf_Trim(&b) == FALSE) {
       goto nem;
    }
 
@@ -542,6 +544,7 @@ Escape_Strchr(char escByte,      // IN
          }
       }
    }
+
    return NULL;
 }
 
@@ -586,6 +589,7 @@ Escape_Unescape(char escByte,       // IN
    }
 
    DynBuf_Append(&result, &nullbyte, sizeof('\0'));
+
    return DynBuf_Get(&result);
 }
 
index ef8beeecc4c0aee9709e45aa1c09499bdb3193b4..9a6e409ac3e555814ad81e92f7382a44deab5d62 100644 (file)
@@ -125,6 +125,7 @@ HashTableComputeHash(HashTable *ht,            // IN: hash table
    switch (ht->keyType) {
    case HASH_STRING_KEY: {
         int c;
+
         while ((c = (unsigned char) *s++)) {
            h ^= c;
            h = h << HASH_ROTATE | h >> (32 - HASH_ROTATE);
@@ -133,6 +134,7 @@ HashTableComputeHash(HashTable *ht,            // IN: hash table
       break;
    case HASH_ISTRING_KEY: {
         int c;
+
         while ((c = tolower((unsigned char) *s++))) {
            h ^= c;
            h = h << HASH_ROTATE | h >> (32 - HASH_ROTATE);
@@ -155,11 +157,13 @@ HashTableComputeHash(HashTable *ht,            // IN: hash table
    {
       int numBits = ht->numBits;
       uint32 mask = MASK(numBits);
+
       for (; h > mask; h = (h & mask) ^ (h >> numBits)) {
       }
    }
 
    ASSERT(h < ht->numEntries);
+
    return h;
 }
 
@@ -386,6 +390,7 @@ HashTable_Clear(HashTable *ht) // IN/OUT
 
    for (i = 0; i < ht->numEntries; i++) {
       HashTableEntry *entry;
+
       while ((entry = ENTRY(ht->buckets[i])) != NULL) {
         SETENTRY(ht->buckets[i], ENTRY(entry->next));
         if (ht->copyKey) {
@@ -467,6 +472,7 @@ HashTable_Lookup(HashTable  *ht,      // IN
    if (clientData) {
       *clientData = Atomic_ReadPtr(&entry->clientData);
    }
+
    return TRUE;
 }
 
@@ -543,9 +549,11 @@ HashTable_LookupAndDelete(HashTable *ht,      // IN/OUT: the hash table
             ht->freeEntryFn(Atomic_ReadPtr(&entry->clientData));
          }
          free(entry);
+
          return TRUE;
       }
    }
+
    return FALSE;
 }
 
@@ -647,6 +655,7 @@ HashTable_ReplaceOrInsert(HashTable  *ht,          // IN/OUT
 #ifndef NO_ATOMIC_HASHTABLE
    if (ht->atomic && ht->freeEntryFn) {
       void *old = Atomic_ReadWritePtr(&entry->clientData, clientData);
+
       ht->freeEntryFn(old);
    } else
 #endif
@@ -656,6 +665,7 @@ HashTable_ReplaceOrInsert(HashTable  *ht,          // IN/OUT
       }
       Atomic_WritePtr(&entry->clientData, clientData);
    }
+
    return TRUE;
 }
 
@@ -748,12 +758,13 @@ again:
 
    oldEntry = HashTableLookup(ht, keyStr, hash);
    if (oldEntry != NULL) {
-      if(entry != NULL) {
+      if (entry != NULL) {
          if (ht->copyKey) {
             free((char *) entry->keyStr);
          }
          free(entry);
       }
+
       return oldEntry;
    }
 
@@ -776,6 +787,7 @@ again:
    }
 
    ht->numElements++;
+
    return NULL;
 }
 
@@ -855,6 +867,7 @@ HashTable_ToArray(const HashTable *ht,  // IN
    /* fill array */
    for (i = 0, j = 0; i < ht->numEntries; i++) {
       HashTableEntry *entry;
+
       for (entry = ENTRY(ht->buckets[i]);
           entry != NULL;
           entry = ENTRY(entry->next)) {
@@ -895,16 +908,19 @@ HashTable_ForEach(const HashTable *ht,           // IN
 
    for (i = 0; i < ht->numEntries; i++) {
       HashTableEntry *entry;
+
       for (entry = ENTRY(ht->buckets[i]);
           entry != NULL;
           entry = ENTRY(entry->next)) {
          int result = (*cb)(entry->keyStr, Atomic_ReadPtr(&entry->clientData),
                            clientData);
+
          if (result) {
             return result;
          }
       }
    }
+
    return 0;
 }
 
index cc3d1c4df32d5dc0b94b1325c2614471a5f9ae40..5506f73fa4564d8b45240a73d473d05786c14daa 100644 (file)
@@ -33,6 +33,7 @@
 #include <sys/time.h>
 #include <sys/timeb.h>
 #include <pwd.h>
+#include <pthread.h>
 #include <sys/resource.h>
 #if defined(sun)
 #include <sys/systeminfo.h>
@@ -136,9 +137,9 @@ typedef struct lsb_distro_info {
 
 
 static LSBDistroInfo lsbFields[] = {
-   {"DISTRIB_ID=", "DISTRIB_ID=%s"},
-   {"DISTRIB_RELEASE=", "DISTRIB_RELEASE=%s"},
-   {"DISTRIB_CODENAME=", "DISTRIB_CODENAME=%s"},
+   {"DISTRIB_ID=",          "DISTRIB_ID=%s"},
+   {"DISTRIB_RELEASE=",     "DISTRIB_RELEASE=%s"},
+   {"DISTRIB_CODENAME=",    "DISTRIB_CODENAME=%s"},
    {"DISTRIB_DESCRIPTION=", "DISTRIB_DESCRIPTION=%s"},
    {NULL, NULL},
 };
@@ -151,44 +152,44 @@ typedef struct distro_info {
 
 
 static DistroInfo distroArray[] = {
-   {"RedHat", "/etc/redhat-release"},
-   {"RedHat", "/etc/redhat_version"},
-   {"Sun", "/etc/sun-release"},
-   {"SuSE", "/etc/SuSE-release"},
-   {"SuSE", "/etc/novell-release"},
-   {"SuSE", "/etc/sles-release"},
-   {"Debian", "/etc/debian_version"},
-   {"Debian", "/etc/debian_release"},
-   {"Mandrake", "/etc/mandrake-release"},
-   {"Mandriva", "/etc/mandriva-release"},
-   {"Mandrake", "/etc/mandrakelinux-release"},
-   {"TurboLinux", "/etc/turbolinux-release"},
-   {"Fedora Core", "/etc/fedora-release"},
-   {"Gentoo", "/etc/gentoo-release"},
-   {"Novell", "/etc/nld-release"},
-   {"Ubuntu", "/etc/lsb-release"},
-   {"Annvix", "/etc/annvix-release"},
-   {"Arch", "/etc/arch-release"},
-   {"Arklinux", "/etc/arklinux-release"},
-   {"Aurox", "/etc/aurox-release"},
-   {"BlackCat", "/etc/blackcat-release"},
-   {"Cobalt", "/etc/cobalt-release"},
-   {"Conectiva", "/etc/conectiva-release"},
-   {"Immunix", "/etc/immunix-release"},
-   {"Knoppix", "/etc/knoppix_version"},
+   {"RedHat",             "/etc/redhat-release"},
+   {"RedHat",             "/etc/redhat_version"},
+   {"Sun",                "/etc/sun-release"},
+   {"SuSE",               "/etc/SuSE-release"},
+   {"SuSE",               "/etc/novell-release"},
+   {"SuSE",               "/etc/sles-release"},
+   {"Debian",             "/etc/debian_version"},
+   {"Debian",             "/etc/debian_release"},
+   {"Mandrake",           "/etc/mandrake-release"},
+   {"Mandriva",           "/etc/mandriva-release"},
+   {"Mandrake",           "/etc/mandrakelinux-release"},
+   {"TurboLinux",         "/etc/turbolinux-release"},
+   {"Fedora Core",        "/etc/fedora-release"},
+   {"Gentoo",             "/etc/gentoo-release"},
+   {"Novell",             "/etc/nld-release"},
+   {"Ubuntu",             "/etc/lsb-release"},
+   {"Annvix",             "/etc/annvix-release"},
+   {"Arch",               "/etc/arch-release"},
+   {"Arklinux",           "/etc/arklinux-release"},
+   {"Aurox",              "/etc/aurox-release"},
+   {"BlackCat",           "/etc/blackcat-release"},
+   {"Cobalt",             "/etc/cobalt-release"},
+   {"Conectiva",          "/etc/conectiva-release"},
+   {"Immunix",            "/etc/immunix-release"},
+   {"Knoppix",            "/etc/knoppix_version"},
    {"Linux-From-Scratch", "/etc/lfs-release"},
-   {"Linux-PPC", "/etc/linuxppc-release"},
-   {"MkLinux", "/etc/mklinux-release"},
-   {"PLD", "/etc/pld-release"},
-   {"Slackware", "/etc/slackware-version"},
-   {"Slackware", "/etc/slackware-release"},
-   {"SMEServer", "/etc/e-smith-release"},
-   {"Solaris", "/etc/release"},
-   {"Tiny Sofa", "/etc/tinysofa-release"},
-   {"UltraPenguin", "/etc/ultrapenguin-release"},
-   {"UnitedLinux", "/etc/UnitedLinux-release"},
-   {"VALinux", "/etc/va-release"},
-   {"Yellow Dog", "/etc/yellowdog-release"},
+   {"Linux-PPC",          "/etc/linuxppc-release"},
+   {"MkLinux",            "/etc/mklinux-release"},
+   {"PLD",                "/etc/pld-release"},
+   {"Slackware",          "/etc/slackware-version"},
+   {"Slackware",          "/etc/slackware-release"},
+   {"SMEServer",          "/etc/e-smith-release"},
+   {"Solaris",            "/etc/release"},
+   {"Tiny Sofa",          "/etc/tinysofa-release"},
+   {"UltraPenguin",       "/etc/ultrapenguin-release"},
+   {"UnitedLinux",        "/etc/UnitedLinux-release"},
+   {"VALinux",            "/etc/va-release"},
+   {"Yellow Dog",         "/etc/yellowdog-release"},
    {NULL, NULL},
 };
 
@@ -372,7 +373,7 @@ Hostinfo_GetSystemBitness(void)
 #      if !defined SOL10
    /*
     * XXX: This is bad.  We define SI_ARCHITECTURE_K to what it is on Solaris
-    * 10 so that we can use a single guestd build for Solaris 9 and 10.  In the
+    * 10 so that we can use a single guestd build for Solaris 9 and 10. In the
     * future we should have the Solaris 9 build just return 32 -- since it did
     * not support 64-bit x86 -- and let the Solaris 10 headers define
     * SI_ARCHITECTURE_K, then have the installer symlink to the correct binary.
@@ -888,9 +889,9 @@ Hostinfo_GetOSName(uint32 outBufFullLen,  // IN: length of osNameFull buffer
       char *dashPtr;
 
       /*
-       * FreeBSD releases report their version as "x.y-RELEASE". We'll be naive
-       * look for the first dash, and use everything before it as the version
-       * number.
+       * FreeBSD releases report their version as "x.y-RELEASE". We'll be
+       * naive look for the first dash, and use everything before it as the
+       * version number.
        */
 
       dashPtr = Str_Strchr(buf.release, '-');
@@ -913,7 +914,7 @@ Hostinfo_GetOSName(uint32 outBufFullLen,  // IN: length of osNameFull buffer
       /*
        * Solaris releases report their version as "x.y". For our supported
        * releases it seems that x is always "5", and is ignored in favor of
-       * y for the version number.
+       * "y" for the version number.
        */
 
       if (sscanf(buf.release, "5.%2[0-9]", solarisRelease) == 1) {
@@ -1029,6 +1030,7 @@ Hostinfo_HTDisabled(void)
 
    if (HostType_OSIsVMK()) {
       VMK_ReturnStatus status = VMKernel_HTEnabledCPU();
+
       if (status != VMK_OK) {
          return TRUE;
       } else {
@@ -1039,6 +1041,7 @@ Hostinfo_HTDisabled(void)
    if (logical == 0 && cores == 0) {
       logical = HostinfoReadProc("logical");
       cores = HostinfoReadProc("cores");
+
       if (logical <= 0 || cores <= 0) {
          logical = cores = 0;
       }
@@ -1077,7 +1080,15 @@ Hostinfo_HTDisabled(void)
 uint32
 Hostinfo_NumCPUs(void)
 {
-#if defined(__APPLE__)
+#if defined(sun)
+   static int count = 0;
+
+   if (count <= 0) {
+      count = sysconf(_SC_NPROCESSORS_CONF);
+   }
+
+   return count;
+#elif defined(__APPLE__)
    uint32 out;
    size_t outSize = sizeof out;
 
@@ -1333,6 +1344,7 @@ HostinfoGetLoadAverage(float *avg0,  // IN/OUT:
    res = getloadavg(avg, 3);
    if (res < 3) {
       NOT_TESTED_ONCE();
+
       return FALSE;
    }
 
@@ -2089,7 +2101,7 @@ Hostinfo_Daemonize(const char *path,             // IN: NUL-terminated UTF-8
          _exit(EXIT_SUCCESS);
       }
    } else {
-      Err_SetErrno(err);
+      errno = err;
 
       if (pidPath) {
          Posix_Unlink(pidPath);
@@ -2422,8 +2434,8 @@ Hostinfo_GetKernelZoneElemSize(char const *name) // IN: Kernel zone name
    /*
     * popen(3) incorrectly executes the shell with the identity of the calling
     * process, ignoring a potential per-thread identity. And starting with
-    * Mac OS 10.6 it is even worse: if there is a per-thread identity, popen(3)
-    * removes it!
+    * Mac OS 10.6 it is even worse: if there is a per-thread identity,
+    * popen(3) removes it!
     *
     * So we run this code in a separate process which runs with the same
     * identity as the current thread.
@@ -2550,6 +2562,7 @@ Hostinfo_SystemUpTime(void)
 
    if (VmkSyscall_Init(FALSE, NULL, 0)) {
       status = VMKernel_GetUptimeUS(&uptime);
+
       if (status == VMK_OK) {
          return uptime;
       }
@@ -3083,7 +3096,7 @@ Hostinfo_SystemTimerUS(void)
 
    return Hostinfo_RawSystemTimerUS();
 #else
-   static Atomic_uint32 mutex = {0};
+   static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
    VmTimeType curTime;
    VmTimeType newTime;
 
@@ -3091,8 +3104,7 @@ Hostinfo_SystemTimerUS(void)
    static VmTimeType lastTimeRead;
    static VmTimeType lastTimeReset;
 
-   /* Get and take lock. */
-   while (Atomic_ReadWrite(&mutex, 1)); // Spinlock.
+   pthread_mutex_lock(&mutex);  // use native mechanism, just like Windows
 
    curTime = Hostinfo_RawSystemTimerUS();
 
@@ -3117,9 +3129,92 @@ Hostinfo_SystemTimerUS(void)
    lastTimeRead = newTime;
 
 exit:
-   /* Release lock. */
-   Atomic_Write(&mutex, 0);
+   pthread_mutex_unlock(&mutex);
 
    return newTime;
 #endif
 }
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * Hostinfo_GetModulePath --
+ *
+ *     Retrieve the full path to the executable. Not supported under VMvisor.
+ *
+ *      Note: If your process is running with elevated privileges
+ *      (setuid/setgid), treat the path returned by this function as
+ *      untrusted (for example, do not pass it to exec or open).
+ *
+ *      This function returns a path that is under the control of the
+ *      user.  An attacker could manipulate the path returned by this
+ *      function to elevate privileges.
+ *
+ * Results:
+ *      On success: The allocated, NUL-terminated file path.
+ *         Note: This path can be a symbolic or hard link; it's just one
+ *         possible path to access the executable.
+ *
+ *      On failure: NULL.
+ *
+ * Side effects:
+ *     None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+Unicode
+Hostinfo_GetModulePath(uint32 priv)  // IN:
+{
+   Unicode path;
+
+#if defined(__APPLE__)
+   uint32_t pathSize = FILE_MAXPATH;
+#else
+   uid_t uid = -1;
+#endif
+
+   if ((priv != HGMP_PRIVILEGE) && (priv != HGMP_NO_PRIVILEGE)) {
+      Warning("%s: invalid privilege parameter\n", __FUNCTION__);
+
+      return NULL;
+   }
+
+#if defined(__APPLE__)
+   path = Util_SafeMalloc(pathSize);
+   if (_NSGetExecutablePath(path, &pathSize)) {
+      Warning(LGPFX" %s: _NSGetExecutablePath failed.\n", __FUNCTION__);
+      free(path);
+
+      return NULL;
+   }
+
+#else
+#if defined(VMX86_SERVER)
+   if (HostType_OSIsVMK()) {
+      return NULL;
+   }
+#endif
+
+   // "/proc/self/exe" only exists on Linux 2.2+.
+   ASSERT(Hostinfo_OSVersion(0) >= 2 && Hostinfo_OSVersion(1) >= 2);
+
+   if (priv == HGMP_PRIVILEGE) {
+      uid = Id_BeginSuperUser();
+   }
+
+   path = Posix_ReadLink("/proc/self/exe");
+
+   if (priv == HGMP_PRIVILEGE) {
+      Id_EndSuperUser(uid);
+   }
+
+   if (path == NULL) {
+      Warning(LGPFX" %s: readlink failed: %s\n", __FUNCTION__,
+              strerror(errno));
+   }
+#endif
+
+   return path;
+}
index ca879e69d626b9b98251b9d0359945b8462bc81b..9920c6a55ed41dd5b00f33a34fb6be2a465fc4d6 100644 (file)
@@ -109,6 +109,7 @@ IOV_Zero(VMIOVec *iov)   // IN
    while (numBytesLeft > 0) {
       size_t c = MIN(numBytesLeft, iov->entries[i].iov_len);
       void *buf;
+
       ASSERT_NOT_IMPLEMENTED(i < iov->numEntries);
       buf = iov->entries[i].iov_base;
       ASSERT(buf && buf != LAZY_ALLOC_MAGIC);
@@ -259,6 +260,7 @@ IOV_IsZero(VMIOVec* iov)      // IN: the iov to scan
          return FALSE;
       }
    }
+
    return TRUE;
 }
 
@@ -310,15 +312,17 @@ IOVSplitList(VMIOVec *regionV,      // IN/OUT: VMIOVec for this region
       if (regionV->numBytes > regionV->numSectors * sectorSize) {
          int spillover;
          
-         spillover = (int) (regionV->numBytes - regionV->numSectors * sectorSize);
+         spillover = (int) (regionV->numBytes -
+                                            regionV->numSectors * sectorSize);
          ASSERT(spillover < curEntry->iov_len);
          ASSERT(spillover > 0);
 
          /*
-          *  Truncate the last overlapping entry and store the excess. After we
-          *  finish this region, we'll smash this last entry with its remainder
-          *  and just move on to the next region.
+          * Truncate the last overlapping entry and store the excess. After
+          * we finish this region, we'll smash this last entry with its
+          * remainder and just move on to the next region.
           */
+
          regionV->numBytes -= spillover;
          curEntry->iov_len -= spillover;
          overlap->iov_len = spillover;
@@ -326,10 +330,11 @@ IOVSplitList(VMIOVec *regionV,      // IN/OUT: VMIOVec for this region
          break;
       } else if (regionV->numBytes == regionV->numSectors * sectorSize) {
          /*
-          *  Clean finish.  The last entry for this region will be handled with
-          *  no overlap, so increment past it for the start of the next
-          *  region's entries.
+          * Clean finish. The last entry for this region will be handled
+          * with no overlap, so increment past it for the start of the next
+          * region's entries.
           */
+
          overlap->iov_len = 0;
          curEntry++;
          break;
@@ -381,6 +386,7 @@ IOV_Split(VMIOVec *origV,         // IN/OUT: VMIOVec for whole xfer
    /*
     * The resulting iov cannot have more entries than the incoming one.
     */
+
    v = Util_SafeMalloc(sizeof *v + origV->numEntries * sizeof(struct iovec));
    iov = &v->iov;
    memcpy(iov, origV, sizeof *iov);
@@ -390,6 +396,7 @@ IOV_Split(VMIOVec *origV,         // IN/OUT: VMIOVec for whole xfer
    /*
     * Handle lazy allocation of backing store.
     */
+
    if (origV->entries->iov_base == LAZY_ALLOC_MAGIC && 
        origV->entries->iov_len == 0) {
 
@@ -523,6 +530,7 @@ IOV_Duplicate(VMIOVec* iovIn)     // IN
    v->iov.entries = v->e;
    memcpy(v->iov.entries, iovIn->entries,
           iovIn->numEntries * sizeof(struct iovec));
+
    return &v->iov;
 }
 
@@ -644,6 +652,7 @@ IOVFindFirstEntryOffset(struct iovec* entries,        // IN
       Log(LGPFX"%s:%d i %d (of %d), offsets: entry %"FMTSZ"u, iov %"FMTSZ"u "
           "invalid iov offset\n",
           __FILE__, __LINE__, i, numEntries, entryOffset, iovOffset);
+
       return numEntries;
    }
 
@@ -652,6 +661,7 @@ IOVFindFirstEntryOffset(struct iovec* entries,        // IN
    ASSERT(entryOffset < entryLen);
 
    *entryOffsetp = entryOffset;
+
    return i - 1;
 }
 
@@ -824,6 +834,7 @@ IOV_WriteIovToIov(VMIOVec *srcIov,        // IN
       Log(LGPFX"%s:%d iov [%"FMT64"u:%"FMT64"u] and [%"FMT64"u:%"FMT64"u] - "
           "no overlap!\n", __FILE__, __LINE__, srcIov->startSector,
           srcIov->numSectors, dstIov->startSector, dstIov->numSectors);
+
       return 0;
    }
 
@@ -856,11 +867,9 @@ IOV_WriteIovToIov(VMIOVec *srcIov,        // IN
       entryLen = MIN(count, srcEntries[i].iov_len - srcEntryOffset);
 
       copyLen = IOV_WriteBufToIovPlus(
-                     (uint8 *)(srcEntries[i].iov_base) + srcEntryOffset,
-                     entryLen,
-                     dstIov->entries,
-                     dstIov->numEntries,
-                     dstIovOffset);
+                           (uint8 *)(srcEntries[i].iov_base) + srcEntryOffset,
+                                      entryLen, dstIov->entries,
+                                      dstIov->numEntries, dstIovOffset);
 
       if (copyLen == 0) {  /* finished */
          break;
index ca4b7b16ac28d370023ff74798f680c0b91c27e9..3fb076bcae6be030d72100fb900b955d22d3541b 100644 (file)
@@ -67,9 +67,9 @@
  */
 
 static IP_ADAPTER_INFO *
-FindWindowsAdapter(IP_ADAPTER_INFO *head, // IN:
-                   char *pattern,         // IN:
-                   Bool findPattern)      // IN:
+FindWindowsAdapter(IP_ADAPTER_INFO *head,  // IN:
+                   char *pattern,          // IN:
+                   Bool findPattern)       // IN:
 {
    IP_ADAPTER_INFO *adapterInfo;
    IP_ADAPTER_INFO *adapterChoice = NULL;
@@ -129,14 +129,14 @@ FindWindowsAdapter(IP_ADAPTER_INFO *head, // IN:
 static int
 ObtainHardwareID(uint64 *hardwareID) // OUT:
 {
-   void            *buf;
-   DWORD           status;
-   HMODULE         dllHandle;
+   void *buf;
+   DWORD status;
+   HMODULE dllHandle;
    IP_ADAPTER_INFO *adapterList;
    IP_ADAPTER_INFO *adapterChoice;
-   DWORD           (WINAPI *getAdaptersFn)(IP_ADAPTER_INFO *, ULONG *);
+   DWORD (WINAPI *getAdaptersFn)(IP_ADAPTER_INFO *, ULONG *);
 
-   ULONG           bufLen = 0;
+   ULONG bufLen = 0;
 
    // Deal with BUG 21643
    dllHandle = LoadLibrary(TEXT("icmp.dll"));
@@ -144,6 +144,7 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
 
    if (!dllHandle) {
       Warning("%s Failed to load icmp.dll.\n", __FUNCTION__);
+
       return EINVAL;
    }
 
@@ -151,6 +152,7 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
 
    if (!dllHandle) {
       Warning("%s Failed to load iphlpapi.dll.\n", __FUNCTION__);
+
       return EINVAL;
    }
 
@@ -159,6 +161,7 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
    if (!getAdaptersFn) {
       FreeLibrary(dllHandle);
       Warning("%s Failed to find GetAdaptersInfo.\n", __FUNCTION__);
+
       return EINVAL;
    }
 
@@ -182,16 +185,17 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
 
    default:
       FreeLibrary(dllHandle);
-      Warning("%s GetAdaptersInfo failure %d: %d.\n",
-              __FUNCTION__, __LINE__, status);
+      Warning("%s GetAdaptersInfo failure %d: %d.\n", __FUNCTION__,
+              __LINE__, status);
+
       return EINVAL;
-      break;
    }
 
    buf = malloc(bufLen);
 
    if (buf == NULL) {
       FreeLibrary(dllHandle);
+
       return ENOMEM;
    }
 
@@ -203,8 +207,8 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
 
    if (status != NO_ERROR) {
       // something is seriously wrong; worked before...
-      Warning("%s GetAdaptersInfo failure %d: %d.\n",
-              __FUNCTION__, __LINE__, status);
+      Warning("%s GetAdaptersInfo failure %d: %d.\n", __FUNCTION__,
+              __LINE__, status);
 
       free(buf);
 
@@ -262,11 +266,11 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
  */
 
 static struct ifaddrs *
-CheckEthernet(struct ifaddrs *ifp, // IN:
-              uint32 n)            // IN:
+CheckEthernet(struct ifaddrs *ifp,  // IN:
+              uint32 n)             // IN:
 {
    struct ifaddrs *p;
-   char           name[8];
+   char name[8];
 
    // Construct the interface name
    Str_Sprintf(name, sizeof name, "en%u", n);
@@ -310,9 +314,9 @@ CheckEthernet(struct ifaddrs *ifp, // IN:
  */
 
 static int
-ObtainHardwareID(uint64 *hardwareID) // OUT:
+ObtainHardwareID(uint64 *hardwareID)  // OUT:
 {
-   uint32         i;
+   uint32 i;
    struct ifaddrs *p;
    struct ifaddrs *ifp;
 
@@ -446,7 +450,7 @@ CheckEthernet(uint32 n,        // IN:
  */
 
 static int
-ObtainHardwareID(uint64 *hardwareID) // OUT:
+ObtainHardwareID(uint64 *hardwareID)  // OUT:
 {
    uint32 i;
 
@@ -494,7 +498,7 @@ ObtainHardwareID(uint64 *hardwareID) // OUT:
  */
 
 static int
-ObtainHardwareID(uint64 *hardwareID) // OUT:
+ObtainHardwareID(uint64 *hardwareID)  // OUT:
 {
    *hardwareID = gethostid();
 
@@ -568,8 +572,8 @@ HostNameHash(unsigned char *str) // IN:
  */
 
 void
-Hostinfo_MachineID(uint32 *hostNameHash,   // OUT:
-                   uint64 *hostHardwareID) // OUT:
+Hostinfo_MachineID(uint32 *hostNameHash,    // OUT:
+                   uint64 *hostHardwareID)  // OUT:
 {
    static Bool fetchValues = TRUE;
    static uint64 cachedHardwareID;
index 0f578f822567d605ffe3dbe870570afab7ab66cb..7bbf768c79a1ddefaa5cb11d52904a96920994c7 100644 (file)
@@ -49,7 +49,8 @@
  */
 
 int
-daemon(int nochdir, int noclose)
+daemon(int nochdir,  // IN:
+       int noclose)  // IN:
 {
    int fd;
 
@@ -79,6 +80,7 @@ daemon(int nochdir, int noclose)
          close (fd);
       }
    }
+
    return (0);
 }
 #endif
index 56abe383e3bed8ad46387aafc8be052ab3e183f3..850c17810b5502e590eaeb9c15befe41441c348c 100644 (file)
@@ -78,12 +78,14 @@ Random_Crypto(unsigned int size,  // IN:
    if (CryptGenRandom(csp, size, buffer) == FALSE) {
       CryptReleaseContext(csp, 0);
       Log("%s: CryptGenRandom failed %d\n", __FUNCTION__, GetLastError());
+
       return FALSE;
    }
 
    if (CryptReleaseContext(csp, 0) == FALSE) {
       Log("%s: CryptReleaseContext failed %d\n", __FUNCTION__,
           GetLastError());
+
       return FALSE;
    }
 #else
@@ -126,6 +128,7 @@ Random_Crypto(unsigned int size,  // IN:
 
    if (fd == -1) {
       Log("%s: Failed to open random device: %d\n", __FUNCTION__, errno);
+
       return FALSE;
    }
 
@@ -138,6 +141,7 @@ Random_Crypto(unsigned int size,  // IN:
 
          close(fd);
          Log("%s: Short read: %d\n", __FUNCTION__, error);
+
          return FALSE;
       }
       if (bytesRead > 0) {
@@ -148,6 +152,7 @@ Random_Crypto(unsigned int size,  // IN:
 
    if (close(fd) == -1) {
       Log("%s: Failed to close: %d\n", __FUNCTION__, errno);
+
       return FALSE;
    }
 #endif
index 946e291e0c443d7ab508470d9b53f9c58f978df1..4f6b6898d737f904d051492bc11191887dde1f2c 100644 (file)
@@ -299,11 +299,14 @@ StrUtil_StrToInt(int32 *out,      // OUT
 
    val = strtol(str, &ptr, 0);
    *out = (int32)val;
+
    /*
-    * Input must be complete, no overflow, and value read must fit into 32 bits -
-    * both signed and unsigned values are accepted.
+    * Input must be complete, no overflow, and value read must fit into
+    * 32 bits - both signed and unsigned values are accepted.
     */
-   return *ptr == '\0' && errno != ERANGE && (val == (int32)val || val == (uint32)val);
+
+   return *ptr == '\0' && errno != ERANGE &&
+          (val == (int32)val || val == (uint32)val);
 }
 
 
@@ -338,11 +341,14 @@ StrUtil_StrToUint(uint32 *out,     // OUT
 
    val = strtoul(str, &ptr, 0);
    *out = (uint32)val;
+
    /*
-    * Input must be complete, no overflow, and value read must fit into 32 bits -
-    * both signed and unsigned values are accepted.
+    * Input must be complete, no overflow, and value read must fit into 32
+    * bits - both signed and unsigned values are accepted.
     */
-   return *ptr == '\0' && errno != ERANGE && (val == (uint32)val || val == (int32)val);
+
+   return *ptr == '\0' && errno != ERANGE &&
+          (val == (uint32)val || val == (int32)val);
 }
 
 
@@ -446,8 +452,8 @@ StrUtil_StrToSizet(size_t *out,     // OUT: The output value
  *
  *      Converts a string containing a measure of disk capacity (such as
  *      "100MB" or "1.5k") into an unadorned and primitive quantity of sector
- *      capacity. The comment before the switch statement describes the kinds of
- *      disk capacity expressible.
+ *      capacity. The comment before the switch statement describes the kinds
+ *      of disk capacity expressible.
  *
  * Results:
  *      TRUE if conversion was successful, FALSE otherwise.
@@ -504,21 +510,23 @@ StrUtil_CapacityToSectorType(SectorType *out,    // OUT: The output value
       quantity *= (double)(1 << shift);
    } else {
       /*
-       * No suffix, so multiply by the number of bytes per unit as specified by
-       * the caller.
+       * No suffix, so multiply by the number of bytes per unit as specified
+       * by the caller.
        */
+
       quantity *= (double)bytes;
    }
 
    /*
-    * Convert from "number of bytes" to "number of sectors", rounding up or down
-    * appropriately.
+    * Convert from "number of bytes" to "number of sectors", rounding up or
+    * down appropriately.
     *
-    * XXX: We should use DISKLIB_SECTOR_SIZE, but do we really want the disklib
-    * header dependencies in this file?
+    * XXX: We should use DISKLIB_SECTOR_SIZE, but do we really want the
+    * disklib header dependencies in this file?
     *
     */
    *out = (SectorType)((quantity + 256) / 512);
+
    return TRUE;
 }
 #endif
@@ -548,9 +556,10 @@ StrUtil_FormatSizeInBytesUnlocalized(uint64 size) // IN
    /*
     * XXX TODO, BUG 199661:
     * This is a direct copy of Msg_FormatSizeInBytes without localization.
-    * These two functions should ideally share the basic functionality, and just
-    * differ in the string localization
+    * These two functions should ideally share the basic functionality, and
+    * just differ in the string localization
     */
+
    char const *fmt;
    double sizeInSelectedUnit;
    unsigned int precision;
@@ -665,6 +674,7 @@ StrUtil_GetLongestLineLength(const char *buf,   //IN
        bufLength -= len;
        buf = next;
     }
+
     return longest;
 }
 
@@ -691,6 +701,7 @@ StrUtil_StartsWith(const char *s,      // IN
 {
    ASSERT(s != NULL);
    ASSERT(prefix != NULL);
+
    return Str_Strncmp(s, prefix, strlen(prefix)) == 0;
 }
 
@@ -717,6 +728,7 @@ StrUtil_CaselessStartsWith(const char *s,      // IN
 {
    ASSERT(s != NULL);
    ASSERT(prefix != NULL);
+
    return Str_Strncasecmp(s, prefix, strlen(prefix)) == 0;
 }
 
@@ -729,7 +741,8 @@ StrUtil_CaselessStartsWith(const char *s,      // IN
  *      Detects if a string ends with another string.
  *
  * Results:
- *      TRUE if string 'suffix' is found at the end of string 's', FALSE otherwise.
+ *      TRUE  if string 'suffix' is found at the end of string 's'
+ *      FALSE otherwise.
  *
  * Side effects:
  *      None.
@@ -789,6 +802,7 @@ StrUtil_VDynBufPrintf(DynBuf *b,        // IN/OUT
     * Arbitrary lower-limit on buffer size allocation, to avoid doing
     * many tiny enlarge operations.
     */
+
    const size_t minAllocSize = 128;
 
    while (1) {
@@ -831,7 +845,9 @@ StrUtil_VDynBufPrintf(DynBuf *b,        // IN/OUT
           * happens, believe it or not. See bug 253674.
           */
 
-         ASSERT(i + size == allocSize || ((char*)DynBuf_Get(b))[i + size] == '\0');
+         ASSERT(i + size == allocSize ||
+                ((char *)DynBuf_Get(b))[i + size] == '\0');
+
          DynBuf_SetSize(b, size + i);
          break;
 
@@ -843,6 +859,7 @@ StrUtil_VDynBufPrintf(DynBuf *b,        // IN/OUT
           */
 
          Bool success = DynBuf_Enlarge(b, size + minAllocSize);
+
          if (!success) {
             return FALSE;
          }
index f29a024ace454c8134ec5f159c98dde21c35f54c..02a16ef3bd79bb9087bd8ca0af406f6a5fc1be27 100644 (file)
 static void TimeUtilInit(TimeUtil_Date *d);
 static Bool TimeUtilLoadDate(TimeUtil_Date *d, const char *date);
 static Bool TimeUtilIsLeapYear(unsigned int year);
-static Bool TimeUtilIsValidDate(unsigned int year, unsigned int month, unsigned int day);
+static Bool TimeUtilIsValidDate(unsigned int year,
+                                unsigned int month,
+                                unsigned int day);
 
 
 /*
  * Function to guess Windows TZ Index and Name by using time offset in
  * a lookup table
  */
-static int TimeUtilFindIndexAndNameByUTCOffset(int utcStdOffMins, const char **ptzName);
+
+static int TimeUtilFindIndexAndNameByUTCOffset(int utcStdOffMins,
+                                               const char **ptzName);
 
 #if defined(_WIN32)
 /*
@@ -158,6 +162,7 @@ TimeUtil_StringToDate(TimeUtil_Date *d,  // IN/OUT
     * Reduce the string to a known and handled format: YYYYMMDD.
     * Then, passed to internal function TimeUtilLoadDate.
     */
+
    if (strlen(date) == 8) {
       /* 'YYYYMMDD' */
       return TimeUtilLoadDate(d, date);
@@ -318,6 +323,7 @@ TimeUtil_DaysSubtract(TimeUtil_Date *d,   // IN/OUT
     *   intentionally subtract an additional 2 days for each year
     *   and an additional 3 days.
     */
+
    dayCount = dayCount + 3 + 2 * (dayCount / 365);
 
    subYear = dayCount / 365;
@@ -344,6 +350,7 @@ TimeUtil_DaysSubtract(TimeUtil_Date *d,   // IN/OUT
     * making sure on the valid range, without checking
     * for leap year, etc.
     */
+
    if ((estDay > 28) && (estMonth == 2)) {
       estDay = 28;
    }
@@ -356,6 +363,7 @@ TimeUtil_DaysSubtract(TimeUtil_Date *d,   // IN/OUT
     * we also copy the time from the original argument in making
     * sure that it does not play role in the comparison.
     */
+
    estRes.hour = d->hour;
    estRes.minute = d->minute;
    estRes.second = d->second;
@@ -365,6 +373,7 @@ TimeUtil_DaysSubtract(TimeUtil_Date *d,   // IN/OUT
     * guaranteed to be lower than the actual result. Otherwise,
     * infinite loop will happen.
     */
+
    ASSERT(TimeUtil_DateLowerThan(&estRes, d));
 
    /*
@@ -372,6 +381,7 @@ TimeUtil_DaysSubtract(TimeUtil_Date *d,   // IN/OUT
     * Done by moving up (moving forward) the estimated a day at a time
     *    until they are the correct one (i.e. estDate + arg #day = arg date)
     */
+
    temp = estRes;
    TimeUtil_DaysAdd(&temp, nr);
    while (TimeUtil_DateLowerThan(&temp, d)) {
@@ -538,12 +548,15 @@ TimeUtil_DaysLeft(TimeUtil_Date const *d) // IN
    /* Get the current local date. */
    TimeUtil_PopulateWithCurrent(TRUE, &c);
 
-   /* Compute how many days we can add to the current date before reaching
-      the given date */
+   /*
+    * Compute how many days we can add to the current date before reaching
+    * the given date
+    */
+
    for (i = 0; i < MAX_DAYSLEFT + 1; i++) {
-      if (    c.year > d->year
-          || (c.year == d->year && c.month > d->month)
-          || (c.year == d->year && c.month == d->month && c.day >= d->day)) {
+      if ((c.year > d->year) ||
+          (c.year == d->year && c.month > d->month) ||
+          (c.year == d->year && c.month == d->month && c.day >= d->day)) {
          /* current date >= given date */
          return i;
       }
@@ -769,7 +782,8 @@ TimeUtil_GetTimeFormat(int64 utcTime,  // IN
       return NULL;
    }
 
-   if (!TimeUtil_UTCTimeToSystemTime((const __time64_t) utcTime, &systemTime)) {
+   if (!TimeUtil_UTCTimeToSystemTime((const __time64_t) utcTime,
+                                      &systemTime)) {
       return NULL;
    }
 
@@ -789,6 +803,7 @@ TimeUtil_GetTimeFormat(int64 utcTime,  // IN
    char *str;
    str = Util_SafeStrdup(ctime((const time_t *) &utcTime));
    str[strlen(str)-1] = '\0';
+
    return str;
 #endif // _WIN32
 }
@@ -875,7 +890,7 @@ VmTimeType
 TimeUtil_UnixTimeToNtTime(struct timespec unixTime) // IN: Time in Unix format
 {
    return (VmTimeType)unixTime.tv_sec * 10000000 +
-      unixTime.tv_nsec / 100 + UNIX_EPOCH;
+                                          unixTime.tv_nsec / 100 + UNIX_EPOCH;
 }
 #endif // _WIN32 && N_PLAT_NLM
 
@@ -909,6 +924,7 @@ TimeUtil_UTCTimeToSystemTime(const __time64_t utcTime,   // IN
     * _localtime64 support years up through 3000.  At least it says
     * so.  I'm getting garbage only after reaching year 4408.
     */
+
    if (utcTime < 0 || utcTime > (60LL * 60 * 24 * 365 * (3000 - 1970))) {
       return FALSE;
    }
@@ -926,6 +942,7 @@ TimeUtil_UTCTimeToSystemTime(const __time64_t utcTime,   // IN
     * Main reason for this test is to cut out negative values _localtime64
     * likes to return for some inputs.
     */
+
    if (atmYear < 1601 || atmYear > 30827 ||
        atmMonth < 1 || atmMonth > 12 ||
        atm->tm_wday < 0 || atm->tm_wday > 6 ||
@@ -1016,6 +1033,7 @@ TimeUtil_GetLocalWindowsTimeZoneIndexAndName(char **ptzName)   // OUT: returning
           * Offset is to standard (no need for DST adjustment).
           * Negative is east of prime meridian.
           */
+
          utcStdOffMins = 0 - timezone/60;
       #else
          /*
@@ -1023,6 +1041,7 @@ TimeUtil_GetLocalWindowsTimeZoneIndexAndName(char **ptzName)   // OUT: returning
           * Offset is to local (need to adjust for DST).
           * Negative is west of prime meridian.
           */
+
          utcStdOffMins = tim.tm_gmtoff/60;
          if (tim.tm_isdst) {
             utcStdOffMins -= 60;
@@ -1037,7 +1056,8 @@ TimeUtil_GetLocalWindowsTimeZoneIndexAndName(char **ptzName)   // OUT: returning
 
    /* If we don't have it yet, look up windowsCode. */
    if (winTimeZoneIndex < 0) {
-      winTimeZoneIndex = TimeUtilFindIndexAndNameByUTCOffset(utcStdOffMins, &tzNameByUTCOffset);
+      winTimeZoneIndex = TimeUtilFindIndexAndNameByUTCOffset(utcStdOffMins,
+                                                         &tzNameByUTCOffset);
       if (winTimeZoneIndex >= 0) {
          *ptzName = Unicode_AllocWithUTF8(tzNameByUTCOffset);
       }
@@ -1113,6 +1133,7 @@ TimeUtilIsValidDate(unsigned int year,   // IN
    /*
     * Initialize the table
     */
+
    if (TimeUtilIsLeapYear(year)) {
       monthdays[2] = 29;
    } else {
@@ -1227,7 +1248,8 @@ TimeUtilLoadDate(TimeUtil_Date *d,  // IN/OUT
       return FALSE;
    }
 
-   if (!TimeUtilIsValidDate((unsigned int) year, (unsigned int) month, (unsigned int) day)) {
+   if (!TimeUtilIsValidDate((unsigned int) year, (unsigned int) month,
+                            (unsigned int) day)) {
       return FALSE;
    }
 
@@ -1404,9 +1426,7 @@ static int Win32TimeUtilLookupZoneIndex(const char* targetName)
                            "Windows NT\\"
                            "CurrentVersion\\"
                            "Time Zones",
-                           0,
-                           KEY_READ,
-                           &parentKey) != ERROR_SUCCESS) {
+                           0, KEY_READ, &parentKey) != ERROR_SUCCESS) {
       /* Failed to open registry */
       return (-1);
    }
@@ -1415,13 +1435,9 @@ static int Win32TimeUtilLookupZoneIndex(const char* targetName)
    keyIndex = 0;
    while (
          timeZoneIndex < 0 &&
-         Win32U_RegEnumKeyEx(parentKey,
-                             keyIndex,
-                             childKeyName,
-                             &childKeyLen,
+         Win32U_RegEnumKeyEx(parentKey, keyIndex, childKeyName, &childKeyLen,
                              0,0,0,0) == ERROR_SUCCESS) {
-
-      char* std;
+      char *std;
       DWORD stdSize;
 
       /* Open child key */
@@ -1431,28 +1447,25 @@ static int Win32TimeUtilLookupZoneIndex(const char* targetName)
       }
 
       /* Get size of "Std" value */
-      if (Win32U_RegQueryValueEx(childKey,
-                                 "Std", 0, 0,
+      if (Win32U_RegQueryValueEx(childKey, "Std", 0, 0,
                                  NULL, &stdSize) == ERROR_SUCCESS) {
 
          /* Get value of "Std" */
          std = (char*) calloc(stdSize+1, sizeof(char));
          if (std != NULL) {
-            if (Win32U_RegQueryValueEx(childKey,
-                                       "Std", 0, 0,
-                                       (LPBYTE) std, &stdSize) == ERROR_SUCCESS) {
+            if (Win32U_RegQueryValueEx(childKey, "Std", 0, 0, (LPBYTE) std,
+                                       &stdSize) == ERROR_SUCCESS) {
 
                /* Make sure there is at least one EOS */
                std[stdSize] = '\0';
 
                /* Is this the name we want? */
                if (!strcmp(std, targetName)) {
-
                   /* yes: look up value of "Index" */
                   DWORD val = 0;
                   DWORD valSize = sizeof(val);
-                  if (Win32U_RegQueryValueEx(childKey,
-                                             "Index", 0, 0,
+
+                  if (Win32U_RegQueryValueEx(childKey, "Index", 0, 0,
                                              (LPBYTE) &val,
                                              &valSize) == ERROR_SUCCESS) {
                      timeZoneIndex = val;
index 09a923585cdbff6f291c9245b150dd4b951db16e..35463842b8499b5d9ad29b7255333eb1eea2085b 100644 (file)
@@ -91,7 +91,7 @@
  */
 
 char *
-Util_GetCanonicalPath(const char *path) // IN
+Util_GetCanonicalPath(const char *path)  // IN:
 {
    char *canonicalPath = NULL;
 
@@ -158,7 +158,7 @@ Util_GetCanonicalPath(const char *path) // IN
  */
 
 char *
-Util_GetCanonicalPathForHash(const char *path) // IN: UTF-8
+Util_GetCanonicalPathForHash(const char *path)  // IN: UTF-8
 {
    char *ret = NULL;
    char *cpath = Util_GetCanonicalPath(path);
@@ -193,7 +193,7 @@ Util_GetCanonicalPathForHash(const char *path) // IN: UTF-8
  */
 
 static char*
-UtilGetLegacyEncodedString(const char *path) // IN: UTF-8
+UtilGetLegacyEncodedString(const char *path)  // IN: UTF-8
 {
    char *ret = NULL;
    char *cpath = Util_GetCanonicalPath(path);
@@ -242,7 +242,7 @@ UtilGetLegacyEncodedString(const char *path) // IN: UTF-8
  */
 
 char *
-Util_CompatGetCanonicalPath(const char *path) // IN: UTF-8
+Util_CompatGetCanonicalPath(const char *path)  // IN: UTF-8
 {
    char *cpath = Util_GetCanonicalPath(path);
    char *ret = NULL;
@@ -267,10 +267,10 @@ Util_CompatGetCanonicalPath(const char *path) // IN: UTF-8
  *      path case-sensitivity.
  *
  *      XXX: This implementation makes assumptions about the host filesystem's
- *           case sensitivity without any regard to what filesystem the provided
- *           paths actually use. There are many ways to break this assumption,
- *           on any of our supported host OSes! The return value of this function
- *           cannot be trusted.
+ *           case sensitivity without any regard to what filesystem the
+ *           provided paths actually use. There are many ways to break this
+ *           assumption, on any of our supported host OSes! The return value
+ *           of this function cannot be trusted.
  *
  * Results:
  *      TRUE if the paths are equivalenr, FALSE if they are not.
@@ -282,11 +282,12 @@ Util_CompatGetCanonicalPath(const char *path) // IN: UTF-8
  */
 
 Bool
-Util_CanonicalPathsIdentical(const char *path1, // IN
-                             const char *path2) // IN
+Util_CanonicalPathsIdentical(const char *path1,  // IN:
+                             const char *path2)  // IN:
 {
    ASSERT(path1);
    ASSERT(path2);
+
 #if defined(linux)
    return (strcmp(path1, path2) == 0);
 #elif defined(_WIN32)
@@ -362,7 +363,7 @@ Util_IsAbsolutePath(const char *path)  // IN: path to check
  */
 
 unsigned
-Util_GetPrime(unsigned n0)
+Util_GetPrime(unsigned n0)  // IN:
 {
    unsigned i, ii, n, nn;
 
index 5fdd4b82a23c39c1c9c322708c3f595dec9e0c96..822d0ac3843ede06e847312bcd453b9c632ce352 100644 (file)
@@ -64,9 +64,9 @@
  */
 
 static void *
-SuperFgets(FILE *stream,        // IN
-           size_t *count,       // IN/OUT
-           void *bufIn)         // OUT
+SuperFgets(FILE *stream,   // IN:
+           size_t *count,  // IN/OUT:
+           void *bufIn)    // OUT:
 {
    char *buf = (char *)bufIn;
    size_t size = 0;
@@ -146,8 +146,8 @@ SuperFgets(FILE *stream,        // IN
  *
  *      Read the next line from a stream.
  *
- *      A line is defined as an arbitrary long sequence of arbitrary bytes, that
- *      ends with the first occurrence of one of these line terminators:
+ *      A line is defined as an arbitrary long sequence of arbitrary bytes,
+ *      that ends with the first occurrence of one of these line terminators:
  *      . \r\n          (the ANSI way, in text mode)
  *      . \n            (the UNIX way)
  *      . \r            (the Legacy Mac (pre-OS X) way)
@@ -158,13 +158,14 @@ SuperFgets(FILE *stream,        // IN
  *      will be interpreted as two newlines in text mode ('\r' followed by
  *      '\r\n'), but three newlines in binary mode ('\r', '\r', '\n').
  *
- *      If maxBufLength is non-zero at most maxBufLength bytes will be allocated.
+ *      If maxBufLength is non-zero at most maxBufLength bytes will be
+ *      allocated.
  *
  * Results:
  *      StdIO_Success on success: '*buf' is an allocated, NUL terminated buffer
  *                                that contains the line (excluding the line
- *                                terminator). If not NULL, '*count' contains the
- *                                size of the buffer (excluding the NUL
+ *                                terminator). If not NULL, '*count' contains
+ *                                the size of the buffer (excluding the NUL
  *                                terminator)
  *      StdIO_EOF if there is no next line (end of stream)
  *      StdIO_Error on failure: errno is set accordingly
@@ -180,10 +181,10 @@ SuperFgets(FILE *stream,        // IN
  */
 
 StdIO_Status
-StdIO_ReadNextLine(FILE *stream,         // IN
-                   char **buf,           // OUT
-                   size_t maxBufLength,  // IN
-                   size_t *count)        // OUT
+StdIO_ReadNextLine(FILE *stream,         // IN:
+                   char **buf,           // OUT:
+                   size_t maxBufLength,  // IN:
+                   size_t *count)        // OUT:
 {
    DynBuf b;
 
@@ -202,6 +203,7 @@ StdIO_ReadNextLine(FILE *stream,         // IN
        * The dynamic buffer must be at least 2 bytes large, so that at least
        * 1 stream byte and fgets()'s NUL byte can fit --hpreg
        */
+
       if (DynBuf_Enlarge(&b, 2) == FALSE) {
          errno = ENOMEM;
          goto error;
@@ -233,6 +235,7 @@ StdIO_ReadNextLine(FILE *stream,         // IN
          if (size == 0 && feof(stream)) {
             /* Reached end-of-file before reading anything */
             DynBuf_Destroy(&b);
+
             return StdIO_EOF;
          }
 
index 7d173427deaccaafbd7c15b6bcc103e35ae00215..7fc00b8ba0981f761c74a411c0d5455a4e4d0b82 100644 (file)
     bit mask & shift operations.
 ------------------------------------------------------------------------ */
 
-typedef unsigned long  UTF32;  /* at least 32 bits */
-typedef unsigned short UTF16;  /* at least 16 bits */
-typedef unsigned char  UTF8;   /* typically 8 bits */
-typedef unsigned char  Boolean; /* 0 or 1 */
+#include "vm_basic_types.h"
+
+typedef uint32          UTF32;    /* at least 32 bits */
+typedef uint16          UTF16;    /* at least 16 bits */
+typedef uint8           UTF8;     /* typically 8 bits */
+typedef unsigned char   Boolean;  /* 0 or 1 */
 
 /* Some fundamental constants */
 #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
index 6386b65f32d84da99fe7c0c288ff0c24ef7797aa..581a50cd9b9d943b8ed3824271e276f9c2c23ddf 100644 (file)
@@ -39,7 +39,7 @@ Msg_Append(const char *fmt,
    Str_Vsnprintf(buf, sizeof buf, fmt, args);
    va_end(args);
 
-   Warning("Msg_Append: %s\n", buf);
+   Warning("%s [STUB]: %s\n", __FUNCTION__, buf);
 }
 
 
@@ -64,7 +64,7 @@ Msg_Question(Msg_String const *buttons,
    Str_Vsnprintf(buf, sizeof buf, fmt, args);
    va_end(args);
 
-   Warning("Msg_Question: %s\n", buf);
+   Warning("%s [STUB]: %s\n", __FUNCTION__, buf);
 
    return (unsigned int) defaultAnswer;
 }
index 7bcfa5e883a4819e9d7864236932b1f4f03dcb5b..d43cd7cd8d283683da538e7a52c7421539c9e1f4 100644 (file)
@@ -136,7 +136,7 @@ static int SNEForEachCallback(const char *key, void *value, void *clientData);
  *          497 days. This function can detect the wrapping and still return
  *          a correct, monotonic, 64 bit wide value if it is called at least
  *          once every 497 days.
- *      
+ *
  * Result:
  *    The value on success
  *    -1 on failure (never happens in this implementation)
@@ -153,7 +153,7 @@ System_Uptime(void)
    /*
     * Dummy variable b/c times(NULL) segfaults on FreeBSD 3.2 --greg
     */
-   struct tms tp; 
+   struct tms tp;
 
 #if !defined (VM_X86_64)
    static uint64 base = 0;
@@ -203,7 +203,7 @@ System_GetCurrentTime(int64 *secs,  // OUT
 
    ASSERT(secs);
    ASSERT(usecs);
-   
+
    if (gettimeofday(&tv, NULL) < 0) {
       return FALSE;
    }
@@ -377,7 +377,7 @@ System_IsTimeSlewEnabled(void)
    struct timeval oldTx;
    int error;
 
-   /* 
+   /*
     * Solaris needs first argument non-NULL and zero
     * to get the old timeval value.
     */
@@ -440,24 +440,24 @@ System_AddToCurrentTime(int64 deltaSecs,  // IN
    int64 newTime;
    int64 secs;
    int64 usecs;
-   
+
    if (!System_GetCurrentTime(&secs, &usecs)) {
       return FALSE;
    }
-   
+
    if (System_IsTimeSlewEnabled()) {
       System_DisableTimeSlew();
    }
 
    newTime = (secs + deltaSecs) * 1000000L + (usecs + deltaUsecs);
    ASSERT(newTime > 0);
-   
+
    /*
     * timeval.tv_sec is a 32-bit signed integer. So, Linux will treat
-    * newTime as a time before the epoch if newTime is a time 68 years 
-    * after the epoch (beacuse of overflow). 
+    * newTime as a time before the epoch if newTime is a time 68 years
+    * after the epoch (beacuse of overflow).
     *
-    * If it is a 64-bit linux, everything should be fine. 
+    * If it is a 64-bit linux, everything should be fine.
     */
    if (sizeof tv.tv_sec < 8 && newTime / 1000000L > MAX_INT32) {
       Log("System_AddToCurrentTime() overflow: deltaSecs=%"FMT64"d, secs=%"FMT64"d\n",
@@ -465,14 +465,14 @@ System_AddToCurrentTime(int64 deltaSecs,  // IN
 
       return FALSE;
    }
+
    tv.tv_sec = newTime / 1000000L;
    tv.tv_usec = newTime % 1000000L;
 
    if (settimeofday(&tv, NULL) < 0) {
       return FALSE;
    }
-   
+
    return TRUE;
 }
 
@@ -527,7 +527,7 @@ System_GetTimeAsString(void)
    do {
       char *newBuf;
       bufSize *= 2;
-      
+
       newBuf = realloc(buf, bufSize);
       if (newBuf == NULL) {
          goto out;
@@ -562,7 +562,7 @@ System_GetTimeAsString(void)
  *
  * Results:
  *    TRUE if this is an ACPI system.
- *    FALSE if this is not an ACPI system.   
+ *    FALSE if this is not an ACPI system.
  *
  * Side effects:
  *     None.
@@ -581,14 +581,14 @@ System_IsACPI(void)
 
 /*
  *-----------------------------------------------------------------------------
- *  
- * System_Shutdown -- 
+ *
+ * System_Shutdown --
  *
  *   Initiate system shutdown.
- * 
- * Return value: 
+ *
+ * Return value:
  *    None.
- * 
+ *
  * Side effects:
  *    None.
  *
@@ -624,17 +624,17 @@ System_Shutdown(Bool reboot)  // IN: "reboot or shutdown" flag
 
 /*
  *-----------------------------------------------------------------------------
- *  
- * System_IsUserAdmin -- 
+ *
+ * System_IsUserAdmin --
  *
  *    On Windows this functions checks if the calling user has membership in
  *    the Administrators group (for NT platforms). On POSIX machines, we simply
  *    check if the user's effective UID is root.
- * 
- * Return value: 
+ *
+ * Return value:
  *    TRUE if the user has an effective UID of root.
  *    FALSE if not.
- * 
+ *
  * Side effects:
  *    None.
  *
@@ -668,7 +668,7 @@ System_GetEnv(Bool global,           // IN
               const char *valueName) // IN: UTF-8
 {
    char *result;
-   
+
 #if defined(sun)
    result = NULL;
 #else
@@ -720,7 +720,7 @@ System_SetEnv(Bool global,      // IN
  *
  * System_UnsetEnv --
  *
- *    Unset environment variable. 
+ *    Unset environment variable.
  *
  * Results:
  *    0 if success, -1 otherwise.
@@ -748,7 +748,7 @@ System_UnsetEnv(const char *valueName) // IN: UTF-8
  *
  * System_SetLDPath --
  *
- *    Set LD_LIBRARY_PATH. If native is TRUE, use VMWARE_LD_LIBRARY_PATH 
+ *    Set LD_LIBRARY_PATH. If native is TRUE, use VMWARE_LD_LIBRARY_PATH
  *    as the value (and ignore the path argument, which should be set to
  *    NULL in this case). If native is FALSE, use the passed in path (and
  *    if that path is NULL, unsetenv the value).
@@ -758,7 +758,7 @@ System_UnsetEnv(const char *valueName) // IN: UTF-8
  *    responsible for calling free() on this pointer.
  *
  * Side effects:
- *    Manipulates the value of LD_LIBRARY_PATH variable. 
+ *    Manipulates the value of LD_LIBRARY_PATH variable.
  *
  *----------------------------------------------------------------------
  */
@@ -812,7 +812,7 @@ System_SetLDPath(const char *path,      // IN: UTF-8
       free(p);
    } else if (path) {
       /*
-       * Set LD_LIBRARY_PATH to the specified value. 
+       * Set LD_LIBRARY_PATH to the specified value.
        */
       System_SetEnv(TRUE, "LD_LIBRARY_PATH", (char *) path);
    } else {
@@ -840,7 +840,7 @@ System_SetLDPath(const char *path,      // IN: UTF-8
  *      whether the value was set in the native environment.  Based on this:
  *        VMWARE_FOO="1foo"               -> FOO="foo"
  *        VMWARE_FOO="1"                  -> FOO=""
- *        VMWARE_FOO="0 VMWARE_UNDEFINED" -> FOO is unset in the native environment
+ *        VMWARE_FOO="0"                  -> FOO is unset in the native environment
  *
  *      Variables without the VMWARE_ prefix are just copied over to the new
  *      environment.  Note, of course, that VMWARE_-prefixed variables take
@@ -977,7 +977,7 @@ SNEBuildHash(const char **compatEnviron)
           * XXX Should we move this marker to a separate header?
           */
          char *realKey = &key[prefixLength];
-         char *realValue = (strcmp(value, "0 VMWARE_UNDEFINED") == 0)
+         char *realValue = (value[0] == '0')
                            ? NULL
                            : Util_SafeStrdup(&value[1]);
          HashTable_ReplaceOrInsert(environTable, realKey, realValue);
index bedf82cab5ba9e2c5d04c4304a67336484a9080e..3482c648e5ff683fda4ce2ccd6b21e9224f75a97 100644 (file)
@@ -18,7 +18,6 @@
 noinst_LTLIBRARIES = libUser.la
 
 libUser_la_SOURCES =
-libUser_la_SOURCES += hostinfoPosix2.c
 libUser_la_SOURCES += util.c
 libUser_la_SOURCES += utilPosix.c
 
diff --git a/open-vm-tools/lib/user/hostinfoPosix2.c b/open-vm-tools/lib/user/hostinfoPosix2.c
deleted file mode 100644 (file)
index 4279598..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*********************************************************
- * Copyright (C) 1998 VMware, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*
- * hostinfoPosix.c --
- *
- *   Interface to host-specific information functions for Posix hosts
- *   
- *   I created this file for this only reason: the functions it contains should
- *   be callable by _any_ VMware userland program --hpreg
- *   
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/utsname.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <pwd.h>
-#include <sys/resource.h>
-#if defined(__APPLE__)
-#define SYS_NMLN _SYS_NAMELEN
-#include <assert.h>
-#include <CoreServices/CoreServices.h>
-#include <mach-o/dyld.h>
-#include <mach/host_info.h>
-#include <mach/mach_host.h>
-#include <mach/mach_init.h>
-#include <mach/mach.h>
-#include <mach/mach_time.h>
-#include <sys/sysctl.h>
-#elif defined(__FreeBSD__)
-#include <sys/sysctl.h>
-#if !defined(RLIMIT_AS)
-#  if defined(RLIMIT_VMEM)
-#     define RLIMIT_AS RLIMIT_VMEM
-#  else
-#     define RLIMIT_AS RLIMIT_RSS
-#  endif
-#endif
-#else
-#if !defined(USING_AUTOCONF) || defined(HAVE_SYS_VFS_H)
-#include <sys/vfs.h>
-#endif
-#if !defined(sun) && (!defined(USING_AUTOCONF) || (defined(HAVE_SYS_IO_H) && defined(HAVE_SYS_SYSINFO_H)))
-#include <sys/io.h>
-#include <sys/sysinfo.h>
-#ifndef HAVE_SYSINFO
-#define HAVE_SYSINFO 1
-#endif
-#endif
-#endif
-
-#if defined(__APPLE__) || defined(__FreeBSD__)
-#include <paths.h>
-#endif
-
-#if !defined(_PATH_DEVNULL)
-#define _PATH_DEVNULL "/dev/null"
-#endif
-
-#include "vmware.h"
-#include "hostType.h"
-#include "hostinfo.h"
-#include "vm_version.h"
-#include "str.h"
-#include "msg.h"
-#include "log.h"
-#include "posix.h"
-#include "file.h"
-#include "backdoor_def.h"
-#include "util.h"
-#include "vmstdio.h"
-#include "su.h"
-#include "vm_atomic.h"
-#include "x86cpuid.h"
-#include "syncMutex.h"
-#include "unicode.h"
-
-#ifdef VMX86_SERVER
-#include "uwvmkAPI.h"
-#include "uwvmk.h"
-#include "vmkSyscall.h"
-#endif
-
-#define LGPFX "HOSTINFO:"
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * Hostinfo_GetModulePath --
- *
- *     Retrieve the full path to the executable. Not supported under VMvisor.
- *
- *      Note: If your process is running with elevated privileges
- *      (setuid/setgid), treat the path returned by this function as
- *      untrusted (for example, do not pass it to exec or open).
- *
- *      This function returns a path that is under the control of the
- *      user.  An attacker could manipulate the path returned by this
- *      function to elevate privileges.
- *
- * Results:
- *      On success: The allocated, NUL-terminated file path.
- *         Note: This path can be a symbolic or hard link; it's just one
- *         possible path to access the executable.
- *
- *      On failure: NULL.
- *
- * Side effects:
- *     None
- *
- *-----------------------------------------------------------------------------
- */
-
-Unicode
-Hostinfo_GetModulePath(uint32 priv)  // IN:
-{
-   Unicode path;
-
-#if defined(__APPLE__)
-   uint32_t pathSize = FILE_MAXPATH;
-#else
-   uid_t uid = -1;
-#endif
-
-   if ((priv != HGMP_PRIVILEGE) && (priv != HGMP_NO_PRIVILEGE)) {
-      Warning("%s: invalid privilege parameter\n", __FUNCTION__);
-
-      return NULL;
-   }
-
-#if defined(__APPLE__)
-   path = Util_SafeMalloc(pathSize);
-   if (_NSGetExecutablePath(path, &pathSize)) {
-      Warning(LGPFX" %s: _NSGetExecutablePath failed.\n", __FUNCTION__);
-      free(path);
-
-      return NULL;
-   }
-
-#else
-#if defined(VMX86_SERVER)
-   if (HostType_OSIsVMK()) {
-      return NULL;
-   }
-#endif
-
-   // "/proc/self/exe" only exists on Linux 2.2+.
-   ASSERT(Hostinfo_OSVersion(0) >= 2 && Hostinfo_OSVersion(1) >= 2);
-
-   if (priv == HGMP_PRIVILEGE) {
-      uid = Id_BeginSuperUser();
-   }
-
-   path = Posix_ReadLink("/proc/self/exe");
-
-   if (priv == HGMP_PRIVILEGE) {
-      Id_EndSuperUser(uid);
-   }
-
-   if (path == NULL) {
-      Warning(LGPFX" %s: readlink failed: %s\n", __FUNCTION__,
-              Err_ErrString());
-   }
-#endif
-
-   return path;
-}