Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/PC/winsound.c

    r2 r388  
    7979
    8080    if(!PyArg_ParseTuple(args,"z#i:PlaySound",&sound,&length,&flags)) {
    81         return NULL;
     81    return NULL;
    8282    }
    8383
    8484    if(flags&SND_ASYNC && flags &SND_MEMORY) {
    85         /* Sidestep reference counting headache; unfortunately this also
    86            prevent SND_LOOP from memory. */
    87         PyErr_SetString(PyExc_RuntimeError,"Cannot play asynchronously from memory");
    88         return NULL;
     85    /* Sidestep reference counting headache; unfortunately this also
     86       prevent SND_LOOP from memory. */
     87    PyErr_SetString(PyExc_RuntimeError,"Cannot play asynchronously from memory");
     88    return NULL;
    8989    }
    9090
     
    9494    if(!ok)
    9595    {
    96         PyErr_SetString(PyExc_RuntimeError,"Failed to play sound");
    97         return NULL;
     96    PyErr_SetString(PyExc_RuntimeError,"Failed to play sound");
     97    return NULL;
    9898    }
    9999
     
    105105sound_beep(PyObject *self, PyObject *args)
    106106{
    107         int freq;
    108         int dur;
    109         BOOL ok;
     107    int freq;
     108    int dur;
     109    BOOL ok;
    110110
    111         if (!PyArg_ParseTuple(args, "ii:Beep", &freq,  &dur))
    112                 return NULL;
     111    if (!PyArg_ParseTuple(args, "ii:Beep", &freq,  &dur))
     112        return NULL;
    113113
    114         if (freq < 37 || freq > 32767) {
    115                 PyErr_SetString(PyExc_ValueError,
    116                                 "frequency must be in 37 thru 32767");
    117                 return NULL;
    118         }
     114    if (freq < 37 || freq > 32767) {
     115        PyErr_SetString(PyExc_ValueError,
     116                        "frequency must be in 37 thru 32767");
     117        return NULL;
     118    }
    119119
    120         Py_BEGIN_ALLOW_THREADS
    121         ok = Beep(freq, dur);
    122         Py_END_ALLOW_THREADS
    123         if (!ok) {
    124                 PyErr_SetString(PyExc_RuntimeError,"Failed to beep");
    125                 return NULL;
    126         }
     120    Py_BEGIN_ALLOW_THREADS
     121    ok = Beep(freq, dur);
     122    Py_END_ALLOW_THREADS
     123    if (!ok) {
     124        PyErr_SetString(PyExc_RuntimeError,"Failed to beep");
     125        return NULL;
     126    }
    127127
    128         Py_INCREF(Py_None);
    129         return Py_None;
     128    Py_INCREF(Py_None);
     129    return Py_None;
    130130}
    131131
     
    133133sound_msgbeep(PyObject *self, PyObject *args)
    134134{
    135         int x = MB_OK;
    136         if (!PyArg_ParseTuple(args, "|i:MessageBeep", &x))
    137                 return NULL;
    138         MessageBeep(x);
    139         Py_INCREF(Py_None);
    140         return Py_None;
     135    int x = MB_OK;
     136    if (!PyArg_ParseTuple(args, "|i:MessageBeep", &x))
     137        return NULL;
     138    MessageBeep(x);
     139    Py_INCREF(Py_None);
     140    return Py_None;
    141141}
    142142
     
    156156    if(v&&k)
    157157    {
    158         PyDict_SetItem(dict,k,v);
     158    PyDict_SetItem(dict,k,v);
    159159    }
    160160    Py_XDECREF(k);
     
    167167initwinsound(void)
    168168{
    169         PyObject *dict;
    170         PyObject *module = Py_InitModule3("winsound",
    171                                           sound_methods,
    172                                           sound_module_doc);
    173         if (module == NULL)
    174                 return;
    175         dict = PyModule_GetDict(module);
     169    PyObject *dict;
     170    PyObject *module = Py_InitModule3("winsound",
     171                                      sound_methods,
     172                                      sound_module_doc);
     173    if (module == NULL)
     174        return;
     175    dict = PyModule_GetDict(module);
    176176
    177         ADD_DEFINE(SND_ASYNC);
    178         ADD_DEFINE(SND_NODEFAULT);
    179         ADD_DEFINE(SND_NOSTOP);
    180         ADD_DEFINE(SND_NOWAIT);
    181         ADD_DEFINE(SND_ALIAS);
    182         ADD_DEFINE(SND_FILENAME);
    183         ADD_DEFINE(SND_MEMORY);
    184         ADD_DEFINE(SND_PURGE);
    185         ADD_DEFINE(SND_LOOP);
    186         ADD_DEFINE(SND_APPLICATION);
     177    ADD_DEFINE(SND_ASYNC);
     178    ADD_DEFINE(SND_NODEFAULT);
     179    ADD_DEFINE(SND_NOSTOP);
     180    ADD_DEFINE(SND_NOWAIT);
     181    ADD_DEFINE(SND_ALIAS);
     182    ADD_DEFINE(SND_FILENAME);
     183    ADD_DEFINE(SND_MEMORY);
     184    ADD_DEFINE(SND_PURGE);
     185    ADD_DEFINE(SND_LOOP);
     186    ADD_DEFINE(SND_APPLICATION);
    187187
    188         ADD_DEFINE(MB_OK);
    189         ADD_DEFINE(MB_ICONASTERISK);
    190         ADD_DEFINE(MB_ICONEXCLAMATION);
    191         ADD_DEFINE(MB_ICONHAND);
    192         ADD_DEFINE(MB_ICONQUESTION);
     188    ADD_DEFINE(MB_OK);
     189    ADD_DEFINE(MB_ICONASTERISK);
     190    ADD_DEFINE(MB_ICONEXCLAMATION);
     191    ADD_DEFINE(MB_ICONHAND);
     192    ADD_DEFINE(MB_ICONQUESTION);
    193193}
Note: See TracChangeset for help on using the changeset viewer.