summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-27 18:52:48 +1100
committerquou <quou@disroot.org>2024-12-27 18:52:48 +1100
commitd920e5d62020d751ccaa3491cc66275ade749011 (patch)
treee806a95c598e255f9883de98cc350a3b9279d0ce /sc
parente8c93463b2ae5114f0c88e768e5625abac9d5a50 (diff)
building and running on windows with visual studio
Diffstat (limited to 'sc')
-rw-r--r--sc/sc.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/sc/sc.cpp b/sc/sc.cpp
index 0f61fdf..3c39b0c 100644
--- a/sc/sc.cpp
+++ b/sc/sc.cpp
@@ -62,10 +62,7 @@ bool rf(const char* n, char*& buf, size_t& size) {
rewind(f);
buf = new char[size + 1];
buf[size] = 0;
- if (size != fread(buf, 1, size, f)) {
- delete[] buf;
- return false;
- }
+ buf[fread(buf, 1, size, f)] = 0;
return true;
}
@@ -708,6 +705,7 @@ int main(int argc, const char** argv) {
Desc desc;
if (argc < 3) {
print_err("Usage: %s infile outfile.\n", argv[0]);
+ return 1;
}
if (!rf(argv[1], src, src_size)) {
print_err("Failed to read %s\n", argv[1]);