Skip to content

Commit

Permalink
How is this not working fr
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyz32 committed Jul 31, 2024
1 parent a359886 commit 9c24702
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ src/mzversion.h:
system "CRTCPPMOD MODULE(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$<') OPTION(*EVENTF) SYSIFCOPT(*IFS64IO) DBGVIEW(*SOURCE) TERASPACE(*YES *TSIFC) STGMDL(*SNGLVL) DTAMDL(*p128) DEFINE(DEBUG_ENABLED) OUTPUT(*PRINT)" > $*.log 2>&1

/qsys.lib/${BUILDLIB}.lib/%.module: src/%.sqlc
system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) DBGVIEW(*SOURCE) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL) OUTPUT(*PRINT)" > $*.log 2>&1
system "CRTSQLCI OBJ(${BUILDLIB}/$*) SRCSTMF('$(CURDIR)/$^') COMMIT(*NONE) DATFMT(*ISO) TIMFMT(*ISO) DBGVIEW(*SOURCE) CVTCCSID(*JOB) COMPILEOPT('INCDIR(''src'')') SQLPATH(${BUILDLIB}) DFTRDBCOL(${BUILDLIB}) OPTION(*SQL)" > $*.log 2>&1

/qsys.lib/${BUILDLIB.lib}:
-system "RUNSQL SQL('create schema ${BUILDLIB}') NAMING(*SYS)"
Expand Down
4 changes: 2 additions & 2 deletions ile/src/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ int main(int _argc, char **argv)
return 0;
}

BUFSTRN(watch_option, argv[1], sizeof(argv[1]));
BUFSTRN(session_id, argv[2], sizeof(argv[2]));
BUFSTRN(watch_option, std::string(argv[1]), 10);
BUFSTRN(session_id, std::string(argv[2]), 10);

DEBUG("watch program called. Watch option setting is '%s'\n", watch_option.c_str());
publisher_info_set *publishers = conf_get_publisher_info(session_id.c_str());
Expand Down
2 changes: 1 addition & 1 deletion ile/src/manzan.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

#define BUFSTRN(dest, src, len) \
std::string dest = src.substr(0, len); \
std::string dest(src, len); \
{ \
size_t lastChar = dest.find_last_not_of(" "); \
if (lastChar != std::string::npos) \
Expand Down
21 changes: 10 additions & 11 deletions test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@
// Demonstrate some basic assertions.
TEST(UTILITY, testBUFSTRN) {

std::string spaceAtEnd = "hello ";
BUFSTRN(trimmed0, spaceAtEnd, sizeof(spaceAtEnd));
char spaceAtEnd[] = "hello ";
BUFSTRN(trimmed0, spaceAtEnd, strlen(spaceAtEnd));
EXPECT_STREQ(trimmed0.c_str(), "hello");


std::string spaceInMiddle = "hello d";
BUFSTRN(trimmed1, spaceInMiddle, sizeof(spaceInMiddle));
char spaceInMiddle[] = "hello d";
BUFSTRN(trimmed1, spaceInMiddle, strlen(spaceInMiddle));
EXPECT_STREQ(trimmed1.c_str(), "hello d");

std::string spaceAtBeginning = " hello";
BUFSTRN(trimmed2, spaceAtBeginning, sizeof(spaceAtBeginning));
char spaceAtBeginning[] = " hello";
BUFSTRN(trimmed2, spaceAtBeginning, strlen(spaceAtBeginning));
EXPECT_STREQ(trimmed2.c_str(), " hello");

std::string allSpace = " ";
BUFSTRN(trimmed3, allSpace, sizeof(allSpace));
char allSpace[] = " ";
BUFSTRN(trimmed3, allSpace, strlen(allSpace));
EXPECT_STREQ(trimmed3.c_str(), "");

std::string emptyString = "";
BUFSTRN(trimmed4, emptyString, sizeof(emptyString));
char emptyString[] = "";
BUFSTRN(trimmed4, emptyString, strlen(emptyString));
EXPECT_STREQ(trimmed4.c_str(), "");

}

0 comments on commit 9c24702

Please sign in to comment.