X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2FOICMiddle%2FLineInput.cpp;h=184258bfdc192a01d535e47ec90574be8d9fb25b;hb=70a84e8168a3ad16c0057f5bcb43d2be98c32252;hp=52a8528d8fedf069cf81e796ee9398eb397521a5;hpb=69aa2f11f36140cd02dbd81f8fea9e35daff9df2;p=platform%2Fupstream%2Fiotivity.git diff --git a/examples/OICMiddle/LineInput.cpp b/examples/OICMiddle/LineInput.cpp index 52a8528..184258b 100644 --- a/examples/OICMiddle/LineInput.cpp +++ b/examples/OICMiddle/LineInput.cpp @@ -52,9 +52,8 @@ int LineInput::run() while (true) { fputs(">", stdout); len = 0; - getline(&line, &len, stdin); - int n = strlen(line); - if (!n) + const ssize_t n = getline(&line, &len, stdin); + if (n <= 0) continue; if (m_observer) { m_observer->cancelObserve(); @@ -116,7 +115,7 @@ LineResult LineInput::processLine(string command, stringstream& result, observec return processUnrecognized(elems, result); } -LineResult LineInput::processHelp(elements_t& elems, stringstream& ss) +LineResult LineInput::processHelp(elements_t& /*elems*/, stringstream& ss) { ss << "\nUsage:\n" "\tfind\t\tFind resources\n" @@ -139,7 +138,7 @@ LineResult LineInput::processUnrecognized(elements_t& elems, stringstream& ss) return LR_Unrecognized; } -LineResult LineInput::processFind(elements_t& elems, stringstream& ss) +LineResult LineInput::processFind(elements_t& /*elems*/, stringstream& /*ss*/) { m_client->findResources(); return LR_OK; @@ -156,7 +155,7 @@ void LineInput::registerResourceWithServer(std::string & url) { m_server->registerResource(url, resType, iface); } -LineResult LineInput::processShow(elements_t& elems, stringstream& ss) +LineResult LineInput::processShow(elements_t& /*elems*/, stringstream& ss) { int index = 0; m_resourceList.clear(); @@ -236,7 +235,7 @@ LineResult LineInput::processGet(elements_t& elems, stringstream& ss) return LR_Timeout; } - std::string jsonRep = wreq->m_rep.getJSONRepresentation(); + std::string jsonRep ;//= wreq->m_rep.getJSONRepresentation(); //ss << jsonRep << endl; printJSONAsTable(jsonRep); return LR_OK; @@ -329,7 +328,7 @@ LineResult LineInput::processCancel(elements_t& elems, stringstream& ss) return LR_OK; } -WrapResource *LineInput::resolveResource(string resID, stringstream& ss) +WrapResource *LineInput::resolveResource(string resID, stringstream& /*ss*/) { size_t len; string useID = resID; @@ -352,12 +351,16 @@ WrapResource *LineInput::resolveResource(string resID, stringstream& ss) return it->second; } -void LineInput::obsCB(token_t token, const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode, const int sequenceNumber) +void LineInput::obsCB(token_t /*token*/, + const HeaderOptions& /*headerOptions*/, + const OCRepresentation& /*rep*/, + const int eCode, + const int sequenceNumber) { if (!m_observer) return; cout << "cb " << eCode << " " << sequenceNumber << '\n'; - cout << rep.getJSONRepresentation() << "\n"; + //cout << rep.getJSONRepresentation() << "\n"; } ParseState LineInput::finishElem(char*& e, elements_t& elems) @@ -382,7 +385,7 @@ ParseState LineInput::putCharInElem(char c, char *& e, ParseState newState) LineResult LineInput::parseLine(string lineIn, elements_t& elems) { const char *d; - char c, *e, delim; + char c, *e, delim = 0; bool isSep1, isSep2; size_t len = lineIn.size(); ParseState state = PS_Between;