-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling on Linux #1
Labels
documentation
Improvements or additions to documentation
Comments
Patch inlined for readability, too: diff --git a/revorb.cpp b/revorb.cpp
index 425f7b5..d1fde84 100644
--- a/revorb.cpp
+++ b/revorb.cpp
@@ -17,7 +17,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "ReVorb.h"
+#include "revorb.h"
bool Failed = false;
@@ -152,7 +152,7 @@ int32_t main(int32_t argumentCount, const char* arguments[])
if (!strcmp(arguments[1], "-"))
{
fi = stdin;
- _setmode(_fileno(stdin), _O_BINARY);
+ //_setmode(fileno(stdin), _O_BINARY);
}
else
{
@@ -173,7 +173,7 @@ int32_t main(int32_t argumentCount, const char* arguments[])
if (!strcmp(arguments[2], "-"))
{
fo = stdout;
- _setmode(_fileno(stdout), _O_BINARY);
+ //_setmode(fileno(stdout), _O_BINARY);
}
else
{
@@ -348,12 +348,12 @@ int32_t main(int32_t argumentCount, const char* arguments[])
{
if (Failed)
{
- _unlink(tmpName);
+ unlink(tmpName);
strcat_s(tmpName, sizeof(tmpName), ".tmp");
}
else
{
- if (_unlink(arguments[1]) || rename(tmpName, arguments[1]))
+ if (unlink(arguments[1]) || rename(tmpName, arguments[1]))
{
fprintf(stderr, "%S: Could not put the output file back in place.\n", tmpName);
}
diff --git a/revorb.h b/revorb.h
index 0692646..6277d67 100644
--- a/revorb.h
+++ b/revorb.h
@@ -18,10 +18,12 @@
*/
#pragma once
#include <stdio.h>
-#include <io.h>
+#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <iostream>
+#include <libsafec/safe_lib.h>
+#include <libsafec/safe_str_lib.h>
#include "libogg/ogg.h"
#include "libvorbis/codec.h" |
Thanks for the info! I was planning on rewriting this entire project in modern C++ so it uses std::ofstream and std::filesystem (which would fix a lot of these issues) but got busy with other projects/work. Don't expect myself to do that anytime soon because I'm lazy, but if you do submit a pr I will definitely merge it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I'm honestly writing this more for informational purposes, in case someone else wants to compile on Linux and wants a few pointers. Getting it compiling on Linux requires a few code changes, and I don't know the best way to make something like this more crossplatform (my C/C++ is extraordinarily rusty). I also wouldn't expect you to support an extra OS or anything, of course. :)
Anyway, this compiles and runs just fine on Linux with a few minor changes:
#include "ReVorb.h"
at the top ofrevorb.cpp
needs to be#include "revorb.h"
instead (that, or the header file renamed to have the capital letters)*_s
functions) in glibc/gcc. There's more than one Linux implementation of these out there, but the one I used was https://github.com/rurban/safeclib - this won't be found by default on most Linux machines. After installing/compiling that, add#include <libsafec/safe_lib.h>
and#include <libsafec/safe_str_lib.h>
torevorb.h
revorb.h
, remove the include forio.h
and substituteunistd.h
_unlink
doesn't exit -- just change those instances tounlink
instead, inrevorb.cpp
. There's two instances. (This is whatunistd.h
provides)_setmode
(or_fileno
). Just comment out those lines inrevorb.cpp
entirely. There's two instances of that. I did verify that reading in the file via stdin produces the same output as from a file.So, do all that, and it compiles/runs just fine with:
I'm attaching a patch with all the changes that I mentioned. As I say, not expecting any of this to get merged in or whatever. If I ever get enthusiastic enough to draft up a "proper" PR for this, I'll submit it that way.
revorb_linux.patch.gz
The text was updated successfully, but these errors were encountered: