~ubuntu-branches/ubuntu/utopic/golang/utopic

« back to all changes in this revision

Viewing changes to src/pkg/mime/type_windows.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
func initMime() {
13
13
        var root syscall.Handle
14
 
        if syscall.RegOpenKeyEx(syscall.HKEY_CLASSES_ROOT, syscall.StringToUTF16Ptr(`\`),
 
14
        rootpathp, _ := syscall.UTF16PtrFromString(`\`)
 
15
        if syscall.RegOpenKeyEx(syscall.HKEY_CLASSES_ROOT, rootpathp,
15
16
                0, syscall.KEY_READ, &root) != nil {
16
17
                return
17
18
        }
31
32
                        continue
32
33
                }
33
34
                var h syscall.Handle
 
35
                extpathp, _ := syscall.UTF16PtrFromString(`\` + ext)
34
36
                if syscall.RegOpenKeyEx(
35
 
                        syscall.HKEY_CLASSES_ROOT, syscall.StringToUTF16Ptr(`\`+ext),
 
37
                        syscall.HKEY_CLASSES_ROOT, extpathp,
36
38
                        0, syscall.KEY_READ, &h) != nil {
37
39
                        continue
38
40
                }
39
41
                var typ uint32
40
42
                n = uint32(len(buf) * 2) // api expects array of bytes, not uint16
 
43
                contenttypep, _ := syscall.UTF16PtrFromString("Content Type")
41
44
                if syscall.RegQueryValueEx(
42
 
                        h, syscall.StringToUTF16Ptr("Content Type"),
 
45
                        h, contenttypep,
43
46
                        nil, &typ, (*byte)(unsafe.Pointer(&buf[0])), &n) != nil {
44
47
                        syscall.RegCloseKey(h)
45
48
                        continue
55
58
 
56
59
func initMimeForTests() map[string]string {
57
60
        return map[string]string{
58
 
                ".bmp": "image/bmp",
59
61
                ".png": "image/png",
60
62
        }
61
63
}