Skip to content
Permalink
Browse files

bugfix loader

  • Loading branch information...
pixeljetstream committed Sep 4, 2015
1 parent c1364ec commit 007ef9c37709302922782e57b8d9f1a89b742e87
Showing with 16 additions and 16 deletions.
  1. BIN bin_Windows_32/glslc.exe
  2. BIN bin_Windows_64/glslc.exe
  3. +16 −16 src/glslc.cpp
BIN +17.5 KB (110%) bin_Windows_32/glslc.exe
Binary file not shown.
BIN +25.5 KB (110%) bin_Windows_64/glslc.exe
Binary file not shown.
@@ -28,14 +28,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#define GLSLC_VERSION 10
#define GLSLC_VERSION 11

#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <regex>
#include <sstream>
#include <fstream>

#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
@@ -412,27 +413,26 @@ bool createContext()

#endif

std::string readFile(const char* filename){
std::string content;

size_t filesize;
FILE* infile = fopen(filename,"rt");
std::string readFile( const char* filename)
{
std::string result;

if (!infile){
std::ifstream stream(filename, std::ios::in);
if(!stream.is_open()){
fprintf(stderr,"error: could not open input file \"%s\"\n",filename);
exit(1);
return result;
}

fseek (infile, 0, SEEK_END); // non-portable
filesize=ftell (infile);
fseek (infile, 0, SEEK_SET);
stream.seekg(0, std::ios::end);
result.reserve(stream.tellg());
stream.seekg(0, std::ios::beg);

content.resize(filesize);
fread(&content[0],filesize,1,infile);
//content[filesize] = 0;
result.assign(
(std::istreambuf_iterator<char>(stream)),
std::istreambuf_iterator<char>());

fclose (infile);
return content;
return result;
}

void printHelp()
@@ -574,7 +574,7 @@ std::string manualInclude ( std::string const & filename,
if(!includeSource.empty())
{
// strip null terminator from content
Text += std::string(includeSource.c_str());
Text += includeSource;
Text += eol + std::string("#line ") + SSTR(lineCount + 1) + std::string(" ") + includeMarker(filename) + eol;
}

0 comments on commit 007ef9c

Please sign in to comment.
You can’t perform that action at this time.