Mercurial > vim
comparison src/os_mswin.c @ 835:8bebcabccc2c v7.0e01
updated for version 7.0e01
author | vimboss |
---|---|
date | Mon, 17 Apr 2006 22:14:47 +0000 |
parents | 01583c79d5f4 |
children | 2c885fab04e3 |
comparison
equal
deleted
inserted
replaced
834:5117153003bd | 835:8bebcabccc2c |
---|---|
1092 int len_loc; | 1092 int len_loc; |
1093 int length; | 1093 int length; |
1094 | 1094 |
1095 if (lenp == NULL) | 1095 if (lenp == NULL) |
1096 { | 1096 { |
1097 len_loc = STRLEN(str) + 1; | 1097 len_loc = (int)STRLEN(str) + 1; |
1098 lenp = &len_loc; | 1098 lenp = &len_loc; |
1099 } | 1099 } |
1100 | 1100 |
1101 if (enc_codepage > 0) | 1101 if (enc_codepage > 0) |
1102 { | 1102 { |
1151 char_u *utf8_str = NULL, *enc_str = NULL; | 1151 char_u *utf8_str = NULL, *enc_str = NULL; |
1152 int len_loc; | 1152 int len_loc; |
1153 | 1153 |
1154 if (lenp == NULL) | 1154 if (lenp == NULL) |
1155 { | 1155 { |
1156 len_loc = wcslen(str) + 1; | 1156 len_loc = (int)wcslen(str) + 1; |
1157 lenp = &len_loc; | 1157 lenp = &len_loc; |
1158 } | 1158 } |
1159 | 1159 |
1160 if (enc_codepage > 0) | 1160 if (enc_codepage > 0) |
1161 { | 1161 { |
1265 rawp = (char_u *)GlobalLock(rawh); | 1265 rawp = (char_u *)GlobalLock(rawh); |
1266 if (rawp != NULL && STRCMP(p_enc, rawp) == 0) | 1266 if (rawp != NULL && STRCMP(p_enc, rawp) == 0) |
1267 { | 1267 { |
1268 n = STRLEN(p_enc) + 1; | 1268 n = STRLEN(p_enc) + 1; |
1269 str = rawp + n; | 1269 str = rawp + n; |
1270 str_size = metadata.rawlen - n; | 1270 str_size = (int)(metadata.rawlen - n); |
1271 } | 1271 } |
1272 else | 1272 else |
1273 { | 1273 { |
1274 GlobalUnlock(rawh); | 1274 GlobalUnlock(rawh); |
1275 rawh = NULL; | 1275 rawh = NULL; |
1290 { | 1290 { |
1291 WCHAR *hMemWstr = (WCHAR *)GlobalLock(hMemW); | 1291 WCHAR *hMemWstr = (WCHAR *)GlobalLock(hMemW); |
1292 | 1292 |
1293 /* Use the length of our metadata if possible, but limit it to the | 1293 /* Use the length of our metadata if possible, but limit it to the |
1294 * GlobalSize() for safety. */ | 1294 * GlobalSize() for safety. */ |
1295 maxlen = GlobalSize(hMemW) / sizeof(WCHAR); | 1295 maxlen = (int)(GlobalSize(hMemW) / sizeof(WCHAR)); |
1296 if (metadata.ucslen >= 0) | 1296 if (metadata.ucslen >= 0) |
1297 { | 1297 { |
1298 if (metadata.ucslen > maxlen) | 1298 if (metadata.ucslen > maxlen) |
1299 str_size = maxlen; | 1299 str_size = maxlen; |
1300 else | 1300 else |
1319 { | 1319 { |
1320 str = (char_u *)GlobalLock(hMem); | 1320 str = (char_u *)GlobalLock(hMem); |
1321 | 1321 |
1322 /* The length is either what our metadata says or the strlen(). | 1322 /* The length is either what our metadata says or the strlen(). |
1323 * But limit it to the GlobalSize() for safety. */ | 1323 * But limit it to the GlobalSize() for safety. */ |
1324 maxlen = GlobalSize(hMem); | 1324 maxlen = (int)GlobalSize(hMem); |
1325 if (metadata.txtlen >= 0) | 1325 if (metadata.txtlen >= 0) |
1326 { | 1326 { |
1327 if (metadata.txtlen > maxlen) | 1327 if (metadata.txtlen > maxlen) |
1328 str_size = maxlen; | 1328 str_size = maxlen; |
1329 else | 1329 else |
1442 * when copy/paste from/to Vim with the same 'encoding', so that illegal | 1442 * when copy/paste from/to Vim with the same 'encoding', so that illegal |
1443 * bytes can also be copied and no conversion is needed. */ | 1443 * bytes can also be copied and no conversion is needed. */ |
1444 { | 1444 { |
1445 LPSTR lpszMemRaw; | 1445 LPSTR lpszMemRaw; |
1446 | 1446 |
1447 metadata.rawlen = txtlen + STRLEN(p_enc) + 1; | 1447 metadata.rawlen = (int)(txtlen + STRLEN(p_enc) + 1); |
1448 hMemRaw = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, | 1448 hMemRaw = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, |
1449 metadata.rawlen + 1); | 1449 metadata.rawlen + 1); |
1450 lpszMemRaw = (LPSTR)GlobalLock(hMemRaw); | 1450 lpszMemRaw = (LPSTR)GlobalLock(hMemRaw); |
1451 if (lpszMemRaw != NULL) | 1451 if (lpszMemRaw != NULL) |
1452 { | 1452 { |
2368 | 2368 |
2369 /* Check if the file name ends in ".lnk". Avoid calling | 2369 /* Check if the file name ends in ".lnk". Avoid calling |
2370 * CoCreateInstance(), it's quite slow. */ | 2370 * CoCreateInstance(), it's quite slow. */ |
2371 if (fname == NULL) | 2371 if (fname == NULL) |
2372 return rfname; | 2372 return rfname; |
2373 len = STRLEN(fname); | 2373 len = (int)STRLEN(fname); |
2374 if (len <= 4 || STRNICMP(fname + len - 4, ".lnk", 4) != 0) | 2374 if (len <= 4 || STRNICMP(fname + len - 4, ".lnk", 4) != 0) |
2375 return rfname; | 2375 return rfname; |
2376 | 2376 |
2377 CoInitialize(NULL); | 2377 CoInitialize(NULL); |
2378 | 2378 |
2482 { | 2482 { |
2483 COPYDATASTRUCT data; | 2483 COPYDATASTRUCT data; |
2484 | 2484 |
2485 data.dwData = COPYDATA_ENCODING; | 2485 data.dwData = COPYDATA_ENCODING; |
2486 #ifdef FEAT_MBYTE | 2486 #ifdef FEAT_MBYTE |
2487 data.cbData = STRLEN(p_enc) + 1; | 2487 data.cbData = (DWORD)STRLEN(p_enc) + 1; |
2488 data.lpData = p_enc; | 2488 data.lpData = p_enc; |
2489 #else | 2489 #else |
2490 data.cbData = STRLEN("latin1") + 1; | 2490 data.cbData = STRLEN("latin1") + 1; |
2491 data.lpData = "latin1"; | 2491 data.lpData = "latin1"; |
2492 #endif | 2492 #endif |
2598 reply.dwData = COPYDATA_ERROR_RESULT; | 2598 reply.dwData = COPYDATA_ERROR_RESULT; |
2599 } | 2599 } |
2600 else | 2600 else |
2601 reply.dwData = COPYDATA_RESULT; | 2601 reply.dwData = COPYDATA_RESULT; |
2602 reply.lpData = res; | 2602 reply.lpData = res; |
2603 reply.cbData = STRLEN(res) + 1; | 2603 reply.cbData = (DWORD)STRLEN(res) + 1; |
2604 | 2604 |
2605 serverSendEnc(sender); | 2605 serverSendEnc(sender); |
2606 retval = SendMessage(sender, WM_COPYDATA, (WPARAM)message_window, | 2606 retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window, |
2607 (LPARAM)(&reply)); | 2607 (LPARAM)(&reply)); |
2608 vim_free(res); | 2608 vim_free(res); |
2609 return retval; | 2609 return retval; |
2610 | 2610 |
2611 case COPYDATA_REPLY: | 2611 case COPYDATA_REPLY: |
2770 HWND hwnd = 0; | 2770 HWND hwnd = 0; |
2771 int i = 0; | 2771 int i = 0; |
2772 char_u *p; | 2772 char_u *p; |
2773 | 2773 |
2774 /* Leave enough space for a 9-digit suffix to ensure uniqueness! */ | 2774 /* Leave enough space for a 9-digit suffix to ensure uniqueness! */ |
2775 ok_name = alloc(STRLEN(name) + 10); | 2775 ok_name = alloc((unsigned)STRLEN(name) + 10); |
2776 | 2776 |
2777 STRCPY(ok_name, name); | 2777 STRCPY(ok_name, name); |
2778 p = ok_name + STRLEN(name); | 2778 p = ok_name + STRLEN(name); |
2779 | 2779 |
2780 for (;;) | 2780 for (;;) |
2847 target = (HWND)n; | 2847 target = (HWND)n; |
2848 if (!IsWindow(target)) | 2848 if (!IsWindow(target)) |
2849 return -1; | 2849 return -1; |
2850 | 2850 |
2851 data.dwData = COPYDATA_REPLY; | 2851 data.dwData = COPYDATA_REPLY; |
2852 data.cbData = STRLEN(reply) + 1; | 2852 data.cbData = (DWORD)STRLEN(reply) + 1; |
2853 data.lpData = reply; | 2853 data.lpData = reply; |
2854 | 2854 |
2855 serverSendEnc(target); | 2855 serverSendEnc(target); |
2856 if (SendMessage(target, WM_COPYDATA, (WPARAM)message_window, | 2856 if (SendMessage(target, WM_COPYDATA, (WPARAM)message_window, |
2857 (LPARAM)(&data))) | 2857 (LPARAM)(&data))) |
2883 | 2883 |
2884 if (ptarget) | 2884 if (ptarget) |
2885 *(HWND *)ptarget = target; | 2885 *(HWND *)ptarget = target; |
2886 | 2886 |
2887 data.dwData = asExpr ? COPYDATA_EXPR : COPYDATA_KEYS; | 2887 data.dwData = asExpr ? COPYDATA_EXPR : COPYDATA_KEYS; |
2888 data.cbData = STRLEN(cmd) + 1; | 2888 data.cbData = (DWORD)STRLEN(cmd) + 1; |
2889 data.lpData = cmd; | 2889 data.lpData = cmd; |
2890 | 2890 |
2891 serverSendEnc(target); | 2891 serverSendEnc(target); |
2892 if (SendMessage(target, WM_COPYDATA, (WPARAM)message_window, | 2892 if (SendMessage(target, WM_COPYDATA, (WPARAM)message_window, |
2893 (LPARAM)(&data)) == 0) | 2893 (LPARAM)(&data)) == 0) |