-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathLinuxCompat.cpp
More file actions
36 lines (32 loc) · 823 Bytes
/
LinuxCompat.cpp
File metadata and controls
36 lines (32 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
const char *validate_fmt(const char* fmt, const char* file, int32_t line)
{
//Unused parameter generates compiler warning, so...
if (file) {};
if (line) {};
return fmt;
/*
const char* p = fmt;
while (1) {
p = strstr( p, "%s" );
if (p == NULL) break;
if ((p == fmt) || (*(p-1) != '%')) {
fprintf(stderr, "Hey, you used \"%%s\" in %s: line %d!\n", file, line);
abort();
}
}
return fmt;
*/
}
const char *validate_str(const char *src, int destsize, const char* file, int32_t line)
{
int len = strlen(src);
if (destsize <= len) {
fprintf(stderr, "ERROR! Destination string not large enough for operation in %s: line %d!\n", file, line);
abort();
}
return src;
}