Mercurial > vim
comparison src/eval.c @ 835:8bebcabccc2c v7.0e01
updated for version 7.0e01
author | vimboss |
---|---|
date | Mon, 17 Apr 2006 22:14:47 +0000 |
parents | 52d17d53b555 |
children | 8e5830943bff |
comparison
equal
deleted
inserted
replaced
834:5117153003bd | 835:8bebcabccc2c |
---|---|
1911 { | 1911 { |
1912 hashitem_T *hi; | 1912 hashitem_T *hi; |
1913 dictitem_T *di; | 1913 dictitem_T *di; |
1914 int todo; | 1914 int todo; |
1915 | 1915 |
1916 todo = ht->ht_used; | 1916 todo = (int)ht->ht_used; |
1917 for (hi = ht->ht_array; todo > 0 && !got_int; ++hi) | 1917 for (hi = ht->ht_array; todo > 0 && !got_int; ++hi) |
1918 { | 1918 { |
1919 if (!HASHITEM_EMPTY(hi)) | 1919 if (!HASHITEM_EMPTY(hi)) |
1920 { | 1920 { |
1921 --todo; | 1921 --todo; |
2664 if (op != NULL && *op != '=') | 2664 if (op != NULL && *op != '=') |
2665 { | 2665 { |
2666 typval_T tv; | 2666 typval_T tv; |
2667 | 2667 |
2668 /* handle +=, -= and .= */ | 2668 /* handle +=, -= and .= */ |
2669 if (get_var_tv(lp->ll_name, STRLEN(lp->ll_name), | 2669 if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name), |
2670 &tv, TRUE) == OK) | 2670 &tv, TRUE) == OK) |
2671 { | 2671 { |
2672 if (tv_op(&tv, rettv, op) == OK) | 2672 if (tv_op(&tv, rettv, op) == OK) |
2673 set_var(lp->ll_name, &tv, FALSE); | 2673 set_var(lp->ll_name, &tv, FALSE); |
2674 clear_tv(&tv); | 2674 clear_tv(&tv); |
3127 * the arguments. */ | 3127 * the arguments. */ |
3128 if (fudi.fd_dict != NULL) | 3128 if (fudi.fd_dict != NULL) |
3129 ++fudi.fd_dict->dv_refcount; | 3129 ++fudi.fd_dict->dv_refcount; |
3130 | 3130 |
3131 /* If it is the name of a variable of type VAR_FUNC use its contents. */ | 3131 /* If it is the name of a variable of type VAR_FUNC use its contents. */ |
3132 len = STRLEN(tofree); | 3132 len = (int)STRLEN(tofree); |
3133 name = deref_func_name(tofree, &len); | 3133 name = deref_func_name(tofree, &len); |
3134 | 3134 |
3135 /* Skip white space to allow ":call func ()". Not good, but required for | 3135 /* Skip white space to allow ":call func ()". Not good, but required for |
3136 * backward compatibility. */ | 3136 * backward compatibility. */ |
3137 startarg = skipwhite(arg); | 3137 startarg = skipwhite(arg); |
3162 { | 3162 { |
3163 curwin->w_cursor.lnum = lnum; | 3163 curwin->w_cursor.lnum = lnum; |
3164 curwin->w_cursor.col = 0; | 3164 curwin->w_cursor.col = 0; |
3165 } | 3165 } |
3166 arg = startarg; | 3166 arg = startarg; |
3167 if (get_func_tv(name, STRLEN(name), &rettv, &arg, | 3167 if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg, |
3168 eap->line1, eap->line2, &doesrange, | 3168 eap->line1, eap->line2, &doesrange, |
3169 !eap->skip, fudi.fd_dict) == FAIL) | 3169 !eap->skip, fudi.fd_dict) == FAIL) |
3170 { | 3170 { |
3171 failed = TRUE; | 3171 failed = TRUE; |
3172 break; | 3172 break; |
3489 else | 3489 else |
3490 d->dv_lock &= ~VAR_LOCKED; | 3490 d->dv_lock &= ~VAR_LOCKED; |
3491 if (deep < 0 || deep > 1) | 3491 if (deep < 0 || deep > 1) |
3492 { | 3492 { |
3493 /* recursive: lock/unlock the items the List contains */ | 3493 /* recursive: lock/unlock the items the List contains */ |
3494 todo = d->dv_hashtab.ht_used; | 3494 todo = (int)d->dv_hashtab.ht_used; |
3495 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) | 3495 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
3496 { | 3496 { |
3497 if (!HASHITEM_EMPTY(hi)) | 3497 if (!HASHITEM_EMPTY(hi)) |
3498 { | 3498 { |
3499 --todo; | 3499 --todo; |
3532 { | 3532 { |
3533 hashitem_T *hi; | 3533 hashitem_T *hi; |
3534 int todo; | 3534 int todo; |
3535 | 3535 |
3536 hash_lock(&globvarht); | 3536 hash_lock(&globvarht); |
3537 todo = globvarht.ht_used; | 3537 todo = (int)globvarht.ht_used; |
3538 for (hi = globvarht.ht_array; todo > 0 && !got_int; ++hi) | 3538 for (hi = globvarht.ht_array; todo > 0 && !got_int; ++hi) |
3539 { | 3539 { |
3540 if (!HASHITEM_EMPTY(hi)) | 3540 if (!HASHITEM_EMPTY(hi)) |
3541 { | 3541 { |
3542 --todo; | 3542 --todo; |
5478 int todo; | 5478 int todo; |
5479 | 5479 |
5480 if (dict_len(d1) != dict_len(d2)) | 5480 if (dict_len(d1) != dict_len(d2)) |
5481 return FALSE; | 5481 return FALSE; |
5482 | 5482 |
5483 todo = d1->dv_hashtab.ht_used; | 5483 todo = (int)d1->dv_hashtab.ht_used; |
5484 for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) | 5484 for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi) |
5485 { | 5485 { |
5486 if (!HASHITEM_EMPTY(hi)) | 5486 if (!HASHITEM_EMPTY(hi)) |
5487 { | 5487 { |
5488 item2 = dict_find(d2, hi->hi_key, -1); | 5488 item2 = dict_find(d2, hi->hi_key, -1); |
6128 int copyID; | 6128 int copyID; |
6129 { | 6129 { |
6130 int todo; | 6130 int todo; |
6131 hashitem_T *hi; | 6131 hashitem_T *hi; |
6132 | 6132 |
6133 todo = ht->ht_used; | 6133 todo = (int)ht->ht_used; |
6134 for (hi = ht->ht_array; todo > 0; ++hi) | 6134 for (hi = ht->ht_array; todo > 0; ++hi) |
6135 if (!HASHITEM_EMPTY(hi)) | 6135 if (!HASHITEM_EMPTY(hi)) |
6136 { | 6136 { |
6137 --todo; | 6137 --todo; |
6138 set_ref_in_item(&HI2DI(hi)->di_tv, copyID); | 6138 set_ref_in_item(&HI2DI(hi)->di_tv, copyID); |
6249 if (d->dv_used_next != NULL) | 6249 if (d->dv_used_next != NULL) |
6250 d->dv_used_next->dv_used_prev = d->dv_used_prev; | 6250 d->dv_used_next->dv_used_prev = d->dv_used_prev; |
6251 | 6251 |
6252 /* Lock the hashtab, we don't want it to resize while freeing items. */ | 6252 /* Lock the hashtab, we don't want it to resize while freeing items. */ |
6253 hash_lock(&d->dv_hashtab); | 6253 hash_lock(&d->dv_hashtab); |
6254 todo = d->dv_hashtab.ht_used; | 6254 todo = (int)d->dv_hashtab.ht_used; |
6255 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) | 6255 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
6256 { | 6256 { |
6257 if (!HASHITEM_EMPTY(hi)) | 6257 if (!HASHITEM_EMPTY(hi)) |
6258 { | 6258 { |
6259 /* Remove the item before deleting it, just in case there is | 6259 /* Remove the item before deleting it, just in case there is |
6278 dictitem_alloc(key) | 6278 dictitem_alloc(key) |
6279 char_u *key; | 6279 char_u *key; |
6280 { | 6280 { |
6281 dictitem_T *di; | 6281 dictitem_T *di; |
6282 | 6282 |
6283 di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(key)); | 6283 di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key))); |
6284 if (di != NULL) | 6284 if (di != NULL) |
6285 { | 6285 { |
6286 STRCPY(di->di_key, key); | 6286 STRCPY(di->di_key, key); |
6287 di->di_flags = 0; | 6287 di->di_flags = 0; |
6288 } | 6288 } |
6296 dictitem_copy(org) | 6296 dictitem_copy(org) |
6297 dictitem_T *org; | 6297 dictitem_T *org; |
6298 { | 6298 { |
6299 dictitem_T *di; | 6299 dictitem_T *di; |
6300 | 6300 |
6301 di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(org->di_key)); | 6301 di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) |
6302 + STRLEN(org->di_key))); | |
6302 if (di != NULL) | 6303 if (di != NULL) |
6303 { | 6304 { |
6304 STRCPY(di->di_key, org->di_key); | 6305 STRCPY(di->di_key, org->di_key); |
6305 di->di_flags = 0; | 6306 di->di_flags = 0; |
6306 copy_tv(&org->di_tv, &di->di_tv); | 6307 copy_tv(&org->di_tv, &di->di_tv); |
6363 if (copyID != 0) | 6364 if (copyID != 0) |
6364 { | 6365 { |
6365 orig->dv_copyID = copyID; | 6366 orig->dv_copyID = copyID; |
6366 orig->dv_copydict = copy; | 6367 orig->dv_copydict = copy; |
6367 } | 6368 } |
6368 todo = orig->dv_hashtab.ht_used; | 6369 todo = (int)orig->dv_hashtab.ht_used; |
6369 for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) | 6370 for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) |
6370 { | 6371 { |
6371 if (!HASHITEM_EMPTY(hi)) | 6372 if (!HASHITEM_EMPTY(hi)) |
6372 { | 6373 { |
6373 --todo; | 6374 --todo; |
6460 dict_len(d) | 6461 dict_len(d) |
6461 dict_T *d; | 6462 dict_T *d; |
6462 { | 6463 { |
6463 if (d == NULL) | 6464 if (d == NULL) |
6464 return 0L; | 6465 return 0L; |
6465 return d->dv_hashtab.ht_used; | 6466 return (long)d->dv_hashtab.ht_used; |
6466 } | 6467 } |
6467 | 6468 |
6468 /* | 6469 /* |
6469 * Find item "key[len]" in Dictionary "d". | 6470 * Find item "key[len]" in Dictionary "d". |
6470 * If "len" is negative use strlen(key). | 6471 * If "len" is negative use strlen(key). |
6565 if ((d = tv->vval.v_dict) == NULL) | 6566 if ((d = tv->vval.v_dict) == NULL) |
6566 return NULL; | 6567 return NULL; |
6567 ga_init2(&ga, (int)sizeof(char), 80); | 6568 ga_init2(&ga, (int)sizeof(char), 80); |
6568 ga_append(&ga, '{'); | 6569 ga_append(&ga, '{'); |
6569 | 6570 |
6570 todo = d->dv_hashtab.ht_used; | 6571 todo = (int)d->dv_hashtab.ht_used; |
6571 for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) | 6572 for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) |
6572 { | 6573 { |
6573 if (!HASHITEM_EMPTY(hi)) | 6574 if (!HASHITEM_EMPTY(hi)) |
6574 { | 6575 { |
6575 --todo; | 6576 --todo; |
6857 char_u *p, *r, *s; | 6858 char_u *p, *r, *s; |
6858 | 6859 |
6859 len = (function ? 13 : 3); | 6860 len = (function ? 13 : 3); |
6860 if (str != NULL) | 6861 if (str != NULL) |
6861 { | 6862 { |
6862 len += STRLEN(str); | 6863 len += (unsigned)STRLEN(str); |
6863 for (p = str; *p != NUL; mb_ptr_adv(p)) | 6864 for (p = str; *p != NUL; mb_ptr_adv(p)) |
6864 if (*p == '\'') | 6865 if (*p == '\'') |
6865 ++len; | 6866 ++len; |
6866 } | 6867 } |
6867 s = r = alloc(len); | 6868 s = r = alloc(len); |
7289 if (v->di_tv.vval.v_string == NULL) | 7290 if (v->di_tv.vval.v_string == NULL) |
7290 { | 7291 { |
7291 *lenp = 0; | 7292 *lenp = 0; |
7292 return (char_u *)""; /* just in case */ | 7293 return (char_u *)""; /* just in case */ |
7293 } | 7294 } |
7294 *lenp = STRLEN(v->di_tv.vval.v_string); | 7295 *lenp = (int)STRLEN(v->di_tv.vval.v_string); |
7295 return v->di_tv.vval.v_string; | 7296 return v->di_tv.vval.v_string; |
7296 } | 7297 } |
7297 | 7298 |
7298 return name; | 7299 return name; |
7299 } | 7300 } |
7552 if (!aborting()) | 7553 if (!aborting()) |
7553 { | 7554 { |
7554 switch (error) | 7555 switch (error) |
7555 { | 7556 { |
7556 case ERROR_UNKNOWN: | 7557 case ERROR_UNKNOWN: |
7557 emsg_funcname("E117: Unknown function: %s", name); | 7558 emsg_funcname(N_("E117: Unknown function: %s"), name); |
7558 break; | 7559 break; |
7559 case ERROR_TOOMANY: | 7560 case ERROR_TOOMANY: |
7560 emsg_funcname(e_toomanyarg, name); | 7561 emsg_funcname(e_toomanyarg, name); |
7561 break; | 7562 break; |
7562 case ERROR_TOOFEW: | 7563 case ERROR_TOOFEW: |
7563 emsg_funcname("E119: Not enough arguments for function: %s", | 7564 emsg_funcname(N_("E119: Not enough arguments for function: %s"), |
7564 name); | 7565 name); |
7565 break; | 7566 break; |
7566 case ERROR_SCRIPT: | 7567 case ERROR_SCRIPT: |
7567 emsg_funcname("E120: Using <SID> not in a script context: %s", | 7568 emsg_funcname(N_("E120: Using <SID> not in a script context: %s"), |
7568 name); | 7569 name); |
7569 break; | 7570 break; |
7570 case ERROR_DICT: | 7571 case ERROR_DICT: |
7571 emsg_funcname("E725: Calling dict function without Dictionary: %s", | 7572 emsg_funcname(N_("E725: Calling dict function without Dictionary: %s"), |
7572 name); | 7573 name); |
7573 break; | 7574 break; |
7574 } | 7575 } |
7575 } | 7576 } |
7576 | 7577 |
8045 { | 8046 { |
8046 if (*t == NUL) /* EOL reached */ | 8047 if (*t == NUL) /* EOL reached */ |
8047 return; | 8048 return; |
8048 t += (*mb_ptr2len)(t); | 8049 t += (*mb_ptr2len)(t); |
8049 } | 8050 } |
8050 rettv->vval.v_number = t - str; | 8051 rettv->vval.v_number = (varnumber_T)(t - str); |
8051 #else | 8052 #else |
8052 if (idx <= STRLEN(str)) | 8053 if (idx <= STRLEN(str)) |
8053 rettv->vval.v_number = idx; | 8054 rettv->vval.v_number = idx; |
8054 #endif | 8055 #endif |
8055 } | 8056 } |
8108 */ | 8109 */ |
8109 copy_tv(&item->li_tv, &argv[argc++]); | 8110 copy_tv(&item->li_tv, &argv[argc++]); |
8110 } | 8111 } |
8111 | 8112 |
8112 if (item == NULL) | 8113 if (item == NULL) |
8113 (void)call_func(func, STRLEN(func), rettv, argc, argv, | 8114 (void)call_func(func, (int)STRLEN(func), rettv, argc, argv, |
8114 curwin->w_cursor.lnum, curwin->w_cursor.lnum, | 8115 curwin->w_cursor.lnum, curwin->w_cursor.lnum, |
8115 &dummy, TRUE, selfdict); | 8116 &dummy, TRUE, selfdict); |
8116 | 8117 |
8117 /* Free the arguments. */ | 8118 /* Free the arguments. */ |
8118 while (argc > 0) | 8119 while (argc > 0) |
8189 { | 8190 { |
8190 if (fp->col == MAXCOL) | 8191 if (fp->col == MAXCOL) |
8191 { | 8192 { |
8192 /* '> can be MAXCOL, get the length of the line then */ | 8193 /* '> can be MAXCOL, get the length of the line then */ |
8193 if (fp->lnum <= curbuf->b_ml.ml_line_count) | 8194 if (fp->lnum <= curbuf->b_ml.ml_line_count) |
8194 col = STRLEN(ml_get(fp->lnum)) + 1; | 8195 col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1; |
8195 else | 8196 else |
8196 col = MAXCOL; | 8197 col = MAXCOL; |
8197 } | 8198 } |
8198 else | 8199 else |
8199 { | 8200 { |
8418 ic = get_tv_number_chk(&argvars[2], &error); | 8419 ic = get_tv_number_chk(&argvars[2], &error); |
8419 if (argvars[3].v_type != VAR_UNKNOWN) | 8420 if (argvars[3].v_type != VAR_UNKNOWN) |
8420 EMSG(_(e_invarg)); | 8421 EMSG(_(e_invarg)); |
8421 } | 8422 } |
8422 | 8423 |
8423 todo = error ? 0 : d->dv_hashtab.ht_used; | 8424 todo = error ? 0 : (int)d->dv_hashtab.ht_used; |
8424 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) | 8425 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
8425 { | 8426 { |
8426 if (!HASHITEM_EMPTY(hi)) | 8427 if (!HASHITEM_EMPTY(hi)) |
8427 { | 8428 { |
8428 --todo; | 8429 --todo; |
8950 else | 8951 else |
8951 action = (char_u *)"force"; | 8952 action = (char_u *)"force"; |
8952 | 8953 |
8953 /* Go over all entries in the second dict and add them to the | 8954 /* Go over all entries in the second dict and add them to the |
8954 * first dict. */ | 8955 * first dict. */ |
8955 todo = d2->dv_hashtab.ht_used; | 8956 todo = (int)d2->dv_hashtab.ht_used; |
8956 for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) | 8957 for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) |
8957 { | 8958 { |
8958 if (!HASHITEM_EMPTY(hi2)) | 8959 if (!HASHITEM_EMPTY(hi2)) |
8959 { | 8960 { |
8960 --todo; | 8961 --todo; |
9152 prepare_vimvar(VV_KEY, &save_key); | 9153 prepare_vimvar(VV_KEY, &save_key); |
9153 vimvars[VV_KEY].vv_type = VAR_STRING; | 9154 vimvars[VV_KEY].vv_type = VAR_STRING; |
9154 | 9155 |
9155 ht = &d->dv_hashtab; | 9156 ht = &d->dv_hashtab; |
9156 hash_lock(ht); | 9157 hash_lock(ht); |
9157 todo = ht->ht_used; | 9158 todo = (int)ht->ht_used; |
9158 for (hi = ht->ht_array; todo > 0; ++hi) | 9159 for (hi = ht->ht_array; todo > 0; ++hi) |
9159 { | 9160 { |
9160 if (!HASHITEM_EMPTY(hi)) | 9161 if (!HASHITEM_EMPTY(hi)) |
9161 { | 9162 { |
9162 --todo; | 9163 --todo; |
11318 | 11319 |
11319 xp_name = get_tv_string_buf_chk(&argvars[2], buf); | 11320 xp_name = get_tv_string_buf_chk(&argvars[2], buf); |
11320 if (xp_name == NULL) | 11321 if (xp_name == NULL) |
11321 return; | 11322 return; |
11322 | 11323 |
11323 xp_namelen = STRLEN(xp_name); | 11324 xp_namelen = (int)STRLEN(xp_name); |
11324 | 11325 |
11325 if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt, | 11326 if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt, |
11326 &xp_arg) == FAIL) | 11327 &xp_arg) == FAIL) |
11327 return; | 11328 return; |
11328 } | 11329 } |
11632 return; | 11633 return; |
11633 | 11634 |
11634 if (rettv_list_alloc(rettv) == FAIL) | 11635 if (rettv_list_alloc(rettv) == FAIL) |
11635 return; | 11636 return; |
11636 | 11637 |
11637 todo = d->dv_hashtab.ht_used; | 11638 todo = (int)d->dv_hashtab.ht_used; |
11638 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) | 11639 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
11639 { | 11640 { |
11640 if (!HASHITEM_EMPTY(hi)) | 11641 if (!HASHITEM_EMPTY(hi)) |
11641 { | 11642 { |
11642 --todo; | 11643 --todo; |
12151 ++idx; | 12152 ++idx; |
12152 } | 12153 } |
12153 else | 12154 else |
12154 { | 12155 { |
12155 #ifdef FEAT_MBYTE | 12156 #ifdef FEAT_MBYTE |
12156 startcol = regmatch.startp[0] | 12157 startcol = (colnr_T)(regmatch.startp[0] |
12157 + (*mb_ptr2len)(regmatch.startp[0]) - str; | 12158 + (*mb_ptr2len)(regmatch.startp[0]) - str); |
12158 #else | 12159 #else |
12159 startcol = regmatch.startp[0] + 1 - str; | 12160 startcol = regmatch.startp[0] + 1 - str; |
12160 #endif | 12161 #endif |
12161 } | 12162 } |
12162 } | 12163 } |
12196 rettv->vval.v_number = | 12197 rettv->vval.v_number = |
12197 (varnumber_T)(regmatch.startp[0] - str); | 12198 (varnumber_T)(regmatch.startp[0] - str); |
12198 else | 12199 else |
12199 rettv->vval.v_number = | 12200 rettv->vval.v_number = |
12200 (varnumber_T)(regmatch.endp[0] - str); | 12201 (varnumber_T)(regmatch.endp[0] - str); |
12201 rettv->vval.v_number += str - expr; | 12202 rettv->vval.v_number += (varnumber_T)(str - expr); |
12202 } | 12203 } |
12203 } | 12204 } |
12204 vim_free(regmatch.regprog); | 12205 vim_free(regmatch.regprog); |
12205 } | 12206 } |
12206 | 12207 |
12321 int todo; | 12322 int todo; |
12322 | 12323 |
12323 d = argvars[0].vval.v_dict; | 12324 d = argvars[0].vval.v_dict; |
12324 if (d != NULL) | 12325 if (d != NULL) |
12325 { | 12326 { |
12326 todo = d->dv_hashtab.ht_used; | 12327 todo = (int)d->dv_hashtab.ht_used; |
12327 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) | 12328 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
12328 { | 12329 { |
12329 if (!HASHITEM_EMPTY(hi)) | 12330 if (!HASHITEM_EMPTY(hi)) |
12330 { | 12331 { |
12331 --todo; | 12332 --todo; |
12709 } | 12710 } |
12710 | 12711 |
12711 filtd = 0; | 12712 filtd = 0; |
12712 while (cnt < maxline || maxline < 0) | 12713 while (cnt < maxline || maxline < 0) |
12713 { | 12714 { |
12714 readlen = fread(buf + filtd, 1, FREAD_SIZE - filtd, fd); | 12715 readlen = (int)fread(buf + filtd, 1, FREAD_SIZE - filtd, fd); |
12715 buflen = filtd + readlen; | 12716 buflen = filtd + readlen; |
12716 tolist = 0; | 12717 tolist = 0; |
12717 for ( ; filtd < buflen || readlen <= 0; ++filtd) | 12718 for ( ; filtd < buflen || readlen <= 0; ++filtd) |
12718 { | 12719 { |
12719 if (buf[filtd] == '\n' || readlen <= 0) | 12720 if (buf[filtd] == '\n' || readlen <= 0) |
14597 * in the copy without changing the original list items. */ | 14598 * in the copy without changing the original list items. */ |
14598 copy_tv(&(*(listitem_T **)s1)->li_tv, &argv[0]); | 14599 copy_tv(&(*(listitem_T **)s1)->li_tv, &argv[0]); |
14599 copy_tv(&(*(listitem_T **)s2)->li_tv, &argv[1]); | 14600 copy_tv(&(*(listitem_T **)s2)->li_tv, &argv[1]); |
14600 | 14601 |
14601 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ | 14602 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ |
14602 res = call_func(item_compare_func, STRLEN(item_compare_func), | 14603 res = call_func(item_compare_func, (int)STRLEN(item_compare_func), |
14603 &rettv, 2, argv, 0L, 0L, &dummy, TRUE, NULL); | 14604 &rettv, 2, argv, 0L, 0L, &dummy, TRUE, NULL); |
14604 clear_tv(&argv[0]); | 14605 clear_tv(&argv[0]); |
14605 clear_tv(&argv[1]); | 14606 clear_tv(&argv[1]); |
14606 | 14607 |
14607 if (res == FAIL) | 14608 if (res == FAIL) |
15132 char_u *lastmatch = NULL; | 15133 char_u *lastmatch = NULL; |
15133 int haystack_len, end_idx; | 15134 int haystack_len, end_idx; |
15134 | 15135 |
15135 needle = get_tv_string_chk(&argvars[1]); | 15136 needle = get_tv_string_chk(&argvars[1]); |
15136 haystack = get_tv_string_buf_chk(&argvars[0], buf); | 15137 haystack = get_tv_string_buf_chk(&argvars[0], buf); |
15137 haystack_len = STRLEN(haystack); | 15138 haystack_len = (int)STRLEN(haystack); |
15138 | 15139 |
15139 rettv->vval.v_number = -1; | 15140 rettv->vval.v_number = -1; |
15140 if (needle == NULL || haystack == NULL) | 15141 if (needle == NULL || haystack == NULL) |
15141 return; /* type error; errmsg already given */ | 15142 return; /* type error; errmsg already given */ |
15142 if (argvars[2].v_type != VAR_UNKNOWN) | 15143 if (argvars[2].v_type != VAR_UNKNOWN) |
16970 functv = *rettv; | 16971 functv = *rettv; |
16971 rettv->v_type = VAR_UNKNOWN; | 16972 rettv->v_type = VAR_UNKNOWN; |
16972 | 16973 |
16973 /* Invoke the function. Recursive! */ | 16974 /* Invoke the function. Recursive! */ |
16974 s = functv.vval.v_string; | 16975 s = functv.vval.v_string; |
16975 ret = get_func_tv(s, STRLEN(s), rettv, arg, | 16976 ret = get_func_tv(s, (int)STRLEN(s), rettv, arg, |
16976 curwin->w_cursor.lnum, curwin->w_cursor.lnum, | 16977 curwin->w_cursor.lnum, curwin->w_cursor.lnum, |
16977 &len, evaluate, selfdict); | 16978 &len, evaluate, selfdict); |
16978 | 16979 |
16979 /* Clear the funcref afterwards, so that deleting it while | 16980 /* Clear the funcref afterwards, so that deleting it while |
16980 * evaluating the arguments is possible (see test55). */ | 16981 * evaluating the arguments is possible (see test55). */ |
17510 int todo; | 17511 int todo; |
17511 hashitem_T *hi; | 17512 hashitem_T *hi; |
17512 dictitem_T *v; | 17513 dictitem_T *v; |
17513 | 17514 |
17514 hash_lock(ht); | 17515 hash_lock(ht); |
17515 todo = ht->ht_used; | 17516 todo = (int)ht->ht_used; |
17516 for (hi = ht->ht_array; todo > 0; ++hi) | 17517 for (hi = ht->ht_array; todo > 0; ++hi) |
17517 { | 17518 { |
17518 if (!HASHITEM_EMPTY(hi)) | 17519 if (!HASHITEM_EMPTY(hi)) |
17519 { | 17520 { |
17520 --todo; | 17521 --todo; |
18164 */ | 18165 */ |
18165 if (ends_excmd(*eap->arg)) | 18166 if (ends_excmd(*eap->arg)) |
18166 { | 18167 { |
18167 if (!eap->skip) | 18168 if (!eap->skip) |
18168 { | 18169 { |
18169 todo = func_hashtab.ht_used; | 18170 todo = (int)func_hashtab.ht_used; |
18170 for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) | 18171 for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) |
18171 { | 18172 { |
18172 if (!HASHITEM_EMPTY(hi)) | 18173 if (!HASHITEM_EMPTY(hi)) |
18173 { | 18174 { |
18174 --todo; | 18175 --todo; |
18198 *p = c; | 18199 *p = c; |
18199 if (regmatch.regprog != NULL) | 18200 if (regmatch.regprog != NULL) |
18200 { | 18201 { |
18201 regmatch.rm_ic = p_ic; | 18202 regmatch.rm_ic = p_ic; |
18202 | 18203 |
18203 todo = func_hashtab.ht_used; | 18204 todo = (int)func_hashtab.ht_used; |
18204 for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) | 18205 for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) |
18205 { | 18206 { |
18206 if (!HASHITEM_EMPTY(hi)) | 18207 if (!HASHITEM_EMPTY(hi)) |
18207 { | 18208 { |
18208 --todo; | 18209 --todo; |
18682 { | 18683 { |
18683 scriptname = autoload_name(name); | 18684 scriptname = autoload_name(name); |
18684 if (scriptname != NULL) | 18685 if (scriptname != NULL) |
18685 { | 18686 { |
18686 p = vim_strchr(scriptname, '/'); | 18687 p = vim_strchr(scriptname, '/'); |
18687 plen = STRLEN(p); | 18688 plen = (int)STRLEN(p); |
18688 slen = STRLEN(sourcing_name); | 18689 slen = (int)STRLEN(sourcing_name); |
18689 if (slen > plen && fnamecmp(p, | 18690 if (slen > plen && fnamecmp(p, |
18690 sourcing_name + slen - plen) == 0) | 18691 sourcing_name + slen - plen) == 0) |
18691 j = OK; | 18692 j = OK; |
18692 vim_free(scriptname); | 18693 vim_free(scriptname); |
18693 } | 18694 } |
18864 goto theend; | 18865 goto theend; |
18865 } | 18866 } |
18866 | 18867 |
18867 if (lv.ll_exp_name != NULL) | 18868 if (lv.ll_exp_name != NULL) |
18868 { | 18869 { |
18869 len = STRLEN(lv.ll_exp_name); | 18870 len = (int)STRLEN(lv.ll_exp_name); |
18870 if (lead <= 2 && lv.ll_name == lv.ll_exp_name | 18871 if (lead <= 2 && lv.ll_name == lv.ll_exp_name |
18871 && STRNCMP(lv.ll_name, "s:", 2) == 0) | 18872 && STRNCMP(lv.ll_name, "s:", 2) == 0) |
18872 { | 18873 { |
18873 /* When there was "s:" already or the name expanded to get a | 18874 /* When there was "s:" already or the name expanded to get a |
18874 * leading "s:" then remove it. */ | 18875 * leading "s:" then remove it. */ |
19108 ufunc_T *fp; | 19109 ufunc_T *fp; |
19109 int i; | 19110 int i; |
19110 ufunc_T **sorttab; | 19111 ufunc_T **sorttab; |
19111 int st_len = 0; | 19112 int st_len = 0; |
19112 | 19113 |
19113 todo = func_hashtab.ht_used; | 19114 todo = (int)func_hashtab.ht_used; |
19114 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); | 19115 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo)); |
19115 | 19116 |
19116 for (hi = func_hashtab.ht_array; todo > 0; ++hi) | 19117 for (hi = func_hashtab.ht_array; todo > 0; ++hi) |
19117 { | 19118 { |
19118 if (!HASHITEM_EMPTY(hi)) | 19119 if (!HASHITEM_EMPTY(hi)) |
20272 if (find_viminfo_parameter('!') == NULL) | 20273 if (find_viminfo_parameter('!') == NULL) |
20273 return; | 20274 return; |
20274 | 20275 |
20275 fprintf(fp, _("\n# global variables:\n")); | 20276 fprintf(fp, _("\n# global variables:\n")); |
20276 | 20277 |
20277 todo = globvarht.ht_used; | 20278 todo = (int)globvarht.ht_used; |
20278 for (hi = globvarht.ht_array; todo > 0; ++hi) | 20279 for (hi = globvarht.ht_array; todo > 0; ++hi) |
20279 { | 20280 { |
20280 if (!HASHITEM_EMPTY(hi)) | 20281 if (!HASHITEM_EMPTY(hi)) |
20281 { | 20282 { |
20282 --todo; | 20283 --todo; |
20308 hashitem_T *hi; | 20309 hashitem_T *hi; |
20309 dictitem_T *this_var; | 20310 dictitem_T *this_var; |
20310 int todo; | 20311 int todo; |
20311 char_u *p, *t; | 20312 char_u *p, *t; |
20312 | 20313 |
20313 todo = globvarht.ht_used; | 20314 todo = (int)globvarht.ht_used; |
20314 for (hi = globvarht.ht_array; todo > 0; ++hi) | 20315 for (hi = globvarht.ht_array; todo > 0; ++hi) |
20315 { | 20316 { |
20316 if (!HASHITEM_EMPTY(hi)) | 20317 if (!HASHITEM_EMPTY(hi)) |
20317 { | 20318 { |
20318 --todo; | 20319 --todo; |
20540 if (hasTilde) | 20541 if (hasTilde) |
20541 pbuf = tfname = expand_env_save(*fnamep); | 20542 pbuf = tfname = expand_env_save(*fnamep); |
20542 else | 20543 else |
20543 pbuf = tfname = FullName_save(*fnamep, FALSE); | 20544 pbuf = tfname = FullName_save(*fnamep, FALSE); |
20544 | 20545 |
20545 len = tflen = STRLEN(tfname); | 20546 len = tflen = (int)STRLEN(tfname); |
20546 | 20547 |
20547 if (!get_short_pathname(&tfname, &pbuf, &len)) | 20548 if (!get_short_pathname(&tfname, &pbuf, &len)) |
20548 return -1; | 20549 return -1; |
20549 | 20550 |
20550 if (len == 0) | 20551 if (len == 0) |