~ubuntu-branches/ubuntu/saucy/orbit2/saucy

« back to all changes in this revision

Viewing changes to src/orb/orb-core/corba-orb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-03-06 18:40:04 UTC
  • mfrom: (1.2.17 upstream) (7.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090306184004-pbuwp3a2d69aubkn
Tags: 1:2.14.17-0.1
* Non-maintainer upload.
* New upstream bugfix release. No API changes.
* Update Standards-Version to 3.8.0, no additional changes needed.
* Build depend on autotools-dev to get config.{sub,guess} updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
OrbitDebugFlags _orbit_debug_flags = ORBIT_DEBUG_NONE;
24
24
#endif
25
25
 
26
 
#ifdef G_OS_WIN32
27
 
/* Silence gcc warning about no prototype */
28
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL,
29
 
                     DWORD     fdwReason,
30
 
                     LPVOID    lpvReserved);
31
 
#endif
32
 
 
33
26
/*
34
27
 * Command line option handling.
35
28
 */
56
49
static char        *orbit_net_id             = NULL;
57
50
static gboolean     orbit_use_http_iors      = FALSE;
58
51
static char        *orbit_ipsock             = NULL;
59
 
static char        *orbit_ipname             = NULL;
 
52
static const char  *orbit_ipname             = NULL;
60
53
static char        *orbit_debug_options      = NULL;
61
54
static char        *orbit_naming_ref         = NULL;
62
55
static GSList      *orbit_initref_list       = NULL; 
1481
1474
 
1482
1475
#ifdef G_OS_WIN32
1483
1476
 
1484
 
const gchar *ORBit_win32_typelib_dir;
1485
 
const gchar *ORBit_win32_system_rcfile;
1486
 
 
1487
 
/* DllMain function needed to fetch the DLL name and deduce the
1488
 
 * installation directory from that, and then form the pathnames for
1489
 
 * the typelib directory and system orbitrc file.
1490
 
 */
 
1477
/* DllMain function used to store the DLL handle */
 
1478
static HMODULE hmodule;
 
1479
G_LOCK_DEFINE_STATIC (mutex);
 
1480
 
 
1481
/* Silence gcc warnings about no prototype */
 
1482
BOOL WINAPI DllMain (HINSTANCE hinstDLL,
 
1483
                     DWORD     fdwReason,
 
1484
                     LPVOID    lpvReserved);
 
1485
const gchar *ORBit_win32_get_typelib_dir (void);
 
1486
const gchar *ORBit_win32_get_system_rcfile (void);
 
1487
 
1491
1488
BOOL WINAPI
1492
1489
DllMain (HINSTANCE hinstDLL,
1493
1490
         DWORD     fdwReason,
1494
1491
         LPVOID    lpvReserved)
1495
1492
{
1496
 
  wchar_t wcbfr[1000];
1497
 
  char cpbfr[1000];
1498
 
  char *dll_name = NULL;
1499
 
  gchar *prefix;
1500
 
  
1501
 
  switch (fdwReason) {
1502
 
  case DLL_PROCESS_ATTACH:
1503
 
          /* GLib 2.6 uses UTF-8 file names */
1504
 
          if (GetVersion () < 0x80000000) {
1505
 
                  /* NT-based Windows has wide char API */
1506
 
                  if (GetModuleFileNameW ((HMODULE) hinstDLL,
1507
 
                                          wcbfr, G_N_ELEMENTS (wcbfr)))
1508
 
                          dll_name = g_utf16_to_utf8 (wcbfr, -1,
1509
 
                                                      NULL, NULL, NULL);
1510
 
          } else {
1511
 
                  /* Win9x, yecch */
1512
 
                  if (GetModuleFileNameA ((HMODULE) hinstDLL,
1513
 
                                          cpbfr, G_N_ELEMENTS (cpbfr)))
1514
 
                          dll_name = g_locale_to_utf8 (cpbfr, -1,
1515
 
                                                       NULL, NULL, NULL);
1516
 
          }
1517
 
 
1518
 
          if (dll_name) {
1519
 
                  gchar *p = strrchr (dll_name, '\\');
1520
 
                  
1521
 
                  if (p != NULL)
1522
 
                          *p = '\0';
1523
 
 
1524
 
                  p = strrchr (dll_name, '\\');
1525
 
                  if (p && (g_ascii_strcasecmp (p + 1, "bin") == 0))
1526
 
                          *p = '\0';
1527
 
                  
1528
 
                  prefix = dll_name;
1529
 
          } else {
1530
 
                  prefix = g_strdup ("");
1531
 
          }
1532
 
 
1533
 
          ORBit_win32_typelib_dir = g_strconcat (prefix,
1534
 
                                                 "\\lib\\orbit-2.0",
1535
 
                                                 NULL);
1536
 
          ORBit_win32_system_rcfile = g_strconcat (prefix,
1537
 
                                                   "\\etc\\orbitrc",
1538
 
                                                   NULL);
1539
 
          g_free (prefix);
1540
 
          break;
1541
 
  }
1542
 
 
1543
 
  return TRUE;
 
1493
        switch (fdwReason) {
 
1494
        case DLL_PROCESS_ATTACH:
 
1495
                hmodule = hinstDLL;
 
1496
                break;
 
1497
        }
 
1498
        return TRUE;
 
1499
}
 
1500
 
 
1501
static const char *typelib_dir = NULL;
 
1502
static const char *system_rcfile = NULL;
 
1503
 
 
1504
static void
 
1505
setup (void)
 
1506
{
 
1507
        gchar *prefix;
 
1508
 
 
1509
        G_LOCK (mutex);
 
1510
        if (typelib_dir != NULL) {
 
1511
                G_UNLOCK (mutex);
 
1512
                return;
 
1513
        }
 
1514
 
 
1515
        prefix = g_win32_get_package_installation_directory_of_module (hmodule);
 
1516
 
 
1517
        if (prefix == NULL) {
 
1518
                /* Just to not crash... */
 
1519
                prefix = g_strdup ("");
 
1520
        }
 
1521
 
 
1522
        typelib_dir = g_strconcat (prefix,
 
1523
                                   "\\lib\\orbit-2.0",
 
1524
                                   NULL);
 
1525
 
 
1526
        system_rcfile = g_strconcat (prefix,
 
1527
                                     "\\etc\\orbitrc",
 
1528
                                     NULL);
 
1529
        G_UNLOCK (mutex);
 
1530
 
 
1531
        g_free (prefix);
 
1532
}
 
1533
 
 
1534
const gchar *
 
1535
ORBit_win32_get_typelib_dir (void)
 
1536
{
 
1537
        setup ();
 
1538
        return typelib_dir;
 
1539
}
 
1540
 
 
1541
const gchar *
 
1542
ORBit_win32_get_system_rcfile (void)
 
1543
{
 
1544
        setup ();
 
1545
        return system_rcfile;
1544
1546
}
1545
1547
 
1546
1548
#endif