Remove redundant parameters from MDICreateChild and MDIDestroyChild.
[wine.git] / dlls / wininet / utility.c
blob2c27fb7e24e133a9123851d0d84dbaf78844ffb3
1 /*
2 * Wininet - Utility functions
4 * Copyright 1999 Corel Corporation
6 * Ulrich Czekalla
8 */
10 #include "config.h"
12 #include <stdlib.h>
13 #include <string.h>
14 #include <time.h>
16 #include "windef.h"
17 #include "winbase.h"
18 #include "wininet.h"
19 #include "winerror.h"
20 #include "winsock.h"
22 #include "debugtools.h"
23 #include "internet.h"
25 DEFAULT_DEBUG_CHANNEL(wininet);
27 #define TIME_STRING_LEN 30
29 time_t ConvertTimeString(LPCSTR asctime)
31 char tmpChar[TIME_STRING_LEN];
32 char *tmpChar2;
33 struct tm SystemTime;
34 int timelen = strlen(asctime);
36 if(!asctime || !timelen)
37 return 0;
39 strncpy(tmpChar, asctime, TIME_STRING_LEN);
41 /* Assert that the string is the expected length */
42 if (tmpChar[TIME_STRING_LEN] != '\0')
44 tmpChar[TIME_STRING_LEN] = '\0';
45 FIXME("\n");
48 /* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure
49 * We assume the time is in this format
50 * and divide it into easy to swallow chunks
52 tmpChar[3]='\0';
53 tmpChar[7]='\0';
54 tmpChar[11]='\0';
55 tmpChar[16]='\0';
56 tmpChar[19]='\0';
57 tmpChar[22]='\0';
58 tmpChar[25]='\0';
60 SystemTime.tm_year = atoi(tmpChar+12) - 1900;
61 SystemTime.tm_mday = atoi(tmpChar+5);
62 SystemTime.tm_hour = atoi(tmpChar+17);
63 SystemTime.tm_min = atoi(tmpChar+20);
64 SystemTime.tm_sec = atoi(tmpChar+23);
66 /* and month */
67 tmpChar2 = tmpChar + 8;
68 switch(tmpChar2[2])
70 case 'n':
71 if(tmpChar2[1]=='a')
72 SystemTime.tm_mon = 0;
73 else
74 SystemTime.tm_mon = 5;
75 break;
76 case 'b':
77 SystemTime.tm_mon = 1;
78 break;
79 case 'r':
80 if(tmpChar2[1]=='a')
81 SystemTime.tm_mon = 2;
82 else
83 SystemTime.tm_mon = 3;
84 break;
85 case 'y':
86 SystemTime.tm_mon = 4;
87 break;
88 case 'l':
89 SystemTime.tm_mon = 6;
90 break;
91 case 'g':
92 SystemTime.tm_mon = 7;
93 break;
94 case 'p':
95 SystemTime.tm_mon = 8;
96 break;
97 case 't':
98 SystemTime.tm_mon = 9;
99 break;
100 case 'v':
101 SystemTime.tm_mon = 10;
102 break;
103 case 'c':
104 SystemTime.tm_mon = 11;
105 break;
106 default:
107 FIXME("\n");
110 return mktime(&SystemTime);
114 BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
115 struct hostent **phe, struct sockaddr_in *psa)
117 TRACE("%s\n", lpszServerName);
119 *phe = gethostbyname(lpszServerName);
120 if (NULL == *phe)
122 TRACE("Failed to get hostname: (%s)\n", lpszServerName);
123 return FALSE;
126 memset(psa,0,sizeof(struct sockaddr_in));
127 memcpy((char *)&psa->sin_addr, (*phe)->h_addr, (*phe)->h_length);
128 psa->sin_family = (*phe)->h_addrtype;
129 psa->sin_port = htons((u_short)nServerPort);
131 return TRUE;