~ubuntu-branches/ubuntu/wily/easytag/wily

« back to all changes in this revision

Viewing changes to src/win32/win32dep.c

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2013-10-11 17:07:47 UTC
  • mto: (8.1.4 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20131011170747-uqvgtx7uyd046j7z
Tags: upstream-2.1.8
ImportĀ upstreamĀ versionĀ 2.1.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24
24
 *
25
25
 */
 
26
 
 
27
#include <winsock2.h>
26
28
#include <windows.h>
27
29
#include <io.h>
28
30
#include <stdlib.h>
60
62
typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR);
61
63
typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR);
62
64
 
63
 
// Defined also in "#include <shlobj.h>"
64
 
typedef enum
65
 
{
66
 
    SHGFP_TYPE_CURRENT  = 0,   // current value for user, verify it exists
67
 
    SHGFP_TYPE_DEFAULT  = 1,   // default value, may not exist
68
 
} SHGFP_TYPE;
69
 
 
70
65
/*
71
66
 * LOCALS
72
67
 */
75
70
 
76
71
static HINSTANCE libeasytagdll_hInstance = 0;
77
72
 
 
73
/* Prototypes. */
 
74
gboolean weasytag_read_reg_dword (HKEY rootkey, const char *subkey,
 
75
                                  const char *valname, LPDWORD result);
 
76
void str_replace_char (gchar *str, gchar in_char, gchar out_char);
78
77
 
79
78
 
80
79
/*
139
138
    }
140
139
        else {
141
140
        //Log_Print(_("Function '%s' not found in dll '%s'"), procedure, dllname);
142
 
        g_print(_("Function '%s' not found in dll '%s'"), procedure, dllname);
 
141
        g_print(_("Function '%s' not found in DLL '%s'"), procedure, dllname);
143
142
        g_print("\n");
144
143
                if(did_load) {
145
144
            /* unload dll */
274
273
 
275
274
        //ET_Win32_Path_Replace_Backslashes(app_data_dir);
276
275
 
277
 
        //Log_Print(_("EasyTAG settings dir: '%s'"), app_data_dir);
278
 
        g_print(_("EasyTAG settings dir: '%s'"), app_data_dir);
 
276
        //Log_Print(_("EasyTAG settings directory: '%s'"), app_data_dir);
 
277
        g_print(_("EasyTAG settings directory: '%s'"), app_data_dir);
279
278
        g_print("\n");
280
279
        }
281
280
 
463
462
void weasytag_init(void) {
464
463
    WORD wVersionRequested;
465
464
    WSADATA wsaData;
466
 
        char *newenv;
467
465
 
468
466
    //Log_Print(_("weasytag_init start..."));
469
467
    g_print(_("weasytag_init start..."));
472
470
    //g_print(_("EasyTAG version: %s"),VERSION);
473
471
    //g_print("\n");
474
472
 
475
 
        g_print(_("Glib version: %u.%u.%u\n"),glib_major_version, glib_minor_version, glib_micro_version);
 
473
        g_print(_("GLib version: %u.%u.%u\n"),glib_major_version, glib_minor_version, glib_micro_version);
476
474
 
477
475
    /* Winsock init */
478
476
    wVersionRequested = MAKEWORD( 2, 2 );
520
518
 
521
519
 
522
520
/* this is used by libmp4v2 : what is it doing here you think ? well...search! */
523
 
int gettimeofday (struct timeval *t, void *foo)
 
521
gint
 
522
gettimeofday (struct timeval *t, void *foo)
524
523
{
525
524
    struct _timeb temp;
526
525
 
534
533
 
535
534
 
536
535
/* emulate the unix function */
537
 
int mkstemp (char *template)
 
536
gint
 
537
et_w32_mkstemp (gchar *template)
538
538
{
539
539
    int fd = -1;
540
540
 
547
547
    return fd;
548
548
}
549
549
 
550
 
void str_replace_char (gchar *str, gchar in_char, gchar out_char)
 
550
void
 
551
str_replace_char (gchar *str, gchar in_char, gchar out_char)
551
552
{
552
553
    while(*str)
553
554
    {
617
618
    return player;
618
619
}
619
620
 
620
 
 
 
621
gint
 
622
et_w32_truncate (const gchar *path, off_t length)
 
623
{
 
624
    HANDLE h;
 
625
    gint ret;
 
626
 
 
627
    h = CreateFile (path, GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
 
628
 
 
629
    if (h == INVALID_HANDLE_VALUE)
 
630
    {
 
631
        /* errno = map_errno (GetLastError ()); */
 
632
        return -1;
 
633
    }
 
634
 
 
635
    ret = chsize ((gint)h, length);
 
636
    CloseHandle (h);
 
637
 
 
638
    return ret;
 
639
}
 
640
 
 
641
gint
 
642
et_w32_ftruncate (gint fd, off_t length)
 
643
{
 
644
    HANDLE h;
 
645
 
 
646
    h = (HANDLE)_get_osfhandle (fd);
 
647
 
 
648
    if (h == (HANDLE) - 1) return -1;
 
649
 
 
650
    return chsize ((gint)h, length);
 
651
}