Fix some of the Errors/warnings detected by checkapi.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25284 f5534014-38df-0310-8fa8-9805f1628bb7
This commit is contained in:
etxrab 2008-05-13 07:26:20 +00:00
parent 4fae53e13b
commit 330bb2c781
2 changed files with 9 additions and 9 deletions

View File

@ -704,12 +704,12 @@ append_to_preamble(char *str)
if (toklen != 0) {
if (packet_preamble_len + toklen > PACKET_PREAMBLE_MAX_LEN)
return; /* no room to add the token to the preamble */
strncpy(&packet_preamble[packet_preamble_len], str, PACKET_PREAMBLE_MAX_LEN - packet_preamble_len);
g_strlcpy(&packet_preamble[packet_preamble_len], str, PACKET_PREAMBLE_MAX_LEN);
packet_preamble_len += toklen;
if (debug >= 2) {
char *c;
char xs[PACKET_PREAMBLE_MAX_LEN];
strncpy(xs, packet_preamble, PACKET_PREAMBLE_MAX_LEN);
g_strlcpy(xs, packet_preamble, PACKET_PREAMBLE_MAX_LEN);
while ((c = strchr(xs, '\r')) != NULL) *c=' ';
fprintf (stderr, "[[append_to_preamble: \"%s\"]]", xs);
}
@ -1263,7 +1263,7 @@ parse_options (int argc, char *argv[])
}
if (strcmp(argv[optind], "-")) {
input_filename = strdup(argv[optind]);
input_filename = g_strdup(argv[optind]);
input_file = eth_fopen(input_filename, "rb");
if (!input_file) {
fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
@ -1276,7 +1276,7 @@ parse_options (int argc, char *argv[])
}
if (strcmp(argv[optind+1], "-")) {
output_filename = strdup(argv[optind+1]);
output_filename = g_strdup(argv[optind+1]);
output_file = eth_fopen(output_filename, "wb");
if (!output_file) {
fprintf(stderr, "Cannot open file [%s] for writing: %s\n",

View File

@ -131,11 +131,11 @@ int main(int argc, char** argv) {
switch (opt) {
case 'i':
if (interface) panic(1,"interface already given");
interface = strdup(optarg);
interface = g_strdup(optarg);
break;
case 'w':
if (outfile) panic(3,"output file already given");
outfile = strdup(optarg);
outfile = g_strdup(optarg);
break;
case 's':
snaplen = strtoul(optarg,NULL,10);
@ -144,15 +144,15 @@ int main(int argc, char** argv) {
break;
case 'b':
if (start_filter_str) panic(5,"start filter already given");
start_filter_str = strdup(optarg);
start_filter_str = g_strdup(optarg);
break;
case 'e':
if (stop_filter_str) panic(6,"stop filter already given");
stop_filter_str = strdup(optarg);
stop_filter_str = g_strdup(optarg);
break;
case 'f':
if (capture_filter_str) panic(7,"capture filter already given");
capture_filter_str = strdup(optarg);
capture_filter_str = g_strdup(optarg);
break;
case 'p':
promisc = 1;