Mercurial > vim
comparison src/if_py_both.h @ 15472:0fcc1315c061 v8.1.0744
patch 8.1.0744: compiler warnings for signed/unsigned strings
commit https://github.com/vim/vim/commit/b1443b480fe9965a6eaa9211657d299e88964084
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:51:14 2019 +0100
patch 8.1.0744: compiler warnings for signed/unsigned strings
Problem: Compiler warnings for signed/unsigned strings.
Solution: A few more type cast fixes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Jan 2019 00:00:04 +0100 |
parents | 55ccc2d353bd |
children | dd725a8ab112 |
comparison
equal
deleted
inserted
replaced
15471:c3aa513f6b0b | 15472:0fcc1315c061 |
---|---|
408 io_ga.ga_len += (int)n; | 408 io_ga.ga_len += (int)n; |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 static int | 412 static int |
413 msg_wrapper(char *text) | |
414 { | |
415 return msg((char_u *)text); | |
416 } | |
417 | |
418 static int | |
413 write_output(OutputObject *self, PyObject *string) | 419 write_output(OutputObject *self, PyObject *string) |
414 { | 420 { |
415 Py_ssize_t len = 0; | 421 Py_ssize_t len = 0; |
416 char *str = NULL; | 422 char *str = NULL; |
417 int error = self->error; | 423 int error = self->error; |
419 if (!PyArg_Parse(string, "et#", ENC_OPT, &str, &len)) | 425 if (!PyArg_Parse(string, "et#", ENC_OPT, &str, &len)) |
420 return -1; | 426 return -1; |
421 | 427 |
422 Py_BEGIN_ALLOW_THREADS | 428 Py_BEGIN_ALLOW_THREADS |
423 Python_Lock_Vim(); | 429 Python_Lock_Vim(); |
424 writer((writefn)(error ? emsg : msg), (char_u *)str, len); | 430 writer((writefn)(error ? emsg : msg_wrapper), (char_u *)str, len); |
425 Python_Release_Vim(); | 431 Python_Release_Vim(); |
426 Py_END_ALLOW_THREADS | 432 Py_END_ALLOW_THREADS |
427 PyMem_Free(str); | 433 PyMem_Free(str); |
428 | 434 |
429 return 0; | 435 return 0; |
632 return -1; | 638 return -1; |
633 } | 639 } |
634 else if (msg_list != NULL && *msg_list != NULL) | 640 else if (msg_list != NULL && *msg_list != NULL) |
635 { | 641 { |
636 int should_free; | 642 int should_free; |
637 char_u *msg; | 643 char *msg; |
638 | 644 |
639 msg = get_exception_string(*msg_list, ET_ERROR, NULL, &should_free); | 645 msg = get_exception_string(*msg_list, ET_ERROR, NULL, &should_free); |
640 | 646 |
641 if (msg == NULL) | 647 if (msg == NULL) |
642 { | 648 { |
643 PyErr_NoMemory(); | 649 PyErr_NoMemory(); |
644 return -1; | 650 return -1; |
645 } | 651 } |
646 | 652 |
647 PyErr_SetVim((char *) msg); | 653 PyErr_SetVim(msg); |
648 | 654 |
649 free_global_msglist(); | 655 free_global_msglist(); |
650 | 656 |
651 if (should_free) | 657 if (should_free) |
652 vim_free(msg); | 658 vim_free(msg); |
3481 } | 3487 } |
3482 | 3488 |
3483 static int | 3489 static int |
3484 set_option_value_err(char_u *key, int numval, char_u *stringval, int opt_flags) | 3490 set_option_value_err(char_u *key, int numval, char_u *stringval, int opt_flags) |
3485 { | 3491 { |
3486 char_u *errmsg; | 3492 char *errmsg; |
3487 | 3493 |
3488 if ((errmsg = set_option_value(key, numval, stringval, opt_flags))) | 3494 if ((errmsg = set_option_value(key, numval, stringval, opt_flags))) |
3489 { | 3495 { |
3490 if (VimTryEnd()) | 3496 if (VimTryEnd()) |
3491 return FAIL; | 3497 return FAIL; |
3492 PyErr_SetVim((char *)errmsg); | 3498 PyErr_SetVim(errmsg); |
3493 return FAIL; | 3499 return FAIL; |
3494 } | 3500 } |
3495 return OK; | 3501 return OK; |
3496 } | 3502 } |
3497 | 3503 |